/* Generated by Cython 0.24 */

#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 < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_24"
#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
#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_CPYTHON 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
  #define CYTHON_USE_PYLONG_INTERNALS 1
#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 > 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_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_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #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_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_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(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
#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_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#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
#if PY_VERSION_HEX >= 0x030500B1
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
typedef struct {
    unaryfunc am_await;
    unaryfunc am_aiter;
    unaryfunc am_anext;
} __Pyx_PyAsyncMethodsStruct;
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
#else
#define __Pyx_PyType_AsAsync(obj) NULL
#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
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)

#ifndef CYTHON_INLINE
  #if 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


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

#if PY_MAJOR_VERSION >= 3
  #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

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

#define __PYX_HAVE__petsc4py__PETSc
#define __PYX_HAVE_API__petsc4py__PETSc
#include "petsc.h"
#include "compat.h"
#include "custom.h"
#include "scalar.h"
#include "petsc4py/numpy.h"
#include "cython.h"
#include "pep3118.h"
#include "libpetsc4py.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "initpkg.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#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_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#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) && defined (_M_X64)
    #define __Pyx_sst_abs(value) _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 char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE 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_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((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)
#if PY_MAJOR_VERSION < 3
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);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#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);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#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 PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
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;


static const char *__pyx_f[] = {
  "PETSc/Const.pyx",
  "PETSc/Error.pyx",
  "PETSc/petscdef.pxi",
  "PETSc/petscopt.pxi",
  "PETSc/petscis.pxi",
  "PETSc/petscvec.pxi",
  "PETSc/petscmat.pxi",
  "PETSc/petscdmda.pxi",
  "PETSc/petscdmshell.pxi",
  "PETSc/Comm.pyx",
  "PETSc/Object.pyx",
  "PETSc/PETSc.pyx",
  "PETSc/arraynpy.pxi",
  "PETSc/petscmpi.pxi",
  "PETSc/petscsys.pxi",
  "PETSc/petsclog.pxi",
  "PETSc/petscobj.pxi",
  "PETSc/petscvwr.pxi",
  "PETSc/petscksp.pxi",
  "PETSc/petscsnes.pxi",
  "PETSc/petscts.pxi",
  "PETSc/petsctao.pxi",
  "PETSc/petscdm.pxi",
  "PETSc/petscdmcomposite.pxi",
  "PETSc/Options.pyx",
  "PETSc/Sys.pyx",
  "PETSc/Log.pyx",
  "PETSc/Viewer.pyx",
  "PETSc/Random.pyx",
  "PETSc/IS.pyx",
  "PETSc/Vec.pyx",
  "PETSc/Scatter.pyx",
  "PETSc/Section.pyx",
  "PETSc/Mat.pyx",
  "PETSc/PC.pyx",
  "PETSc/KSP.pyx",
  "PETSc/SNES.pyx",
  "PETSc/TS.pyx",
  "PETSc/TAO.pyx",
  "PETSc/AO.pyx",
  "PETSc/DM.pyx",
  "PETSc/DMDA.pyx",
  "PETSc/DMPlex.pyx",
  "PETSc/DMComposite.pyx",
  "PETSc/DMShell.pyx",
  "PETSc/SF.pyx",
  "PETSc/Partitioner.pyx",
  "PETSc/CAPI.pyx",
  "petsc4py.PETSc.pyx",
};

/*--- Type declarations ---*/
struct PyPetscCommObject;
struct PyPetscObjectObject;
struct PyPetscViewerObject;
struct PyPetscRandomObject;
struct PyPetscISObject;
struct PyPetscLGMapObject;
struct PyPetscSFObject;
struct PyPetscVecObject;
struct PyPetscScatterObject;
struct PyPetscSectionObject;
struct PyPetscMatObject;
struct PyPetscNullSpaceObject;
struct PyPetscPCObject;
struct PyPetscKSPObject;
struct PyPetscSNESObject;
struct PyPetscTSObject;
struct PyPetscTAOObject;
struct PyPetscAOObject;
struct PyPetscDMObject;
struct PyPetscPartitionerObject;
struct __pyx_obj_8petsc4py_5PETSc__IS_buffer;
struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer;
struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm;
struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil;
struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array;
struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access;
struct __pyx_obj_8petsc4py_5PETSc_Options;
struct __pyx_obj_8petsc4py_5PETSc_Sys;
struct __pyx_obj_8petsc4py_5PETSc_Log;
struct __pyx_obj_8petsc4py_5PETSc_LogStage;
struct __pyx_obj_8petsc4py_5PETSc_LogClass;
struct __pyx_obj_8petsc4py_5PETSc_LogEvent;
struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5;
struct __pyx_obj_8petsc4py_5PETSc_DMDA;
struct __pyx_obj_8petsc4py_5PETSc_DMPlex;
struct __pyx_obj_8petsc4py_5PETSc_DMComposite;
struct __pyx_obj_8petsc4py_5PETSc_DMShell;
struct __pyx_opt_args_8petsc4py_5PETSc_getprefix;

/* "PETSc/petscopt.pxi":104
 * 
 * 
 * cdef enum PetscOptType:             # <<<<<<<<<<<<<<
 *     OPT_BOOL
 *     OPT_INT
 */
enum __pyx_t_8petsc4py_5PETSc_PetscOptType {
  __pyx_e_8petsc4py_5PETSc_OPT_BOOL,
  __pyx_e_8petsc4py_5PETSc_OPT_INT,
  __pyx_e_8petsc4py_5PETSc_OPT_REAL,
  __pyx_e_8petsc4py_5PETSc_OPT_SCALAR,
  __pyx_e_8petsc4py_5PETSc_OPT_STRING
};

/* "PETSc/petscopt.pxi":39
 * #
 * 
 * cdef getprefix(prefix, deft=None):             # <<<<<<<<<<<<<<
 *     if prefix is None:
 *         prefix = deft
 */
struct __pyx_opt_args_8petsc4py_5PETSc_getprefix {
  int __pyx_n;
  PyObject *deft;
};

/* "PETSc/petscmpi.pxi":36
 *     void *Cython_ImportFunction(object, char[], char[]) except? NULL
 * 
 * ctypedef MPI_Comm* PyMPICommGet(object) except NULL             # <<<<<<<<<<<<<<
 * ctypedef object    PyMPICommNew(MPI_Comm)
 * 
 */
typedef MPI_Comm *__pyx_t_8petsc4py_5PETSc_PyMPICommGet(PyObject *);

/* "PETSc/petscmpi.pxi":37
 * 
 * ctypedef MPI_Comm* PyMPICommGet(object) except NULL
 * ctypedef object    PyMPICommNew(MPI_Comm)             # <<<<<<<<<<<<<<
 * 
 * cdef inline MPI_Comm mpi4py_Comm_Get(object comm) except *:
 */
typedef PyObject *__pyx_t_8petsc4py_5PETSc_PyMPICommNew(MPI_Comm);

/* "PETSc/petscvec.pxi":288
 * # --------------------------------------------------------------------
 * 
 * ctypedef int VecSetValuesFcn(PetscVec,PetscInt,const_PetscInt[],             # <<<<<<<<<<<<<<
 *                              const_PetscScalar[],PetscInsertMode)
 * 
 */
typedef int __pyx_t_8petsc4py_5PETSc_VecSetValuesFcn(Vec, PetscInt, const PetscInt *, const PetscScalar *, InsertMode);

/* "PETSc/petscmat.pxi":737
 * # -----------------------------------------------------------------------------
 * 
 * ctypedef int MatSetValuesFcn(PetscMat,PetscInt,const_PetscInt[],             # <<<<<<<<<<<<<<
 *                              PetscInt,const_PetscInt[],
 *                              const_PetscScalar[],PetscInsertMode)
 */
typedef int __pyx_t_8petsc4py_5PETSc_MatSetValuesFcn(Mat, PetscInt, const PetscInt *, PetscInt, const PetscInt *, const PetscScalar *, InsertMode);

/* "PETSc/petscdmshell.pxi":1
 * ctypedef int (*PetscDMShellXToYFunction)(PetscDM,             # <<<<<<<<<<<<<<
 *                                          PetscVec,
 *                                          PetscInsertMode,
 */
typedef int (*__pyx_t_8petsc4py_5PETSc_PetscDMShellXToYFunction)(DM, Vec, InsertMode, Vec);

/* "petsc4py/PETSc.pxd":70
 * # --------------------------------------------------------------------
 * 
 * ctypedef public api class Comm [             # <<<<<<<<<<<<<<
 *     type   PyPetscComm_Type,
 *     object PyPetscCommObject,
 */
struct PyPetscCommObject {
  PyObject_HEAD
  MPI_Comm comm;
  int isdup;
  PyObject *base;
};
typedef struct PyPetscCommObject PyPetscCommObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscComm_Type;

/* "petsc4py/PETSc.pxd":78
 *     cdef object base
 * 
 * ctypedef public api class Object [             # <<<<<<<<<<<<<<
 *     type   PyPetscObject_Type,
 *     object PyPetscObjectObject,
 */
struct PyPetscObjectObject {
  PyObject_HEAD
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object *__pyx_vtab;
  PyObject *__weakref__;
  PyObject *__pyx___dummy__;
  PetscObject oval;
  PetscObject *obj;
};
typedef struct PyPetscObjectObject PyPetscObjectObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscObject_Type;

/* "petsc4py/PETSc.pxd":90
 *     cdef object get_dict(self)
 * 
 * ctypedef public api class Viewer(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscViewer_Type,
 *     object PyPetscViewerObject,
 */
struct PyPetscViewerObject {
  struct PyPetscObjectObject __pyx_base;
  PetscViewer vwr;
};
typedef struct PyPetscViewerObject PyPetscViewerObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscViewer_Type;

/* "petsc4py/PETSc.pxd":96
 *     cdef PetscViewer vwr
 * 
 * ctypedef public api class Random(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscRandom_Type,
 *     object PyPetscRandomObject,
 */
struct PyPetscRandomObject {
  struct PyPetscObjectObject __pyx_base;
  PetscRandom rnd;
};
typedef struct PyPetscRandomObject PyPetscRandomObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscRandom_Type;

/* "petsc4py/PETSc.pxd":102
 *     cdef PetscRandom rnd
 * 
 * ctypedef public api class IS(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscIS_Type,
 *     object PyPetscISObject,
 */
struct PyPetscISObject {
  struct PyPetscObjectObject __pyx_base;
  IS iset;
};
typedef struct PyPetscISObject PyPetscISObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscIS_Type;

/* "petsc4py/PETSc.pxd":108
 *     cdef PetscIS iset
 * 
 * ctypedef public api class LGMap(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscLGMap_Type,
 *     object PyPetscLGMapObject,
 */
struct PyPetscLGMapObject {
  struct PyPetscObjectObject __pyx_base;
  ISLocalToGlobalMapping lgm;
};
typedef struct PyPetscLGMapObject PyPetscLGMapObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscLGMap_Type;

/* "petsc4py/PETSc.pxd":114
 *     cdef PetscLGMap lgm
 * 
 * ctypedef public api class SF(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscSF_Type,
 *     object PyPetscSFObject,
 */
struct PyPetscSFObject {
  struct PyPetscObjectObject __pyx_base;
  PetscSF sf;
};
typedef struct PyPetscSFObject PyPetscSFObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscSF_Type;

/* "petsc4py/PETSc.pxd":120
 *     cdef PetscSF sf
 * 
 * ctypedef public api class Vec(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscVec_Type,
 *     object PyPetscVecObject,
 */
struct PyPetscVecObject {
  struct PyPetscObjectObject __pyx_base;
  Vec vec;
};
typedef struct PyPetscVecObject PyPetscVecObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscVec_Type;

/* "petsc4py/PETSc.pxd":126
 *     cdef PetscVec vec
 * 
 * ctypedef public api class Scatter(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscScatter_Type,
 *     object PyPetscScatterObject,
 */
struct PyPetscScatterObject {
  struct PyPetscObjectObject __pyx_base;
  VecScatter sct;
};
typedef struct PyPetscScatterObject PyPetscScatterObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscScatter_Type;

/* "petsc4py/PETSc.pxd":132
 *     cdef PetscScatter sct
 * 
 * ctypedef public api class Section(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscSection_Type,
 *     object PyPetscSectionObject,
 */
struct PyPetscSectionObject {
  struct PyPetscObjectObject __pyx_base;
  PetscSection sec;
};
typedef struct PyPetscSectionObject PyPetscSectionObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscSection_Type;

/* "petsc4py/PETSc.pxd":138
 *     cdef PetscSection sec
 * 
 * ctypedef public api class Mat(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscMat_Type,
 *     object PyPetscMatObject,
 */
struct PyPetscMatObject {
  struct PyPetscObjectObject __pyx_base;
  Mat mat;
};
typedef struct PyPetscMatObject PyPetscMatObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscMat_Type;

/* "petsc4py/PETSc.pxd":144
 *     cdef PetscMat mat
 * 
 * ctypedef public api class NullSpace(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscNullSpace_Type,
 *     object PyPetscNullSpaceObject,
 */
struct PyPetscNullSpaceObject {
  struct PyPetscObjectObject __pyx_base;
  MatNullSpace nsp;
};
typedef struct PyPetscNullSpaceObject PyPetscNullSpaceObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscNullSpace_Type;

/* "petsc4py/PETSc.pxd":150
 *     cdef PetscNullSpace nsp
 * 
 * ctypedef public api class PC(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscPC_Type,
 *     object PyPetscPCObject,
 */
struct PyPetscPCObject {
  struct PyPetscObjectObject __pyx_base;
  PC pc;
};
typedef struct PyPetscPCObject PyPetscPCObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscPC_Type;

/* "petsc4py/PETSc.pxd":156
 *     cdef PetscPC pc
 * 
 * ctypedef public api class KSP(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscKSP_Type,
 *     object PyPetscKSPObject,
 */
struct PyPetscKSPObject {
  struct PyPetscObjectObject __pyx_base;
  KSP ksp;
};
typedef struct PyPetscKSPObject PyPetscKSPObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscKSP_Type;

/* "petsc4py/PETSc.pxd":162
 *     cdef PetscKSP ksp
 * 
 * ctypedef public api class SNES(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscSNES_Type,
 *     object PyPetscSNESObject,
 */
struct PyPetscSNESObject {
  struct PyPetscObjectObject __pyx_base;
  SNES snes;
};
typedef struct PyPetscSNESObject PyPetscSNESObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscSNES_Type;

/* "petsc4py/PETSc.pxd":168
 *     cdef PetscSNES snes
 * 
 * ctypedef public api class TS(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscTS_Type,
 *     object PyPetscTSObject,
 */
struct PyPetscTSObject {
  struct PyPetscObjectObject __pyx_base;
  TS ts;
};
typedef struct PyPetscTSObject PyPetscTSObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscTS_Type;

/* "petsc4py/PETSc.pxd":174
 *     cdef PetscTS ts
 * 
 * ctypedef public api class TAO(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscTAO_Type,
 *     object PyPetscTAOObject,
 */
struct PyPetscTAOObject {
  struct PyPetscObjectObject __pyx_base;
  Tao tao;
};
typedef struct PyPetscTAOObject PyPetscTAOObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscTAO_Type;

/* "petsc4py/PETSc.pxd":180
 *     cdef PetscTAO tao
 * 
 * ctypedef public api class AO(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscAO_Type,
 *     object PyPetscAOObject,
 */
struct PyPetscAOObject {
  struct PyPetscObjectObject __pyx_base;
  AO ao;
};
typedef struct PyPetscAOObject PyPetscAOObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscAO_Type;

/* "petsc4py/PETSc.pxd":186
 *     cdef PetscAO ao
 * 
 * ctypedef public api class DM(Object) [             # <<<<<<<<<<<<<<
 *     type   PyPetscDM_Type,
 *     object PyPetscDMObject,
 */
struct PyPetscDMObject {
  struct PyPetscObjectObject __pyx_base;
  DM dm;
};
typedef struct PyPetscDMObject PyPetscDMObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscDM_Type;

/* "petsc4py/PETSc.pxd":192
 *     cdef PetscDM dm
 * 
 * ctypedef public api class Partitioner(Object) [             # <<<<<<<<<<<<<<
 *     type PyPetscPartitioner_Type,
 *     object PyPetscPartitionerObject,
 */
struct PyPetscPartitionerObject {
  struct PyPetscObjectObject __pyx_base;
  PetscPartitioner part;
};
typedef struct PyPetscPartitionerObject PyPetscPartitionerObject;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscPartitioner_Type;

/* "PETSc/petscis.pxi":113
 * # --------------------------------------------------------------------
 * 
 * cdef class _IS_buffer:             # <<<<<<<<<<<<<<
 * 
 *     cdef PetscIS iset
 */
struct __pyx_obj_8petsc4py_5PETSc__IS_buffer {
  PyObject_HEAD
  struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *__pyx_vtab;
  IS iset;
  PetscInt size;
  const PetscInt *data;
  int hasarray;
};


/* "PETSc/petscvec.pxi":413
 *     return 0
 * 
 * cdef class _Vec_buffer:             # <<<<<<<<<<<<<<
 * 
 *     cdef PetscVec vec
 */
struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer {
  PyObject_HEAD
  struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *__pyx_vtab;
  Vec vec;
  PetscInt size;
  PetscScalar *data;
  int readonly;
  int hasarray;
};


/* "PETSc/petscvec.pxi":533
 * # --------------------------------------------------------------------
 * 
 * cdef class _Vec_LocalForm:             # <<<<<<<<<<<<<<
 * 
 *     "Context manager for `Vec` local form"
 */
struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm {
  PyObject_HEAD
  struct PyPetscVecObject *gvec;
  struct PyPetscVecObject *lvec;
};


/* "PETSc/petscmat.pxi":1017
 * 
 * #@cython.internal
 * cdef class _Mat_Stencil:             # <<<<<<<<<<<<<<
 *    cdef PetscMatStencil stencil
 *    property i:
 */
struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil {
  PyObject_HEAD
  MatStencil stencil;
};


/* "PETSc/petscdmda.pxi":198
 * # --------------------------------------------------------------------
 * 
 * cdef class _DMDA_Vec_array(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef _Vec_buffer vecbuf
 */
struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array {
  PyObject_HEAD
  struct __pyx_vtabstruct_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_vtab;
  struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *vecbuf;
  PyObject *starts;
  PyObject *sizes;
  PyObject *shape;
  PyObject *strides;
  PyArrayObject *array;
};


/* "PETSc/petscdmcomposite.pxi":17
 *     int DMCompositeGetISLocalToGlobalMappings(PetscDM,PetscLGMap**)
 * 
 * cdef class _DMComposite_access:             # <<<<<<<<<<<<<<
 *     cdef PetscDM  dm
 *     cdef PetscVec gvec
 */
struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access {
  PyObject_HEAD
  DM dm;
  Vec gvec;
  PetscInt nlocs;
  PetscInt *locs;
  Vec *vecs;
  PyObject *locs_mem;
  PyObject *vecs_mem;
  PyObject *access;
};


/* "PETSc/Options.pyx":3
 * # --------------------------------------------------------------------
 * 
 * cdef class Options:             # <<<<<<<<<<<<<<
 * 
 *     cdef PetscOptions opt
 */
struct __pyx_obj_8petsc4py_5PETSc_Options {
  PyObject_HEAD
  PetscOptions opt;
  PyObject *_prefix;
};


/* "PETSc/Sys.pyx":3
 * # --------------------------------------------------------------------
 * 
 * cdef class Sys:             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
struct __pyx_obj_8petsc4py_5PETSc_Sys {
  PyObject_HEAD
};


/* "PETSc/Log.pyx":3
 * # --------------------------------------------------------------------
 * 
 * cdef class Log:             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
struct __pyx_obj_8petsc4py_5PETSc_Log {
  PyObject_HEAD
};


/* "PETSc/Log.pyx":95
 * # --------------------------------------------------------------------
 * 
 * cdef class LogStage:             # <<<<<<<<<<<<<<
 * 
 *     cdef readonly PetscLogStage id
 */
struct __pyx_obj_8petsc4py_5PETSc_LogStage {
  PyObject_HEAD
  PetscLogStage id;
};


/* "PETSc/Log.pyx":191
 * # --------------------------------------------------------------------
 * 
 * cdef class LogClass:             # <<<<<<<<<<<<<<
 * 
 *     cdef readonly PetscLogClass id
 */
struct __pyx_obj_8petsc4py_5PETSc_LogClass {
  PyObject_HEAD
  PetscClassId id;
};


/* "PETSc/Log.pyx":253
 * # --------------------------------------------------------------------
 * 
 * cdef class LogEvent:             # <<<<<<<<<<<<<<
 * 
 *     cdef readonly PetscLogEvent id
 */
struct __pyx_obj_8petsc4py_5PETSc_LogEvent {
  PyObject_HEAD
  PetscLogEvent id;
};


/* "PETSc/Viewer.pyx":322
 * # --------------------------------------------------------------------
 * 
 * cdef class ViewerHDF5(Viewer):             # <<<<<<<<<<<<<<
 * 
 *     def create(self, name, mode=None, comm=None):
 */
struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 {
  struct PyPetscViewerObject __pyx_base;
};


/* "PETSc/DMDA.pyx":17
 * # --------------------------------------------------------------------
 * 
 * cdef class DMDA(DM):             # <<<<<<<<<<<<<<
 * 
 *     StencilType       = DMDAStencilType
 */
struct __pyx_obj_8petsc4py_5PETSc_DMDA {
  struct PyPetscDMObject __pyx_base;
};


/* "PETSc/DMPlex.pyx":3
 * # --------------------------------------------------------------------
 * 
 * cdef class DMPlex(DM):             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
struct __pyx_obj_8petsc4py_5PETSc_DMPlex {
  struct PyPetscDMObject __pyx_base;
};


/* "PETSc/DMComposite.pyx":3
 * # --------------------------------------------------------------------
 * 
 * cdef class DMComposite(DM):             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
struct __pyx_obj_8petsc4py_5PETSc_DMComposite {
  struct PyPetscDMObject __pyx_base;
};


/* "PETSc/DMShell.pyx":1
 * cdef class DMShell(DM):             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
struct __pyx_obj_8petsc4py_5PETSc_DMShell {
  struct PyPetscDMObject __pyx_base;
};


__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscObject_Type;

/* "PETSc/Object.pyx":3
 * # --------------------------------------------------------------------
 * 
 * cdef class Object:             # <<<<<<<<<<<<<<
 * 
 *     # --- special methods ---
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_Object {
  PyObject *(*get_attr)(struct PyPetscObjectObject *, char *);
  PyObject *(*set_attr)(struct PyPetscObjectObject *, char *, PyObject *);
  PyObject *(*get_dict)(struct PyPetscObjectObject *);
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_Object *__pyx_vtabptr_8petsc4py_5PETSc_Object;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscViewer_Type;

/* "PETSc/Viewer.pyx":74
 * # --------------------------------------------------------------------
 * 
 * cdef class Viewer(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type   = ViewerType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_Viewer {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_Viewer *__pyx_vtabptr_8petsc4py_5PETSc_Viewer;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscRandom_Type;

/* "PETSc/Random.pyx":11
 * # --------------------------------------------------------------------
 * 
 * cdef class Random(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type = RandomType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_Random {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_Random *__pyx_vtabptr_8petsc4py_5PETSc_Random;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscIS_Type;

/* "PETSc/IS.pyx":10
 * # --------------------------------------------------------------------
 * 
 * cdef class IS(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type = ISType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_IS {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_IS *__pyx_vtabptr_8petsc4py_5PETSc_IS;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscLGMap_Type;

/* "PETSc/IS.pyx":350
 * # --------------------------------------------------------------------
 * 
 * cdef class LGMap(Object):             # <<<<<<<<<<<<<<
 * 
 *     MapType = GLMapType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_LGMap {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_LGMap *__pyx_vtabptr_8petsc4py_5PETSc_LGMap;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscSF_Type;

/* "PETSc/SF.pyx":9
 * # --------------------------------------------------------------------
 * 
 * cdef class SF(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type = SFType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_SF {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_SF *__pyx_vtabptr_8petsc4py_5PETSc_SF;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscVec_Type;

/* "PETSc/Vec.pyx":25
 * # --------------------------------------------------------------------
 * 
 * cdef class Vec(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type = VecType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_Vec {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_Vec *__pyx_vtabptr_8petsc4py_5PETSc_Vec;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscScatter_Type;

/* "PETSc/Scatter.pyx":3
 * # --------------------------------------------------------------------
 * 
 * cdef class Scatter(Object):             # <<<<<<<<<<<<<<
 * 
 *     Mode = ScatterMode
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_Scatter {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_Scatter *__pyx_vtabptr_8petsc4py_5PETSc_Scatter;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscSection_Type;

/* "PETSc/Section.pyx":3
 * # --------------------------------------------------------------------
 * 
 * cdef class Section(Object):             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_Section {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_Section *__pyx_vtabptr_8petsc4py_5PETSc_Section;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscMat_Type;

/* "PETSc/Mat.pyx":148
 * # --------------------------------------------------------------------
 * 
 * cdef class Mat(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type            = MatType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_Mat {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_Mat *__pyx_vtabptr_8petsc4py_5PETSc_Mat;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscNullSpace_Type;

/* "PETSc/Mat.pyx":1461
 * # --------------------------------------------------------------------
 * 
 * cdef class NullSpace(Object):             # <<<<<<<<<<<<<<
 * 
 *     #
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_NullSpace {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_NullSpace *__pyx_vtabptr_8petsc4py_5PETSc_NullSpace;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscPC_Type;

/* "PETSc/PC.pyx":104
 * # --------------------------------------------------------------------
 * 
 * cdef class PC(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type = PCType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_PC {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_PC *__pyx_vtabptr_8petsc4py_5PETSc_PC;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscKSP_Type;

/* "PETSc/KSP.pyx":86
 * # --------------------------------------------------------------------
 * 
 * cdef class KSP(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type            = KSPType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *__pyx_vtabptr_8petsc4py_5PETSc_KSP;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscSNES_Type;

/* "PETSc/SNES.pyx":61
 * # --------------------------------------------------------------------
 * 
 * cdef class SNES(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type = SNESType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *__pyx_vtabptr_8petsc4py_5PETSc_SNES;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscTS_Type;

/* "PETSc/TS.pyx":69
 * # -----------------------------------------------------------------------------
 * 
 * cdef class TS(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type = TSType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_TS {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *__pyx_vtabptr_8petsc4py_5PETSc_TS;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscTAO_Type;

/* "PETSc/TAO.pyx":53
 * # --------------------------------------------------------------------
 * 
 * cdef class TAO(Object):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *__pyx_vtabptr_8petsc4py_5PETSc_TAO;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscAO_Type;

/* "PETSc/AO.pyx":11
 * # --------------------------------------------------------------------
 * 
 * cdef class AO(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type = AOType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_AO {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_AO *__pyx_vtabptr_8petsc4py_5PETSc_AO;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscDM_Type;

/* "PETSc/DM.pyx":24
 * # --------------------------------------------------------------------
 * 
 * cdef class DM(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type         = DMType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_DM {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *__pyx_vtabptr_8petsc4py_5PETSc_DM;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) PyPetscPartitioner_Type;

/* "PETSc/Partitioner.pyx":10
 * # --------------------------------------------------------------------
 * 
 * cdef class Partitioner(Object):             # <<<<<<<<<<<<<<
 * 
 *     Type = PartitionerType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_Partitioner {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Object __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_Partitioner *__pyx_vtabptr_8petsc4py_5PETSc_Partitioner;


/* "PETSc/petscis.pxi":113
 * # --------------------------------------------------------------------
 * 
 * cdef class _IS_buffer:             # <<<<<<<<<<<<<<
 * 
 *     cdef PetscIS iset
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer {
  int (*acquire)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *);
  int (*release)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *);
  int (*acquirebuffer)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *, Py_buffer *, int);
  int (*releasebuffer)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *, Py_buffer *);
  PyObject *(*enter)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *);
  PyObject *(*exit)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *);
  Py_ssize_t (*getbuffer)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *, void **);
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *__pyx_vtabptr_8petsc4py_5PETSc__IS_buffer;


/* "PETSc/petscvec.pxi":413
 *     return 0
 * 
 * cdef class _Vec_buffer:             # <<<<<<<<<<<<<<
 * 
 *     cdef PetscVec vec
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer {
  int (*acquire)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *);
  int (*release)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *);
  int (*acquirebuffer)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *, Py_buffer *, int);
  int (*releasebuffer)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *, Py_buffer *);
  PyObject *(*enter)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *);
  PyObject *(*exit)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *);
  Py_ssize_t (*getbuffer)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *, void **);
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *__pyx_vtabptr_8petsc4py_5PETSc__Vec_buffer;


/* "PETSc/petscdmda.pxi":198
 * # --------------------------------------------------------------------
 * 
 * cdef class _DMDA_Vec_array(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef _Vec_buffer vecbuf
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc__DMDA_Vec_array {
  int (*acquire)(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *);
  int (*release)(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *);
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_vtabptr_8petsc4py_5PETSc__DMDA_Vec_array;


/* "PETSc/Viewer.pyx":322
 * # --------------------------------------------------------------------
 * 
 * cdef class ViewerHDF5(Viewer):             # <<<<<<<<<<<<<<
 * 
 *     def create(self, name, mode=None, comm=None):
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_ViewerHDF5 {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_Viewer __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_ViewerHDF5 *__pyx_vtabptr_8petsc4py_5PETSc_ViewerHDF5;


/* "PETSc/DMDA.pyx":17
 * # --------------------------------------------------------------------
 * 
 * cdef class DMDA(DM):             # <<<<<<<<<<<<<<
 * 
 *     StencilType       = DMDAStencilType
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_DMDA {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_DM __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_DMDA *__pyx_vtabptr_8petsc4py_5PETSc_DMDA;


/* "PETSc/DMPlex.pyx":3
 * # --------------------------------------------------------------------
 * 
 * cdef class DMPlex(DM):             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_DMPlex {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_DM __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_DMPlex *__pyx_vtabptr_8petsc4py_5PETSc_DMPlex;


/* "PETSc/DMComposite.pyx":3
 * # --------------------------------------------------------------------
 * 
 * cdef class DMComposite(DM):             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_DMComposite {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_DM __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_DMComposite *__pyx_vtabptr_8petsc4py_5PETSc_DMComposite;


/* "PETSc/DMShell.pyx":1
 * cdef class DMShell(DM):             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */

struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell {
  struct __pyx_vtabstruct_8petsc4py_5PETSc_DM __pyx_base;
};
static struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *__pyx_vtabptr_8petsc4py_5PETSc_DMShell;

/* --- 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_COMPILING_IN_CPYTHON
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);

/* decode_c_bytes.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, 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));

/* decode_bytes.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_bytes(
         PyObject* string, 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)) {
    return __Pyx_decode_c_bytes(
        PyBytes_AS_STRING(string), PyBytes_GET_SIZE(string),
        start, stop, encoding, errors, decode_func);
}

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

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

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

/* PyThreadStateGet.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = PyThreadState_GET();
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#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);
#else
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(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

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

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

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

/* ListAppend.proto */
#if CYTHON_COMPILING_IN_CPYTHON
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

/* GetException.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#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

/* SwapException.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#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

/* SaveResetException.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#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

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

/* pop_index.proto */
static PyObject* __Pyx__PyObject_PopNewIndex(PyObject* L, PyObject* py_ix);
static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, PyObject* py_ix);
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyList_PopIndex(PyObject* L, PyObject* py_ix, Py_ssize_t ix);
#define __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) (\
    (likely(PyList_CheckExact(L) && __Pyx_fits_Py_ssize_t(ix, type, is_signed))) ?\
        __Pyx__PyList_PopIndex(L, py_ix, ix) : (\
        (unlikely(py_ix == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) :\
            __Pyx__PyObject_PopIndex(L, py_ix)))
#define __Pyx_PyList_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) (\
    __Pyx_fits_Py_ssize_t(ix, type, is_signed) ?\
        __Pyx__PyList_PopIndex(L, py_ix, ix) : (\
        (unlikely(py_ix == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) :\
            __Pyx__PyObject_PopIndex(L, py_ix)))
#else
#define __Pyx_PyList_PopIndex(L, py_ix, ix, is_signed, type, to_py_func)\
    __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func)
#define __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) (\
    (unlikely(py_ix == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) :\
        __Pyx__PyObject_PopIndex(L, py_ix))
#endif

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* 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 CYTHON_INLINE 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);

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

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

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* 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);

/* PyErrExceptionMatches.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#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

/* 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);

/* ArgTypeTest.proto */
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact);

/* KeywordStringCheck.proto */
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);

/* PyObjectSetAttrStr.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* py_dict_keys.proto */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d);

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod0.proto */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
    ((likely((cfunc)->func)) ?\
        (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
         (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
             ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) : __Pyx__CallUnboundCMethod0(cfunc, self)))) :\
        __Pyx__CallUnboundCMethod0(cfunc, self))
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* PyIntBinop.proto */
#if CYTHON_COMPILING_IN_CPYTHON
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

/* 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 CYTHON_INLINE 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);

/* PyIntBinop.proto */
#if CYTHON_COMPILING_IN_CPYTHON
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

/* ListCompAppend.proto */
#if CYTHON_COMPILING_IN_CPYTHON
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

/* StringJoin.proto */
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyString_Join __Pyx_PyBytes_Join
#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
#else
#define __Pyx_PyString_Join PyUnicode_Join
#define __Pyx_PyBaseString_Join PyUnicode_Join
#endif
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION < 3
    #define __Pyx_PyBytes_Join _PyString_Join
    #else
    #define __Pyx_PyBytes_Join _PyBytes_Join
    #endif
#else
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
#endif

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

/* dict_getitem_default.proto */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);

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

/* pop.proto */
static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L);
#define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ?\
    __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
#else
#define __Pyx_PyList_Pop(L)  __Pyx__PyObject_Pop(L)
#define __Pyx_PyObject_Pop(L)  __Pyx__PyObject_Pop(L)
#endif

/* PyDictContains.proto */
static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

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

/* PyObjectLookupSpecial.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
#if PY_MAJOR_VERSION < 3
    if (unlikely(PyInstance_Check(obj)))
        return __Pyx_PyObject_GetAttrStr(obj, attr_name);
#endif
    res = _PyType_Lookup(tp, attr_name);
    if (likely(res)) {
        descrgetfunc f = Py_TYPE(res)->tp_descr_get;
        if (!f) {
            Py_INCREF(res);
        } else {
            res = f(res, obj, (PyObject *)tp);
        }
    } else {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#else
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

/* SliceObject.proto */
#define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
    __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
        PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* SliceTupleAndList.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
#else
#define __Pyx_PyList_GetSlice(seq, start, stop)   PySequence_GetSlice(seq, start, stop)
#define __Pyx_PyTuple_GetSlice(seq, start, stop)  PySequence_GetSlice(seq, start, stop)
#endif

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

/* py_dict_clear.proto */
#define __Pyx_PyDict_Clear(d) (PyDict_Clear(d), 0)

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

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* GetNameInClass.proto */
static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name);

/* 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);

/* RegisterModuleCleanup.proto */
static void __pyx_module_cleanup(PyObject *self);
static int __Pyx_RegisterCleanup(void);

/* 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);

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_InsertMode(InsertMode value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ScatterMode(ScatterMode value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_NormType(NormType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscViewerFormat(PetscViewerFormat value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscFileMode(PetscFileMode value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ISGlobalToLocalMappingType(ISGlobalToLocalMappingType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_VecOption(VecOption value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MatOption(MatOption value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MatAssemblyType(MatAssemblyType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MatInfoType(MatInfoType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MatStructure(MatStructure value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MatFactorShiftType(MatFactorShiftType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MatSORType(MatSORType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCSide(PCSide value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCASMType(PCASMType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCGASMType(PCGASMType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCMGType(PCMGType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCCompositeType(PCCompositeType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCFieldSplitSchurPreType(PCFieldSplitSchurPreType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCFieldSplitSchurFactType(PCFieldSplitSchurFactType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_KSPNormType(KSPNormType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_KSPConvergedReason(KSPConvergedReason value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SNESNormSchedule(SNESNormSchedule value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SNESConvergedReason(SNESConvergedReason value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_TSProblemType(TSProblemType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_TSEquationType(TSEquationType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_TSExactFinalTimeOption(TSExactFinalTimeOption value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_TSConvergedReason(TSConvergedReason value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_TaoConvergedReason(TaoConvergedReason value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DMBoundaryType(DMBoundaryType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DMDAStencilType(DMDAStencilType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DMDAInterpolationType(DMDAInterpolationType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DMDAElementType(DMDAElementType value);

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscInt(PetscInt value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscBool(PetscBool value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscLogStage(PetscLogStage value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscClassId(PetscClassId value);

static PyObject* __pyx_convert__to_py_PetscEventPerfInfo(PetscEventPerfInfo s);
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscLogEvent(PetscLogEvent value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MPI_Fint(MPI_Fint value);

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

static PyObject* __pyx_convert__to_py_MatInfo(MatInfo s);
/* ClassMethod.proto */
#include "descrobject.h"
static PyObject* __Pyx_Method_ClassMethod(PyObject *method);

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

/* CIntFromPy.proto */
static CYTHON_INLINE PetscInt __Pyx_PyInt_As_PetscInt(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE InsertMode __Pyx_PyInt_As_InsertMode(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE ScatterMode __Pyx_PyInt_As_ScatterMode(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE PetscFileMode __Pyx_PyInt_As_PetscFileMode(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE MatStructure __Pyx_PyInt_As_MatStructure(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE MatAssemblyType __Pyx_PyInt_As_MatAssemblyType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE MatInfoType __Pyx_PyInt_As_MatInfoType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE MatFactorShiftType __Pyx_PyInt_As_MatFactorShiftType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE KSPConvergedReason __Pyx_PyInt_As_KSPConvergedReason(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE SNESConvergedReason __Pyx_PyInt_As_SNESConvergedReason(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE TaoConvergedReason __Pyx_PyInt_As_TaoConvergedReason(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE DMBoundaryType __Pyx_PyInt_As_DMBoundaryType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE DMDAStencilType __Pyx_PyInt_As_DMDAStencilType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE DMDAInterpolationType __Pyx_PyInt_As_DMDAInterpolationType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE DMDAElementType __Pyx_PyInt_As_DMDAElementType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE PetscClassId __Pyx_PyInt_As_PetscClassId(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE PetscViewerFormat __Pyx_PyInt_As_PetscViewerFormat(PyObject *);

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

/* CIntFromPy.proto */
static CYTHON_INLINE PetscBool __Pyx_PyInt_As_PetscBool(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE ISGlobalToLocalMappingType __Pyx_PyInt_As_ISGlobalToLocalMappingType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE VecOption __Pyx_PyInt_As_VecOption(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE NormType __Pyx_PyInt_As_NormType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE MatOption __Pyx_PyInt_As_MatOption(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE PCASMType __Pyx_PyInt_As_PCASMType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE PCGASMType __Pyx_PyInt_As_PCGASMType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE PCCompositeType __Pyx_PyInt_As_PCCompositeType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE PCFieldSplitSchurFactType __Pyx_PyInt_As_PCFieldSplitSchurFactType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE PCFieldSplitSchurPreType __Pyx_PyInt_As_PCFieldSplitSchurPreType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE PCMGType __Pyx_PyInt_As_PCMGType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE PCSide __Pyx_PyInt_As_PCSide(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE KSPNormType __Pyx_PyInt_As_KSPNormType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE SNESNormSchedule __Pyx_PyInt_As_SNESNormSchedule(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE TSProblemType __Pyx_PyInt_As_TSProblemType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE TSEquationType __Pyx_PyInt_As_TSEquationType(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE TSExactFinalTimeOption __Pyx_PyInt_As_TSExactFinalTimeOption(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE TSConvergedReason __Pyx_PyInt_As_TSConvergedReason(PyObject *);

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

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

/* FunctionExport.proto */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

/* 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 int __pyx_f_8petsc4py_5PETSc_10_IS_buffer_acquire(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self); /* proto*/
static int __pyx_f_8petsc4py_5PETSc_10_IS_buffer_release(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self); /* proto*/
static int __pyx_f_8petsc4py_5PETSc_10_IS_buffer_acquirebuffer(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /* proto*/
static int __pyx_f_8petsc4py_5PETSc_10_IS_buffer_releasebuffer(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, Py_buffer *__pyx_v_view); /* proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_10_IS_buffer_enter(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_10_IS_buffer_exit(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self); /* proto*/
static Py_ssize_t __pyx_f_8petsc4py_5PETSc_10_IS_buffer_getbuffer(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, void **__pyx_v_p); /* proto*/
static int __pyx_f_8petsc4py_5PETSc_11_Vec_buffer_acquire(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self); /* proto*/
static int __pyx_f_8petsc4py_5PETSc_11_Vec_buffer_release(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self); /* proto*/
static int __pyx_f_8petsc4py_5PETSc_11_Vec_buffer_acquirebuffer(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /* proto*/
static int __pyx_f_8petsc4py_5PETSc_11_Vec_buffer_releasebuffer(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_buffer *__pyx_v_view); /* proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_11_Vec_buffer_enter(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_11_Vec_buffer_exit(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self); /* proto*/
static Py_ssize_t __pyx_f_8petsc4py_5PETSc_11_Vec_buffer_getbuffer(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, void **__pyx_v_p); /* proto*/
static int __pyx_f_8petsc4py_5PETSc_15_DMDA_Vec_array_acquire(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self); /* proto*/
static int __pyx_f_8petsc4py_5PETSc_15_DMDA_Vec_array_release(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_6Object_get_attr(struct PyPetscObjectObject *__pyx_v_self, char *__pyx_v_name); /* proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_6Object_set_attr(struct PyPetscObjectObject *__pyx_v_self, char *__pyx_v_name, PyObject *__pyx_v_attr); /* proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_6Object_get_dict(struct PyPetscObjectObject *__pyx_v_self); /* proto*/

/* Module declarations from 'numpy' */

/* Module declarations from 'petsc4py.PETSc' */
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_Comm = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_Object = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_Viewer = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_Random = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_IS = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_LGMap = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_SF = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_Vec = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_Scatter = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_Section = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_Mat = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_NullSpace = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_PC = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_KSP = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_SNES = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_TS = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_TAO = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_AO = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_DM = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_Partitioner = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_dtype = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_ndarray = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc__IS_buffer = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc__Vec_buffer = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc__Vec_LocalForm = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc__Mat_Stencil = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc__DMDA_Vec_array = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc__DMComposite_access = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_Options = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_Sys = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_Log = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_LogStage = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_LogClass = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_LogEvent = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_ViewerHDF5 = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_DMDA = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_DMPlex = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_DMComposite = 0;
static PyTypeObject *__pyx_ptype_8petsc4py_5PETSc_DMShell = 0;
static PyObject *__pyx_v_8petsc4py_5PETSc_PetscError = 0;
static PyObject *__pyx_v_8petsc4py_5PETSc_citations_registry = 0;
static PyObject *__pyx_v_8petsc4py_5PETSc_stage_registry = 0;
static PyObject *__pyx_v_8petsc4py_5PETSc_class_registry = 0;
static PyObject *__pyx_v_8petsc4py_5PETSc_event_registry = 0;
static struct PyPetscCommObject *__pyx_v_8petsc4py_5PETSc___COMM_NULL__ = 0;
static struct PyPetscCommObject *__pyx_v_8petsc4py_5PETSc___COMM_SELF__ = 0;
static struct PyPetscCommObject *__pyx_v_8petsc4py_5PETSc___COMM_WORLD__ = 0;
static MPI_Comm __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT;
static PyObject *__pyx_v_8petsc4py_5PETSc_type_registry = 0;
static PyObject *__pyx_v_8petsc4py_5PETSc_tracebacklist = 0;
static int __pyx_v_8petsc4py_5PETSc_PyPetsc_Argc;
static char **__pyx_v_8petsc4py_5PETSc_PyPetsc_Argv;
static int __pyx_v_8petsc4py_5PETSc_registercalled;
static char const *__pyx_v_8petsc4py_5PETSc_citation;
static int __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(int, PyTypeObject *); /*proto*/
static PyTypeObject *__pyx_f_8petsc4py_5PETSc_PyPetscType_Lookup(int); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_bytes2str(const char *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_str2bytes(PyObject *, const char **); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_S_(const char *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_SETERR(int); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_CHKERR(int); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toInt(PetscInt); /*proto*/
static CYTHON_INLINE PetscInt __pyx_f_8petsc4py_5PETSc_asInt(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toReal(PetscReal); /*proto*/
static CYTHON_INLINE PetscReal __pyx_f_8petsc4py_5PETSc_asReal(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toScalar(PetscScalar); /*proto*/
static CYTHON_INLINE PetscScalar __pyx_f_8petsc4py_5PETSc_asScalar(PyObject *); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_asarray(PyObject *); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_arange(PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_empty_i(PetscInt); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_empty_r(PetscInt); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_empty_s(PetscInt); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_empty_c(PetscInt); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_empty_p(PetscInt); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_array_i(PetscInt, const PetscInt *); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_array_r(PetscInt, const PetscReal *); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_array_s(PetscInt, const PetscScalar *); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_iarray(PyObject *, int); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_iarray_i(PyObject *, PetscInt *, PetscInt **); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_iarray_r(PyObject *, PetscInt *, PetscReal **); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_iarray_s(PyObject *, PetscInt *, PetscScalar **); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_oarray(PyObject *, int); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_oarray_i(PyObject *, PetscInt *, PetscInt **); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_oarray_r(PyObject *, PetscInt *, PetscReal **); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_oarray_s(PyObject *, PetscInt *, PetscScalar **); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_oarray_p(PyObject *, PetscInt *, void **); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_ofarray_s(PyObject *, PetscInt *, PetscScalar **); /*proto*/
static CYTHON_INLINE InsertMode __pyx_f_8petsc4py_5PETSc_insertmode(PyObject *); /*proto*/
static CYTHON_INLINE ScatterMode __pyx_f_8petsc4py_5PETSc_scattermode(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_getprefix(PyObject *, struct __pyx_opt_args_8petsc4py_5PETSc_getprefix *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_opt2str(const char *, const char *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_getopt_Bool(PetscOptions, const char *, const char *, PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_getopt_Int(PetscOptions, const char *, const char *, PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_getopt_Real(PetscOptions, const char *, const char *, PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_getopt_Scalar(PetscOptions, const char *, const char *, PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_getopt_String(PetscOptions, const char *, const char *, PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_getpair(PyObject *, PyObject *, const char **, const char **); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_getopt(PetscOptions, enum __pyx_t_8petsc4py_5PETSc_PetscOptType, PyObject *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_tokenize(PyObject *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_iskey(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_gettok(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_getkey(PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_parseopt(PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE MPI_Comm __pyx_f_8petsc4py_5PETSc_mpi4py_Comm_Get(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_mpi4py_Comm_New(MPI_Comm); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_PetscCommDEALLOC(MPI_Comm *); /*proto*/
static CYTHON_INLINE MPI_Comm __pyx_f_8petsc4py_5PETSc_def_Comm(PyObject *, MPI_Comm); /*proto*/
static CYTHON_INLINE struct PyPetscCommObject *__pyx_f_8petsc4py_5PETSc_new_Comm(MPI_Comm); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_comm_size(MPI_Comm); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_comm_rank(MPI_Comm); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Sys_Sizes(PyObject *, PyObject *, PetscInt *, PetscInt *, PetscInt *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Sys_Layout(MPI_Comm, PetscInt, PetscInt *, PetscInt *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_event_args2objs(PyObject *, PetscObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_PetscINCREF(PetscObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_PetscCLEAR(PetscObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_PetscDEALLOC(PetscObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_PetscINCSTATE(PetscObject *); /*proto*/
static CYTHON_INLINE void __pyx_f_8petsc4py_5PETSc_Py_DecRef(PyObject *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_PetscDelPyDict(void *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PetscGetPyDict(PetscObject, int); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PetscGetPyObj(PetscObject, char *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PetscSetPyObj(PetscObject, char *, PyObject *); /*proto*/
static CYTHON_INLINE long __pyx_f_8petsc4py_5PETSc_Object_toFortran(PetscObject); /*proto*/
static CYTHON_INLINE PyTypeObject *__pyx_f_8petsc4py_5PETSc_subtype_DM(DM); /*proto*/
static CYTHON_INLINE PyTypeObject *__pyx_f_8petsc4py_5PETSc_subtype_Object(PetscObject); /*proto*/
static CYTHON_INLINE PetscFileMode __pyx_f_8petsc4py_5PETSc_filemode(PyObject *); /*proto*/
static CYTHON_INLINE struct PyPetscISObject *__pyx_f_8petsc4py_5PETSc_ref_IS(IS); /*proto*/
static CYTHON_INLINE struct PyPetscLGMapObject *__pyx_f_8petsc4py_5PETSc_ref_LGMap(ISLocalToGlobalMapping); /*proto*/
static CYTHON_INLINE struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_ref_Vec(Vec); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_pos(struct PyPetscVecObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_neg(struct PyPetscVecObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_abs(struct PyPetscVecObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_iadd(struct PyPetscVecObject *, PyObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_isub(struct PyPetscVecObject *, PyObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_imul(struct PyPetscVecObject *, PyObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_idiv(struct PyPetscVecObject *, PyObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_add(struct PyPetscVecObject *, PyObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_sub(struct PyPetscVecObject *, PyObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_mul(struct PyPetscVecObject *, PyObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_div(struct PyPetscVecObject *, PyObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_radd(struct PyPetscVecObject *, PyObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_rsub(struct PyPetscVecObject *, PyObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_rmul(struct PyPetscVecObject *, PyObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_rdiv(struct PyPetscVecObject *, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Vec_Sizes(PyObject *, PyObject *, PetscInt *, PetscInt *, PetscInt *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_vecsetvalues(Vec, PyObject *, PyObject *, PyObject *, int, int); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_vecgetvalues(Vec, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_f_8petsc4py_5PETSc_vec_getbuffer_r(struct PyPetscVecObject *); /*proto*/
static CYTHON_INLINE struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_f_8petsc4py_5PETSc_vec_getbuffer_w(struct PyPetscVecObject *); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_vec_getarray_r(struct PyPetscVecObject *); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_vec_getarray_w(struct PyPetscVecObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_vec_setarray(struct PyPetscVecObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_vec_getitem(struct PyPetscVecObject *, PyObject *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_vec_setitem(struct PyPetscVecObject *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_Vec_AcquireArray(Vec, PetscScalar **, int); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_Vec_ReleaseArray(Vec, PetscScalar **, int); /*proto*/
static CYTHON_INLINE struct PyPetscNullSpaceObject *__pyx_f_8petsc4py_5PETSc_ref_NullSpace(MatNullSpace); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_NullSpace_Function(MatNullSpace, Vec, void *); /*proto*/
static CYTHON_INLINE struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_ref_Mat(Mat); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_pos(struct PyPetscMatObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_neg(struct PyPetscMatObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_iadd(struct PyPetscMatObject *, PyObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_isub(struct PyPetscMatObject *, PyObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_imul(struct PyPetscMatObject *, PyObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_idiv(struct PyPetscMatObject *, PyObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_add(struct PyPetscMatObject *, PyObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_sub(struct PyPetscMatObject *, PyObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_mul(struct PyPetscMatObject *, PyObject *); /*proto*/
static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_mat_mul_vec(struct PyPetscMatObject *, struct PyPetscVecObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_div(struct PyPetscMatObject *, PyObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_radd(struct PyPetscMatObject *, PyObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_rsub(struct PyPetscMatObject *, PyObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_rmul(struct PyPetscMatObject *, PyObject *); /*proto*/
static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_rdiv(struct PyPetscMatObject *, PyObject *); /*proto*/
static CYTHON_INLINE MatStructure __pyx_f_8petsc4py_5PETSc_matstructure(PyObject *); /*proto*/
static CYTHON_INLINE MatAssemblyType __pyx_f_8petsc4py_5PETSc_assemblytype(PyObject *); /*proto*/
static CYTHON_INLINE MatInfoType __pyx_f_8petsc4py_5PETSc_infotype(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Mat_Sizes(PyObject *, PyObject *, PetscInt *, PetscInt *, PetscInt *, PetscInt *, PetscInt *, PetscInt *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Mat_Create(const char*, PyObject *, PyObject *, PyObject *, Mat *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ_NNZ(Mat, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ_CSR(Mat, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ(Mat, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_Mat_AllocDense(Mat, PyObject *); /*proto*/
static CYTHON_INLINE __pyx_t_8petsc4py_5PETSc_MatSetValuesFcn *__pyx_f_8petsc4py_5PETSc_matsetvalues_fcn(int, int); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_matsetvalues(Mat, PyObject *, PyObject *, PyObject *, PyObject *, int, int); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_matsetvalues_rcv(Mat, PyObject *, PyObject *, PyObject *, PyObject *, int, int); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_matsetvalues_ijv(Mat, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int, int); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_matsetvalues_csr(Mat, PyObject *, PyObject *, PyObject *, PyObject *, int, int); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_matgetvalues(Mat, PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE MatFactorShiftType __pyx_f_8petsc4py_5PETSc_matfactorshifttype(PyObject *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_matfactorinfo(PetscBool, PetscBool, PyObject *, MatFactorInfo *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_mat_getitem(struct PyPetscMatObject *, PyObject *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_mat_setitem(struct PyPetscMatObject *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_matsetvaluestencil(Mat, struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *, struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *, PyObject *, InsertMode, int); /*proto*/
static CYTHON_INLINE struct PyPetscKSPObject *__pyx_f_8petsc4py_5PETSc_ref_KSP(KSP); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_KSP_Converged(KSP, PetscInt, PetscReal, KSPConvergedReason *, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_KSP_Monitor(KSP, PetscInt, PetscReal, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_KSP_ComputeRHS(KSP, Vec, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_KSP_ComputeOps(KSP, Mat, Mat, void *); /*proto*/
static CYTHON_INLINE struct PyPetscSNESObject *__pyx_f_8petsc4py_5PETSc_ref_SNES(SNES); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_SNES_InitialGuess(SNES, Vec, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_SNES_Function(SNES, Vec, Vec, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_SNES_Update(SNES, PetscInt); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_SNES_Jacobian(SNES, Vec, Mat, Mat, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_SNES_Objective(SNES, Vec, PetscReal *, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_SNES_Converged(SNES, PetscInt, PetscReal, PetscReal, PetscReal, SNESConvergedReason *, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_SNES_Monitor(SNES, PetscInt, PetscReal, void *); /*proto*/
static CYTHON_INLINE struct PyPetscTSObject *__pyx_f_8petsc4py_5PETSc_ref_TS(TS); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TS_RHSFunction(TS, PetscReal, Vec, Vec, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TS_RHSJacobian(TS, PetscReal, Vec, Mat, Mat, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TS_IFunction(TS, PetscReal, Vec, Vec, Vec, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TS_IJacobian(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TS_Monitor(TS, PetscInt, PetscReal, Vec, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TS_PreStep(TS); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TS_PostStep(TS); /*proto*/
static CYTHON_INLINE struct PyPetscTAOObject *__pyx_f_8petsc4py_5PETSc_ref_TAO(Tao); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TAO_Objective(Tao, Vec, PetscReal *, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TAO_SeparableObjective(Tao, Vec, Vec, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TAO_Gradient(Tao, Vec, Vec, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TAO_ObjGrad(Tao, Vec, PetscReal *, Vec, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TAO_Constraints(Tao, Vec, Vec, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TAO_VarBounds(Tao, Vec, Vec, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TAO_Hessian(Tao, Vec, Mat, Mat, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TAO_Jacobian(Tao, Vec, Mat, Mat, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TAO_JacobianState(Tao, Vec, Mat, Mat, Mat, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TAO_JacobianDesign(Tao, Vec, Mat, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TAO_Converged(Tao, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_TAO_Monitor(Tao, void *); /*proto*/
static CYTHON_INLINE DMBoundaryType __pyx_f_8petsc4py_5PETSc_asBoundaryType(PyObject *); /*proto*/
static CYTHON_INLINE PetscInt __pyx_f_8petsc4py_5PETSc_asBoundary(PyObject *, DMBoundaryType *, DMBoundaryType *, DMBoundaryType *); /*proto*/
static CYTHON_INLINE DMDAStencilType __pyx_f_8petsc4py_5PETSc_asStencil(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toStencil(DMDAStencilType); /*proto*/
static CYTHON_INLINE DMDAInterpolationType __pyx_f_8petsc4py_5PETSc_dainterpolationtype(PyObject *); /*proto*/
static CYTHON_INLINE DMDAElementType __pyx_f_8petsc4py_5PETSc_daelementtype(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_DMDAGetDim(DM, PetscInt *); /*proto*/
static CYTHON_INLINE PetscInt __pyx_f_8petsc4py_5PETSc_asDims(PyObject *, PetscInt *, PetscInt *, PetscInt *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toDims(PetscInt, PetscInt, PetscInt, PetscInt); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_asOwnershipRanges(PyObject *, PetscInt, PetscInt *, PetscInt *, PetscInt *, PetscInt **, PetscInt **, PetscInt **); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toOwnershipRanges(PetscInt, PetscInt, PetscInt, PetscInt, const PetscInt *, const PetscInt *, const PetscInt *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_adjust_index_exp(PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_adjust_index(PyObject *, PyObject *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateGlobalVector(DM, Vec *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateLocalVector(DM, Vec *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_GlobalToLocalBegin(DM, Vec, InsertMode, Vec); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_GlobalToLocalEnd(DM, Vec, InsertMode, Vec); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_LocalToGlobalBegin(DM, Vec, InsertMode, Vec); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_LocalToGlobalEnd(DM, Vec, InsertMode, Vec); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_LocalToLocalBegin(DM, Vec, InsertMode, Vec); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_LocalToLocalEnd(DM, Vec, InsertMode, Vec); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateMatrix(DM, Mat *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_Coarsen(DM, MPI_Comm, DM *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_Refine(DM, MPI_Comm, DM *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateInterpolation(DM, DM, Mat *, Vec *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateInjection(DM, DM, Mat *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateFieldDecomposition(DM, PetscInt *, char ***, IS **, DM **); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateSubDM(DM, PetscInt, PetscInt *, IS *, DM *); /*proto*/
static PetscBool __pyx_f_8petsc4py_5PETSc_get_citation(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_set_citation(PyObject *, int); /*proto*/
static struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_f_8petsc4py_5PETSc_get_LogStage(PyObject *); /*proto*/
static struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_f_8petsc4py_5PETSc_reg_LogStage(PyObject *, PetscLogStage); /*proto*/
static struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_f_8petsc4py_5PETSc_get_LogClass(PyObject *); /*proto*/
static struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_f_8petsc4py_5PETSc_reg_LogClass(PyObject *, PetscClassId); /*proto*/
static struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_f_8petsc4py_5PETSc_get_LogEvent(PyObject *); /*proto*/
static struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_f_8petsc4py_5PETSc_reg_LogEvent(PyObject *, PetscLogEvent); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_tp_traverse(PyObject *, visitproc, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_tp_clear(PyObject *); /*proto*/
static CYTHON_INLINE void __pyx_f_8petsc4py_5PETSc_TypeEnableGC(PyTypeObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_setref(void *, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_PyPetscError_Set(int); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscComm_New(MPI_Comm); /*proto*/
static MPI_Comm __pyx_f_8petsc4py_5PETSc_PyPetscComm_Get(PyObject *); /*proto*/
static MPI_Comm *__pyx_f_8petsc4py_5PETSc_PyPetscComm_GetPtr(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscObject_New(PetscObject); /*proto*/
static PetscObject __pyx_f_8petsc4py_5PETSc_PyPetscObject_Get(PyObject *); /*proto*/
static PetscObject *__pyx_f_8petsc4py_5PETSc_PyPetscObject_GetPtr(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscViewer_New(PetscViewer); /*proto*/
static PetscViewer __pyx_f_8petsc4py_5PETSc_PyPetscViewer_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscRandom_New(PetscRandom); /*proto*/
static PetscRandom __pyx_f_8petsc4py_5PETSc_PyPetscRandom_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscIS_New(IS); /*proto*/
static IS __pyx_f_8petsc4py_5PETSc_PyPetscIS_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscLGMap_New(ISLocalToGlobalMapping); /*proto*/
static ISLocalToGlobalMapping __pyx_f_8petsc4py_5PETSc_PyPetscLGMap_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscSF_New(PetscSF); /*proto*/
static PetscSF __pyx_f_8petsc4py_5PETSc_PyPetscSF_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscVec_New(Vec); /*proto*/
static Vec __pyx_f_8petsc4py_5PETSc_PyPetscVec_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscScatter_New(VecScatter); /*proto*/
static VecScatter __pyx_f_8petsc4py_5PETSc_PyPetscScatter_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscSection_New(PetscSection); /*proto*/
static PetscSection __pyx_f_8petsc4py_5PETSc_PyPetscSection_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscMat_New(Mat); /*proto*/
static Mat __pyx_f_8petsc4py_5PETSc_PyPetscMat_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscPC_New(PC); /*proto*/
static PC __pyx_f_8petsc4py_5PETSc_PyPetscPC_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscKSP_New(KSP); /*proto*/
static KSP __pyx_f_8petsc4py_5PETSc_PyPetscKSP_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscSNES_New(SNES); /*proto*/
static SNES __pyx_f_8petsc4py_5PETSc_PyPetscSNES_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscTS_New(TS); /*proto*/
static TS __pyx_f_8petsc4py_5PETSc_PyPetscTS_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscTAO_New(Tao); /*proto*/
static Tao __pyx_f_8petsc4py_5PETSc_PyPetscTAO_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscAO_New(AO); /*proto*/
static AO __pyx_f_8petsc4py_5PETSc_PyPetscAO_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscDM_New(DM); /*proto*/
static DM __pyx_f_8petsc4py_5PETSc_PyPetscDM_Get(PyObject *); /*proto*/
static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscPartitioner_New(PetscPartitioner); /*proto*/
static PetscPartitioner __pyx_f_8petsc4py_5PETSc_PyPetscPartitioner_Get(PyObject *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_traceback(MPI_Comm, int, const char *, const char *, int, PetscErrorType, const char *, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_PetscPythonErrorHandler(MPI_Comm, int, const char *, const char *, int, PetscErrorType, const char *, void *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_getinitargs(PyObject *, int *, char ***); /*proto*/
static void __pyx_f_8petsc4py_5PETSc_delinitargs(int *, char ***); /*proto*/
static void __pyx_f_8petsc4py_5PETSc_finalize(void); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_initialize(PyObject *, PyObject *); /*proto*/
static int __pyx_f_8petsc4py_5PETSc_register(void); /*proto*/
#define __Pyx_MODULE_NAME "petsc4py.PETSc"
int __pyx_module_is_main_petsc4py__PETSc = 0;

/* Implementation of 'petsc4py.PETSc' */
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_SystemError;
static PyObject *__pyx_builtin_Ellipsis;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_MemoryError;
static const char __pyx_k_A[] = "A";
static const char __pyx_k_B[] = "B";
static const char __pyx_k_C[] = "C";
static const char __pyx_k_H[] = "H";
static const char __pyx_k_I[] = "I";
static const char __pyx_k_J[] = "J";
static const char __pyx_k_L[] = "L";
static const char __pyx_k_O[] = "O";
static const char __pyx_k_P[] = "P";
static const char __pyx_k_R[] = "R";
static const char __pyx_k_S[] = "S";
static const char __pyx_k_U[] = "U";
static const char __pyx_k_V[] = "V";
static const char __pyx_k_W[] = "W";
static const char __pyx_k_X[] = "X";
static const char __pyx_k_a[] = "a";
static const char __pyx_k_b[] = "b";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_f[] = "f";
static const char __pyx_k_g[] = "g";
static const char __pyx_k_l[] = "l";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_s[] = "%s";
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_w[] = "w";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_y[] = "y";
static const char __pyx_k_AU[] = "AU";
static const char __pyx_k_BE[] = "BE";
static const char __pyx_k_CG[] = "CG";
static const char __pyx_k_CN[] = "CN";
static const char __pyx_k_CP[] = "CP";
static const char __pyx_k_CR[] = "CR";
static const char __pyx_k_DA[] = "DA";
static const char __pyx_k_FE[] = "FE";
static const char __pyx_k_GL[] = "GL";
static const char __pyx_k_IS[] = "IS";
static const char __pyx_k_LU[] = "LU";
static const char __pyx_k_MG[] = "MG";
static const char __pyx_k_ML[] = "ML";
static const char __pyx_k_MS[] = "MS";
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_NM[] = "NM";
static const char __pyx_k_NN[] = "NN";
static const char __pyx_k_NO[] = "NO";
static const char __pyx_k_NZ[] = "NZ";
static const char __pyx_k_P1[] = "P1";
static const char __pyx_k_PD[] = "PD";
static const char __pyx_k_Q0[] = "Q0";
static const char __pyx_k_Q1[] = "Q1";
static const char __pyx_k_QN[] = "QN";
static const char __pyx_k_RK[] = "RK";
static const char __pyx_k_TH[] = "TH";
static const char __pyx_k_UA[] = "UA";
static const char __pyx_k_VU[] = "VU";
static const char __pyx_k__2[] = " ";
static const char __pyx_k__5[] = "-";
static const char __pyx_k_au[] = "au";
static const char __pyx_k_bs[] = "bs";
static const char __pyx_k_da[] = "da";
static const char __pyx_k_dm[] = "dm";
static const char __pyx_k_dt[] = "dt";
static const char __pyx_k_gv[] = "gv";
static const char __pyx_k_lv[] = "lv";
static const char __pyx_k_na[] = "na";
static const char __pyx_k_p1[] = "p1";
static const char __pyx_k_pc[] = "pc";
static const char __pyx_k_pd[] = "pd";
static const char __pyx_k_q0[] = "q0";
static const char __pyx_k_q1[] = "q1";
static const char __pyx_k_rw[] = "rw";
static const char __pyx_k_sf[] = "sf";
static const char __pyx_k_sx[] = "sx";
static const char __pyx_k_ua[] = "ua";
static const char __pyx_k_vg[] = "vg";
static const char __pyx_k_vl[] = "vl";
static const char __pyx_k_vn[] = "vn";
static const char __pyx_k_xl[] = "xl";
static const char __pyx_k_xu[] = "xu";
static const char __pyx_k_A11[] = "A11";
static const char __pyx_k_ADD[] = "ADD";
static const char __pyx_k_AGG[] = "AGG";
static const char __pyx_k_AIJ[] = "AIJ";
static const char __pyx_k_AMD[] = "AMD";
static const char __pyx_k_ASM[] = "ASM";
static const char __pyx_k_BDF[] = "BDF";
static const char __pyx_k_BOX[] = "BOX";
static const char __pyx_k_CGS[] = "CGS";
static const char __pyx_k_DOF[] = "DOF";
static const char __pyx_k_Dup[] = "Dup";
static const char __pyx_k_FAS[] = "FAS";
static const char __pyx_k_FCG[] = "FCG";
static const char __pyx_k_FFT[] = "FFT";
static const char __pyx_k_FRB[] = "FRB";
static const char __pyx_k_GCR[] = "GCR";
static const char __pyx_k_GEO[] = "GEO";
static const char __pyx_k_ICC[] = "ICC";
static const char __pyx_k_ILU[] = "ILU";
static const char __pyx_k_INF[] = "INF";
static const char __pyx_k_IPM[] = "IPM";
static const char __pyx_k_KSP[] = "KSP";
static const char __pyx_k_LCD[] = "LCD";
static const char __pyx_k_LCL[] = "LCL";
static const char __pyx_k_LRC[] = "LRC";
static const char __pyx_k_LSC[] = "LSC";
static const char __pyx_k_MAT[] = "MAT";
static const char __pyx_k_MAX[] = "MAX";
static const char __pyx_k_MPI[] = "MPI";
static const char __pyx_k_N12[] = "N12";
static const char __pyx_k_NCG[] = "NCG";
static const char __pyx_k_NGS[] = "NGS";
static const char __pyx_k_NLS[] = "NLS";
static const char __pyx_k_NTL[] = "NTL";
static const char __pyx_k_NTR[] = "NTR";
static const char __pyx_k_OWD[] = "OWD";
static const char __pyx_k_QCG[] = "QCG";
static const char __pyx_k_QMD[] = "QMD";
static const char __pyx_k_RCM[] = "RCM";
static const char __pyx_k_SEQ[] = "SEQ";
static const char __pyx_k_SOR[] = "SOR";
static const char __pyx_k_SPD[] = "SPD";
static const char __pyx_k_SSP[] = "SSP";
static const char __pyx_k_SVD[] = "SVD";
static const char __pyx_k_TFS[] = "TFS";
static const char __pyx_k_VTK[] = "VTK";
static const char __pyx_k_WBM[] = "WBM";
static const char __pyx_k__10[] = "";
static const char __pyx_k__32[] = "\n";
static const char __pyx_k_a_2[] = "a+";
static const char __pyx_k_all[] = "all";
static const char __pyx_k_app[] = "app";
static const char __pyx_k_box[] = "box";
static const char __pyx_k_c_d[] = "=%c%d";
static const char __pyx_k_col[] = "col";
static const char __pyx_k_csr[] = "csr";
static const char __pyx_k_d_s[] = "[%*d] %s";
static const char __pyx_k_dim[] = "dim";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_dof[] = "dof";
static const char __pyx_k_end[] = "end";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_idx[] = "idx";
static const char __pyx_k_its[] = "its";
static const char __pyx_k_ksp[] = "ksp";
static const char __pyx_k_mat[] = "mat";
static const char __pyx_k_nnz[] = "nnz";
static const char __pyx_k_nsd[] = "nsd";
static const char __pyx_k_nsp[] = "nsp";
static const char __pyx_k_obj[] = "obj";
static const char __pyx_k_out[] = "out";
static const char __pyx_k_ozz[] = "ozz";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_pre[] = "pre";
static const char __pyx_k_r_2[] = "r+";
static const char __pyx_k_rhs[] = "rhs";
static const char __pyx_k_row[] = "row";
static const char __pyx_k_s_s[] = "-%s%s";
static const char __pyx_k_sec[] = "sec";
static const char __pyx_k_sep[] = "sep";
static const char __pyx_k_str[] = "__str__";
static const char __pyx_k_tab[] = "tab";
static const char __pyx_k_tol[] = "tol";
static const char __pyx_k_val[] = "val";
static const char __pyx_k_vec[] = "vec";
static const char __pyx_k_vlg[] = "vlg";
static const char __pyx_k_w_2[] = "w+";
static const char __pyx_k_zoz[] = "zoz";
static const char __pyx_k_zzo[] = "zzo";
static const char __pyx_k_BAIJ[] = "BAIJ";
static const char __pyx_k_BCGS[] = "BCGS";
static const char __pyx_k_BDDC[] = "BDDC";
static const char __pyx_k_BFBT[] = "BFBT";
static const char __pyx_k_BICG[] = "BICG";
static const char __pyx_k_BMRM[] = "BMRM";
static const char __pyx_k_CGLS[] = "CGLS";
static const char __pyx_k_CGNE[] = "CGNE";
static const char __pyx_k_CUSP[] = "CUSP";
static const char __pyx_k_DAAD[] = "DAAD";
static const char __pyx_k_DIAG[] = "DIAG";
static const char __pyx_k_DRAW[] = "DRAW";
static const char __pyx_k_DROP[] = "DROP";
static const char __pyx_k_FFTW[] = "FFTW";
static const char __pyx_k_FULL[] = "FULL";
static const char __pyx_k_Free[] = "Free";
static const char __pyx_k_GAMG[] = "GAMG";
static const char __pyx_k_GASM[] = "GASM";
static const char __pyx_k_GLTR[] = "GLTR";
static const char __pyx_k_GPCG[] = "GPCG";
static const char __pyx_k_HALF[] = "HALF";
static const char __pyx_k_HDF5[] = "HDF5";
static const char __pyx_k_LEFT[] = "LEFT";
static const char __pyx_k_LMVM[] = "LMVM";
static const char __pyx_k_LSQR[] = "LSQR";
static const char __pyx_k_Left[] = "Left";
static const char __pyx_k_MAIJ[] = "MAIJ";
static const char __pyx_k_MASK[] = "MASK";
static const char __pyx_k_MFFD[] = "MFFD";
static const char __pyx_k_MOAB[] = "MOAB";
static const char __pyx_k_Mode[] = "Mode";
static const char __pyx_k_NASH[] = "NASH";
static const char __pyx_k_NASM[] = "NASM";
static const char __pyx_k_NEST[] = "NEST";
static const char __pyx_k_NONE[] = "NONE";
static const char __pyx_k_PFMG[] = "PFMG";
static const char __pyx_k_PLEX[] = "PLEX";
static const char __pyx_k_RAND[] = "RAND";
static const char __pyx_k_READ[] = "READ";
static const char __pyx_k_ROSW[] = "ROSW";
static const char __pyx_k_SAME[] = "SAME";
static const char __pyx_k_SAWS[] = "SAWS";
static const char __pyx_k_SELF[] = "SELF";
static const char __pyx_k_SPAI[] = "SPAI";
static const char __pyx_k_STAR[] = "STAR";
static const char __pyx_k_STCG[] = "STCG";
static const char __pyx_k_Side[] = "Side";
static const char __pyx_k_Size[] = "Size";
static const char __pyx_k_TEST[] = "TEST";
static const char __pyx_k_TRON[] = "TRON";
static const char __pyx_k_Type[] = "Type";
static const char __pyx_k_USER[] = "USER";
static const char __pyx_k_addv[] = "addv";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_atol[] = "atol";
static const char __pyx_k_attr[] = "attr";
static const char __pyx_k_axpy[] = "axpy";
static const char __pyx_k_beta[] = "beta";
static const char __pyx_k_cell[] = "cell";
static const char __pyx_k_cgid[] = "cgid";
static const char __pyx_k_cmap[] = "cmap";
static const char __pyx_k_cols[] = "cols";
static const char __pyx_k_comm[] = "comm";
static const char __pyx_k_cone[] = "cone";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_date[] = "date";
static const char __pyx_k_diag[] = "diag";
static const char __pyx_k_dims[] = "dims";
static const char __pyx_k_drop[] = "drop";
static const char __pyx_k_exit[] = "__exit__";
static const char __pyx_k_fill[] = "fill";
static const char __pyx_k_flag[] = "flag";
static const char __pyx_k_gtol[] = "gtol";
static const char __pyx_k_gvec[] = "gvec";
static const char __pyx_k_idxm[] = "idxm";
static const char __pyx_k_ierr[] = "ierr";
static const char __pyx_k_imag[] = "imag";
static const char __pyx_k_imex[] = "imex";
static const char __pyx_k_info[] = "info";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_iset[] = "iset";
static const char __pyx_k_ival[] = "ival";
static const char __pyx_k_join[] = "join";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_kind[] = "kind";
static const char __pyx_k_left[] = "left";
static const char __pyx_k_lits[] = "lits";
static const char __pyx_k_locs[] = "locs";
static const char __pyx_k_ltog[] = "ltog";
static const char __pyx_k_ltol[] = "ltol";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mats[] = "mats";
static const char __pyx_k_memo[] = "memo";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_mult[] = "mult";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_nmax[] = "nmax";
static const char __pyx_k_nmin[] = "nmin";
static const char __pyx_k_none[] = "none";
static const char __pyx_k_norm[] = "norm";
static const char __pyx_k_opts[] = "opts";
static const char __pyx_k_pEnd[] = "pEnd";
static const char __pyx_k_perm[] = "perm";
static const char __pyx_k_push[] = "push";
static const char __pyx_k_rank[] = "rank";
static const char __pyx_k_real[] = "real";
static const char __pyx_k_repr[] = "__repr__";
static const char __pyx_k_rmap[] = "rmap";
static const char __pyx_k_rows[] = "rows";
static const char __pyx_k_rtol[] = "rtol";
static const char __pyx_k_seed[] = "seed";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_side[] = "side";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_snes[] = "snes";
static const char __pyx_k_star[] = "star";
static const char __pyx_k_step[] = "step";
static const char __pyx_k_stol[] = "stol";
static const char __pyx_k_stop[] = "stop";
static const char __pyx_k_supp[] = "supp";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_vecs[] = "vecs";
static const char __pyx_k_view[] = "view";
static const char __pyx_k_xdot[] = "xdot";
static const char __pyx_k_xmax[] = "xmax";
static const char __pyx_k_xmin[] = "xmin";
static const char __pyx_k_ymax[] = "ymax";
static const char __pyx_k_ymin[] = "ymin";
static const char __pyx_k_zmax[] = "zmax";
static const char __pyx_k_zmin[] = "zmin";
static const char __pyx_k_ALPHA[] = "ALPHA";
static const char __pyx_k_ASCII[] = "ASCII";
static const char __pyx_k_ASFLS[] = "ASFLS";
static const char __pyx_k_ASILS[] = "ASILS";
static const char __pyx_k_ASPIN[] = "ASPIN";
static const char __pyx_k_BASIC[] = "BASIC";
static const char __pyx_k_BCGSL[] = "BCGSL";
static const char __pyx_k_BLMVM[] = "BLMVM";
static const char __pyx_k_BLOCK[] = "BLOCK";
static const char __pyx_k_BQPIP[] = "BQPIP";
static const char __pyx_k_BSTRM[] = "BSTRM";
static const char __pyx_k_CHACO[] = "CHACO";
static const char __pyx_k_Class[] = "Class";
static const char __pyx_k_Clone[] = "Clone";
static const char __pyx_k_DENSE[] = "DENSE";
static const char __pyx_k_EIMEX[] = "EIMEX";
static const char __pyx_k_EULER[] = "EULER";
static const char __pyx_k_Error[] = "Error";
static const char __pyx_k_Event[] = "Event";
static const char __pyx_k_FBCGS[] = "FBCGS";
static const char __pyx_k_FINAL[] = "FINAL";
static const char __pyx_k_FLUSH[] = "FLUSH";
static const char __pyx_k_GMRES[] = "GMRES";
static const char __pyx_k_HYPRE[] = "HYPRE";
static const char __pyx_k_IBCGS[] = "IBCGS";
static const char __pyx_k_LOCAL[] = "LOCAL";
static const char __pyx_k_LOWER[] = "LOWER";
static const char __pyx_k_MIMEX[] = "MIMEX";
static const char __pyx_k_OWLQN[] = "OWLQN";
static const char __pyx_k_PARMS[] = "PARMS";
static const char __pyx_k_PATCH[] = "PATCH";
static const char __pyx_k_Print[] = "Print";
static const char __pyx_k_RIGHT[] = "RIGHT";
static const char __pyx_k_Right[] = "Right";
static const char __pyx_k_SBAIJ[] = "SBAIJ";
static const char __pyx_k_SCHUR[] = "SCHUR";
static const char __pyx_k_SELFP[] = "SELFP";
static const char __pyx_k_SHELL[] = "SHELL";
static const char __pyx_k_SPRNG[] = "SPRNG";
static const char __pyx_k_SSFLS[] = "SSFLS";
static const char __pyx_k_SSILS[] = "SSILS";
static const char __pyx_k_Stage[] = "Stage";
static const char __pyx_k_TCQMR[] = "TCQMR";
static const char __pyx_k_TFQMR[] = "TFQMR";
static const char __pyx_k_THETA[] = "THETA";
static const char __pyx_k_THIRD[] = "THIRD";
static const char __pyx_k_TSIRM[] = "TSIRM";
static const char __pyx_k_TWIST[] = "TWIST";
static const char __pyx_k_UPPER[] = "UPPER";
static const char __pyx_k_WRITE[] = "WRITE";
static const char __pyx_k_abort[] = "abort";
static const char __pyx_k_alpha[] = "alpha";
static const char __pyx_k_apply[] = "apply";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_begin[] = "begin";
static const char __pyx_k_bsize[] = "bsize";
static const char __pyx_k_catol[] = "catol";
static const char __pyx_k_cells[] = "cells";
static const char __pyx_k_comms[] = "comms";
static const char __pyx_k_count[] = "count";
static const char __pyx_k_crank[] = "crank";
static const char __pyx_k_crtol[] = "crtol";
static const char __pyx_k_csize[] = "csize";
static const char __pyx_k_ctype[] = "ctype";
static const char __pyx_k_devel[] = "devel";
static const char __pyx_k_dtcol[] = "dtcol";
static const char __pyx_k_edges[] = "edges";
static const char __pyx_k_emacs[] = "emacs";
static const char __pyx_k_enter[] = "__enter__";
static const char __pyx_k_entry[] = "entry";
static const char __pyx_k_exoid[] = "exoid";
static const char __pyx_k_faces[] = "faces";
static const char __pyx_k_field[] = "field";
static const char __pyx_k_first[] = "first";
static const char __pyx_k_flops[] = "flops";
static const char __pyx_k_flush[] = "flush";
static const char __pyx_k_fnorm[] = "fnorm";
static const char __pyx_k_force[] = "force";
static const char __pyx_k_gamma[] = "gamma";
static const char __pyx_k_gatol[] = "gatol";
static const char __pyx_k_getDM[] = "getDM";
static const char __pyx_k_getPC[] = "getPC";
static const char __pyx_k_group[] = "group";
static const char __pyx_k_grtol[] = "grtol";
static const char __pyx_k_gttol[] = "gttol";
static const char __pyx_k_icntl[] = "icntl";
static const char __pyx_k_imode[] = "imode";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_is_to[] = "is_to";
static const char __pyx_k_iscol[] = "iscol";
static const char __pyx_k_isets[] = "isets";
static const char __pyx_k_isrow[] = "isrow";
static const char __pyx_k_kargs[] = "kargs";
static const char __pyx_k_klass[] = "klass";
static const char __pyx_k_label[] = "label";
static const char __pyx_k_level[] = "level";
static const char __pyx_k_lgmap[] = "lgmap";
static const char __pyx_k_local[] = "local";
static const char __pyx_k_lower[] = "lower";
static const char __pyx_k_lvecs[] = "lvecs";
static const char __pyx_k_major[] = "major";
static const char __pyx_k_minor[] = "minor";
static const char __pyx_k_model[] = "model";
static const char __pyx_k_omega[] = "omega";
static const char __pyx_k_order[] = "order";
static const char __pyx_k_otype[] = "otype";
static const char __pyx_k_patch[] = "patch";
static const char __pyx_k_petsc[] = "petsc";
static const char __pyx_k_point[] = "point";
static const char __pyx_k_ptype[] = "ptype";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_ready[] = "ready";
static const char __pyx_k_reset[] = "reset";
static const char __pyx_k_reuse[] = "reuse";
static const char __pyx_k_right[] = "right";
static const char __pyx_k_rnorm[] = "rnorm";
static const char __pyx_k_scale[] = "scale";
static const char __pyx_k_setDM[] = "setDM";
static const char __pyx_k_setup[] = "setup";
static const char __pyx_k_shape[] = "shape";
static const char __pyx_k_shift[] = "shift";
static const char __pyx_k_sizes[] = "sizes";
static const char __pyx_k_sleep[] = "sleep";
static const char __pyx_k_solve[] = "solve";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_stage[] = "stage";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_state[] = "state";
static const char __pyx_k_strip[] = "strip";
static const char __pyx_k_theta[] = "theta";
static const char __pyx_k_title[] = "title";
static const char __pyx_k_toAll[] = "toAll";
static const char __pyx_k_twist[] = "twist";
static const char __pyx_k_upper[] = "upper";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_width[] = "width";
static const char __pyx_k_xnorm[] = "xnorm";
static const char __pyx_k_ynorm[] = "ynorm";
static const char __pyx_k_ADD_BC[] = "ADD_BC";
static const char __pyx_k_AIJCRL[] = "AIJCRL";
static const char __pyx_k_ALPHA2[] = "ALPHA2";
static const char __pyx_k_ALWAYS[] = "ALWAYS";
static const char __pyx_k_AOType[] = "AOType";
static const char __pyx_k_APPEND[] = "APPEND";
static const char __pyx_k_BEULER[] = "BEULER";
static const char __pyx_k_BINARY[] = "BINARY";
static const char __pyx_k_DECIDE[] = "DECIDE";
static const char __pyx_k_DGMRES[] = "DGMRES";
static const char __pyx_k_DMType[] = "DMType";
static const char __pyx_k_EXOTIC[] = "EXOTIC";
static const char __pyx_k_FBCGSR[] = "FBCGSR";
static const char __pyx_k_FGMRES[] = "FGMRES";
static const char __pyx_k_Format[] = "Format";
static const char __pyx_k_INSERT[] = "INSERT";
static const char __pyx_k_ISType[] = "ISType";
static const char __pyx_k_JACOBI[] = "JACOBI";
static const char __pyx_k_LGMRES[] = "LGMRES";
static const char __pyx_k_LINEAR[] = "LINEAR";
static const char __pyx_k_MATLAB[] = "MATLAB";
static const char __pyx_k_MGType[] = "MGType";
static const char __pyx_k_MINRES[] = "MINRES";
static const char __pyx_k_MIRROR[] = "MIRROR";
static const char __pyx_k_MPIADJ[] = "MPIADJ";
static const char __pyx_k_MPIAIJ[] = "MPIAIJ";
static const char __pyx_k_NATIVE[] = "NATIVE";
static const char __pyx_k_NETCDF[] = "NETCDF";
static const char __pyx_k_NGMRES[] = "NGMRES";
static const char __pyx_k_NORMAL[] = "NORMAL";
static const char __pyx_k_NORM_1[] = "NORM_1";
static const char __pyx_k_NORM_2[] = "NORM_2";
static const char __pyx_k_Option[] = "Option";
static const char __pyx_k_PCSide[] = "PCSide";
static const char __pyx_k_PCType[] = "PCType";
static const char __pyx_k_PGMRES[] = "PGMRES";
static const char __pyx_k_PIPECG[] = "PIPECG";
static const char __pyx_k_PIPECR[] = "PIPECR";
static const char __pyx_k_PSEUDO[] = "PSEUDO";
static const char __pyx_k_PYTHON[] = "PYTHON";
static const char __pyx_k_RAND48[] = "RAND48";
static const char __pyx_k_Reason[] = "Reason";
static const char __pyx_k_SACUSP[] = "SACUSP";
static const char __pyx_k_SBSTRM[] = "SBSTRM";
static const char __pyx_k_SEQAIJ[] = "SEQAIJ";
static const char __pyx_k_SFType[] = "SFType";
static const char __pyx_k_SHARED[] = "SHARED";
static const char __pyx_k_SLICED[] = "SLICED";
static const char __pyx_k_SOCKET[] = "SOCKET";
static const char __pyx_k_STDERR[] = "STDERR";
static const char __pyx_k_STDOUT[] = "STDOUT";
static const char __pyx_k_STRIDE[] = "STRIDE";
static const char __pyx_k_STRING[] = "STRING";
static const char __pyx_k_SUBSET[] = "SUBSET";
static const char __pyx_k_SYMMLQ[] = "SYMMLQ";
static const char __pyx_k_TSType[] = "TSType";
static const char __pyx_k_UPDATE[] = "UPDATE";
static const char __pyx_k_WINDOW[] = "WINDOW";
static const char __pyx_k_alpha2[] = "alpha2";
static const char __pyx_k_alphas[] = "alphas";
static const char __pyx_k_amount[] = "amount";
static const char __pyx_k_appctx[] = "appctx";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_author[] = "author";
static const char __pyx_k_column[] = "column";
static const char __pyx_k_coords[] = "coords";
static const char __pyx_k_decode[] = "decode";
static const char __pyx_k_decomp[] = "decomp";
static const char __pyx_k_design[] = "design";
static const char __pyx_k_divtol[] = "divtol";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_eqtype[] = "eqtype";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_getDim[] = "getDim";
static const char __pyx_k_getDof[] = "getDof";
static const char __pyx_k_getKSP[] = "getKSP";
static const char __pyx_k_getNPC[] = "getNPC";
static const char __pyx_k_getRhs[] = "getRhs";
static const char __pyx_k_ghosts[] = "ghosts";
static const char __pyx_k_handle[] = "handle";
static const char __pyx_k_ignore[] = "ignore";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_insert[] = "insert";
static const char __pyx_k_invert[] = "invert";
static const char __pyx_k_iscols[] = "iscols";
static const char __pyx_k_isperm[] = "isperm";
static const char __pyx_k_isrows[] = "isrows";
static const char __pyx_k_length[] = "length";
static const char __pyx_k_levels[] = "levels";
static const char __pyx_k_max_it[] = "max_it";
static const char __pyx_k_memory[] = "memory";
static const char __pyx_k_mgtype[] = "mgtype";
static const char __pyx_k_mirror[] = "mirror";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_mpi4py[] = "mpi4py";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_ncycle[] = "ncycle";
static const char __pyx_k_newsec[] = "newsec";
static const char __pyx_k_newvec[] = "newvec";
static const char __pyx_k_nlocal[] = "nlocal";
static const char __pyx_k_nroots[] = "nroots";
static const char __pyx_k_numDof[] = "numDof";
static const char __pyx_k_nzdiag[] = "nzdiag";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_offset[] = "offset";
static const char __pyx_k_option[] = "option";
static const char __pyx_k_output[] = "output";
static const char __pyx_k_pStart[] = "pStart";
static const char __pyx_k_parent[] = "parent";
static const char __pyx_k_points[] = "points";
static const char __pyx_k_prefix[] = "prefix";
static const char __pyx_k_python[] = "python";
static const char __pyx_k_radius[] = "radius";
static const char __pyx_k_random[] = "random";
static const char __pyx_k_reason[] = "reason";
static const char __pyx_k_refine[] = "refine";
static const char __pyx_k_remote[] = "remote";
static const char __pyx_k_remove[] = "remove";
static const char __pyx_k_result[] = "result";
static const char __pyx_k_rowmap[] = "rowmap";
static const char __pyx_k_rscale[] = "rscale";
static const char __pyx_k_rtol_0[] = "rtol_0";
static const char __pyx_k_setKSP[] = "setKSP";
static const char __pyx_k_setNPC[] = "setNPC";
static const char __pyx_k_solver[] = "solver";
static const char __pyx_k_starts[] = "starts";
static const char __pyx_k_submat[] = "submat";
static const char __pyx_k_subvec[] = "subvec";
static const char __pyx_k_svalue[] = "svalue";
static const char __pyx_k_tbline[] = "tbline";
static const char __pyx_k_tblist[] = "tblist";
static const char __pyx_k_toZero[] = "toZero";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_vec_to[] = "vec_to";
static const char __pyx_k_viewer[] = "viewer";
static const char __pyx_k_ADD_ALL[] = "ADD_ALL";
static const char __pyx_k_AIJCUSP[] = "AIJCUSP";
static const char __pyx_k_AIJPERM[] = "AIJPERM";
static const char __pyx_k_ARKIMEX[] = "ARKIMEX";
static const char __pyx_k_ASMType[] = "ASMType";
static const char __pyx_k_BJACOBI[] = "BJACOBI";
static const char __pyx_k_Barrier[] = "Barrier";
static const char __pyx_k_DEFAULT[] = "DEFAULT";
static const char __pyx_k_DRAW_LG[] = "DRAW_LG";
static const char __pyx_k_FORWARD[] = "FORWARD";
static const char __pyx_k_GENERAL[] = "GENERAL";
static const char __pyx_k_GHOSTED[] = "GHOSTED";
static const char __pyx_k_GROPPCG[] = "GROPPCG";
static const char __pyx_k_IntType[] = "IntType";
static const char __pyx_k_KASKADE[] = "KASKADE";
static const char __pyx_k_KSPONLY[] = "KSPONLY";
static const char __pyx_k_KSPType[] = "KSPType";
static const char __pyx_k_MAPPING[] = "MAPPING";
static const char __pyx_k_MPIBAIJ[] = "MPIBAIJ";
static const char __pyx_k_MPICUSP[] = "MPICUSP";
static const char __pyx_k_MPIMAIJ[] = "MPIMAIJ";
static const char __pyx_k_MapType[] = "MapType";
static const char __pyx_k_MatType[] = "MatType";
static const char __pyx_k_NATURAL[] = "NATURAL";
static const char __pyx_k_NETWORK[] = "NETWORK";
static const char __pyx_k_NONZERO[] = "NONZERO";
static const char __pyx_k_PIPEFCG[] = "PIPEFCG";
static const char __pyx_k_PIPEGCR[] = "PIPEGCR";
static const char __pyx_k_PREONLY[] = "PREONLY";
static const char __pyx_k_QUARTER[] = "QUARTER";
static const char __pyx_k_REVERSE[] = "REVERSE";
static const char __pyx_k_SAME_NZ[] = "SAME_NZ";
static const char __pyx_k_SCATTER[] = "SCATTER";
static const char __pyx_k_SEQBAIJ[] = "SEQBAIJ";
static const char __pyx_k_SEQCUSP[] = "SEQCUSP";
static const char __pyx_k_SEQMAIJ[] = "SEQMAIJ";
static const char __pyx_k_SORType[] = "SORType";
static const char __pyx_k_SPECIAL[] = "SPECIAL";
static const char __pyx_k_SYSPFMG[] = "SYSPFMG";
static const char __pyx_k_Stencil[] = "Stencil";
static const char __pyx_k_TAOType[] = "TAOType";
static const char __pyx_k_VTK_VTR[] = "VTK_VTR";
static const char __pyx_k_VTK_VTS[] = "VTK_VTS";
static const char __pyx_k_VTK_VTU[] = "VTK_VTU";
static const char __pyx_k_VecType[] = "VecType";
static const char __pyx_k_alpha_f[] = "alpha_f";
static const char __pyx_k_alpha_m[] = "alpha_m";
static const char __pyx_k_array_w[] = "array_w";
static const char __pyx_k_asmtype[] = "asmtype";
static const char __pyx_k_barrier[] = "barrier";
static const char __pyx_k_bcComps[] = "bcComps";
static const char __pyx_k_bcField[] = "bcField";
static const char __pyx_k_coarsen[] = "coarsen";
static const char __pyx_k_conePos[] = "conePos";
static const char __pyx_k_context[] = "context";
static const char __pyx_k_default[] = "default";
static const char __pyx_k_destroy[] = "destroy";
static const char __pyx_k_display[] = "display";
static const char __pyx_k_dm_type[] = "dm_type";
static const char __pyx_k_dtcount[] = "dtcount";
static const char __pyx_k_forward[] = "forward";
static const char __pyx_k_getComm[] = "getComm";
static const char __pyx_k_getInfo[] = "getInfo";
static const char __pyx_k_getName[] = "getName";
static const char __pyx_k_getRank[] = "getRank";
static const char __pyx_k_getSNES[] = "getSNES";
static const char __pyx_k_getSeed[] = "getSeed";
static const char __pyx_k_getSize[] = "getSize";
static const char __pyx_k_getTime[] = "getTime";
static const char __pyx_k_getType[] = "getType";
static const char __pyx_k_getVecs[] = "getVecs";
static const char __pyx_k_ghosted[] = "ghosted";
static const char __pyx_k_hasName[] = "hasName";
static const char __pyx_k_hessian[] = "hessian";
static const char __pyx_k_indices[] = "indices";
static const char __pyx_k_is_from[] = "is_from";
static const char __pyx_k_is_type[] = "is_type";
static const char __pyx_k_mallocs[] = "mallocs";
static const char __pyx_k_matMult[] = "matMult";
static const char __pyx_k_monitor[] = "monitor";
static const char __pyx_k_nleaves[] = "nleaves";
static const char __pyx_k_nlevels[] = "nlevels";
static const char __pyx_k_nonzero[] = "nonzero";
static const char __pyx_k_numComp[] = "numComp";
static const char __pyx_k_nz_used[] = "nz_used";
static const char __pyx_k_objgrad[] = "objgrad";
static const char __pyx_k_options[] = "options";
static const char __pyx_k_overlap[] = "overlap";
static const char __pyx_k_pc_type[] = "pc_type";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_prestep[] = "prestep";
static const char __pyx_k_py_type[] = "py_type";
static const char __pyx_k_release[] = "release";
static const char __pyx_k_replace[] = "replace";
static const char __pyx_k_restart[] = "restart";
static const char __pyx_k_reverse[] = "reverse";
static const char __pyx_k_scatter[] = "scatter";
static const char __pyx_k_seconds[] = "seconds";
static const char __pyx_k_setName[] = "setName";
static const char __pyx_k_setSeed[] = "setSeed";
static const char __pyx_k_setTime[] = "setTime";
static const char __pyx_k_setType[] = "setType";
static const char __pyx_k_sf_type[] = "sf_type";
static const char __pyx_k_smooths[] = "smooths";
static const char __pyx_k_sortype[] = "sortype";
static const char __pyx_k_strides[] = "strides";
static const char __pyx_k_subcomm[] = "subcomm";
static const char __pyx_k_submats[] = "submats";
static const char __pyx_k_ts_type[] = "ts_type";
static const char __pyx_k_typestr[] = "typestr";
static const char __pyx_k_useCone[] = "useCone";
static const char __pyx_k_vectors[] = "vectors";
static const char __pyx_k_version[] = "version";
static const char __pyx_k_ADDITIVE[] = "ADDITIVE";
static const char __pyx_k_ADVANCED[] = "ADVANCED";
static const char __pyx_k_AINVCUSP[] = "AINVCUSP";
static const char __pyx_k_ANDERSON[] = "ANDERSON";
static const char __pyx_k_BLOCKMAT[] = "BLOCKMAT";
static const char __pyx_k_CHOLESKY[] = "CHOLESKY";
static const char __pyx_k_DrawSize[] = "DrawSize";
static const char __pyx_k_EXPLICIT[] = "EXPLICIT";
static const char __pyx_k_Ellipsis[] = "Ellipsis";
static const char __pyx_k_FileMode[] = "FileMode";
static const char __pyx_k_GALERKIN[] = "GALERKIN";
static const char __pyx_k_GAMGType[] = "GAMGType";
static const char __pyx_k_GASMType[] = "GASMType";
static const char __pyx_k_Get_rank[] = "Get_rank";
static const char __pyx_k_Get_size[] = "Get_size";
static const char __pyx_k_HDF5_VIZ[] = "HDF5_VIZ";
static const char __pyx_k_IMPLICIT[] = "IMPLICIT";
static const char __pyx_k_INBLOCKS[] = "INBLOCKS";
static const char __pyx_k_INFINITY[] = "INFINITY";
static const char __pyx_k_InfoType[] = "InfoType";
static const char __pyx_k_KACZMARZ[] = "KACZMARZ";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_LOCALREF[] = "LOCALREF";
static const char __pyx_k_MPIBSTRM[] = "MPIBSTRM";
static const char __pyx_k_MPIDENSE[] = "MPIDENSE";
static const char __pyx_k_MPISBAIJ[] = "MPISBAIJ";
static const char __pyx_k_NEWTONLS[] = "NEWTONLS";
static const char __pyx_k_NEWTONTR[] = "NEWTONTR";
static const char __pyx_k_NOFORMAT[] = "NOFORMAT";
static const char __pyx_k_NORM_MAX[] = "NORM_MAX";
static const char __pyx_k_NormType[] = "NormType";
static const char __pyx_k_PARMETIS[] = "PARMETIS";
static const char __pyx_k_PBJACOBI[] = "PBJACOBI";
static const char __pyx_k_PCMGType[] = "PCMGType";
static const char __pyx_k_PERIODIC[] = "PERIODIC";
static const char __pyx_k_PIPECGRR[] = "PIPECGRR";
static const char __pyx_k_POUNDERS[] = "POUNDERS";
static const char __pyx_k_RANDER48[] = "RANDER48";
static const char __pyx_k_RESTRICT[] = "RESTRICT";
static const char __pyx_k_RealType[] = "RealType";
static const char __pyx_k_SEQBSTRM[] = "SEQBSTRM";
static const char __pyx_k_SEQCUFFT[] = "SEQCUFFT";
static const char __pyx_k_SEQDENSE[] = "SEQDENSE";
static const char __pyx_k_SEQSBAIJ[] = "SEQSBAIJ";
static const char __pyx_k_SNESType[] = "SNESType";
static const char __pyx_k_SPECTRAL[] = "SPECTRAL";
static const char __pyx_k_STANDARD[] = "STANDARD";
static const char __pyx_k_STEPOVER[] = "STEPOVER";
static const char __pyx_k_SUNDIALS[] = "SUNDIALS";
static const char __pyx_k_VIENNACL[] = "VIENNACL";
static const char __pyx_k_addFlops[] = "addFlops";
static const char __pyx_k_assembly[] = "assembly";
static const char __pyx_k_bcPoints[] = "bcPoints";
static const char __pyx_k_boundary[] = "boundary";
static const char __pyx_k_buffer_w[] = "buffer_w";
static const char __pyx_k_citation[] = "citation";
static const char __pyx_k_constant[] = "constant";
static const char __pyx_k_debugger[] = "debugger";
static const char __pyx_k_delValue[] = "delValue";
static const char __pyx_k_end_args[] = "end_args";
static const char __pyx_k_filename[] = "filename";
static const char __pyx_k_finalize[] = "_finalize";
static const char __pyx_k_function[] = "function";
static const char __pyx_k_gamgtype[] = "gamgtype";
static const char __pyx_k_gasmtype[] = "gasmtype";
static const char __pyx_k_getArray[] = "getArray";
static const char __pyx_k_getFlops[] = "getFlops";
static const char __pyx_k_getSizes[] = "getSizes";
static const char __pyx_k_getUseEW[] = "getUseEW";
static const char __pyx_k_getUseFD[] = "getUseFD";
static const char __pyx_k_getUseMF[] = "getUseMF";
static const char __pyx_k_getValue[] = "getValue";
static const char __pyx_k_gradient[] = "gradient";
static const char __pyx_k_hasLabel[] = "hasLabel";
static const char __pyx_k_inblocks[] = "inblocks";
static const char __pyx_k_interval[] = "interval";
static const char __pyx_k_isSorted[] = "isSorted";
static const char __pyx_k_itemsize[] = "itemsize";
static const char __pyx_k_jacobian[] = "jacobian";
static const char __pyx_k_ksp_type[] = "ksp_type";
static const char __pyx_k_localsec[] = "localsec";
static const char __pyx_k_logFlops[] = "logFlops";
static const char __pyx_k_map_type[] = "map_type";
static const char __pyx_k_mat_type[] = "mat_type";
static const char __pyx_k_max_time[] = "max_time";
static const char __pyx_k_mpiabort[] = "mpiabort";
static const char __pyx_k_normtype[] = "normtype";
static const char __pyx_k_nsubcomm[] = "nsubcomm";
static const char __pyx_k_numProcs[] = "numProcs";
static const char __pyx_k_numcells[] = "numcells";
static const char __pyx_k_only_and[] = "only '==' and '!='";
static const char __pyx_k_ord_type[] = "ord_type";
static const char __pyx_k_periodic[] = "periodic";
static const char __pyx_k_position[] = "position";
static const char __pyx_k_poststep[] = "poststep";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_readonly[] = "readonly";
static const char __pyx_k_refine_x[] = "refine_x";
static const char __pyx_k_refine_y[] = "refine_y";
static const char __pyx_k_refine_z[] = "refine_z";
static const char __pyx_k_rnd_type[] = "rnd_type";
static const char __pyx_k_rtol_max[] = "rtol_max";
static const char __pyx_k_setSizes[] = "setSizes";
static const char __pyx_k_setUseEW[] = "setUseEW";
static const char __pyx_k_setUseFD[] = "setUseFD";
static const char __pyx_k_setUseMF[] = "setUseMF";
static const char __pyx_k_setValue[] = "setValue";
static const char __pyx_k_subminor[] = "subminor";
static const char __pyx_k_tao_type[] = "tao_type";
static const char __pyx_k_timestep[] = "timestep";
static const char __pyx_k_vec_from[] = "vec_from";
static const char __pyx_k_vec_type[] = "vec_type";
static const char __pyx_k_vwr_type[] = "vwr_type";
static const char __pyx_k_ASCII_VTK[] = "ASCII_VTK";
static const char __pyx_k_ASCII_XML[] = "ASCII_XML";
static const char __pyx_k_CARTESIAN[] = "CARTESIAN";
static const char __pyx_k_CHEBYSHEV[] = "CHEBYSHEV";
static const char __pyx_k_CLASSICAL[] = "CLASSICAL";
static const char __pyx_k_COMM_NULL[] = "COMM_NULL";
static const char __pyx_k_COMM_SELF[] = "COMM_SELF";
static const char __pyx_k_COMPOSITE[] = "COMPOSITE";
static const char __pyx_k_DETERMINE[] = "DETERMINE";
static const char __pyx_k_DIFFERENT[] = "DIFFERENT";
static const char __pyx_k_EISENSTAT[] = "EISENSTAT";
static const char __pyx_k_ELEMENTAL[] = "ELEMENTAL";
static const char __pyx_k_FROBENIUS[] = "FROBENIUS";
static const char __pyx_k_FULL_SIZE[] = "FULL_SIZE";
static const char __pyx_k_GLMapType[] = "GLMapType";
static const char __pyx_k_HALF_SIZE[] = "HALF_SIZE";
static const char __pyx_k_HERMITIAN[] = "HERMITIAN";
static const char __pyx_k_INSERT_BC[] = "INSERT_BC";
static const char __pyx_k_ITERATING[] = "ITERATING";
static const char __pyx_k_MATCHSTEP[] = "MATCHSTEP";
static const char __pyx_k_MPIAIJCRL[] = "MPIAIJCRL";
static const char __pyx_k_MPISBSTRM[] = "MPISBSTRM";
static const char __pyx_k_MatOption[] = "MatOption";
static const char __pyx_k_NINFINITY[] = "NINFINITY";
static const char __pyx_k_NONLINEAR[] = "NONLINEAR";
static const char __pyx_k_NORM_NONE[] = "NORM_NONE";
static const char __pyx_k_PCASMType[] = "PCASMType";
static const char __pyx_k_PINFINITY[] = "PINFINITY";
static const char __pyx_k_REDUNDANT[] = "REDUNDANT";
static const char __pyx_k_ROWLENGTH[] = "ROWLENGTH";
static const char __pyx_k_SEQAIJCRL[] = "SEQAIJCRL";
static const char __pyx_k_SEQSBSTRM[] = "SEQSBSTRM";
static const char __pyx_k_SUBMATRIX[] = "SUBMATRIX";
static const char __pyx_k_SUBSET_NZ[] = "SUBSET_NZ";
static const char __pyx_k_SYMMETRIC[] = "SYMMETRIC";
static const char __pyx_k_Structure[] = "Structure";
static const char __pyx_k_TELESCOPE[] = "TELESCOPE";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_VecOption[] = "VecOption";
static const char __pyx_k_col_bsize[] = "col_bsize";
static const char __pyx_k_conePoint[] = "conePoint";
static const char __pyx_k_converged[] = "converged";
static const char __pyx_k_createMat[] = "createMat";
static const char __pyx_k_duplicate[] = "duplicate";
static const char __pyx_k_elem_type[] = "elem_type";
static const char __pyx_k_end_kargs[] = "end_kargs";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_fieldName[] = "fieldName";
static const char __pyx_k_getActive[] = "getActive";
static const char __pyx_k_getAppCtx[] = "getAppCtx";
static const char __pyx_k_getBuffer[] = "getBuffer";
static const char __pyx_k_getMatrix[] = "getMatrix";
static const char __pyx_k_getNumber[] = "getNumber";
static const char __pyx_k_getPCSide[] = "getPCSide";
static const char __pyx_k_getRanges[] = "getRanges";
static const char __pyx_k_getString[] = "getString";
static const char __pyx_k_globalsec[] = "globalsec";
static const char __pyx_k_hypretype[] = "hypretype";
static const char __pyx_k_infoAllow[] = "infoAllow";
static const char __pyx_k_max_fails[] = "max_fails";
static const char __pyx_k_max_funcs[] = "max_funcs";
static const char __pyx_k_max_steps[] = "max_steps";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_nonzero_2[] = "__nonzero__";
static const char __pyx_k_norm_type[] = "norm_type";
static const char __pyx_k_normsched[] = "normsched";
static const char __pyx_k_numFields[] = "numFields";
static const char __pyx_k_objective[] = "objective";
static const char __pyx_k_operators[] = "operators";
static const char __pyx_k_part_type[] = "part_type";
static const char __pyx_k_row_bsize[] = "row_bsize";
static const char __pyx_k_separable[] = "separable";
static const char __pyx_k_setActive[] = "setActive";
static const char __pyx_k_setAppCtx[] = "setAppCtx";
static const char __pyx_k_setPCSide[] = "setPCSide";
static const char __pyx_k_shifttype[] = "shifttype";
static const char __pyx_k_snes_type[] = "snes_type";
static const char __pyx_k_structure[] = "structure";
static const char __pyx_k_symmetric[] = "symmetric";
static const char __pyx_k_syncFlush[] = "syncFlush";
static const char __pyx_k_syncPrint[] = "syncPrint";
static const char __pyx_k_threshold[] = "threshold";
static const char __pyx_k_time_step[] = "time_step";
static const char __pyx_k_traceback[] = "_traceback_";
static const char __pyx_k_transpose[] = "transpose";
static const char __pyx_k_varbounds[] = "varbounds";
static const char __pyx_k_zeropivot[] = "zeropivot";
static const char __pyx_k_ADD_VALUES[] = "ADD_VALUES";
static const char __pyx_k_ASCII_IMPL[] = "ASCII_IMPL";
static const char __pyx_k_ASCII_INFO[] = "ASCII_INFO";
static const char __pyx_k_COMM_WORLD[] = "COMM_WORLD";
static const char __pyx_k_DRAW_BASIC[] = "DRAW_BASIC";
static const char __pyx_k_DRAW_PORTS[] = "DRAW_PORTS";
static const char __pyx_k_FIELDSPLIT[] = "FIELDSPLIT";
static const char __pyx_k_FINAL_ONLY[] = "FINAL_ONLY";
static const char __pyx_k_GLOBAL_MAX[] = "GLOBAL_MAX";
static const char __pyx_k_GLOBAL_SUM[] = "GLOBAL_SUM";
static const char __pyx_k_INSERT_ALL[] = "INSERT_ALL";
static const char __pyx_k_InsertMode[] = "InsertMode";
static const char __pyx_k_MAX_VALUES[] = "MAX_VALUES";
static const char __pyx_k_MPIAIJCUSP[] = "MPIAIJCUSP";
static const char __pyx_k_MPIAIJPERM[] = "MPIAIJPERM";
static const char __pyx_k_MatSORType[] = "MatSORType";
static const char __pyx_k_PCGAMGType[] = "PCGAMGType";
static const char __pyx_k_PCGASMType[] = "PCGASMType";
static const char __pyx_k_PIPEFGMRES[] = "PIPEFGMRES";
static const char __pyx_k_RICHARDSON[] = "RICHARDSON";
static const char __pyx_k_RandomType[] = "RandomType";
static const char __pyx_k_SACUSPPOLY[] = "SACUSPPOLY";
static const char __pyx_k_SEQAIJCUSP[] = "SEQAIJCUSP";
static const char __pyx_k_SEQAIJPERM[] = "SEQAIJPERM";
static const char __pyx_k_ScalarType[] = "ScalarType";
static const char __pyx_k_THIRD_SIZE[] = "THIRD_SIZE";
static const char __pyx_k_USE_INODES[] = "USE_INODES";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_ViewerType[] = "ViewerType";
static const char __pyx_k_assemblies[] = "assemblies";
static const char __pyx_k_authorinfo[] = "authorinfo";
static const char __pyx_k_begin_args[] = "begin_args";
static const char __pyx_k_block_size[] = "block_size";
static const char __pyx_k_compressed[] = "compressed";
static const char __pyx_k_createVecs[] = "createVecs";
static const char __pyx_k_empty_name[] = "empty name";
static const char __pyx_k_errhandler[] = "errhandler";
static const char __pyx_k_getCPUTime[] = "getCPUTime";
static const char __pyx_k_getClassId[] = "getClassId";
static const char __pyx_k_getCorners[] = "getCorners";
static const char __pyx_k_getIndices[] = "getIndices";
static const char __pyx_k_getMaxTime[] = "getMaxTime";
static const char __pyx_k_getStencil[] = "getStencil";
static const char __pyx_k_getVecLeft[] = "getVecLeft";
static const char __pyx_k_getVersion[] = "getVersion";
static const char __pyx_k_getVisible[] = "getVisible";
static const char __pyx_k_initialize[] = "_initialize";
static const char __pyx_k_isIdentity[] = "isIdentity";
static const char __pyx_k_linear_its[] = "linear_its";
static const char __pyx_k_mpi4py_MPI[] = "mpi4py.MPI";
static const char __pyx_k_proc_sizes[] = "proc_sizes";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_reciprocal[] = "reciprocal";
static const char __pyx_k_setMaxTime[] = "setMaxTime";
static const char __pyx_k_setVisible[] = "setVisible";
static const char __pyx_k_shift_type[] = "shift_type";
static const char __pyx_k_startswith[] = "startswith";
static const char __pyx_k_useClosure[] = "useClosure";
static const char __pyx_k_AIJCUSPARSE[] = "AIJCUSPARSE";
static const char __pyx_k_AIJVIENNACL[] = "AIJVIENNACL";
static const char __pyx_k_APPLY_LOWER[] = "APPLY_LOWER";
static const char __pyx_k_APPLY_UPPER[] = "APPLY_UPPER";
static const char __pyx_k_ASCII_DENSE[] = "ASCII_DENSE";
static const char __pyx_k_ASCII_INDEX[] = "ASCII_INDEX";
static const char __pyx_k_ASCII_LATEX[] = "ASCII_LATEX";
static const char __pyx_k_ASCII_PCICE[] = "ASCII_PCICE";
static const char __pyx_k_ComplexType[] = "ComplexType";
static const char __pyx_k_ElementType[] = "ElementType";
static const char __pyx_k_Error___str[] = "Error.__str__";
static const char __pyx_k_HYPRESTRUCT[] = "HYPRESTRUCT";
static const char __pyx_k_INTERPOLATE[] = "INTERPOLATE";
static const char __pyx_k_KSPNormType[] = "KSPNormType";
static const char __pyx_k_MATHEMATICA[] = "MATHEMATICA";
static const char __pyx_k_MPIVIENNACL[] = "MPIVIENNACL";
static const char __pyx_k_MatInfoType[] = "MatInfoType";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_NORM_ALWAYS[] = "NORM_ALWAYS";
static const char __pyx_k_NRICHARDSON[] = "NRICHARDSON";
static const char __pyx_k_ProblemType[] = "ProblemType";
static const char __pyx_k_RUNGE_KUTTA[] = "RUNGE_KUTTA";
static const char __pyx_k_SEQVIENNACL[] = "SEQVIENNACL";
static const char __pyx_k_ScatterMode[] = "ScatterMode";
static const char __pyx_k_StencilType[] = "StencilType";
static const char __pyx_k_SystemError[] = "SystemError";
static const char __pyx_k_UNSPECIFIED[] = "UNSPECIFIED";
static const char __pyx_k_begin_kargs[] = "begin_kargs";
static const char __pyx_k_constraints[] = "constraints";
static const char __pyx_k_coordinates[] = "coordinates";
static const char __pyx_k_createLabel[] = "createLabel";
static const char __pyx_k_create_gvec[] = "create_gvec";
static const char __pyx_k_create_lvec[] = "create_lvec";
static const char __pyx_k_getGradient[] = "getGradient";
static const char __pyx_k_getInterval[] = "getInterval";
static const char __pyx_k_getMaxSteps[] = "getMaxSteps";
static const char __pyx_k_getNormType[] = "getNormType";
static const char __pyx_k_getNumberDM[] = "getNumberDM";
static const char __pyx_k_getRefCount[] = "getRefCount";
static const char __pyx_k_getSolution[] = "getSolution";
static const char __pyx_k_getTimeStep[] = "getTimeStep";
static const char __pyx_k_getVecRight[] = "getVecRight";
static const char __pyx_k_hasLagrange[] = "hasLagrange";
static const char __pyx_k_interp_type[] = "interp_type";
static const char __pyx_k_interpolate[] = "interpolate";
static const char __pyx_k_isAssembled[] = "isAssembled";
static const char __pyx_k_isFinalized[] = "isFinalized";
static const char __pyx_k_isHermitian[] = "isHermitian";
static const char __pyx_k_isSymmetric[] = "isSymmetric";
static const char __pyx_k_numMessages[] = "numMessages";
static const char __pyx_k_nz_unneeded[] = "nz_unneeded";
static const char __pyx_k_orientation[] = "orientation";
static const char __pyx_k_setDiagonal[] = "setDiagonal";
static const char __pyx_k_setInterval[] = "setInterval";
static const char __pyx_k_setMaxSteps[] = "setMaxSteps";
static const char __pyx_k_setNormType[] = "setNormType";
static const char __pyx_k_setParamsEW[] = "setParamsEW";
static const char __pyx_k_setTimeStep[] = "setTimeStep";
static const char __pyx_k_shiftamount[] = "shiftamount";
static const char __pyx_k_step_number[] = "step_number";
static const char __pyx_k_traceback_2[] = "traceback";
static const char __pyx_k_ASCII_COMMON[] = "ASCII_COMMON";
static const char __pyx_k_ASCII_MATLAB[] = "ASCII_MATLAB";
static const char __pyx_k_ASCII_PYTHON[] = "ASCII_PYTHON";
static const char __pyx_k_AssemblyType[] = "AssemblyType";
static const char __pyx_k_BICGSTABCUSP[] = "BICGSTABCUSP";
static const char __pyx_k_BoundaryType[] = "BoundaryType";
static const char __pyx_k_DIFFERENT_NZ[] = "DIFFERENT_NZ";
static const char __pyx_k_DIVERGED_NAN[] = "DIVERGED_NAN";
static const char __pyx_k_DRAW_CONTOUR[] = "DRAW_CONTOUR";
static const char __pyx_k_EquationType[] = "EquationType";
static const char __pyx_k_Error___init[] = "Error.__init__";
static const char __pyx_k_Error___repr[] = "Error.__repr__";
static const char __pyx_k_HYPRESSTRUCT[] = "HYPRESSTRUCT";
static const char __pyx_k_INITIAL_ONLY[] = "INITIAL_ONLY";
static const char __pyx_k_MatStructure[] = "MatStructure";
static const char __pyx_k_NORM_1_AND_2[] = "NORM_1_AND_2";
static const char __pyx_k_NORM_DEFAULT[] = "NORM_DEFAULT";
static const char __pyx_k_NORM_NATURAL[] = "NORM_NATURAL";
static const char __pyx_k_NormSchedule[] = "NormSchedule";
static const char __pyx_k_ODE_EXPLICIT[] = "ODE_EXPLICIT";
static const char __pyx_k_ODE_IMPLICIT[] = "ODE_IMPLICIT";
static const char __pyx_k_OrderingType[] = "OrderingType";
static const char __pyx_k_PREALLOCATOR[] = "PREALLOCATOR";
static const char __pyx_k_QUARTER_SIZE[] = "QUARTER_SIZE";
static const char __pyx_k_REDISTRIBUTE[] = "REDISTRIBUTE";
static const char __pyx_k_ROW_ORIENTED[] = "ROW_ORIENTED";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_SchurPreType[] = "SchurPreType";
static const char __pyx_k_TRANSPOSEMAT[] = "TRANSPOSEMAT";
static const char __pyx_k_VINEWTONRSLS[] = "VINEWTONRSLS";
static const char __pyx_k_VINEWTONSSLS[] = "VINEWTONSSLS";
static const char __pyx_k_ViewerFormat[] = "ViewerFormat";
static const char __pyx_k_createMatrix[] = "createMatrix";
static const char __pyx_k_create_subdm[] = "create_subdm";
static const char __pyx_k_error_code_d[] = "error code %d";
static const char __pyx_k_getActiveAll[] = "getActiveAll";
static const char __pyx_k_getBlockInfo[] = "getBlockInfo";
static const char __pyx_k_getBlockSize[] = "getBlockSize";
static const char __pyx_k_getClassName[] = "getClassName";
static const char __pyx_k_getDimension[] = "getDimension";
static const char __pyx_k_getLocalSize[] = "getLocalSize";
static const char __pyx_k_getOperators[] = "getOperators";
static const char __pyx_k_getProcSizes[] = "getProcSizes";
static const char __pyx_k_initial_time[] = "initial_time";
static const char __pyx_k_initialguess[] = "initialguess";
static const char __pyx_k_nz_allocated[] = "nz_allocated";
static const char __pyx_k_setActiveAll[] = "setActiveAll";
static const char __pyx_k_setDimension[] = "setDimension";
static const char __pyx_k_stencil_type[] = "stencil_type";
static const char __pyx_k_ADD_BC_VALUES[] = "ADD_BC_VALUES";
static const char __pyx_k_APPEND_UPDATE[] = "APPEND_UPDATE";
static const char __pyx_k_ASCII_SYMMODU[] = "ASCII_SYMMODU";
static const char __pyx_k_BINARY_MATLAB[] = "BINARY_MATLAB";
static const char __pyx_k_CONVERGED_ITS[] = "CONVERGED_ITS";
static const char __pyx_k_CompositeType[] = "CompositeType";
static const char __pyx_k_DIVERGED_DTOL[] = "DIVERGED_DTOL";
static const char __pyx_k_DIVERGED_NULL[] = "DIVERGED_NULL";
static const char __pyx_k_DIVERGED_USER[] = "DIVERGED_USER";
static const char __pyx_k_FORWARD_LOCAL[] = "FORWARD_LOCAL";
static const char __pyx_k_FORWARD_SWEEP[] = "FORWARD_SWEEP";
static const char __pyx_k_INSERT_VALUES[] = "INSERT_VALUES";
static const char __pyx_k_NEW_DIAGONALS[] = "NEW_DIAGONALS";
static const char __pyx_k_NORM_INFINITY[] = "NORM_INFINITY";
static const char __pyx_k_PETSc_Error_d[] = "PETSc.Error(%d)";
static const char __pyx_k_REVERSE_LOCAL[] = "REVERSE_LOCAL";
static const char __pyx_k_SCATTER_LOCAL[] = "SCATTER_LOCAL";
static const char __pyx_k_SchurFactType[] = "SchurFactType";
static const char __pyx_k_TSProblemType[] = "TSProblemType";
static const char __pyx_k_boundary_type[] = "boundary_type";
static const char __pyx_k_createVecLeft[] = "createVecLeft";
static const char __pyx_k_create_matrix[] = "create_matrix";
static const char __pyx_k_diagonalScale[] = "diagonalScale";
static const char __pyx_k_diagonal_fill[] = "diagonal_fill";
static const char __pyx_k_getBlockSizes[] = "getBlockSizes";
static const char __pyx_k_getStepNumber[] = "getStepNumber";
static const char __pyx_k_getTolerances[] = "getTolerances";
static const char __pyx_k_isInitialized[] = "isInitialized";
static const char __pyx_k_isPermutation[] = "isPermutation";
static const char __pyx_k_messageLength[] = "messageLength";
static const char __pyx_k_numReductions[] = "numReductions";
static const char __pyx_k_s_line_d_in_s[] = "%s() line %d in %s";
static const char __pyx_k_setStepNumber[] = "setStepNumber";
static const char __pyx_k_setTolerances[] = "setTolerances";
static const char __pyx_k_stencil_width[] = "stencil_width";
static const char __pyx_k_type_registry[] = "__type_registry__";
static const char __pyx_k_ADD_ALL_VALUES[] = "ADD_ALL_VALUES";
static const char __pyx_k_ASCII_VTK_CELL[] = "ASCII_VTK_CELL";
static const char __pyx_k_AttributeError[] = "AttributeError";
static const char __pyx_k_BACKWARD_SWEEP[] = "BACKWARD_SWEEP";
static const char __pyx_k_CONVERGED_ATOL[] = "CONVERGED_ATOL";
static const char __pyx_k_CONVERGED_MINF[] = "CONVERGED_MINF";
static const char __pyx_k_CONVERGED_RTOL[] = "CONVERGED_RTOL";
static const char __pyx_k_CONVERGED_TIME[] = "CONVERGED_TIME";
static const char __pyx_k_CONVERGED_USER[] = "CONVERGED_USER";
static const char __pyx_k_CRANK_NICOLSON[] = "CRANK_NICOLSON";
static const char __pyx_k_DIVERGED_INNER[] = "DIVERGED_INNER";
static const char __pyx_k_DMBoundaryType[] = "DMBoundaryType";
static const char __pyx_k_ExactFinalTime[] = "ExactFinalTime";
static const char __pyx_k_FINAL_ASSEMBLY[] = "FINAL_ASSEMBLY";
static const char __pyx_k_FLUSH_ASSEMBLY[] = "FLUSH_ASSEMBLY";
static const char __pyx_k_MEMORYSCALABLE[] = "MEMORYSCALABLE";
static const char __pyx_k_MPIAIJCUSPARSE[] = "MPIAIJCUSPARSE";
static const char __pyx_k_MPIAIJVIENNACL[] = "MPIAIJVIENNACL";
static const char __pyx_k_MULTIPLICATIVE[] = "MULTIPLICATIVE";
static const char __pyx_k_NORM_FROBENIUS[] = "NORM_FROBENIUS";
static const char __pyx_k_NOT_SET_VALUES[] = "NOT_SET_VALUES";
static const char __pyx_k_NotImplemented[] = "NotImplemented";
static const char __pyx_k_PRECONDITIONED[] = "PRECONDITIONED";
static const char __pyx_k_SEQAIJCUSPARSE[] = "SEQAIJCUSPARSE";
static const char __pyx_k_SEQAIJVIENNACL[] = "SEQAIJVIENNACL";
static const char __pyx_k_SYMMETRY_SWEEP[] = "SYMMETRY_SWEEP";
static const char __pyx_k_TSEquationType[] = "TSEquationType";
static const char __pyx_k_USE_HASH_TABLE[] = "USE_HASH_TABLE";
static const char __pyx_k_createLocalVec[] = "createLocalVec";
static const char __pyx_k_createVecRight[] = "createVecRight";
static const char __pyx_k_empty_citation[] = "empty citation";
static const char __pyx_k_factor_mallocs[] = "factor_mallocs";
static const char __pyx_k_getDefaultComm[] = "getDefaultComm";
static const char __pyx_k_getGhostRanges[] = "getGhostRanges";
static const char __pyx_k_getKSPFailures[] = "getKSPFailures";
static const char __pyx_k_getProblemType[] = "getProblemType";
static const char __pyx_k_getStencilType[] = "getStencilType";
static const char __pyx_k_getVersionInfo[] = "getVersionInfo";
static const char __pyx_k_jacobian_state[] = "jacobian_state";
static const char __pyx_k_petsc4py_PETSc[] = "petsc4py.PETSc";
static const char __pyx_k_setDefaultComm[] = "setDefaultComm";
static const char __pyx_k_setProblemType[] = "setProblemType";
static const char __pyx_k_splitOwnership[] = "splitOwnership";
static const char __pyx_k_CONVERGED_EVENT[] = "CONVERGED_EVENT";
static const char __pyx_k_CONVERGED_GATOL[] = "CONVERGED_GATOL";
static const char __pyx_k_CONVERGED_GRTOL[] = "CONVERGED_GRTOL";
static const char __pyx_k_CONVERGED_GTTOL[] = "CONVERGED_GTTOL";
static const char __pyx_k_ConvergedReason[] = "ConvergedReason";
static const char __pyx_k_DIVERGED_MAXFCN[] = "DIVERGED_MAXFCN";
static const char __pyx_k_DIVERGED_MAXITS[] = "DIVERGED_MAXITS";
static const char __pyx_k_DIVERGED_MAX_IT[] = "DIVERGED_MAX_IT";
static const char __pyx_k_DMDAElementType[] = "DMDAElementType";
static const char __pyx_k_DMDAStencilType[] = "DMDAStencilType";
static const char __pyx_k_Error___nonzero[] = "Error.__nonzero__";
static const char __pyx_k_FactorShiftType[] = "FactorShiftType";
static const char __pyx_k_MatAssemblyType[] = "MatAssemblyType";
static const char __pyx_k_MatOrderingType[] = "MatOrderingType";
static const char __pyx_k_NORMALHERMITIAN[] = "NORMALHERMITIAN";
static const char __pyx_k_NORM_FINAL_ONLY[] = "NORM_FINAL_ONLY";
static const char __pyx_k_PCCompositeType[] = "PCCompositeType";
static const char __pyx_k_PartitionerType[] = "PartitionerType";
static const char __pyx_k_SCATTER_FORWARD[] = "SCATTER_FORWARD";
static const char __pyx_k_SCATTER_REVERSE[] = "SCATTER_REVERSE";
static const char __pyx_k_SCHURCOMPLEMENT[] = "SCHURCOMPLEMENT";
static const char __pyx_k_array_interface[] = "__array_interface__";
static const char __pyx_k_coneOrientation[] = "coneOrientation";
static const char __pyx_k_createGlobalVec[] = "createGlobalVec";
static const char __pyx_k_getBlockIndices[] = "getBlockIndices";
static const char __pyx_k_getBoundaryType[] = "getBoundaryType";
static const char __pyx_k_getEquationType[] = "getEquationType";
static const char __pyx_k_getGhostCorners[] = "getGhostCorners";
static const char __pyx_k_getResidualNorm[] = "getResidualNorm";
static const char __pyx_k_getSolutionNorm[] = "getSolutionNorm";
static const char __pyx_k_getStencilWidth[] = "getStencilWidth";
static const char __pyx_k_getStepFailures[] = "getStepFailures";
static const char __pyx_k_jacobian_design[] = "jacobian_design";
static const char __pyx_k_popErrorHandler[] = "popErrorHandler";
static const char __pyx_k_prefix_s_name_s[] = "(prefix:%s, name:%s)";
static const char __pyx_k_refinementLimit[] = "refinementLimit";
static const char __pyx_k_setEquationType[] = "setEquationType";
static const char __pyx_k_setResidualNorm[] = "setResidualNorm";
static const char __pyx_k_ASCII_VTK_COORDS[] = "ASCII_VTK_COORDS";
static const char __pyx_k_INSERT_BC_VALUES[] = "INSERT_BC_VALUES";
static const char __pyx_k_SNESNormSchedule[] = "SNESNormSchedule";
static const char __pyx_k_SYMMETRY_ETERNAL[] = "SYMMETRY_ETERNAL";
static const char __pyx_k_TAO_Solver_Types[] = "\n    TAO Solver Types\n    ";
static const char __pyx_k_TSExactFinalTime[] = "TSExactFinalTime";
static const char __pyx_k_UNPRECONDITIONED[] = "UNPRECONDITIONED";
static const char __pyx_k_createNaturalVec[] = "createNaturalVec";
static const char __pyx_k_create_injection[] = "create_injection";
static const char __pyx_k_fill_ratio_given[] = "fill_ratio_given";
static const char __pyx_k_getFunctionValue[] = "getFunctionValue";
static const char __pyx_k_getOptionsPrefix[] = "getOptionsPrefix";
static const char __pyx_k_ownership_ranges[] = "ownership_ranges";
static const char __pyx_k_pushErrorHandler[] = "pushErrorHandler";
static const char __pyx_k_registerCitation[] = "registerCitation";
static const char __pyx_k_setOptionsPrefix[] = "setOptionsPrefix";
static const char __pyx_k_ASCII_FACTOR_INFO[] = "ASCII_FACTOR_INFO";
static const char __pyx_k_ASCII_INFO_DETAIL[] = "ASCII_INFO_DETAIL";
static const char __pyx_k_ASCII_MATHEMATICA[] = "ASCII_MATHEMATICA";
static const char __pyx_k_CONVERGED_STEPTOL[] = "CONVERGED_STEPTOL";
static const char __pyx_k_DIVERGED_NANORINF[] = "DIVERGED_NANORINF";
static const char __pyx_k_INSERT_ALL_VALUES[] = "INSERT_ALL_VALUES";
static const char __pyx_k_InterpolationType[] = "InterpolationType";
static const char __pyx_k_NORM_INITIAL_ONLY[] = "NORM_INITIAL_ONLY";
static const char __pyx_k_POSITIVE_DEFINITE[] = "POSITIVE_DEFINITE";
static const char __pyx_k_TSConvergedReason[] = "TSConvergedReason";
static const char __pyx_k_createLocalVector[] = "createLocalVector";
static const char __pyx_k_fill_ratio_needed[] = "fill_ratio_needed";
static const char __pyx_k_getMaxKSPFailures[] = "getMaxKSPFailures";
static const char __pyx_k_getObjectiveValue[] = "getObjectiveValue";
static const char __pyx_k_getOwnershipRange[] = "getOwnershipRange";
static const char __pyx_k_getSolutionUpdate[] = "getSolutionUpdate";
static const char __pyx_k_initial_time_step[] = "initial_time_step";
static const char __pyx_k_null_communicator[] = "null communicator";
static const char __pyx_k_positive_definite[] = "positive_definite";
static const char __pyx_k_refinementUniform[] = "refinementUniform";
static const char __pyx_k_setMaxKSPFailures[] = "setMaxKSPFailures";
static const char __pyx_k_unknown_options_s[] = "unknown options: %s";
static const char __pyx_k_ASCII_MATRIXMARKET[] = "ASCII_MATRIXMARKET";
static const char __pyx_k_CONTINUE_ITERATING[] = "CONTINUE_ITERATING";
static const char __pyx_k_CONVERGED_TR_DELTA[] = "CONVERGED_TR_DELTA";
static const char __pyx_k_DIVERGED_BREAKDOWN[] = "DIVERGED_BREAKDOWN";
static const char __pyx_k_DIVERGED_FNORM_NAN[] = "DIVERGED_FNORM_NAN";
static const char __pyx_k_DIVERGED_LOCAL_MIN[] = "DIVERGED_LOCAL_MIN";
static const char __pyx_k_INITIAL_FINAL_ONLY[] = "INITIAL_FINAL_ONLY";
static const char __pyx_k_KSPConvergedReason[] = "KSPConvergedReason";
static const char __pyx_k_MatFactorShiftType[] = "MatFactorShiftType";
static const char __pyx_k_TAOConvergedReason[] = "TAOConvergedReason";
static const char __pyx_k_ZERO_INITIAL_GUESS[] = "ZERO_INITIAL_GUESS";
static const char __pyx_k_block_size_not_set[] = "block size not set";
static const char __pyx_k_createGlobalVector[] = "createGlobalVector";
static const char __pyx_k_getConvergedReason[] = "getConvergedReason";
static const char __pyx_k_getIterationNumber[] = "getIterationNumber";
static const char __pyx_k_getMaxStepFailures[] = "getMaxStepFailures";
static const char __pyx_k_getOwnershipRanges[] = "getOwnershipRanges";
static const char __pyx_k_readonly_attribute[] = "readonly attribute";
static const char __pyx_k_setConvergedReason[] = "setConvergedReason";
static const char __pyx_k_setIterationNumber[] = "setIterationNumber";
static const char __pyx_k_setMaxStepFailures[] = "setMaxStepFailures";
static const char __pyx_k_CONVERGED_FNORM_ABS[] = "CONVERGED_FNORM_ABS";
static const char __pyx_k_CONVERGED_ITERATING[] = "CONVERGED_ITERATING";
static const char __pyx_k_DAE_IMPLICIT_INDEX1[] = "DAE_IMPLICIT_INDEX1";
static const char __pyx_k_DAE_IMPLICIT_INDEX2[] = "DAE_IMPLICIT_INDEX2";
static const char __pyx_k_DAE_IMPLICIT_INDEX3[] = "DAE_IMPLICIT_INDEX3";
static const char __pyx_k_DIVERGED_LS_FAILURE[] = "DIVERGED_LS_FAILURE";
static const char __pyx_k_IGNORE_ZERO_ENTRIES[] = "IGNORE_ZERO_ENTRIES";
static const char __pyx_k_I_0_is_d_expected_d[] = "I[0] is %d, expected %d";
static const char __pyx_k_LOCAL_FORWARD_SWEEP[] = "LOCAL_FORWARD_SWEEP";
static const char __pyx_k_NORM_PRECONDITIONED[] = "NORM_PRECONDITIONED";
static const char __pyx_k_NO_OFF_PROC_ENTRIES[] = "NO_OFF_PROC_ENTRIES";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_SNESConvergedReason[] = "SNESConvergedReason";
static const char __pyx_k_createNaturalVector[] = "createNaturalVector";
static const char __pyx_k_DAE_IMPLICIT_INDEXHI[] = "DAE_IMPLICIT_INDEXHI";
static const char __pyx_k_DIVERGED_LINE_SEARCH[] = "DIVERGED_LINE_SEARCH";
static const char __pyx_k_ExactFinalTimeOption[] = "ExactFinalTimeOption";
static const char __pyx_k_KEEP_NONZERO_PATTERN[] = "KEEP_NONZERO_PATTERN";
static const char __pyx_k_LOCAL_BACKWARD_SWEEP[] = "LOCAL_BACKWARD_SWEEP";
static const char __pyx_k_SAME_NONZERO_PATTERN[] = "SAME_NONZERO_PATTERN";
static const char __pyx_k_create_interpolation[] = "create_interpolation";
static const char __pyx_k_getInitialGuessKnoll[] = "getInitialGuessKnoll";
static const char __pyx_k_setInitialGuessKnoll[] = "setInitialGuessKnoll";
static const char __pyx_k_unknown_shift_type_s[] = "unknown shift type: %s";
static const char __pyx_k_CONVERGED_ATOL_NORMAL[] = "CONVERGED_ATOL_NORMAL";
static const char __pyx_k_CONVERGED_RTOL_NORMAL[] = "CONVERGED_RTOL_NORMAL";
static const char __pyx_k_CONVERGED_STEP_LENGTH[] = "CONVERGED_STEP_LENGTH";
static const char __pyx_k_DIVERGED_NONSYMMETRIC[] = "DIVERGED_NONSYMMETRIC";
static const char __pyx_k_DIVERGED_TR_REDUCTION[] = "DIVERGED_TR_REDUCTION";
static const char __pyx_k_DMDAInterpolationType[] = "DMDAInterpolationType";
static const char __pyx_k_LOCAL_SYMMETRIC_SWEEP[] = "LOCAL_SYMMETRIC_SWEEP";
static const char __pyx_k_NEW_NONZERO_LOCATIONS[] = "NEW_NONZERO_LOCATIONS";
static const char __pyx_k_NORM_UNPRECONDITIONED[] = "NORM_UNPRECONDITIONED";
static const char __pyx_k_NO_OFF_PROC_ZERO_ROWS[] = "NO_OFF_PROC_ZERO_ROWS";
static const char __pyx_k_SCATTER_FORWARD_LOCAL[] = "SCATTER_FORWARD_LOCAL";
static const char __pyx_k_SCATTER_REVERSE_LOCAL[] = "SCATTER_REVERSE_LOCAL";
static const char __pyx_k_getConvergenceHistory[] = "getConvergenceHistory";
static const char __pyx_k_getFunctionTolerances[] = "getFunctionTolerances";
static const char __pyx_k_getGradientTolerances[] = "getGradientTolerances";
static const char __pyx_k_setFunctionTolerances[] = "setFunctionTolerances";
static const char __pyx_k_side_r_not_understood[] = "side '%r' not understood";
static const char __pyx_k_CONVERGED_CG_NEG_CURVE[] = "CONVERGED_CG_NEG_CURVE";
static const char __pyx_k_DIVERGED_INDEFINITE_PC[] = "DIVERGED_INDEFINITE_PC";
static const char __pyx_k_DIVERGED_STEP_REJECTED[] = "DIVERGED_STEP_REJECTED";
static const char __pyx_k_ERROR_LOWER_TRIANGULAR[] = "ERROR_LOWER_TRIANGULAR";
static const char __pyx_k_GETROW_UPPERTRIANGULAR[] = "GETROW_UPPERTRIANGULAR";
static const char __pyx_k_Object_is_not_writable[] = "Object is not writable.";
static const char __pyx_k_STRUCTURALLY_SYMMETRIC[] = "STRUCTURALLY_SYMMETRIC";
static const char __pyx_k_SUBSET_NONZERO_PATTERN[] = "SUBSET_NONZERO_PATTERN";
static const char __pyx_k_communicator_not_owned[] = "communicator not owned";
static const char __pyx_k_getInitialGuessNonzero[] = "getInitialGuessNonzero";
static const char __pyx_k_getLinearSolveFailures[] = "getLinearSolveFailures";
static const char __pyx_k_setInitialGuessNonzero[] = "setInitialGuessNonzero";
static const char __pyx_k_size_I_is_d_expected_d[] = "size(I) is %d, expected %d";
static const char __pyx_k_size_J_is_d_expected_d[] = "size(J) is %d, expected %d";
static const char __pyx_k_size_V_is_d_expected_d[] = "size(V) is %d, expected %d";
static const char __pyx_k_unknown_element_type_s[] = "unknown element type: %s";
static const char __pyx_k_unknown_scatter_mode_s[] = "unknown scatter mode: %s";
static const char __pyx_k_unknown_stencil_type_s[] = "unknown stencil type: %s";
static const char __pyx_k_DIVERGED_BREAKDOWN_BICG[] = "DIVERGED_BREAKDOWN_BICG";
static const char __pyx_k_DIVERGED_FUNCTION_COUNT[] = "DIVERGED_FUNCTION_COUNT";
static const char __pyx_k_DIVERGED_INDEFINITE_MAT[] = "DIVERGED_INDEFINITE_MAT";
static const char __pyx_k_IGNORE_LOWER_TRIANGULAR[] = "IGNORE_LOWER_TRIANGULAR";
static const char __pyx_k_IGNORE_NEGATIVE_INDICES[] = "IGNORE_NEGATIVE_INDICES";
static const char __pyx_k_IGNORE_OFF_PROC_ENTRIES[] = "IGNORE_OFF_PROC_ENTRIES";
static const char __pyx_k_NORM_INITIAL_FINAL_ONLY[] = "NORM_INITIAL_FINAL_ONLY";
static const char __pyx_k_SUBSET_OFF_PROC_ENTRIES[] = "SUBSET_OFF_PROC_ENTRIES";
static const char __pyx_k_getConstraintTolerances[] = "getConstraintTolerances";
static const char __pyx_k_isStructurallySymmetric[] = "isStructurallySymmetric";
static const char __pyx_k_unknown_boundary_type_s[] = "unknown boundary type: %s";
static const char __pyx_k_unknown_error_handler_s[] = "unknown error handler: %s";
static const char __pyx_k_CONVERGED_CG_CONSTRAINED[] = "CONVERGED_CG_CONSTRAINED";
static const char __pyx_k_CONVERGED_FNORM_RELATIVE[] = "CONVERGED_FNORM_RELATIVE";
static const char __pyx_k_CONVERGED_SNORM_RELATIVE[] = "CONVERGED_SNORM_RELATIVE";
static const char __pyx_k_DAE_SEMI_EXPLICIT_INDEX1[] = "DAE_SEMI_EXPLICIT_INDEX1";
static const char __pyx_k_DAE_SEMI_EXPLICIT_INDEX2[] = "DAE_SEMI_EXPLICIT_INDEX2";
static const char __pyx_k_DAE_SEMI_EXPLICIT_INDEX3[] = "DAE_SEMI_EXPLICIT_INDEX3";
static const char __pyx_k_DIVERGED_FUNCTION_DOMAIN[] = "DIVERGED_FUNCTION_DOMAIN";
static const char __pyx_k_DIVERGED_NONLINEAR_SOLVE[] = "DIVERGED_NONLINEAR_SOLVE";
static const char __pyx_k_NEW_NONZERO_LOCATION_ERR[] = "NEW_NONZERO_LOCATION_ERR";
static const char __pyx_k_PCFieldSplitSchurPreType[] = "PCFieldSplitSchurPreType";
static const char __pyx_k_SYMMETRIC_MULTIPLICATIVE[] = "SYMMETRIC_MULTIPLICATIVE";
static const char __pyx_k_getNonlinearStepFailures[] = "getNonlinearStepFailures";
static const char __pyx_k_incompatible_array_sizes[] = "incompatible array sizes";
static const char __pyx_k_CONVERGED_HAPPY_BREAKDOWN[] = "CONVERGED_HAPPY_BREAKDOWN";
static const char __pyx_k_DAE_SEMI_EXPLICIT_INDEXHI[] = "DAE_SEMI_EXPLICIT_INDEXHI";
static const char __pyx_k_DIFFERENT_NONZERO_PATTERN[] = "DIFFERENT_NONZERO_PATTERN";
static const char __pyx_k_PCFieldSplitSchurFactType[] = "PCFieldSplitSchurFactType";
static const char __pyx_k_getMaxFunctionEvaluations[] = "getMaxFunctionEvaluations";
static const char __pyx_k_getMaxLinearSolveFailures[] = "getMaxLinearSolveFailures";
static const char __pyx_k_setMaxFunctionEvaluations[] = "setMaxFunctionEvaluations";
static const char __pyx_k_setMaxLinearSolveFailures[] = "setMaxLinearSolveFailures";
static const char __pyx_k_NEW_NONZERO_ALLOCATION_ERR[] = "NEW_NONZERO_ALLOCATION_ERR";
static const char __pyx_k_size_d_nnz_is_d_expected_d[] = "size(d_nnz) is %d, expected %d";
static const char __pyx_k_size_o_nnz_is_d_expected_d[] = "size(o_nnz) is %d, expected %d";
static const char __pyx_k_UNUSED_NONZERO_LOCATION_ERR[] = "UNUSED_NONZERO_LOCATION_ERR";
static const char __pyx_k_getMaxNonlinearStepFailures[] = "getMaxNonlinearStepFailures";
static const char __pyx_k_setMaxNonlinearStepFailures[] = "setMaxNonlinearStepFailures";
static const char __pyx_k_expecting_tuple_list_or_dict[] = "expecting tuple/list or dict";
static const char __pyx_k_option_prefix_must_be_string[] = "option prefix must be string";
static const char __pyx_k_unknown_interpolation_type_s[] = "unknown interpolation type: %s";
static const char __pyx_k_block_size_d_must_be_positive[] = "block size %d must be positive";
static const char __pyx_k_incompatible_array_sizes_nv_d[] = "incompatible array sizes: nv=%d";
static const char __pyx_k_TAO_Solver_Termination_Reasons[] = "\n    TAO Solver Termination Reasons\n    ";
static const char __pyx_k_expecting_a_C_contiguous_array[] = "expecting a C-contiguous array";
static const char __pyx_k_A_matrix_with_d_rows_requires_a[] = "A matrix with %d rows requires a row pointer of length %d (given: %d)";
static const char __pyx_k_Invalid_mode_expected_rw_r_or_w[] = "Invalid mode: expected 'rw', 'r', or 'w'";
static const char __pyx_k_Portable_Extensible_Toolkit_for[] = "\nPortable, Extensible Toolkit for Scientific Computation\n";
static const char __pyx_k_bcPoints_is_a_required_argument[] = "bcPoints is a required argument";
static const char __pyx_k_cannot_place_input_array_size_d[] = "cannot place input array size %d, vector size %d";
static const char __pyx_k_home_devel_petsc4py_3_7_0_src_P[] = "/home/devel/petsc4py-3.7.0/src/PETSc/Error.pyx";
static const char __pyx_k_key_d_cannot_register_s_already[] = "key: %d, cannot register: %s, already registered: %s";
static const char __pyx_k_size_array_is_d_expected_dx_d_d[] = "size(array) is %d, expected %dx%d=%d";
static const char __pyx_k_Given_d_column_indices_but_d_non[] = "Given %d column indices but %d non-zero values";
static const char __pyx_k_Must_provide_as_many_communicato[] = "Must provide as many communicators as levels";
static const char __pyx_k_Must_provide_both_sizes_and_poin[] = "Must provide both sizes and points arrays";
static const char __pyx_k_Out_of_memory_Allocated_d_Used_b[] = "Out of memory. Allocated: %d, Used by process: %d";
static const char __pyx_k_Vector_local_size_d_is_not_compa[] = "Vector local size %d is not compatible with DMDA local sizes %s";
static const char __pyx_k_accessing_non_existent_buffer_se[] = "accessing non-existent buffer segment";
static const char __pyx_k_array_size_d_and_vector_local_si[] = "array size %d and vector local size %d block size %d";
static const char __pyx_k_array_size_d_incompatible_with_v[] = "array size %d incompatible with vector local size %d";
static const char __pyx_k_cell_indices_must_have_two_dimen[] = "cell indices must have two dimensions: cells.ndim=%d";
static const char __pyx_k_column_indices_must_have_two_dim[] = "column indices must have two dimensions: cols.ndim=%d";
static const char __pyx_k_coordinates_must_have_two_dimens[] = "coordinates must have two dimensions: coordinates.ndim=%d";
static const char __pyx_k_coords_vertices_must_have_two_di[] = "coords vertices must have two dimensions: coords.ndim=%d";
static const char __pyx_k_ghosts_size_d_array_size_d_and_v[] = "ghosts size %d, array size %d, and vector local size %d block size %d";
static const char __pyx_k_global_size_d_not_divisible_by_b[] = "global size %d not divisible by block size %d";
static const char __pyx_k_incompatible_array_sizes_ni_d_nj[] = "incompatible array sizes: ni=%d, nj=%d, nv=%d";
static const char __pyx_k_incompatible_array_sizes_ni_d_nv[] = "incompatible array sizes: ni=%d, nv=%d, bs=%d";
static const char __pyx_k_input_arrays_have_incompatible_s[] = "input arrays have incompatible shapes: rows.shape=%s, cols.shape=%s, vals.shape=%s";
static const char __pyx_k_local_and_global_sizes_cannot_be[] = "local and global sizes cannot be both 'DECIDE'";
static const char __pyx_k_local_size_d_not_divisible_by_bl[] = "local size %d not divisible by block size %d";
static const char __pyx_k_number_of_dimensions_d_and_numbe[] = "number of dimensions %d and number ownership ranges %d";
static const char __pyx_k_option_prefix_should_not_have_sp[] = "option prefix should not have spaces";
static const char __pyx_k_option_prefix_should_not_start_w[] = "option prefix should not start with a hypen";
static const char __pyx_k_ownership_range_size_d_and_numbe[] = "ownership range size %d and number or processors %d";
static const char __pyx_k_row_indices_must_have_two_dimens[] = "row indices must have two dimensions: rows.ndim=%d";
static const char __pyx_k_sizes_array_should_have_d_entrie[] = "sizes array should have %d entries (has %d)";
static const char __pyx_k_values_must_have_two_or_more_dim[] = "values must have two or more dimensions: vals.ndim=%d";
static const char __pyx_k_home_devel_petsc4py_3_7_0_src_P_2[] = "/home/devel/petsc4py-3.7.0/src/PETSc/PETSc.pyx";
static const char __pyx_k_incompatible_array_sizes_ni_d_nv_2[] = "incompatible array sizes: ni=%d, nv=%d";
static PyObject *__pyx_n_s_A;
static PyObject *__pyx_n_s_A11;
static PyObject *__pyx_n_s_ADD;
static PyObject *__pyx_n_s_ADDITIVE;
static PyObject *__pyx_n_s_ADD_ALL;
static PyObject *__pyx_n_s_ADD_ALL_VALUES;
static PyObject *__pyx_n_s_ADD_BC;
static PyObject *__pyx_n_s_ADD_BC_VALUES;
static PyObject *__pyx_n_s_ADD_VALUES;
static PyObject *__pyx_n_s_ADVANCED;
static PyObject *__pyx_n_s_AGG;
static PyObject *__pyx_n_s_AIJ;
static PyObject *__pyx_n_s_AIJCRL;
static PyObject *__pyx_n_s_AIJCUSP;
static PyObject *__pyx_n_s_AIJCUSPARSE;
static PyObject *__pyx_n_s_AIJPERM;
static PyObject *__pyx_n_s_AIJVIENNACL;
static PyObject *__pyx_n_s_AINVCUSP;
static PyObject *__pyx_n_s_ALPHA;
static PyObject *__pyx_n_s_ALPHA2;
static PyObject *__pyx_n_s_ALWAYS;
static PyObject *__pyx_n_s_AMD;
static PyObject *__pyx_n_s_ANDERSON;
static PyObject *__pyx_n_s_AOType;
static PyObject *__pyx_n_s_APPEND;
static PyObject *__pyx_n_s_APPEND_UPDATE;
static PyObject *__pyx_n_s_APPLY_LOWER;
static PyObject *__pyx_n_s_APPLY_UPPER;
static PyObject *__pyx_n_s_ARKIMEX;
static PyObject *__pyx_n_s_ASCII;
static PyObject *__pyx_n_s_ASCII_COMMON;
static PyObject *__pyx_n_s_ASCII_DENSE;
static PyObject *__pyx_n_s_ASCII_FACTOR_INFO;
static PyObject *__pyx_n_s_ASCII_IMPL;
static PyObject *__pyx_n_s_ASCII_INDEX;
static PyObject *__pyx_n_s_ASCII_INFO;
static PyObject *__pyx_n_s_ASCII_INFO_DETAIL;
static PyObject *__pyx_n_s_ASCII_LATEX;
static PyObject *__pyx_n_s_ASCII_MATHEMATICA;
static PyObject *__pyx_n_s_ASCII_MATLAB;
static PyObject *__pyx_n_s_ASCII_MATRIXMARKET;
static PyObject *__pyx_n_s_ASCII_PCICE;
static PyObject *__pyx_n_s_ASCII_PYTHON;
static PyObject *__pyx_n_s_ASCII_SYMMODU;
static PyObject *__pyx_n_s_ASCII_VTK;
static PyObject *__pyx_n_s_ASCII_VTK_CELL;
static PyObject *__pyx_n_s_ASCII_VTK_COORDS;
static PyObject *__pyx_n_s_ASCII_XML;
static PyObject *__pyx_n_s_ASFLS;
static PyObject *__pyx_n_s_ASILS;
static PyObject *__pyx_n_s_ASM;
static PyObject *__pyx_n_s_ASMType;
static PyObject *__pyx_n_s_ASPIN;
static PyObject *__pyx_n_s_AU;
static PyObject *__pyx_kp_s_A_matrix_with_d_rows_requires_a;
static PyObject *__pyx_n_s_AssemblyType;
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_B;
static PyObject *__pyx_n_s_BACKWARD_SWEEP;
static PyObject *__pyx_n_s_BAIJ;
static PyObject *__pyx_n_s_BASIC;
static PyObject *__pyx_n_s_BCGS;
static PyObject *__pyx_n_s_BCGSL;
static PyObject *__pyx_n_s_BDDC;
static PyObject *__pyx_n_s_BDF;
static PyObject *__pyx_n_s_BE;
static PyObject *__pyx_n_s_BEULER;
static PyObject *__pyx_n_s_BFBT;
static PyObject *__pyx_n_s_BICG;
static PyObject *__pyx_n_s_BICGSTABCUSP;
static PyObject *__pyx_n_s_BINARY;
static PyObject *__pyx_n_s_BINARY_MATLAB;
static PyObject *__pyx_n_s_BJACOBI;
static PyObject *__pyx_n_s_BLMVM;
static PyObject *__pyx_n_s_BLOCK;
static PyObject *__pyx_n_s_BLOCKMAT;
static PyObject *__pyx_n_s_BMRM;
static PyObject *__pyx_n_s_BOX;
static PyObject *__pyx_n_s_BQPIP;
static PyObject *__pyx_n_s_BSTRM;
static PyObject *__pyx_n_s_Barrier;
static PyObject *__pyx_n_s_BoundaryType;
static PyObject *__pyx_n_s_C;
static PyObject *__pyx_n_s_CARTESIAN;
static PyObject *__pyx_n_s_CG;
static PyObject *__pyx_n_s_CGLS;
static PyObject *__pyx_n_s_CGNE;
static PyObject *__pyx_n_s_CGS;
static PyObject *__pyx_n_s_CHACO;
static PyObject *__pyx_n_s_CHEBYSHEV;
static PyObject *__pyx_n_s_CHOLESKY;
static PyObject *__pyx_n_s_CLASSICAL;
static PyObject *__pyx_n_s_CN;
static PyObject *__pyx_n_s_COMM_NULL;
static PyObject *__pyx_n_s_COMM_SELF;
static PyObject *__pyx_n_s_COMM_WORLD;
static PyObject *__pyx_n_s_COMPOSITE;
static PyObject *__pyx_n_s_CONTINUE_ITERATING;
static PyObject *__pyx_n_s_CONVERGED_ATOL;
static PyObject *__pyx_n_s_CONVERGED_ATOL_NORMAL;
static PyObject *__pyx_n_s_CONVERGED_CG_CONSTRAINED;
static PyObject *__pyx_n_s_CONVERGED_CG_NEG_CURVE;
static PyObject *__pyx_n_s_CONVERGED_EVENT;
static PyObject *__pyx_n_s_CONVERGED_FNORM_ABS;
static PyObject *__pyx_n_s_CONVERGED_FNORM_RELATIVE;
static PyObject *__pyx_n_s_CONVERGED_GATOL;
static PyObject *__pyx_n_s_CONVERGED_GRTOL;
static PyObject *__pyx_n_s_CONVERGED_GTTOL;
static PyObject *__pyx_n_s_CONVERGED_HAPPY_BREAKDOWN;
static PyObject *__pyx_n_s_CONVERGED_ITERATING;
static PyObject *__pyx_n_s_CONVERGED_ITS;
static PyObject *__pyx_n_s_CONVERGED_MINF;
static PyObject *__pyx_n_s_CONVERGED_RTOL;
static PyObject *__pyx_n_s_CONVERGED_RTOL_NORMAL;
static PyObject *__pyx_n_s_CONVERGED_SNORM_RELATIVE;
static PyObject *__pyx_n_s_CONVERGED_STEPTOL;
static PyObject *__pyx_n_s_CONVERGED_STEP_LENGTH;
static PyObject *__pyx_n_s_CONVERGED_TIME;
static PyObject *__pyx_n_s_CONVERGED_TR_DELTA;
static PyObject *__pyx_n_s_CONVERGED_USER;
static PyObject *__pyx_n_s_CP;
static PyObject *__pyx_n_s_CR;
static PyObject *__pyx_n_s_CRANK_NICOLSON;
static PyObject *__pyx_n_s_CUSP;
static PyObject *__pyx_n_s_Class;
static PyObject *__pyx_n_s_Clone;
static PyObject *__pyx_n_s_ComplexType;
static PyObject *__pyx_n_s_CompositeType;
static PyObject *__pyx_n_s_ConvergedReason;
static PyObject *__pyx_n_s_DA;
static PyObject *__pyx_n_s_DAAD;
static PyObject *__pyx_n_s_DAE_IMPLICIT_INDEX1;
static PyObject *__pyx_n_s_DAE_IMPLICIT_INDEX2;
static PyObject *__pyx_n_s_DAE_IMPLICIT_INDEX3;
static PyObject *__pyx_n_s_DAE_IMPLICIT_INDEXHI;
static PyObject *__pyx_n_s_DAE_SEMI_EXPLICIT_INDEX1;
static PyObject *__pyx_n_s_DAE_SEMI_EXPLICIT_INDEX2;
static PyObject *__pyx_n_s_DAE_SEMI_EXPLICIT_INDEX3;
static PyObject *__pyx_n_s_DAE_SEMI_EXPLICIT_INDEXHI;
static PyObject *__pyx_n_s_DECIDE;
static PyObject *__pyx_n_s_DEFAULT;
static PyObject *__pyx_n_s_DENSE;
static PyObject *__pyx_n_s_DETERMINE;
static PyObject *__pyx_n_s_DGMRES;
static PyObject *__pyx_n_s_DIAG;
static PyObject *__pyx_n_s_DIFFERENT;
static PyObject *__pyx_n_s_DIFFERENT_NONZERO_PATTERN;
static PyObject *__pyx_n_s_DIFFERENT_NZ;
static PyObject *__pyx_n_s_DIVERGED_BREAKDOWN;
static PyObject *__pyx_n_s_DIVERGED_BREAKDOWN_BICG;
static PyObject *__pyx_n_s_DIVERGED_DTOL;
static PyObject *__pyx_n_s_DIVERGED_FNORM_NAN;
static PyObject *__pyx_n_s_DIVERGED_FUNCTION_COUNT;
static PyObject *__pyx_n_s_DIVERGED_FUNCTION_DOMAIN;
static PyObject *__pyx_n_s_DIVERGED_INDEFINITE_MAT;
static PyObject *__pyx_n_s_DIVERGED_INDEFINITE_PC;
static PyObject *__pyx_n_s_DIVERGED_INNER;
static PyObject *__pyx_n_s_DIVERGED_LINE_SEARCH;
static PyObject *__pyx_n_s_DIVERGED_LOCAL_MIN;
static PyObject *__pyx_n_s_DIVERGED_LS_FAILURE;
static PyObject *__pyx_n_s_DIVERGED_MAXFCN;
static PyObject *__pyx_n_s_DIVERGED_MAXITS;
static PyObject *__pyx_n_s_DIVERGED_MAX_IT;
static PyObject *__pyx_n_s_DIVERGED_NAN;
static PyObject *__pyx_n_s_DIVERGED_NANORINF;
static PyObject *__pyx_n_s_DIVERGED_NONLINEAR_SOLVE;
static PyObject *__pyx_n_s_DIVERGED_NONSYMMETRIC;
static PyObject *__pyx_n_s_DIVERGED_NULL;
static PyObject *__pyx_n_s_DIVERGED_STEP_REJECTED;
static PyObject *__pyx_n_s_DIVERGED_TR_REDUCTION;
static PyObject *__pyx_n_s_DIVERGED_USER;
static PyObject *__pyx_n_s_DMBoundaryType;
static PyObject *__pyx_n_s_DMDAElementType;
static PyObject *__pyx_n_s_DMDAInterpolationType;
static PyObject *__pyx_n_s_DMDAStencilType;
static PyObject *__pyx_n_s_DMType;
static PyObject *__pyx_n_s_DOF;
static PyObject *__pyx_n_s_DRAW;
static PyObject *__pyx_n_s_DRAW_BASIC;
static PyObject *__pyx_n_s_DRAW_CONTOUR;
static PyObject *__pyx_n_s_DRAW_LG;
static PyObject *__pyx_n_s_DRAW_PORTS;
static PyObject *__pyx_n_s_DROP;
static PyObject *__pyx_n_s_DrawSize;
static PyObject *__pyx_n_s_Dup;
static PyObject *__pyx_n_s_EIMEX;
static PyObject *__pyx_n_s_EISENSTAT;
static PyObject *__pyx_n_s_ELEMENTAL;
static PyObject *__pyx_n_s_ERROR_LOWER_TRIANGULAR;
static PyObject *__pyx_n_s_EULER;
static PyObject *__pyx_n_s_EXOTIC;
static PyObject *__pyx_n_s_EXPLICIT;
static PyObject *__pyx_n_s_ElementType;
static PyObject *__pyx_n_s_Ellipsis;
static PyObject *__pyx_n_s_EquationType;
static PyObject *__pyx_n_s_Error;
static PyObject *__pyx_n_s_Error___init;
static PyObject *__pyx_n_s_Error___nonzero;
static PyObject *__pyx_n_s_Error___repr;
static PyObject *__pyx_n_s_Error___str;
static PyObject *__pyx_n_s_Event;
static PyObject *__pyx_n_s_ExactFinalTime;
static PyObject *__pyx_n_s_ExactFinalTimeOption;
static PyObject *__pyx_n_s_FAS;
static PyObject *__pyx_n_s_FBCGS;
static PyObject *__pyx_n_s_FBCGSR;
static PyObject *__pyx_n_s_FCG;
static PyObject *__pyx_n_s_FE;
static PyObject *__pyx_n_s_FFT;
static PyObject *__pyx_n_s_FFTW;
static PyObject *__pyx_n_s_FGMRES;
static PyObject *__pyx_n_s_FIELDSPLIT;
static PyObject *__pyx_n_s_FINAL;
static PyObject *__pyx_n_s_FINAL_ASSEMBLY;
static PyObject *__pyx_n_s_FINAL_ONLY;
static PyObject *__pyx_n_s_FLUSH;
static PyObject *__pyx_n_s_FLUSH_ASSEMBLY;
static PyObject *__pyx_n_s_FORWARD;
static PyObject *__pyx_n_s_FORWARD_LOCAL;
static PyObject *__pyx_n_s_FORWARD_SWEEP;
static PyObject *__pyx_n_s_FRB;
static PyObject *__pyx_n_s_FROBENIUS;
static PyObject *__pyx_n_s_FULL;
static PyObject *__pyx_n_s_FULL_SIZE;
static PyObject *__pyx_n_s_FactorShiftType;
static PyObject *__pyx_n_s_FileMode;
static PyObject *__pyx_n_s_Format;
static PyObject *__pyx_n_s_Free;
static PyObject *__pyx_n_s_GALERKIN;
static PyObject *__pyx_n_s_GAMG;
static PyObject *__pyx_n_s_GAMGType;
static PyObject *__pyx_n_s_GASM;
static PyObject *__pyx_n_s_GASMType;
static PyObject *__pyx_n_s_GCR;
static PyObject *__pyx_n_s_GENERAL;
static PyObject *__pyx_n_s_GEO;
static PyObject *__pyx_n_s_GETROW_UPPERTRIANGULAR;
static PyObject *__pyx_n_s_GHOSTED;
static PyObject *__pyx_n_s_GL;
static PyObject *__pyx_n_s_GLMapType;
static PyObject *__pyx_n_s_GLOBAL_MAX;
static PyObject *__pyx_n_s_GLOBAL_SUM;
static PyObject *__pyx_n_s_GLTR;
static PyObject *__pyx_n_s_GMRES;
static PyObject *__pyx_n_s_GPCG;
static PyObject *__pyx_n_s_GROPPCG;
static PyObject *__pyx_n_s_Get_rank;
static PyObject *__pyx_n_s_Get_size;
static PyObject *__pyx_kp_s_Given_d_column_indices_but_d_non;
static PyObject *__pyx_n_s_H;
static PyObject *__pyx_n_s_HALF;
static PyObject *__pyx_n_s_HALF_SIZE;
static PyObject *__pyx_n_s_HDF5;
static PyObject *__pyx_n_s_HDF5_VIZ;
static PyObject *__pyx_n_s_HERMITIAN;
static PyObject *__pyx_n_s_HYPRE;
static PyObject *__pyx_n_s_HYPRESSTRUCT;
static PyObject *__pyx_n_s_HYPRESTRUCT;
static PyObject *__pyx_n_s_I;
static PyObject *__pyx_n_s_IBCGS;
static PyObject *__pyx_n_s_ICC;
static PyObject *__pyx_n_s_IGNORE_LOWER_TRIANGULAR;
static PyObject *__pyx_n_s_IGNORE_NEGATIVE_INDICES;
static PyObject *__pyx_n_s_IGNORE_OFF_PROC_ENTRIES;
static PyObject *__pyx_n_s_IGNORE_ZERO_ENTRIES;
static PyObject *__pyx_n_s_ILU;
static PyObject *__pyx_n_s_IMPLICIT;
static PyObject *__pyx_n_s_INBLOCKS;
static PyObject *__pyx_n_s_INF;
static PyObject *__pyx_n_s_INFINITY;
static PyObject *__pyx_n_s_INITIAL_FINAL_ONLY;
static PyObject *__pyx_n_s_INITIAL_ONLY;
static PyObject *__pyx_n_s_INSERT;
static PyObject *__pyx_n_s_INSERT_ALL;
static PyObject *__pyx_n_s_INSERT_ALL_VALUES;
static PyObject *__pyx_n_s_INSERT_BC;
static PyObject *__pyx_n_s_INSERT_BC_VALUES;
static PyObject *__pyx_n_s_INSERT_VALUES;
static PyObject *__pyx_n_s_INTERPOLATE;
static PyObject *__pyx_n_s_IPM;
static PyObject *__pyx_n_s_IS;
static PyObject *__pyx_n_s_ISType;
static PyObject *__pyx_n_s_ITERATING;
static PyObject *__pyx_kp_s_I_0_is_d_expected_d;
static PyObject *__pyx_n_s_InfoType;
static PyObject *__pyx_n_s_InsertMode;
static PyObject *__pyx_n_s_IntType;
static PyObject *__pyx_n_s_InterpolationType;
static PyObject *__pyx_kp_s_Invalid_mode_expected_rw_r_or_w;
static PyObject *__pyx_n_s_J;
static PyObject *__pyx_n_s_JACOBI;
static PyObject *__pyx_n_s_KACZMARZ;
static PyObject *__pyx_n_s_KASKADE;
static PyObject *__pyx_n_s_KEEP_NONZERO_PATTERN;
static PyObject *__pyx_n_s_KSP;
static PyObject *__pyx_n_s_KSPConvergedReason;
static PyObject *__pyx_n_s_KSPNormType;
static PyObject *__pyx_n_s_KSPONLY;
static PyObject *__pyx_n_s_KSPType;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_n_s_L;
static PyObject *__pyx_n_s_LCD;
static PyObject *__pyx_n_s_LCL;
static PyObject *__pyx_n_s_LEFT;
static PyObject *__pyx_n_s_LGMRES;
static PyObject *__pyx_n_s_LINEAR;
static PyObject *__pyx_n_s_LMVM;
static PyObject *__pyx_n_s_LOCAL;
static PyObject *__pyx_n_s_LOCALREF;
static PyObject *__pyx_n_s_LOCAL_BACKWARD_SWEEP;
static PyObject *__pyx_n_s_LOCAL_FORWARD_SWEEP;
static PyObject *__pyx_n_s_LOCAL_SYMMETRIC_SWEEP;
static PyObject *__pyx_n_s_LOWER;
static PyObject *__pyx_n_s_LRC;
static PyObject *__pyx_n_s_LSC;
static PyObject *__pyx_n_s_LSQR;
static PyObject *__pyx_n_s_LU;
static PyObject *__pyx_n_s_Left;
static PyObject *__pyx_n_s_MAIJ;
static PyObject *__pyx_n_s_MAPPING;
static PyObject *__pyx_n_s_MASK;
static PyObject *__pyx_n_s_MAT;
static PyObject *__pyx_n_s_MATCHSTEP;
static PyObject *__pyx_n_s_MATHEMATICA;
static PyObject *__pyx_n_s_MATLAB;
static PyObject *__pyx_n_s_MAX;
static PyObject *__pyx_n_s_MAX_VALUES;
static PyObject *__pyx_n_s_MEMORYSCALABLE;
static PyObject *__pyx_n_s_MFFD;
static PyObject *__pyx_n_s_MG;
static PyObject *__pyx_n_s_MGType;
static PyObject *__pyx_n_s_MIMEX;
static PyObject *__pyx_n_s_MINRES;
static PyObject *__pyx_n_s_MIRROR;
static PyObject *__pyx_n_s_ML;
static PyObject *__pyx_n_s_MOAB;
static PyObject *__pyx_n_s_MPI;
static PyObject *__pyx_n_s_MPIADJ;
static PyObject *__pyx_n_s_MPIAIJ;
static PyObject *__pyx_n_s_MPIAIJCRL;
static PyObject *__pyx_n_s_MPIAIJCUSP;
static PyObject *__pyx_n_s_MPIAIJCUSPARSE;
static PyObject *__pyx_n_s_MPIAIJPERM;
static PyObject *__pyx_n_s_MPIAIJVIENNACL;
static PyObject *__pyx_n_s_MPIBAIJ;
static PyObject *__pyx_n_s_MPIBSTRM;
static PyObject *__pyx_n_s_MPICUSP;
static PyObject *__pyx_n_s_MPIDENSE;
static PyObject *__pyx_n_s_MPIMAIJ;
static PyObject *__pyx_n_s_MPISBAIJ;
static PyObject *__pyx_n_s_MPISBSTRM;
static PyObject *__pyx_n_s_MPIVIENNACL;
static PyObject *__pyx_n_s_MS;
static PyObject *__pyx_n_s_MULTIPLICATIVE;
static PyObject *__pyx_n_s_MapType;
static PyObject *__pyx_n_s_MatAssemblyType;
static PyObject *__pyx_n_s_MatFactorShiftType;
static PyObject *__pyx_n_s_MatInfoType;
static PyObject *__pyx_n_s_MatOption;
static PyObject *__pyx_n_s_MatOrderingType;
static PyObject *__pyx_n_s_MatSORType;
static PyObject *__pyx_n_s_MatStructure;
static PyObject *__pyx_n_s_MatType;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_n_s_Mode;
static PyObject *__pyx_kp_s_Must_provide_as_many_communicato;
static PyObject *__pyx_kp_s_Must_provide_both_sizes_and_poin;
static PyObject *__pyx_n_s_N1;
static PyObject *__pyx_n_s_N12;
static PyObject *__pyx_n_s_N2;
static PyObject *__pyx_n_s_NASH;
static PyObject *__pyx_n_s_NASM;
static PyObject *__pyx_n_s_NATIVE;
static PyObject *__pyx_n_s_NATURAL;
static PyObject *__pyx_n_s_NCG;
static PyObject *__pyx_n_s_ND;
static PyObject *__pyx_n_s_NEST;
static PyObject *__pyx_n_s_NETCDF;
static PyObject *__pyx_n_s_NETWORK;
static PyObject *__pyx_n_s_NEWTONLS;
static PyObject *__pyx_n_s_NEWTONTR;
static PyObject *__pyx_n_s_NEW_DIAGONALS;
static PyObject *__pyx_n_s_NEW_NONZERO_ALLOCATION_ERR;
static PyObject *__pyx_n_s_NEW_NONZERO_LOCATIONS;
static PyObject *__pyx_n_s_NEW_NONZERO_LOCATION_ERR;
static PyObject *__pyx_n_s_NGMRES;
static PyObject *__pyx_n_s_NGS;
static PyObject *__pyx_n_s_NINFINITY;
static PyObject *__pyx_n_s_NLS;
static PyObject *__pyx_n_s_NM;
static PyObject *__pyx_n_s_NN;
static PyObject *__pyx_n_s_NO;
static PyObject *__pyx_n_s_NOFORMAT;
static PyObject *__pyx_n_s_NONE;
static PyObject *__pyx_n_s_NONLINEAR;
static PyObject *__pyx_n_s_NONZERO;
static PyObject *__pyx_n_s_NORMAL;
static PyObject *__pyx_n_s_NORMALHERMITIAN;
static PyObject *__pyx_n_s_NORM_1;
static PyObject *__pyx_n_s_NORM_1_AND_2;
static PyObject *__pyx_n_s_NORM_2;
static PyObject *__pyx_n_s_NORM_ALWAYS;
static PyObject *__pyx_n_s_NORM_DEFAULT;
static PyObject *__pyx_n_s_NORM_FINAL_ONLY;
static PyObject *__pyx_n_s_NORM_FROBENIUS;
static PyObject *__pyx_n_s_NORM_INFINITY;
static PyObject *__pyx_n_s_NORM_INITIAL_FINAL_ONLY;
static PyObject *__pyx_n_s_NORM_INITIAL_ONLY;
static PyObject *__pyx_n_s_NORM_MAX;
static PyObject *__pyx_n_s_NORM_NATURAL;
static PyObject *__pyx_n_s_NORM_NONE;
static PyObject *__pyx_n_s_NORM_PRECONDITIONED;
static PyObject *__pyx_n_s_NORM_UNPRECONDITIONED;
static PyObject *__pyx_n_s_NOT_SET_VALUES;
static PyObject *__pyx_n_s_NO_OFF_PROC_ENTRIES;
static PyObject *__pyx_n_s_NO_OFF_PROC_ZERO_ROWS;
static PyObject *__pyx_n_s_NRICHARDSON;
static PyObject *__pyx_n_s_NTL;
static PyObject *__pyx_n_s_NTR;
static PyObject *__pyx_n_s_NZ;
static PyObject *__pyx_n_s_NormSchedule;
static PyObject *__pyx_n_s_NormType;
static PyObject *__pyx_n_s_NotImplemented;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_n_s_O;
static PyObject *__pyx_n_s_ODE_EXPLICIT;
static PyObject *__pyx_n_s_ODE_IMPLICIT;
static PyObject *__pyx_n_s_OWD;
static PyObject *__pyx_n_s_OWLQN;
static PyObject *__pyx_kp_s_Object_is_not_writable;
static PyObject *__pyx_n_s_Option;
static PyObject *__pyx_n_s_OrderingType;
static PyObject *__pyx_kp_s_Out_of_memory_Allocated_d_Used_b;
static PyObject *__pyx_n_s_P;
static PyObject *__pyx_n_s_P1;
static PyObject *__pyx_n_s_PARMETIS;
static PyObject *__pyx_n_s_PARMS;
static PyObject *__pyx_n_s_PATCH;
static PyObject *__pyx_n_s_PBJACOBI;
static PyObject *__pyx_n_s_PCASMType;
static PyObject *__pyx_n_s_PCCompositeType;
static PyObject *__pyx_n_s_PCFieldSplitSchurFactType;
static PyObject *__pyx_n_s_PCFieldSplitSchurPreType;
static PyObject *__pyx_n_s_PCGAMGType;
static PyObject *__pyx_n_s_PCGASMType;
static PyObject *__pyx_n_s_PCMGType;
static PyObject *__pyx_n_s_PCSide;
static PyObject *__pyx_n_s_PCType;
static PyObject *__pyx_n_s_PD;
static PyObject *__pyx_n_s_PERIODIC;
static PyObject *__pyx_kp_s_PETSc_Error_d;
static PyObject *__pyx_n_s_PFMG;
static PyObject *__pyx_n_s_PGMRES;
static PyObject *__pyx_n_s_PINFINITY;
static PyObject *__pyx_n_s_PIPECG;
static PyObject *__pyx_n_s_PIPECGRR;
static PyObject *__pyx_n_s_PIPECR;
static PyObject *__pyx_n_s_PIPEFCG;
static PyObject *__pyx_n_s_PIPEFGMRES;
static PyObject *__pyx_n_s_PIPEGCR;
static PyObject *__pyx_n_s_PLEX;
static PyObject *__pyx_n_s_POSITIVE_DEFINITE;
static PyObject *__pyx_n_s_POUNDERS;
static PyObject *__pyx_n_s_PREALLOCATOR;
static PyObject *__pyx_n_s_PRECONDITIONED;
static PyObject *__pyx_n_s_PREONLY;
static PyObject *__pyx_n_s_PSEUDO;
static PyObject *__pyx_n_s_PYTHON;
static PyObject *__pyx_n_s_PartitionerType;
static PyObject *__pyx_kp_u_Portable_Extensible_Toolkit_for;
static PyObject *__pyx_n_s_Print;
static PyObject *__pyx_n_s_ProblemType;
static PyObject *__pyx_n_s_Q0;
static PyObject *__pyx_n_s_Q1;
static PyObject *__pyx_n_s_QCG;
static PyObject *__pyx_n_s_QMD;
static PyObject *__pyx_n_s_QN;
static PyObject *__pyx_n_s_QUARTER;
static PyObject *__pyx_n_s_QUARTER_SIZE;
static PyObject *__pyx_n_s_R;
static PyObject *__pyx_n_s_RAND;
static PyObject *__pyx_n_s_RAND48;
static PyObject *__pyx_n_s_RANDER48;
static PyObject *__pyx_n_s_RCM;
static PyObject *__pyx_n_s_READ;
static PyObject *__pyx_n_s_REDISTRIBUTE;
static PyObject *__pyx_n_s_REDUNDANT;
static PyObject *__pyx_n_s_RESTRICT;
static PyObject *__pyx_n_s_REVERSE;
static PyObject *__pyx_n_s_REVERSE_LOCAL;
static PyObject *__pyx_n_s_RICHARDSON;
static PyObject *__pyx_n_s_RIGHT;
static PyObject *__pyx_n_s_RK;
static PyObject *__pyx_n_s_ROSW;
static PyObject *__pyx_n_s_ROWLENGTH;
static PyObject *__pyx_n_s_ROW_ORIENTED;
static PyObject *__pyx_n_s_RUNGE_KUTTA;
static PyObject *__pyx_n_s_RandomType;
static PyObject *__pyx_n_s_RealType;
static PyObject *__pyx_n_s_Reason;
static PyObject *__pyx_n_s_Right;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_s_S;
static PyObject *__pyx_n_s_SACUSP;
static PyObject *__pyx_n_s_SACUSPPOLY;
static PyObject *__pyx_n_s_SAME;
static PyObject *__pyx_n_s_SAME_NONZERO_PATTERN;
static PyObject *__pyx_n_s_SAME_NZ;
static PyObject *__pyx_n_s_SAWS;
static PyObject *__pyx_n_s_SBAIJ;
static PyObject *__pyx_n_s_SBSTRM;
static PyObject *__pyx_n_s_SCATTER;
static PyObject *__pyx_n_s_SCATTER_FORWARD;
static PyObject *__pyx_n_s_SCATTER_FORWARD_LOCAL;
static PyObject *__pyx_n_s_SCATTER_LOCAL;
static PyObject *__pyx_n_s_SCATTER_REVERSE;
static PyObject *__pyx_n_s_SCATTER_REVERSE_LOCAL;
static PyObject *__pyx_n_s_SCHUR;
static PyObject *__pyx_n_s_SCHURCOMPLEMENT;
static PyObject *__pyx_n_s_SELF;
static PyObject *__pyx_n_s_SELFP;
static PyObject *__pyx_n_s_SEQ;
static PyObject *__pyx_n_s_SEQAIJ;
static PyObject *__pyx_n_s_SEQAIJCRL;
static PyObject *__pyx_n_s_SEQAIJCUSP;
static PyObject *__pyx_n_s_SEQAIJCUSPARSE;
static PyObject *__pyx_n_s_SEQAIJPERM;
static PyObject *__pyx_n_s_SEQAIJVIENNACL;
static PyObject *__pyx_n_s_SEQBAIJ;
static PyObject *__pyx_n_s_SEQBSTRM;
static PyObject *__pyx_n_s_SEQCUFFT;
static PyObject *__pyx_n_s_SEQCUSP;
static PyObject *__pyx_n_s_SEQDENSE;
static PyObject *__pyx_n_s_SEQMAIJ;
static PyObject *__pyx_n_s_SEQSBAIJ;
static PyObject *__pyx_n_s_SEQSBSTRM;
static PyObject *__pyx_n_s_SEQVIENNACL;
static PyObject *__pyx_n_s_SFType;
static PyObject *__pyx_n_s_SHARED;
static PyObject *__pyx_n_s_SHELL;
static PyObject *__pyx_n_s_SLICED;
static PyObject *__pyx_n_s_SNESConvergedReason;
static PyObject *__pyx_n_s_SNESNormSchedule;
static PyObject *__pyx_n_s_SNESType;
static PyObject *__pyx_n_s_SOCKET;
static PyObject *__pyx_n_s_SOR;
static PyObject *__pyx_n_s_SORType;
static PyObject *__pyx_n_s_SPAI;
static PyObject *__pyx_n_s_SPD;
static PyObject *__pyx_n_s_SPECIAL;
static PyObject *__pyx_n_s_SPECTRAL;
static PyObject *__pyx_n_s_SPRNG;
static PyObject *__pyx_n_s_SSFLS;
static PyObject *__pyx_n_s_SSILS;
static PyObject *__pyx_n_s_SSP;
static PyObject *__pyx_n_s_STANDARD;
static PyObject *__pyx_n_s_STAR;
static PyObject *__pyx_n_s_STCG;
static PyObject *__pyx_n_s_STDERR;
static PyObject *__pyx_n_s_STDOUT;
static PyObject *__pyx_n_s_STEPOVER;
static PyObject *__pyx_n_s_STRIDE;
static PyObject *__pyx_n_s_STRING;
static PyObject *__pyx_n_s_STRUCTURALLY_SYMMETRIC;
static PyObject *__pyx_n_s_SUBMATRIX;
static PyObject *__pyx_n_s_SUBSET;
static PyObject *__pyx_n_s_SUBSET_NONZERO_PATTERN;
static PyObject *__pyx_n_s_SUBSET_NZ;
static PyObject *__pyx_n_s_SUBSET_OFF_PROC_ENTRIES;
static PyObject *__pyx_n_s_SUNDIALS;
static PyObject *__pyx_n_s_SVD;
static PyObject *__pyx_n_s_SYMMETRIC;
static PyObject *__pyx_n_s_SYMMETRIC_MULTIPLICATIVE;
static PyObject *__pyx_n_s_SYMMETRY_ETERNAL;
static PyObject *__pyx_n_s_SYMMETRY_SWEEP;
static PyObject *__pyx_n_s_SYMMLQ;
static PyObject *__pyx_n_s_SYSPFMG;
static PyObject *__pyx_n_s_ScalarType;
static PyObject *__pyx_n_s_ScatterMode;
static PyObject *__pyx_n_s_SchurFactType;
static PyObject *__pyx_n_s_SchurPreType;
static PyObject *__pyx_n_s_Side;
static PyObject *__pyx_n_s_Size;
static PyObject *__pyx_n_s_Stage;
static PyObject *__pyx_n_s_Stencil;
static PyObject *__pyx_n_s_StencilType;
static PyObject *__pyx_n_s_Structure;
static PyObject *__pyx_n_s_SystemError;
static PyObject *__pyx_n_s_TAOConvergedReason;
static PyObject *__pyx_n_s_TAOType;
static PyObject *__pyx_kp_s_TAO_Solver_Termination_Reasons;
static PyObject *__pyx_kp_s_TAO_Solver_Types;
static PyObject *__pyx_n_s_TCQMR;
static PyObject *__pyx_n_s_TELESCOPE;
static PyObject *__pyx_n_s_TEST;
static PyObject *__pyx_n_s_TFQMR;
static PyObject *__pyx_n_s_TFS;
static PyObject *__pyx_n_s_TH;
static PyObject *__pyx_n_s_THETA;
static PyObject *__pyx_n_s_THIRD;
static PyObject *__pyx_n_s_THIRD_SIZE;
static PyObject *__pyx_n_s_TRANSPOSEMAT;
static PyObject *__pyx_n_s_TRON;
static PyObject *__pyx_n_s_TSConvergedReason;
static PyObject *__pyx_n_s_TSEquationType;
static PyObject *__pyx_n_s_TSExactFinalTime;
static PyObject *__pyx_n_s_TSIRM;
static PyObject *__pyx_n_s_TSProblemType;
static PyObject *__pyx_n_s_TSType;
static PyObject *__pyx_n_s_TWIST;
static PyObject *__pyx_n_s_Type;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_U;
static PyObject *__pyx_n_s_UA;
static PyObject *__pyx_n_s_UNPRECONDITIONED;
static PyObject *__pyx_n_s_UNSPECIFIED;
static PyObject *__pyx_n_s_UNUSED_NONZERO_LOCATION_ERR;
static PyObject *__pyx_n_s_UPDATE;
static PyObject *__pyx_n_s_UPPER;
static PyObject *__pyx_n_s_USER;
static PyObject *__pyx_n_s_USE_HASH_TABLE;
static PyObject *__pyx_n_s_USE_INODES;
static PyObject *__pyx_n_s_V;
static PyObject *__pyx_n_s_VIENNACL;
static PyObject *__pyx_n_s_VINEWTONRSLS;
static PyObject *__pyx_n_s_VINEWTONSSLS;
static PyObject *__pyx_n_s_VTK;
static PyObject *__pyx_n_s_VTK_VTR;
static PyObject *__pyx_n_s_VTK_VTS;
static PyObject *__pyx_n_s_VTK_VTU;
static PyObject *__pyx_n_s_VU;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_VecOption;
static PyObject *__pyx_n_s_VecType;
static PyObject *__pyx_kp_s_Vector_local_size_d_is_not_compa;
static PyObject *__pyx_n_s_ViewerFormat;
static PyObject *__pyx_n_s_ViewerType;
static PyObject *__pyx_n_s_W;
static PyObject *__pyx_n_s_WBM;
static PyObject *__pyx_n_s_WINDOW;
static PyObject *__pyx_n_s_WRITE;
static PyObject *__pyx_n_s_X;
static PyObject *__pyx_n_s_ZERO_INITIAL_GUESS;
static PyObject *__pyx_kp_s__10;
static PyObject *__pyx_kp_s__2;
static PyObject *__pyx_kp_s__32;
static PyObject *__pyx_kp_b__5;
static PyObject *__pyx_kp_s__5;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_kp_s_a_2;
static PyObject *__pyx_n_s_abort;
static PyObject *__pyx_kp_s_accessing_non_existent_buffer_se;
static PyObject *__pyx_n_s_addFlops;
static PyObject *__pyx_n_s_addv;
static PyObject *__pyx_n_s_all;
static PyObject *__pyx_n_s_alpha;
static PyObject *__pyx_n_s_alpha2;
static PyObject *__pyx_n_s_alpha_f;
static PyObject *__pyx_n_s_alpha_m;
static PyObject *__pyx_n_s_alphas;
static PyObject *__pyx_n_s_amount;
static PyObject *__pyx_n_s_app;
static PyObject *__pyx_n_s_appctx;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_apply;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_array;
static PyObject *__pyx_n_s_array_interface;
static PyObject *__pyx_kp_s_array_size_d_and_vector_local_si;
static PyObject *__pyx_kp_s_array_size_d_incompatible_with_v;
static PyObject *__pyx_n_s_array_w;
static PyObject *__pyx_n_s_asmtype;
static PyObject *__pyx_n_s_assemblies;
static PyObject *__pyx_n_s_assembly;
static PyObject *__pyx_n_s_atol;
static PyObject *__pyx_n_s_attr;
static PyObject *__pyx_n_s_au;
static PyObject *__pyx_n_s_author;
static PyObject *__pyx_n_s_authorinfo;
static PyObject *__pyx_n_s_axpy;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_barrier;
static PyObject *__pyx_n_s_bcComps;
static PyObject *__pyx_n_s_bcField;
static PyObject *__pyx_n_s_bcPoints;
static PyObject *__pyx_kp_s_bcPoints_is_a_required_argument;
static PyObject *__pyx_n_s_begin;
static PyObject *__pyx_n_s_begin_args;
static PyObject *__pyx_n_s_begin_kargs;
static PyObject *__pyx_n_s_beta;
static PyObject *__pyx_n_s_block_size;
static PyObject *__pyx_kp_s_block_size_d_must_be_positive;
static PyObject *__pyx_kp_s_block_size_not_set;
static PyObject *__pyx_n_s_boundary;
static PyObject *__pyx_n_s_boundary_type;
static PyObject *__pyx_n_s_box;
static PyObject *__pyx_n_s_bs;
static PyObject *__pyx_n_s_bsize;
static PyObject *__pyx_n_s_buffer_w;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_kp_s_c_d;
static PyObject *__pyx_kp_s_cannot_place_input_array_size_d;
static PyObject *__pyx_n_s_catol;
static PyObject *__pyx_n_s_cell;
static PyObject *__pyx_kp_s_cell_indices_must_have_two_dimen;
static PyObject *__pyx_n_s_cells;
static PyObject *__pyx_n_s_cgid;
static PyObject *__pyx_n_s_citation;
static PyObject *__pyx_n_s_cmap;
static PyObject *__pyx_n_s_coarsen;
static PyObject *__pyx_n_s_col;
static PyObject *__pyx_n_s_col_bsize;
static PyObject *__pyx_n_s_cols;
static PyObject *__pyx_n_s_column;
static PyObject *__pyx_kp_s_column_indices_must_have_two_dim;
static PyObject *__pyx_n_s_comm;
static PyObject *__pyx_n_s_comms;
static PyObject *__pyx_kp_s_communicator_not_owned;
static PyObject *__pyx_n_s_compressed;
static PyObject *__pyx_n_s_cone;
static PyObject *__pyx_n_s_coneOrientation;
static PyObject *__pyx_n_s_conePoint;
static PyObject *__pyx_n_s_conePos;
static PyObject *__pyx_n_s_constant;
static PyObject *__pyx_n_s_constraints;
static PyObject *__pyx_n_s_context;
static PyObject *__pyx_n_s_converged;
static PyObject *__pyx_n_s_coordinates;
static PyObject *__pyx_kp_s_coordinates_must_have_two_dimens;
static PyObject *__pyx_n_s_coords;
static PyObject *__pyx_kp_s_coords_vertices_must_have_two_di;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_s_count;
static PyObject *__pyx_n_s_crank;
static PyObject *__pyx_n_s_createGlobalVec;
static PyObject *__pyx_n_s_createGlobalVector;
static PyObject *__pyx_n_s_createLabel;
static PyObject *__pyx_n_s_createLocalVec;
static PyObject *__pyx_n_s_createLocalVector;
static PyObject *__pyx_n_s_createMat;
static PyObject *__pyx_n_s_createMatrix;
static PyObject *__pyx_n_s_createNaturalVec;
static PyObject *__pyx_n_s_createNaturalVector;
static PyObject *__pyx_n_s_createVecLeft;
static PyObject *__pyx_n_s_createVecRight;
static PyObject *__pyx_n_s_createVecs;
static PyObject *__pyx_n_s_create_gvec;
static PyObject *__pyx_n_s_create_injection;
static PyObject *__pyx_n_s_create_interpolation;
static PyObject *__pyx_n_s_create_lvec;
static PyObject *__pyx_n_s_create_matrix;
static PyObject *__pyx_n_s_create_subdm;
static PyObject *__pyx_n_s_crtol;
static PyObject *__pyx_n_s_csize;
static PyObject *__pyx_n_s_csr;
static PyObject *__pyx_n_s_ctype;
static PyObject *__pyx_kp_s_d_s;
static PyObject *__pyx_n_s_da;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_date;
static PyObject *__pyx_n_s_debugger;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_n_s_decomp;
static PyObject *__pyx_n_s_default;
static PyObject *__pyx_n_s_delValue;
static PyObject *__pyx_n_s_design;
static PyObject *__pyx_n_s_destroy;
static PyObject *__pyx_n_s_devel;
static PyObject *__pyx_n_s_diag;
static PyObject *__pyx_n_s_diagonalScale;
static PyObject *__pyx_n_s_diagonal_fill;
static PyObject *__pyx_n_s_dim;
static PyObject *__pyx_n_s_dims;
static PyObject *__pyx_n_s_display;
static PyObject *__pyx_n_s_divtol;
static PyObject *__pyx_n_s_dm;
static PyObject *__pyx_n_s_dm_type;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_dof;
static PyObject *__pyx_n_s_drop;
static PyObject *__pyx_n_s_dt;
static PyObject *__pyx_n_s_dtcol;
static PyObject *__pyx_n_s_dtcount;
static PyObject *__pyx_n_s_duplicate;
static PyObject *__pyx_n_s_edges;
static PyObject *__pyx_n_s_elem_type;
static PyObject *__pyx_n_s_emacs;
static PyObject *__pyx_kp_s_empty_citation;
static PyObject *__pyx_kp_s_empty_name;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_s_end_args;
static PyObject *__pyx_n_s_end_kargs;
static PyObject *__pyx_n_s_enter;
static PyObject *__pyx_n_s_entry;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_eqtype;
static PyObject *__pyx_n_s_errhandler;
static PyObject *__pyx_kp_s_error_code_d;
static PyObject *__pyx_n_s_exit;
static PyObject *__pyx_n_s_exoid;
static PyObject *__pyx_kp_s_expecting_a_C_contiguous_array;
static PyObject *__pyx_kp_s_expecting_tuple_list_or_dict;
static PyObject *__pyx_n_s_f;
static PyObject *__pyx_n_s_faces;
static PyObject *__pyx_n_s_factor_mallocs;
static PyObject *__pyx_n_s_field;
static PyObject *__pyx_n_s_fieldName;
static PyObject *__pyx_n_s_filename;
static PyObject *__pyx_n_s_fill;
static PyObject *__pyx_n_s_fill_ratio_given;
static PyObject *__pyx_n_s_fill_ratio_needed;
static PyObject *__pyx_n_s_finalize;
static PyObject *__pyx_n_s_first;
static PyObject *__pyx_n_s_flag;
static PyObject *__pyx_n_s_flops;
static PyObject *__pyx_n_s_flush;
static PyObject *__pyx_n_s_fnorm;
static PyObject *__pyx_n_s_force;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_forward;
static PyObject *__pyx_n_s_function;
static PyObject *__pyx_n_s_g;
static PyObject *__pyx_n_s_gamgtype;
static PyObject *__pyx_n_s_gamma;
static PyObject *__pyx_n_s_gasmtype;
static PyObject *__pyx_n_s_gatol;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_getActive;
static PyObject *__pyx_n_s_getActiveAll;
static PyObject *__pyx_n_s_getAppCtx;
static PyObject *__pyx_n_s_getArray;
static PyObject *__pyx_n_s_getBlockIndices;
static PyObject *__pyx_n_s_getBlockInfo;
static PyObject *__pyx_n_s_getBlockSize;
static PyObject *__pyx_n_s_getBlockSizes;
static PyObject *__pyx_n_s_getBoundaryType;
static PyObject *__pyx_n_s_getBuffer;
static PyObject *__pyx_n_s_getCPUTime;
static PyObject *__pyx_n_s_getClassId;
static PyObject *__pyx_n_s_getClassName;
static PyObject *__pyx_n_s_getComm;
static PyObject *__pyx_n_s_getConstraintTolerances;
static PyObject *__pyx_n_s_getConvergedReason;
static PyObject *__pyx_n_s_getConvergenceHistory;
static PyObject *__pyx_n_s_getCorners;
static PyObject *__pyx_n_s_getDM;
static PyObject *__pyx_n_s_getDefaultComm;
static PyObject *__pyx_n_s_getDim;
static PyObject *__pyx_n_s_getDimension;
static PyObject *__pyx_n_s_getDof;
static PyObject *__pyx_n_s_getEquationType;
static PyObject *__pyx_n_s_getFlops;
static PyObject *__pyx_n_s_getFunctionTolerances;
static PyObject *__pyx_n_s_getFunctionValue;
static PyObject *__pyx_n_s_getGhostCorners;
static PyObject *__pyx_n_s_getGhostRanges;
static PyObject *__pyx_n_s_getGradient;
static PyObject *__pyx_n_s_getGradientTolerances;
static PyObject *__pyx_n_s_getIndices;
static PyObject *__pyx_n_s_getInfo;
static PyObject *__pyx_n_s_getInitialGuessKnoll;
static PyObject *__pyx_n_s_getInitialGuessNonzero;
static PyObject *__pyx_n_s_getInterval;
static PyObject *__pyx_n_s_getIterationNumber;
static PyObject *__pyx_n_s_getKSP;
static PyObject *__pyx_n_s_getKSPFailures;
static PyObject *__pyx_n_s_getLinearSolveFailures;
static PyObject *__pyx_n_s_getLocalSize;
static PyObject *__pyx_n_s_getMatrix;
static PyObject *__pyx_n_s_getMaxFunctionEvaluations;
static PyObject *__pyx_n_s_getMaxKSPFailures;
static PyObject *__pyx_n_s_getMaxLinearSolveFailures;
static PyObject *__pyx_n_s_getMaxNonlinearStepFailures;
static PyObject *__pyx_n_s_getMaxStepFailures;
static PyObject *__pyx_n_s_getMaxSteps;
static PyObject *__pyx_n_s_getMaxTime;
static PyObject *__pyx_n_s_getNPC;
static PyObject *__pyx_n_s_getName;
static PyObject *__pyx_n_s_getNonlinearStepFailures;
static PyObject *__pyx_n_s_getNormType;
static PyObject *__pyx_n_s_getNumber;
static PyObject *__pyx_n_s_getNumberDM;
static PyObject *__pyx_n_s_getObjectiveValue;
static PyObject *__pyx_n_s_getOperators;
static PyObject *__pyx_n_s_getOptionsPrefix;
static PyObject *__pyx_n_s_getOwnershipRange;
static PyObject *__pyx_n_s_getOwnershipRanges;
static PyObject *__pyx_n_s_getPC;
static PyObject *__pyx_n_s_getPCSide;
static PyObject *__pyx_n_s_getProblemType;
static PyObject *__pyx_n_s_getProcSizes;
static PyObject *__pyx_n_s_getRanges;
static PyObject *__pyx_n_s_getRank;
static PyObject *__pyx_n_s_getRefCount;
static PyObject *__pyx_n_s_getResidualNorm;
static PyObject *__pyx_n_s_getRhs;
static PyObject *__pyx_n_s_getSNES;
static PyObject *__pyx_n_s_getSeed;
static PyObject *__pyx_n_s_getSize;
static PyObject *__pyx_n_s_getSizes;
static PyObject *__pyx_n_s_getSolution;
static PyObject *__pyx_n_s_getSolutionNorm;
static PyObject *__pyx_n_s_getSolutionUpdate;
static PyObject *__pyx_n_s_getStencil;
static PyObject *__pyx_n_s_getStencilType;
static PyObject *__pyx_n_s_getStencilWidth;
static PyObject *__pyx_n_s_getStepFailures;
static PyObject *__pyx_n_s_getStepNumber;
static PyObject *__pyx_n_s_getString;
static PyObject *__pyx_n_s_getTime;
static PyObject *__pyx_n_s_getTimeStep;
static PyObject *__pyx_n_s_getTolerances;
static PyObject *__pyx_n_s_getType;
static PyObject *__pyx_n_s_getUseEW;
static PyObject *__pyx_n_s_getUseFD;
static PyObject *__pyx_n_s_getUseMF;
static PyObject *__pyx_n_s_getValue;
static PyObject *__pyx_n_s_getVecLeft;
static PyObject *__pyx_n_s_getVecRight;
static PyObject *__pyx_n_s_getVecs;
static PyObject *__pyx_n_s_getVersion;
static PyObject *__pyx_n_s_getVersionInfo;
static PyObject *__pyx_n_s_getVisible;
static PyObject *__pyx_n_s_ghosted;
static PyObject *__pyx_n_s_ghosts;
static PyObject *__pyx_kp_s_ghosts_size_d_array_size_d_and_v;
static PyObject *__pyx_kp_s_global_size_d_not_divisible_by_b;
static PyObject *__pyx_n_s_globalsec;
static PyObject *__pyx_n_s_gradient;
static PyObject *__pyx_n_s_group;
static PyObject *__pyx_n_s_grtol;
static PyObject *__pyx_n_s_gtol;
static PyObject *__pyx_n_s_gttol;
static PyObject *__pyx_n_s_gv;
static PyObject *__pyx_n_s_gvec;
static PyObject *__pyx_n_s_handle;
static PyObject *__pyx_n_s_hasLabel;
static PyObject *__pyx_n_s_hasLagrange;
static PyObject *__pyx_n_s_hasName;
static PyObject *__pyx_n_s_hessian;
static PyObject *__pyx_kp_s_home_devel_petsc4py_3_7_0_src_P;
static PyObject *__pyx_kp_s_home_devel_petsc4py_3_7_0_src_P_2;
static PyObject *__pyx_n_s_hypretype;
static PyObject *__pyx_n_s_icntl;
static PyObject *__pyx_n_s_idx;
static PyObject *__pyx_n_s_idxm;
static PyObject *__pyx_n_s_ierr;
static PyObject *__pyx_n_s_ignore;
static PyObject *__pyx_n_s_imag;
static PyObject *__pyx_n_s_imex;
static PyObject *__pyx_n_s_imode;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_inblocks;
static PyObject *__pyx_kp_s_incompatible_array_sizes;
static PyObject *__pyx_kp_s_incompatible_array_sizes_ni_d_nj;
static PyObject *__pyx_kp_s_incompatible_array_sizes_ni_d_nv;
static PyObject *__pyx_kp_s_incompatible_array_sizes_ni_d_nv_2;
static PyObject *__pyx_kp_s_incompatible_array_sizes_nv_d;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_indices;
static PyObject *__pyx_n_s_info;
static PyObject *__pyx_n_s_infoAllow;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_initial_time;
static PyObject *__pyx_n_s_initial_time_step;
static PyObject *__pyx_n_s_initialguess;
static PyObject *__pyx_n_s_initialize;
static PyObject *__pyx_kp_s_input_arrays_have_incompatible_s;
static PyObject *__pyx_n_s_insert;
static PyObject *__pyx_n_s_interp_type;
static PyObject *__pyx_n_s_interpolate;
static PyObject *__pyx_n_s_interval;
static PyObject *__pyx_n_s_invert;
static PyObject *__pyx_n_s_isAssembled;
static PyObject *__pyx_n_s_isFinalized;
static PyObject *__pyx_n_s_isHermitian;
static PyObject *__pyx_n_s_isIdentity;
static PyObject *__pyx_n_s_isInitialized;
static PyObject *__pyx_n_s_isPermutation;
static PyObject *__pyx_n_s_isSorted;
static PyObject *__pyx_n_s_isStructurallySymmetric;
static PyObject *__pyx_n_s_isSymmetric;
static PyObject *__pyx_n_s_is_from;
static PyObject *__pyx_n_s_is_to;
static PyObject *__pyx_n_s_is_type;
static PyObject *__pyx_n_s_iscol;
static PyObject *__pyx_n_s_iscols;
static PyObject *__pyx_n_s_iset;
static PyObject *__pyx_n_s_isets;
static PyObject *__pyx_n_s_isperm;
static PyObject *__pyx_n_s_isrow;
static PyObject *__pyx_n_s_isrows;
static PyObject *__pyx_n_s_itemsize;
static PyObject *__pyx_n_s_its;
static PyObject *__pyx_n_s_ival;
static PyObject *__pyx_n_s_jacobian;
static PyObject *__pyx_n_s_jacobian_design;
static PyObject *__pyx_n_s_jacobian_state;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_kargs;
static PyObject *__pyx_kp_s_key_d_cannot_register_s_already;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_n_s_kind;
static PyObject *__pyx_n_s_klass;
static PyObject *__pyx_n_s_ksp;
static PyObject *__pyx_n_s_ksp_type;
static PyObject *__pyx_n_s_l;
static PyObject *__pyx_n_s_label;
static PyObject *__pyx_n_s_left;
static PyObject *__pyx_n_s_length;
static PyObject *__pyx_n_s_level;
static PyObject *__pyx_n_s_levels;
static PyObject *__pyx_n_s_lgmap;
static PyObject *__pyx_n_s_linear_its;
static PyObject *__pyx_n_s_lits;
static PyObject *__pyx_n_s_local;
static PyObject *__pyx_kp_s_local_and_global_sizes_cannot_be;
static PyObject *__pyx_kp_s_local_size_d_not_divisible_by_bl;
static PyObject *__pyx_n_s_localsec;
static PyObject *__pyx_n_s_locs;
static PyObject *__pyx_n_s_logFlops;
static PyObject *__pyx_n_s_lower;
static PyObject *__pyx_n_s_ltog;
static PyObject *__pyx_n_s_ltol;
static PyObject *__pyx_n_s_lv;
static PyObject *__pyx_n_s_lvecs;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_major;
static PyObject *__pyx_n_s_mallocs;
static PyObject *__pyx_n_s_map_type;
static PyObject *__pyx_n_s_mat;
static PyObject *__pyx_n_s_matMult;
static PyObject *__pyx_n_s_mat_type;
static PyObject *__pyx_n_s_mats;
static PyObject *__pyx_n_s_max_fails;
static PyObject *__pyx_n_s_max_funcs;
static PyObject *__pyx_n_s_max_it;
static PyObject *__pyx_n_s_max_steps;
static PyObject *__pyx_n_s_max_time;
static PyObject *__pyx_n_s_memo;
static PyObject *__pyx_n_s_memory;
static PyObject *__pyx_n_s_messageLength;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_mgtype;
static PyObject *__pyx_n_s_minor;
static PyObject *__pyx_n_s_mirror;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_n_s_model;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_monitor;
static PyObject *__pyx_n_s_mpi4py;
static PyObject *__pyx_kp_s_mpi4py_MPI;
static PyObject *__pyx_n_s_mpiabort;
static PyObject *__pyx_n_s_mult;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_na;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_ncycle;
static PyObject *__pyx_n_s_newsec;
static PyObject *__pyx_n_s_newvec;
static PyObject *__pyx_n_s_nleaves;
static PyObject *__pyx_n_s_nlevels;
static PyObject *__pyx_n_s_nlocal;
static PyObject *__pyx_n_s_nmax;
static PyObject *__pyx_n_s_nmin;
static PyObject *__pyx_n_s_nnz;
static PyObject *__pyx_n_s_none;
static PyObject *__pyx_n_s_nonzero;
static PyObject *__pyx_n_s_nonzero_2;
static PyObject *__pyx_n_s_norm;
static PyObject *__pyx_n_s_norm_type;
static PyObject *__pyx_n_s_normsched;
static PyObject *__pyx_n_s_normtype;
static PyObject *__pyx_n_s_nroots;
static PyObject *__pyx_n_s_nsd;
static PyObject *__pyx_n_s_nsp;
static PyObject *__pyx_n_s_nsubcomm;
static PyObject *__pyx_kp_s_null_communicator;
static PyObject *__pyx_n_s_numComp;
static PyObject *__pyx_n_s_numDof;
static PyObject *__pyx_n_s_numFields;
static PyObject *__pyx_n_s_numMessages;
static PyObject *__pyx_n_s_numProcs;
static PyObject *__pyx_n_s_numReductions;
static PyObject *__pyx_kp_s_number_of_dimensions_d_and_numbe;
static PyObject *__pyx_n_s_numcells;
static PyObject *__pyx_n_s_nz_allocated;
static PyObject *__pyx_n_s_nz_unneeded;
static PyObject *__pyx_n_s_nz_used;
static PyObject *__pyx_n_s_nzdiag;
static PyObject *__pyx_n_s_obj;
static PyObject *__pyx_n_s_object;
static PyObject *__pyx_n_s_objective;
static PyObject *__pyx_n_s_objgrad;
static PyObject *__pyx_n_s_offset;
static PyObject *__pyx_n_s_omega;
static PyObject *__pyx_kp_s_only_and;
static PyObject *__pyx_n_s_operators;
static PyObject *__pyx_n_s_option;
static PyObject *__pyx_kp_s_option_prefix_must_be_string;
static PyObject *__pyx_kp_s_option_prefix_should_not_have_sp;
static PyObject *__pyx_kp_s_option_prefix_should_not_start_w;
static PyObject *__pyx_n_s_options;
static PyObject *__pyx_n_s_opts;
static PyObject *__pyx_n_s_ord_type;
static PyObject *__pyx_n_s_order;
static PyObject *__pyx_n_s_orientation;
static PyObject *__pyx_n_s_otype;
static PyObject *__pyx_n_s_out;
static PyObject *__pyx_n_s_output;
static PyObject *__pyx_n_s_overlap;
static PyObject *__pyx_kp_s_ownership_range_size_d_and_numbe;
static PyObject *__pyx_n_s_ownership_ranges;
static PyObject *__pyx_n_s_ozz;
static PyObject *__pyx_n_s_p;
static PyObject *__pyx_n_s_p1;
static PyObject *__pyx_n_s_pEnd;
static PyObject *__pyx_n_s_pStart;
static PyObject *__pyx_n_s_parent;
static PyObject *__pyx_n_s_part_type;
static PyObject *__pyx_n_s_patch;
static PyObject *__pyx_n_s_pc;
static PyObject *__pyx_n_s_pc_type;
static PyObject *__pyx_n_s_pd;
static PyObject *__pyx_n_s_periodic;
static PyObject *__pyx_n_s_perm;
static PyObject *__pyx_n_s_petsc;
static PyObject *__pyx_n_s_petsc4py_PETSc;
static PyObject *__pyx_n_s_point;
static PyObject *__pyx_n_s_points;
static PyObject *__pyx_n_s_pop;
static PyObject *__pyx_n_s_popErrorHandler;
static PyObject *__pyx_n_s_position;
static PyObject *__pyx_n_s_positive_definite;
static PyObject *__pyx_n_s_poststep;
static PyObject *__pyx_n_s_pre;
static PyObject *__pyx_n_s_prefix;
static PyObject *__pyx_kp_s_prefix_s_name_s;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_prestep;
static PyObject *__pyx_n_s_proc_sizes;
static PyObject *__pyx_n_s_ptype;
static PyObject *__pyx_n_s_push;
static PyObject *__pyx_n_s_pushErrorHandler;
static PyObject *__pyx_n_s_py_type;
static PyObject *__pyx_n_s_python;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_q0;
static PyObject *__pyx_n_s_q1;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_r;
static PyObject *__pyx_kp_s_r_2;
static PyObject *__pyx_n_s_radius;
static PyObject *__pyx_n_s_random;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_rank;
static PyObject *__pyx_n_s_readonly;
static PyObject *__pyx_kp_s_readonly_attribute;
static PyObject *__pyx_n_s_ready;
static PyObject *__pyx_n_s_real;
static PyObject *__pyx_n_s_reason;
static PyObject *__pyx_n_s_reciprocal;
static PyObject *__pyx_n_s_refine;
static PyObject *__pyx_n_s_refine_x;
static PyObject *__pyx_n_s_refine_y;
static PyObject *__pyx_n_s_refine_z;
static PyObject *__pyx_n_s_refinementLimit;
static PyObject *__pyx_n_s_refinementUniform;
static PyObject *__pyx_n_s_registerCitation;
static PyObject *__pyx_n_s_release;
static PyObject *__pyx_n_s_remote;
static PyObject *__pyx_n_s_remove;
static PyObject *__pyx_n_s_replace;
static PyObject *__pyx_n_s_repr;
static PyObject *__pyx_n_s_reset;
static PyObject *__pyx_n_s_restart;
static PyObject *__pyx_n_s_result;
static PyObject *__pyx_n_s_reuse;
static PyObject *__pyx_n_s_reverse;
static PyObject *__pyx_n_s_rhs;
static PyObject *__pyx_n_s_right;
static PyObject *__pyx_n_s_rmap;
static PyObject *__pyx_n_s_rnd_type;
static PyObject *__pyx_n_s_rnorm;
static PyObject *__pyx_n_s_row;
static PyObject *__pyx_n_s_row_bsize;
static PyObject *__pyx_kp_s_row_indices_must_have_two_dimens;
static PyObject *__pyx_n_s_rowmap;
static PyObject *__pyx_n_s_rows;
static PyObject *__pyx_n_s_rscale;
static PyObject *__pyx_n_s_rtol;
static PyObject *__pyx_n_s_rtol_0;
static PyObject *__pyx_n_s_rtol_max;
static PyObject *__pyx_n_s_rw;
static PyObject *__pyx_kp_s_s;
static PyObject *__pyx_kp_s_s_line_d_in_s;
static PyObject *__pyx_kp_s_s_s;
static PyObject *__pyx_n_s_scale;
static PyObject *__pyx_n_s_scatter;
static PyObject *__pyx_n_s_sec;
static PyObject *__pyx_n_s_seconds;
static PyObject *__pyx_n_s_seed;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_sep;
static PyObject *__pyx_n_s_separable;
static PyObject *__pyx_n_s_setActive;
static PyObject *__pyx_n_s_setActiveAll;
static PyObject *__pyx_n_s_setAppCtx;
static PyObject *__pyx_n_s_setConvergedReason;
static PyObject *__pyx_n_s_setDM;
static PyObject *__pyx_n_s_setDefaultComm;
static PyObject *__pyx_n_s_setDiagonal;
static PyObject *__pyx_n_s_setDimension;
static PyObject *__pyx_n_s_setEquationType;
static PyObject *__pyx_n_s_setFunctionTolerances;
static PyObject *__pyx_n_s_setInitialGuessKnoll;
static PyObject *__pyx_n_s_setInitialGuessNonzero;
static PyObject *__pyx_n_s_setInterval;
static PyObject *__pyx_n_s_setIterationNumber;
static PyObject *__pyx_n_s_setKSP;
static PyObject *__pyx_n_s_setMaxFunctionEvaluations;
static PyObject *__pyx_n_s_setMaxKSPFailures;
static PyObject *__pyx_n_s_setMaxLinearSolveFailures;
static PyObject *__pyx_n_s_setMaxNonlinearStepFailures;
static PyObject *__pyx_n_s_setMaxStepFailures;
static PyObject *__pyx_n_s_setMaxSteps;
static PyObject *__pyx_n_s_setMaxTime;
static PyObject *__pyx_n_s_setNPC;
static PyObject *__pyx_n_s_setName;
static PyObject *__pyx_n_s_setNormType;
static PyObject *__pyx_n_s_setOptionsPrefix;
static PyObject *__pyx_n_s_setPCSide;
static PyObject *__pyx_n_s_setParamsEW;
static PyObject *__pyx_n_s_setProblemType;
static PyObject *__pyx_n_s_setResidualNorm;
static PyObject *__pyx_n_s_setSeed;
static PyObject *__pyx_n_s_setSizes;
static PyObject *__pyx_n_s_setStepNumber;
static PyObject *__pyx_n_s_setTime;
static PyObject *__pyx_n_s_setTimeStep;
static PyObject *__pyx_n_s_setTolerances;
static PyObject *__pyx_n_s_setType;
static PyObject *__pyx_n_s_setUseEW;
static PyObject *__pyx_n_s_setUseFD;
static PyObject *__pyx_n_s_setUseMF;
static PyObject *__pyx_n_s_setValue;
static PyObject *__pyx_n_s_setVisible;
static PyObject *__pyx_n_s_setup;
static PyObject *__pyx_n_s_sf;
static PyObject *__pyx_n_s_sf_type;
static PyObject *__pyx_n_s_shape;
static PyObject *__pyx_n_s_shift;
static PyObject *__pyx_n_s_shift_type;
static PyObject *__pyx_n_s_shiftamount;
static PyObject *__pyx_n_s_shifttype;
static PyObject *__pyx_n_s_side;
static PyObject *__pyx_kp_s_side_r_not_understood;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_kp_s_size_I_is_d_expected_d;
static PyObject *__pyx_kp_s_size_J_is_d_expected_d;
static PyObject *__pyx_kp_s_size_V_is_d_expected_d;
static PyObject *__pyx_kp_s_size_array_is_d_expected_dx_d_d;
static PyObject *__pyx_kp_s_size_d_nnz_is_d_expected_d;
static PyObject *__pyx_kp_s_size_o_nnz_is_d_expected_d;
static PyObject *__pyx_n_s_sizes;
static PyObject *__pyx_kp_s_sizes_array_should_have_d_entrie;
static PyObject *__pyx_n_s_sleep;
static PyObject *__pyx_n_s_smooths;
static PyObject *__pyx_n_s_snes;
static PyObject *__pyx_n_s_snes_type;
static PyObject *__pyx_n_s_solve;
static PyObject *__pyx_n_s_solver;
static PyObject *__pyx_n_s_sortype;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_splitOwnership;
static PyObject *__pyx_n_s_stage;
static PyObject *__pyx_n_s_star;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_starts;
static PyObject *__pyx_n_s_startswith;
static PyObject *__pyx_n_s_state;
static PyObject *__pyx_n_s_stencil_type;
static PyObject *__pyx_n_s_stencil_width;
static PyObject *__pyx_n_s_step;
static PyObject *__pyx_n_s_step_number;
static PyObject *__pyx_n_s_stol;
static PyObject *__pyx_n_s_stop;
static PyObject *__pyx_n_s_str;
static PyObject *__pyx_n_s_strides;
static PyObject *__pyx_n_s_strip;
static PyObject *__pyx_n_s_structure;
static PyObject *__pyx_n_s_subcomm;
static PyObject *__pyx_n_s_submat;
static PyObject *__pyx_n_s_submats;
static PyObject *__pyx_n_s_subminor;
static PyObject *__pyx_n_s_subvec;
static PyObject *__pyx_n_s_supp;
static PyObject *__pyx_n_s_svalue;
static PyObject *__pyx_n_s_sx;
static PyObject *__pyx_n_s_symmetric;
static PyObject *__pyx_n_s_syncFlush;
static PyObject *__pyx_n_s_syncPrint;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_tab;
static PyObject *__pyx_n_s_tao_type;
static PyObject *__pyx_n_s_tbline;
static PyObject *__pyx_n_s_tblist;
static PyObject *__pyx_n_s_theta;
static PyObject *__pyx_n_s_threshold;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_s_time_step;
static PyObject *__pyx_n_s_timestep;
static PyObject *__pyx_n_s_title;
static PyObject *__pyx_n_s_toAll;
static PyObject *__pyx_n_s_toZero;
static PyObject *__pyx_n_s_tol;
static PyObject *__pyx_n_s_traceback;
static PyObject *__pyx_n_s_traceback_2;
static PyObject *__pyx_n_s_transpose;
static PyObject *__pyx_n_s_ts_type;
static PyObject *__pyx_n_s_twist;
static PyObject *__pyx_n_s_type_registry;
static PyObject *__pyx_n_s_typestr;
static PyObject *__pyx_n_s_u;
static PyObject *__pyx_n_s_ua;
static PyObject *__pyx_kp_s_unknown_boundary_type_s;
static PyObject *__pyx_kp_s_unknown_element_type_s;
static PyObject *__pyx_kp_s_unknown_error_handler_s;
static PyObject *__pyx_kp_s_unknown_interpolation_type_s;
static PyObject *__pyx_kp_s_unknown_options_s;
static PyObject *__pyx_kp_s_unknown_scatter_mode_s;
static PyObject *__pyx_kp_s_unknown_shift_type_s;
static PyObject *__pyx_kp_s_unknown_stencil_type_s;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_upper;
static PyObject *__pyx_n_s_useClosure;
static PyObject *__pyx_n_s_useCone;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_val;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_values;
static PyObject *__pyx_kp_s_values_must_have_two_or_more_dim;
static PyObject *__pyx_n_s_varbounds;
static PyObject *__pyx_n_s_vec;
static PyObject *__pyx_n_s_vec_from;
static PyObject *__pyx_n_s_vec_to;
static PyObject *__pyx_n_s_vec_type;
static PyObject *__pyx_n_s_vecs;
static PyObject *__pyx_n_s_vectors;
static PyObject *__pyx_n_s_version;
static PyObject *__pyx_n_s_vg;
static PyObject *__pyx_n_s_view;
static PyObject *__pyx_n_s_viewer;
static PyObject *__pyx_n_s_vl;
static PyObject *__pyx_n_s_vlg;
static PyObject *__pyx_n_s_vn;
static PyObject *__pyx_n_s_vwr_type;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_kp_s_w_2;
static PyObject *__pyx_n_s_width;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_xdot;
static PyObject *__pyx_n_s_xl;
static PyObject *__pyx_n_s_xmax;
static PyObject *__pyx_n_s_xmin;
static PyObject *__pyx_n_s_xnorm;
static PyObject *__pyx_n_s_xu;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_ymax;
static PyObject *__pyx_n_s_ymin;
static PyObject *__pyx_n_s_ynorm;
static PyObject *__pyx_n_s_zeropivot;
static PyObject *__pyx_n_s_zmax;
static PyObject *__pyx_n_s_zmin;
static PyObject *__pyx_n_s_zoz;
static PyObject *__pyx_n_s_zzo;
static int __pyx_pf_8petsc4py_5PETSc_10_IS_buffer___cinit__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset); /* proto */
static void __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_2__dealloc__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_4__getbuffer__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /* proto */
static void __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_6__releasebuffer__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, Py_buffer *__pyx_v_view); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_10_IS_buffer_8__enter__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_10_IS_buffer_10__exit__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_12__getsegcount__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, Py_ssize_t *__pyx_v_lenp); /* proto */
#endif
#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_14__getreadbuffer__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p); /* proto */
#endif
static PyObject *__pyx_pf_8petsc4py_5PETSc_10_IS_buffer_19__array_interface_____get__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer___cinit__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec, int __pyx_v_readonly); /* proto */
static void __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_2__dealloc__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_4__getbuffer__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /* proto */
static void __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_6__releasebuffer__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_buffer *__pyx_v_view); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_8__enter__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_10__exit__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_12__getsegcount__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_ssize_t *__pyx_v_lenp); /* proto */
#endif
#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_14__getreadbuffer__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p); /* proto */
#endif
#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_16__getwritebuffer__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p); /* proto */
#endif
static PyObject *__pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_19__array_interface_____get__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_14_Vec_LocalForm___init__(struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *__pyx_v_self, struct PyPetscVecObject *__pyx_v_gvec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_14_Vec_LocalForm_2__enter__(struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_14_Vec_LocalForm_4__exit__(struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_1i___set__(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_1j___set__(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_1k___set__(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_1c___set__(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_5index___set__(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_5field___set__(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array___cinit__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self, struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_da, struct PyPetscVecObject *__pyx_v_vec, int __pyx_v_DOF); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_2__getitem__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_4__setitem__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_6__enter__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_8__exit__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_6starts___get__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_5sizes___get__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_5shape___get__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_7strides___get__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_5array___get__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_19_DMComposite_access___cinit__(struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm, struct PyPetscVecObject *__pyx_v_gvec, PyObject *__pyx_v_locs); /* proto */
static void __pyx_pf_8petsc4py_5PETSc_19_DMComposite_access_2__dealloc__(struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_19_DMComposite_access_4__enter__(struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_19_DMComposite_access_6__exit__(struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5Error___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_ierr); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5Error_2__nonzero__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5Error_4__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5Error_6__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_7Options___init__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static void __pyx_pf_8petsc4py_5PETSc_7Options_2__dealloc__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_7Options_4__contains__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_6__getitem__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_7Options_8__setitem__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_7Options_10__delitem__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_6prefix___get__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_7Options_6prefix_2__set__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_7Options_6prefix_4__del__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_12create(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_14destroy(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_16clear(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_18view(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_20setFromOptions(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_22prefixPush(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_24prefixPop(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_26hasName(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_28setValue(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_30delValue(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_32getBool(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_34getInt(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_36getReal(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_38getScalar(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_40getString(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_42getAll(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_getVersion(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_patch, PyObject *__pyx_v_devel, PyObject *__pyx_v_date, PyObject *__pyx_v_author); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_2getVersionInfo(CYTHON_UNUSED PyTypeObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_4isInitialized(CYTHON_UNUSED PyTypeObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_6isFinalized(CYTHON_UNUSED PyTypeObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_8getDefaultComm(CYTHON_UNUSED PyTypeObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_10setDefaultComm(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_12Print(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_14syncPrint(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_16syncFlush(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_18splitOwnership(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_20sleep(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_seconds); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_22pushErrorHandler(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_errhandler); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_24popErrorHandler(CYTHON_UNUSED PyTypeObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_26infoAllow(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_28registerCitation(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_citation); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_Stage(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_2Class(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_4Event(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_name, PyObject *__pyx_v_klass); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_6begin(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_all); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_8view(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_10destroy(CYTHON_UNUSED PyTypeObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_12logFlops(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_flops); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_14addFlops(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_flops); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_16getFlops(CYTHON_UNUSED PyTypeObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_18getTime(CYTHON_UNUSED PyTypeObject *__pyx_v_cls); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_20getCPUTime(CYTHON_UNUSED PyTypeObject *__pyx_v_cls); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_8LogStage___cinit__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_2__int__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_4__enter__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_6__exit__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_8push(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_10pop(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_12getName(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_4name___get__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_8LogStage_4name_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_14activate(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_16deactivate(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_18getActive(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_20setActive(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_6active___get__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_8LogStage_6active_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_22getVisible(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_24setVisible(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_7visible___get__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_8LogStage_7visible_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_2id___get__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_8LogClass___cinit__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_2__int__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_4getName(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_4name___get__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_8LogClass_4name_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_6activate(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_8deactivate(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_10getActive(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_12setActive(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_6active___get__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_8LogClass_6active_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_2id___get__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_8LogEvent___cinit__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_2__int__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_4__enter__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_6__exit__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_8begin(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_objs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_10end(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_objs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_12barrierBegin(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, struct PyPetscCommObject *__pyx_v_comm, PyObject *__pyx_v_objs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_14barrierEnd(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, struct PyPetscCommObject *__pyx_v_comm, PyObject *__pyx_v_objs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_16getName(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_4name___get__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_8LogEvent_4name_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_18activate(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_20deactivate(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_22getActive(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_24setActive(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_6active___get__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_8LogEvent_6active_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_26getActiveAll(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_28setActiveAll(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_10active_all___get__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_8LogEvent_10active_all_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_30getPerfInfo(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_stage); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_2id___get__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4Comm___cinit__(struct PyPetscCommObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static void __pyx_pf_8petsc4py_5PETSc_4Comm_2__dealloc__(struct PyPetscCommObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_4__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4Comm_6__nonzero__(struct PyPetscCommObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_8destroy(struct PyPetscCommObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_10duplicate(struct PyPetscCommObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_12getSize(struct PyPetscCommObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_14getRank(struct PyPetscCommObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_16barrier(struct PyPetscCommObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_4size___get__(struct PyPetscCommObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_4rank___get__(struct PyPetscCommObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_7fortran___get__(struct PyPetscCommObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_18tompi4py(struct PyPetscCommObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_6Object___cinit__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static void __pyx_pf_8petsc4py_5PETSc_6Object_2__dealloc__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_4__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_6Object_6__nonzero__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_8__copy__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_10__deepcopy__(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_12view(struct PyPetscObjectObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_14destroy(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_16getType(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_18setOptionsPrefix(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_20getOptionsPrefix(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_22setFromOptions(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_24getComm(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_26getName(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_28setName(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_30getClassId(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_32getClassName(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_34getRefCount(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_36compose(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_name, struct PyPetscObjectObject *__pyx_v_obj); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_38query(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_40incRef(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_42decRef(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_44getAttr(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_46setAttr(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_48getDict(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_50stateIncrease(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_52incrementTabLevel(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_tab, struct PyPetscObjectObject *__pyx_v_parent); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_54setTabLevel(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_56getTabLevel(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_4type___get__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_6Object_4type_2__set__(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_6prefix___get__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_6Object_6prefix_2__set__(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_4comm___get__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_4name___get__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_6Object_4name_2__set__(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_7classid___get__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_5klass___get__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_8refcount___get__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_6handle___get__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_7fortran___get__(struct PyPetscObjectObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_6Viewer___cinit__(struct PyPetscViewerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_2__call__(struct PyPetscViewerObject *__pyx_v_self, struct PyPetscObjectObject *__pyx_v_obj); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_4view(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_obj); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_6destroy(struct PyPetscViewerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_8create(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_10createASCII(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_12createBinary(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_14createMPIIO(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_16createVTK(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_18createHDF5(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_20createNetCDF(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_22createDraw(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_display, PyObject *__pyx_v_title, PyObject *__pyx_v_position, PyObject *__pyx_v_size, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_24setType(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_vwr_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_26getType(struct PyPetscViewerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_28getFormat(struct PyPetscViewerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_30pushFormat(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_format); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_32popFormat(struct PyPetscViewerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_34STDOUT(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_36STDERR(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_38ASCII(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_name, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_40BINARY(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_42DRAW(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_44flush(struct PyPetscViewerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_46setFileMode(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_48getFileMode(struct PyPetscViewerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_50setFileName(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_52getFileName(struct PyPetscViewerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_54setDrawInfo(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_display, PyObject *__pyx_v_title, PyObject *__pyx_v_position, PyObject *__pyx_v_size); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_56clearDraw(struct PyPetscViewerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_create(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_2getTimestep(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_4setTimestep(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self, PyObject *__pyx_v_timestep); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_6incrementTimestep(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_8pushGroup(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self, PyObject *__pyx_v_group); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_10popGroup(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_12getGroup(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_6Random___cinit__(struct PyPetscRandomObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_2__call__(struct PyPetscRandomObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_4view(struct PyPetscRandomObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_6destroy(struct PyPetscRandomObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_8create(struct PyPetscRandomObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_10setType(struct PyPetscRandomObject *__pyx_v_self, PyObject *__pyx_v_rnd_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_12getType(struct PyPetscRandomObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_14setFromOptions(struct PyPetscRandomObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_16getValue(struct PyPetscRandomObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_18getValueReal(struct PyPetscRandomObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_20getSeed(struct PyPetscRandomObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_22setSeed(struct PyPetscRandomObject *__pyx_v_self, PyObject *__pyx_v_seed); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_24getInterval(struct PyPetscRandomObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_26setInterval(struct PyPetscRandomObject *__pyx_v_self, PyObject *__pyx_v_interval); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_4seed___get__(struct PyPetscRandomObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_6Random_4seed_2__set__(struct PyPetscRandomObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_8interval___get__(struct PyPetscRandomObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_6Random_8interval_2__set__(struct PyPetscRandomObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2IS___cinit__(struct PyPetscISObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2IS_2__getbuffer__(struct PyPetscISObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /* proto */
static void __pyx_pf_8petsc4py_5PETSc_2IS_4__releasebuffer__(struct PyPetscISObject *__pyx_v_self, Py_buffer *__pyx_v_view); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_6__enter__(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_8__exit__(struct PyPetscISObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_10view(struct PyPetscISObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_12destroy(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_14create(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_16setType(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_is_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_18getType(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_20createGeneral(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_22createBlock(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_bsize, PyObject *__pyx_v_indices, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_24createStride(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_first, PyObject *__pyx_v_step, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_26duplicate(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_28copy(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_result); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_30load(struct PyPetscISObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_32allGather(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_34toGeneral(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_36invertPermutation(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_nlocal); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_38getSize(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_40getLocalSize(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_42getSizes(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_44getBlockSize(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_46setBlockSize(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_bs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_48sort(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_50isSorted(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_52setPermutation(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_54isPermutation(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_56setIdentity(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_58isIdentity(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_60equal(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_62sum(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_64expand(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_66union(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_68difference(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_70complement(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_nmin, PyObject *__pyx_v_nmax); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_72embed(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset, PyObject *__pyx_v_drop); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_74setIndices(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_indices); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_76getIndices(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_78setBlockIndices(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_bsize, PyObject *__pyx_v_indices); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_80getBlockIndices(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_82setStride(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_first, PyObject *__pyx_v_step); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_84getStride(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_86getInfo(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_11permutation___get__(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_8identity___get__(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_6sorted___get__(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_5sizes___get__(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_4size___get__(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_10local_size___get__(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_10block_size___get__(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_7indices___get__(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_5array___get__(struct PyPetscISObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_19__array_interface_____get__(struct PyPetscISObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_5LGMap___cinit__(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_2__call__(struct PyPetscLGMapObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_result); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_4view(struct PyPetscLGMapObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_6destroy(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_8create(struct PyPetscLGMapObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_10createIS(struct PyPetscLGMapObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_12createSF(struct PyPetscLGMapObject *__pyx_v_self, struct PyPetscSFObject *__pyx_v_sf, PyObject *__pyx_v_start); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_14getSize(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_16getBlockSize(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_18getIndices(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_20getBlockIndices(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_22getInfo(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_24getBlockInfo(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_26apply(struct PyPetscLGMapObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_result); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_28applyBlock(struct PyPetscLGMapObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_result); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_30applyIS(struct PyPetscLGMapObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_32applyInverse(struct PyPetscLGMapObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_map_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_34applyBlockInverse(struct PyPetscLGMapObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_map_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_4size___get__(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_10block_size___get__(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_7indices___get__(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_13block_indices___get__(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_4info___get__(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_10block_info___get__(struct PyPetscLGMapObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3Vec___cinit__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_2__pos__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_4__neg__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_6__abs__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_8__iadd__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_10__isub__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_12__imul__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_14__idiv__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#endif
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_16__itruediv__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_18__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_20__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_22__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_24__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#endif
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_26__truediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_28__getitem__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_i); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3Vec_30__setitem__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_v); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3Vec_32__getbuffer__(struct PyPetscVecObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /* proto */
static void __pyx_pf_8petsc4py_5PETSc_3Vec_34__releasebuffer__(struct PyPetscVecObject *__pyx_v_self, Py_buffer *__pyx_v_view); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_36__enter__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_38__exit__(struct PyPetscVecObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_40view(struct PyPetscVecObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_42destroy(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_44create(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_46setType(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vec_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_48setSizes(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_50createSeq(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_52createMPI(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_54createWithArray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_array, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_56createGhost(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_ghosts, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_58createGhostWithArray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_ghosts, PyObject *__pyx_v_array, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_60createShared(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_62createNest(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_isets, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_64setOptionsPrefix(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_66getOptionsPrefix(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_68setFromOptions(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_70setUp(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_72setOption(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_option, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_74getType(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_76getSize(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_78getLocalSize(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_80getSizes(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_82setBlockSize(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_bsize); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_84getBlockSize(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_86getOwnershipRange(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_88getOwnershipRanges(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_90getBuffer(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_readonly); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_92getArray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_readonly); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_94setArray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_array); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_96placeArray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_array); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_98resetArray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_force); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_100getCUDAHandle(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_102restoreCUDAHandle(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_handle, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_104duplicate(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_array); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_106copy(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_result); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_108chop(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_tol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_110load(struct PyPetscVecObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_112equal(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_114dot(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_116dotBegin(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_118dotEnd(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_120tDot(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_122tDotBegin(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_124tDotEnd(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_126mDot(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_128mDotBegin(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_130mDotEnd(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_132mtDot(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_134mtDotBegin(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_136mtDotEnd(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_138norm(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_norm_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_140normBegin(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_norm_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_142normEnd(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_norm_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_144sum(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_146min(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_148max(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_150normalize(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_152reciprocal(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_154exp(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_156log(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_158sqrtabs(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_160abs(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_162conjugate(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_164setRandom(struct PyPetscVecObject *__pyx_v_self, struct PyPetscRandomObject *__pyx_v_random); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_166permute(struct PyPetscVecObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_order, PyObject *__pyx_v_invert); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_168zeroEntries(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_170set(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_172isset(struct PyPetscVecObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_idx, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_174scale(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_176shift(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_178chop(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_tol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_180swap(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_182axpy(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_184isaxpy(struct PyPetscVecObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_idx, PyObject *__pyx_v_alpha, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_186aypx(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_188axpby(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha, PyObject *__pyx_v_beta, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_190waxpy(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_192maxpy(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alphas, PyObject *__pyx_v_vecs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_194pointwiseMult(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_196pointwiseDivide(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_198pointwiseMin(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_200pointwiseMax(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_202pointwiseMaxAbs(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_204maxPointwiseDivide(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_206getValue(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_208getValues(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_values); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_210setValue(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_212setValues(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_values, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_214setValuesBlocked(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_values, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_216setLGMap(struct PyPetscVecObject *__pyx_v_self, struct PyPetscLGMapObject *__pyx_v_lgmap); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_218setValueLocal(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_220setValuesLocal(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_values, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_222setValuesBlockedLocal(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_values, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_224assemblyBegin(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_226assemblyEnd(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_228assemble(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_230strideScale(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_232strideSum(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_234strideMin(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_236strideMax(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_238strideNorm(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_norm_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_240strideScatter(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field, struct PyPetscVecObject *__pyx_v_vec, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_242strideGather(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field, struct PyPetscVecObject *__pyx_v_vec, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_244localForm(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_246ghostUpdateBegin(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_248ghostUpdateEnd(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_250ghostUpdate(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_252setMPIGhost(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_ghosts); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_254getSubVector(struct PyPetscVecObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset, struct PyPetscVecObject *__pyx_v_subvec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_256restoreSubVector(struct PyPetscVecObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset, struct PyPetscVecObject *__pyx_v_subvec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_258getNestSubVecs(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_260setNestSubVecs(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_sx, PyObject *__pyx_v_idxm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_5sizes___get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3Vec_5sizes_2__set__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_4size___get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_10local_size___get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_10block_size___get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_11owner_range___get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_12owner_ranges___get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_8buffer_w___get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_8buffer_r___get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_7array_w___get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3Vec_7array_w_2__set__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_7array_r___get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_6buffer___get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_5array___get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3Vec_5array_2__set__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_19__array_interface_____get__(struct PyPetscVecObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_7Scatter___cinit__(struct PyPetscScatterObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_2__call__(struct PyPetscScatterObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_4view(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_6destroy(struct PyPetscScatterObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_8create(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec_from, struct PyPetscISObject *__pyx_v_is_from, struct PyPetscVecObject *__pyx_v_vec_to, struct PyPetscISObject *__pyx_v_is_to); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_10copy(struct PyPetscScatterObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_12toAll(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_14toZero(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_16begin(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec_from, struct PyPetscVecObject *__pyx_v_vec_to, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_18end(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec_from, struct PyPetscVecObject *__pyx_v_vec_to, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_20scatterBegin(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec_from, struct PyPetscVecObject *__pyx_v_vec_to, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_22scatterEnd(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec_from, struct PyPetscVecObject *__pyx_v_vec_to, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_24scatter(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec_from, struct PyPetscVecObject *__pyx_v_vec_to, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_7Section___cinit__(struct PyPetscSectionObject *__pyx_v_self); /* proto */
static void __pyx_pf_8petsc4py_5PETSc_7Section_2__dealloc__(struct PyPetscSectionObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_4view(struct PyPetscSectionObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_6destroy(struct PyPetscSectionObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_8create(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_10clone(struct PyPetscSectionObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_12setUp(struct PyPetscSectionObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_14reset(struct PyPetscSectionObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_16getNumFields(struct PyPetscSectionObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_18setNumFields(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_numFields); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_20getFieldName(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_field); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_22setFieldName(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_fieldName); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_24getFieldComponents(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_field); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_26setFieldComponents(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_numComp); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_28getChart(struct PyPetscSectionObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_30setChart(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_pStart, PyObject *__pyx_v_pEnd); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_32getDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_34setDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_numDof); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_36addDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_numDof); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_38getFieldDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_40setFieldDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field, PyObject *__pyx_v_numDof); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_42addFieldDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field, PyObject *__pyx_v_numDof); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_44getConstraintDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_46setConstraintDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_numDof); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_48addConstraintDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_numDof); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_50getFieldConstraintDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_52setFieldConstraintDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field, PyObject *__pyx_v_numDof); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_54addFieldConstraintDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field, PyObject *__pyx_v_numDof); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_56getConstraintIndices(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_58setConstraintIndices(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_indices); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_60getFieldConstraintIndices(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_62setFieldConstraintIndices(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field, PyObject *__pyx_v_indices); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_64getMaxDof(struct PyPetscSectionObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_66getStorageSize(struct PyPetscSectionObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_68getConstrainedStorageSize(struct PyPetscSectionObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_70getOffset(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_72setOffset(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_offset); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_74getOffsetRange(struct PyPetscSectionObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_76createGlobalSection(struct PyPetscSectionObject *__pyx_v_self, struct PyPetscSFObject *__pyx_v_sf); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3Mat___cinit__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_2__pos__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_4__neg__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_6__iadd__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_8__isub__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_10__imul__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_12__idiv__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#endif
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_14__itruediv__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_16__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_18__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_20__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_22__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#endif
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_24__truediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_26__getitem__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_ij); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3Mat_28__setitem__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_ij, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_30__call__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_32view(struct PyPetscMatObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_34destroy(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_36create(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_38setType(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_mat_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_40setSizes(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_42setBlockSize(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_bsize); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_44setBlockSizes(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row_bsize, PyObject *__pyx_v_col_bsize); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_46createAIJ(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_nnz, PyObject *__pyx_v_csr, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_48createBAIJ(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_nnz, PyObject *__pyx_v_csr, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_50createSBAIJ(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_nnz, PyObject *__pyx_v_csr, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_52createAIJCRL(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_nnz, PyObject *__pyx_v_csr, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_54setPreallocationNNZ(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_nnz); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_56setPreallocationCSR(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_csr); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_58createAIJWithArrays(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_csr, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_60createDense(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_array, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_62setPreallocationDense(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_array); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_64createScatter(struct PyPetscMatObject *__pyx_v_self, struct PyPetscScatterObject *__pyx_v_scatter, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_66createNormal(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_68createTranspose(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_70createLRC(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_A, struct PyPetscMatObject *__pyx_v_U, struct PyPetscMatObject *__pyx_v_V); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_72createSubMatrix(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_A, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_74createNest(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_mats, PyObject *__pyx_v_isrows, PyObject *__pyx_v_iscols, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_76createPython(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_context, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_78setPythonContext(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_80getPythonContext(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_82setPythonType(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_py_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_84setOptionsPrefix(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_86getOptionsPrefix(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_88setFromOptions(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_90setUp(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_92setOption(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_option, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_94getType(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_96getSize(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_98getLocalSize(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_100getSizes(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_102getBlockSize(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_104getBlockSizes(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_106getOwnershipRange(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_108getOwnershipRanges(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_110getOwnershipRangeColumn(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_112getOwnershipRangesColumn(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_114getOwnershipIS(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_116getInfo(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_info); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_118duplicate(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_copy); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_120copy(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_result, PyObject *__pyx_v_structure); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_122load(struct PyPetscMatObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_124convert(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_mat_type, struct PyPetscMatObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_126transpose(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_128realPart(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_130imagPart(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_132conjugate(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_134permute(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_row, struct PyPetscISObject *__pyx_v_col); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_136equal(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_138isTranspose(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, PyObject *__pyx_v_tol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_140isSymmetric(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_tol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_142isSymmetricKnown(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_144isHermitian(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_tol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_146isHermitianKnown(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_148isStructurallySymmetric(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_150zeroEntries(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_152getValue(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row, PyObject *__pyx_v_col); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_154getValues(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_cols, PyObject *__pyx_v_values); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_156getValuesCSR(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_158getRow(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_160getRowIJ(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_symmetric, PyObject *__pyx_v_compressed); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_162getColumnIJ(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_symmetric, PyObject *__pyx_v_compressed); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_164setValue(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row, PyObject *__pyx_v_col, PyObject *__pyx_v_value, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_166setValues(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_cols, PyObject *__pyx_v_values, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_168setValuesRCV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_R, PyObject *__pyx_v_C, PyObject *__pyx_v_V, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_170setValuesIJV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv, PyObject *__pyx_v_rowmap); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_172setValuesCSR(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_174setValuesBlocked(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_cols, PyObject *__pyx_v_values, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_176setValuesBlockedRCV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_R, PyObject *__pyx_v_C, PyObject *__pyx_v_V, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_178setValuesBlockedIJV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv, PyObject *__pyx_v_rowmap); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_180setValuesBlockedCSR(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_182setLGMap(struct PyPetscMatObject *__pyx_v_self, struct PyPetscLGMapObject *__pyx_v_rmap, struct PyPetscLGMapObject *__pyx_v_cmap); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_184setValueLocal(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row, PyObject *__pyx_v_col, PyObject *__pyx_v_value, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_186setValuesLocal(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_cols, PyObject *__pyx_v_values, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_188setValuesLocalRCV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_R, PyObject *__pyx_v_C, PyObject *__pyx_v_V, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_190setValuesLocalIJV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv, PyObject *__pyx_v_rowmap); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_192setValuesLocalCSR(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_194setValuesBlockedLocal(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_cols, PyObject *__pyx_v_values, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_196setValuesBlockedLocalRCV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_R, PyObject *__pyx_v_C, PyObject *__pyx_v_V, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_198setValuesBlockedLocalIJV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv, PyObject *__pyx_v_rowmap); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_200setValuesBlockedLocalCSR(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_202setStencil(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_dims, PyObject *__pyx_v_starts, PyObject *__pyx_v_dof); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_204setValueStencil(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row, PyObject *__pyx_v_col, PyObject *__pyx_v_value, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_206setValueBlockedStencil(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row, PyObject *__pyx_v_col, PyObject *__pyx_v_value, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_208zeroRows(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_diag, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_210zeroRowsLocal(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_diag, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_212zeroRowsColumns(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_diag, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_214storeValues(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_216retrieveValues(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_218assemblyBegin(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_assembly); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_220assemblyEnd(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_assembly); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_222assemble(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_assembly); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_224isAssembled(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_226createVecs(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_side); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_228createVecRight(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_230createVecLeft(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_232getColumnVector(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_column, struct PyPetscVecObject *__pyx_v_result); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_234getRedundantMatrix(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_nsubcomm, PyObject *__pyx_v_subcomm, struct PyPetscMatObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_236getDiagonal(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_result); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_238getRowSum(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_result); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_240setDiagonal(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_diag, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_242diagonalScale(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_L, struct PyPetscVecObject *__pyx_v_R); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_244invertBlockDiagonal(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_246setNullSpace(struct PyPetscMatObject *__pyx_v_self, struct PyPetscNullSpaceObject *__pyx_v_nsp); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_248getNullSpace(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_250setNearNullSpace(struct PyPetscMatObject *__pyx_v_self, struct PyPetscNullSpaceObject *__pyx_v_nsp); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_252getNearNullSpace(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_254mult(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_256multAdd(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_v, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_258multTranspose(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_260multTransposeAdd(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_v, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_262multHermitian(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_264multHermitianAdd(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_v, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_266SOR(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x, PyObject *__pyx_v_omega, PyObject *__pyx_v_sortype, PyObject *__pyx_v_shift, PyObject *__pyx_v_its, PyObject *__pyx_v_lits); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_268getDiagonalBlock(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_270increaseOverlap(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset, PyObject *__pyx_v_overlap); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_272getSubMatrix(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, struct PyPetscMatObject *__pyx_v_submat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_274getSubMatrices(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_isrows, PyObject *__pyx_v_iscols, PyObject *__pyx_v_submats); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_276getLocalSubMatrix(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, struct PyPetscMatObject *__pyx_v_submat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_278restoreLocalSubMatrix(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, struct PyPetscMatObject *__pyx_v_submat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_280norm(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_norm_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_282scale(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_284shift(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_286chop(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_tol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_288axpy(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_alpha, struct PyPetscMatObject *__pyx_v_X, PyObject *__pyx_v_structure); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_290aypx(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_alpha, struct PyPetscMatObject *__pyx_v_X, PyObject *__pyx_v_structure); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_292matMultSymbolic(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, PyObject *__pyx_v_fill); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_294matMultNumeric(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, struct PyPetscMatObject *__pyx_v_result); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_296matMult(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, struct PyPetscMatObject *__pyx_v_result, PyObject *__pyx_v_fill); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_298matTransposeMult(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, struct PyPetscMatObject *__pyx_v_result, PyObject *__pyx_v_fill); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_300transposeMatMult(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, struct PyPetscMatObject *__pyx_v_result, PyObject *__pyx_v_fill); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_302getOrdering(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_ord_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_304reorderForNonzeroDiagonal(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, PyObject *__pyx_v_atol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_306factorLU(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_308factorSymbolicLU(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_310factorNumericLU(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_312factorILU(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_314factorSymbolicILU(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_316factorCholesky(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isperm, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_318factorSymbolicCholesky(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isperm, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_320factorNumericCholesky(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_322factorICC(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isperm, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_324factorSymbolicICC(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isperm, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_326getInertia(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_328setUnfactored(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_330setMumpsIcntl(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl, PyObject *__pyx_v_ival); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_332getMumpsIcntl(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_334setMumpsCntl(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl, PyObject *__pyx_v_val); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_336getMumpsCntl(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_338getMumpsInfo(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_340getMumpsInfog(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_342getMumpsRinfo(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_344getMumpsRinfog(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_346solveForward(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_348solveBackward(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_350solve(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_352solveTranspose(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_354solveAdd(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_y, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_356solveTransposeAdd(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_y, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_358matSolve(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_B, struct PyPetscMatObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_360getDenseArray(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_362getDenseLocalMatrix(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_5sizes___get__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3Mat_5sizes_2__set__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_4size___get__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_10local_size___get__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_10block_size___get__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_11block_sizes___get__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_11owner_range___get__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_12owner_ranges___get__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_9assembled___get__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_9symmetric___get__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_9hermitian___get__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_10structsymm___get__(struct PyPetscMatObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_9NullSpace___cinit__(struct PyPetscNullSpaceObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_2__call__(struct PyPetscNullSpaceObject *__pyx_v_self, PyObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_4view(struct PyPetscNullSpaceObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_6destroy(struct PyPetscNullSpaceObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_8create(struct PyPetscNullSpaceObject *__pyx_v_self, PyObject *__pyx_v_constant, PyObject *__pyx_v_vectors, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_10createRigidBody(struct PyPetscNullSpaceObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_coords); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_12setFunction(struct PyPetscNullSpaceObject *__pyx_v_self, PyObject *__pyx_v_function, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_14hasConstant(struct PyPetscNullSpaceObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_16getVecs(struct PyPetscNullSpaceObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_18getFunction(struct PyPetscNullSpaceObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_20remove(struct PyPetscNullSpaceObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2PC___cinit__(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_2__call__(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_4view(struct PyPetscPCObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_6destroy(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_8create(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_10setType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_pc_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_12getType(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_14setOptionsPrefix(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_16getOptionsPrefix(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_18setFromOptions(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_20setOperators(struct PyPetscPCObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_A, struct PyPetscMatObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_22getOperators(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_24setUseAmat(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_26setUp(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_28reset(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_30setUpOnBlocks(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_32apply(struct PyPetscPCObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_34applyTranspose(struct PyPetscPCObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_36applySymmetricLeft(struct PyPetscPCObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_38applySymmetricRight(struct PyPetscPCObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_40getDM(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_42setDM(struct PyPetscPCObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_44setCoordinates(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_coordinates); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_46createPython(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_48setPythonContext(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_50getPythonContext(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_52setPythonType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_py_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_54setASMType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_asmtype); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_56setASMOverlap(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_overlap); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_58setASMLocalSubdomains(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_nsd); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_60setASMTotalSubdomains(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_nsd); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_62getASMSubKSP(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_64setGASMType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_gasmtype); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_66setGASMOverlap(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_overlap); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_68setGAMGType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_gamgtype); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_70setGAMGLevels(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_levels); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_72setGAMGSmooths(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_smooths); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_74getHYPREType(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_76setHYPREType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_hypretype); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_78setHYPREDiscreteCurl(struct PyPetscPCObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_80setHYPREDiscreteGradient(struct PyPetscPCObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_82setHYPRESetAlphaPoissonMatrix(struct PyPetscPCObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_84setHYPRESetBetaPoissonMatrix(struct PyPetscPCObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_86setHYPRESetEdgeConstantVectors(struct PyPetscPCObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_ozz, struct PyPetscVecObject *__pyx_v_zoz, struct PyPetscVecObject *__pyx_v_zzo); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_88setFactorSolverPackage(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_solver); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_90getFactorSolverPackage(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_92setFactorOrdering(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_ord_type, PyObject *__pyx_v_nzdiag, PyObject *__pyx_v_reuse); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_94setFactorPivot(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_zeropivot, PyObject *__pyx_v_inblocks); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_96setFactorShift(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_shift_type, PyObject *__pyx_v_amount); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_98setFactorLevels(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_levels); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_100getFactorMatrix(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_102setFieldSplitType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_ctype); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_104setFieldSplitIS(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_fields); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_106setFieldSplitFields(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_bsize, PyObject *__pyx_v_fields); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_108getFieldSplitSubKSP(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_110setFieldSplitSchurFactType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_ctype); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_112setFieldSplitSchurPreType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_ptype, struct PyPetscMatObject *__pyx_v_pre); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_114setReusePreconditioner(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_116setCompositeType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_ctype); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_118getCompositePC(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_120addCompositePC(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_pc_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_122getKSP(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_124getMGType(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_126setMGType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_mgtype); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_128getMGLevels(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_130getMGCoarseSolve(struct PyPetscPCObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_132setMGInterpolation(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_134getMGInterpolation(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_136setMGRestriction(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_138getMGRestriction(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_140setMGRScale(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscVecObject *__pyx_v_rscale); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_142getMGRScale(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_144getMGSmoother(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_146getMGSmootherDown(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_148getMGSmootherUp(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_150setMGCyclesOnLevel(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, PyObject *__pyx_v_ncycle); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_152setMGRhs(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscVecObject *__pyx_v_rhs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_154setMGX(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_156setMGR(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscVecObject *__pyx_v_r); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP___cinit__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_2__call__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_b, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_4view(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6destroy(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_8create(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_10setType(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_ksp_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_12getType(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_14setOptionsPrefix(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_16getOptionsPrefix(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_18setFromOptions(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_20setAppCtx(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_appctx); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_22getAppCtx(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_24getDM(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_26setDM(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_28setDMActive(struct PyPetscKSPObject *__pyx_v_self, int __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_30setComputeRHS(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_rhs, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_32setComputeOperators(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_operators, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_34setOperators(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_A, struct PyPetscMatObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_36getOperators(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_38setPC(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscPCObject *__pyx_v_pc); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_40getPC(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_42setTolerances(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_rtol, PyObject *__pyx_v_atol, PyObject *__pyx_v_divtol, PyObject *__pyx_v_max_it); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_44getTolerances(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_46setConvergenceTest(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_converged, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_48getConvergenceTest(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_50callConvergenceTest(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_its, PyObject *__pyx_v_rnorm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_52setConvergenceHistory(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_length, PyObject *__pyx_v_reset); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_54getConvergenceHistory(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_56logConvergenceHistory(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_rnorm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_58setMonitor(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_monitor, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_60getMonitor(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_62cancelMonitor(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_64monitor(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_its, PyObject *__pyx_v_rnorm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_66setPCSide(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_side); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_68getPCSide(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_70setNormType(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_normtype); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_72getNormType(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_74setComputeEigenvalues(struct PyPetscKSPObject *__pyx_v_self, int __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_76getComputeEigenvalues(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_78setComputeSingularValues(struct PyPetscKSPObject *__pyx_v_self, int __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_80getComputeSingularValues(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_82setInitialGuessNonzero(struct PyPetscKSPObject *__pyx_v_self, int __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_84getInitialGuessNonzero(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_86setInitialGuessKnoll(struct PyPetscKSPObject *__pyx_v_self, int __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_88getInitialGuessKnoll(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_90setUseFischerGuess(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_model, PyObject *__pyx_v_size); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_92setUp(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_94reset(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_96setUpOnBlocks(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_98solve(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_100solveTranspose(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_102setIterationNumber(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_its); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_104getIterationNumber(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_106setResidualNorm(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_rnorm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_108getResidualNorm(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_110setConvergedReason(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_reason); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_112getConvergedReason(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_114getRhs(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_116getSolution(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_118getWorkVecs(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_right, PyObject *__pyx_v_left); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_120buildSolution(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_122buildResidual(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_r); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_124computeEigenvalues(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_126computeExtremeSingularValues(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_128setGMRESRestart(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_restart); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_130createPython(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_132setPythonContext(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_134getPythonContext(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_136setPythonType(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_py_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6appctx___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_6appctx_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_2dm___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_2dm_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_7vec_sol___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_7vec_rhs___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6mat_op___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6mat_pc___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_13guess_nonzero___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_13guess_nonzero_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_11guess_knoll___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_11guess_knoll_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_2pc___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_7pc_side___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_7pc_side_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_9norm_type___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_9norm_type_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_4rtol___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_4rtol_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_4atol___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_4atol_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6divtol___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_6divtol_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6max_it___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_6max_it_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_3its___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_3its_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_4norm___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_4norm_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_7history___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6reason___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3KSP_6reason_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_9iterating___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_9converged___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_8diverged___get__(struct PyPetscKSPObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES___cinit__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_2view(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_4destroy(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6create(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_8setType(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_snes_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_10getType(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_12setOptionsPrefix(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_14getOptionsPrefix(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_16setFromOptions(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_18setAppCtx(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_appctx); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_20getAppCtx(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_22getDM(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_24setDM(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_26setFASInterpolation(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_28getFASInterpolation(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_30setFASRestriction(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_32getFASRestriction(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_34setFASInjection(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_36getFASInjection(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_38setFASRScale(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_40setFASLevels(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_levels, PyObject *__pyx_v_comms); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_42getFASLevels(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_44getFASCycleSNES(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_46getFASCoarseSolve(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_48getFASSmoother(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_50getFASSmootherDown(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_52getFASSmootherUp(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_54getNPC(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_56hasNPC(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_58setNPC(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscSNESObject *__pyx_v_snes); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_60setInitialGuess(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_initialguess, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_62getInitialGuess(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_64setFunction(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_function, struct PyPetscVecObject *__pyx_v_f, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_66getFunction(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_68setUpdate(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_update, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_70getUpdate(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_72setJacobian(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_jacobian, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_74getJacobian(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_76setObjective(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_objective, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_78getObjective(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_80computeFunction(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_82computeJacobian(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_84computeObjective(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_86setTolerances(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_rtol, PyObject *__pyx_v_atol, PyObject *__pyx_v_stol, PyObject *__pyx_v_max_it); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_88getTolerances(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_90setNormSchedule(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_normsched); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_92getNormSchedule(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_94setConvergenceTest(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_converged, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_96getConvergenceTest(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_98callConvergenceTest(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_its, PyObject *__pyx_v_xnorm, PyObject *__pyx_v_ynorm, PyObject *__pyx_v_fnorm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_100setConvergenceHistory(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_length, PyObject *__pyx_v_reset); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_102getConvergenceHistory(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_104logConvergenceHistory(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_norm, PyObject *__pyx_v_linear_its); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_106setResetCounters(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_reset); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_108setMonitor(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_monitor, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_110getMonitor(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_112cancelMonitor(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_114monitor(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_its, PyObject *__pyx_v_rnorm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_116setMaxFunctionEvaluations(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_max_funcs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_118getMaxFunctionEvaluations(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_120getFunctionEvaluations(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_122setMaxStepFailures(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_max_fails); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_124getMaxStepFailures(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_126getStepFailures(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_128setMaxKSPFailures(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_max_fails); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_130getMaxKSPFailures(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_132getKSPFailures(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_134setUp(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_136reset(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_138solve(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_140setConvergedReason(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_reason); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_142getConvergedReason(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_144setIterationNumber(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_its); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_146getIterationNumber(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_148getLinearSolveIterations(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_150getRhs(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_152getSolution(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_154setSolution(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_156getSolutionUpdate(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_158setKSP(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscKSPObject *__pyx_v_ksp); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_160getKSP(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_162setUseEW(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_flag, PyObject *__pyx_v_targs, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_164getUseEW(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_166setParamsEW(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_version, PyObject *__pyx_v_rtol_0, PyObject *__pyx_v_rtol_max, PyObject *__pyx_v_gamma, PyObject *__pyx_v_alpha, PyObject *__pyx_v_alpha2, PyObject *__pyx_v_threshold); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_168getParamsEW(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_170setUseMF(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_172getUseMF(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_174setUseFD(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_176getUseFD(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_178setVariableBounds(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_xl, struct PyPetscVecObject *__pyx_v_xu); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_180getVIInactiveSet(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_182createPython(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_184setPythonContext(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_186getPythonContext(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_188setPythonType(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_py_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_190getCompositeSNES(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_192getCompositeNumber(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6appctx___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_6appctx_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_2dm___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_2dm_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_3npc___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_3npc_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_7vec_sol___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_7vec_upd___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_7vec_rhs___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_3ksp___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_3ksp_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6use_ew___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_6use_ew_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_4rtol___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_4rtol_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_4atol___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_4atol_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_4stol___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_4stol_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6max_it___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_6max_it_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_9max_funcs___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_9max_funcs_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_3its___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_3its_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_7history___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6reason___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_6reason_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_9iterating___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_9converged___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_8diverged___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6use_mf___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_6use_mf_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6use_fd___get__(struct PyPetscSNESObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_4SNES_6use_fd_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS___cinit__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_2view(struct PyPetscTSObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_4load(struct PyPetscTSObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_6destroy(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_8create(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_10clone(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_12setType(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_ts_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_14getType(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_16setProblemType(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_ptype); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_18getProblemType(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_20setEquationType(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_eqtype); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_22getEquationType(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_24setOptionsPrefix(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_26getOptionsPrefix(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_28setFromOptions(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_30setAppCtx(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_appctx); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_32getAppCtx(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_34setRHSFunction(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_function, struct PyPetscVecObject *__pyx_v_f, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_36setRHSJacobian(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_jacobian, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_38computeRHSFunction(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_40computeRHSFunctionLinear(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_42computeRHSJacobian(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_x, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_44computeRHSJacobianConstant(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_x, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_46getRHSFunction(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_48getRHSJacobian(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_50setIFunction(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_function, struct PyPetscVecObject *__pyx_v_f, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_52setIJacobian(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_jacobian, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_54computeIFunction(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_xdot, struct PyPetscVecObject *__pyx_v_f, PyObject *__pyx_v_imex); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_56computeIJacobian(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_xdot, PyObject *__pyx_v_a, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P, PyObject *__pyx_v_imex); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_58getIFunction(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_60getIJacobian(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_62setSolution(struct PyPetscTSObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_u); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_64getSolution(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_66getSNES(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_68getKSP(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_70getDM(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_72setDM(struct PyPetscTSObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_74setTime(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_76getTime(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_78getPrevTime(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_80getSolveTime(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_82setInitialTimeStep(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_initial_time, PyObject *__pyx_v_initial_time_step); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_84setTimeStep(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_time_step); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_86getTimeStep(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_88setStepNumber(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_step_number); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_90getStepNumber(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_92setMaxTime(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_max_time); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_94getMaxTime(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_96setMaxSteps(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_max_steps); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_98getMaxSteps(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_100setDuration(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_max_time, PyObject *__pyx_v_max_steps); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_102getDuration(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_104getTotalSteps(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_106getSNESIterations(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_108getKSPIterations(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_110setMaxStepRejections(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_112getStepRejections(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_114setMaxSNESFailures(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_116getSNESFailures(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_118setErrorIfStepFails(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_120setTolerances(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_rtol, PyObject *__pyx_v_atol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_122getTolerances(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_124setExactFinalTime(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_option); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_126setConvergedReason(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_reason); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_128getConvergedReason(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_130setMonitor(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_monitor, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_132getMonitor(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_134cancelMonitor(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_136monitor(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_step, PyObject *__pyx_v_time, struct PyPetscVecObject *__pyx_v_u); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_138setPreStep(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_prestep, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_140getPreStep(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_142setPostStep(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_poststep, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_144getPostStep(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_146setUp(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_148reset(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_150step(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_152rollBack(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_154solve(struct PyPetscTSObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_u); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_156interpolate(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_u); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_158createPython(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_160setPythonContext(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_162getPythonContext(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_164setPythonType(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_py_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_166setTheta(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_theta); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_168getTheta(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_170setThetaEndpoint(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_172getThetaEndpoint(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_174setAlphaRadius(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_radius); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_176setAlphaParams(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_alpha_m, PyObject *__pyx_v_alpha_f, PyObject *__pyx_v_gamma); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_178getAlphaParams(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_6appctx___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS_6appctx_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_2dm___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS_2dm_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_12problem_type___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS_12problem_type_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_13equation_type___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS_13equation_type_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_4snes___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_3ksp___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_7vec_sol___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_4time___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS_4time_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_9time_step___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS_9time_step_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_11step_number___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS_11step_number_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_8max_time___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS_8max_time_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_9max_steps___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS_9max_steps_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_4rtol___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS_4rtol_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_4atol___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS_4atol_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_6reason___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2TS_6reason_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_9iterating___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_9converged___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_8diverged___get__(struct PyPetscTSObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3TAO___cinit__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_2view(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_4destroy(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_6create(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_8setType(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_tao_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_10getType(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_12setOptionsPrefix(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_14getOptionsPrefix(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_16setFromOptions(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_18setUp(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_20setInitialTrustRegionRadius(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_radius); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_22setAppCtx(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_appctx); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_24getAppCtx(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_26setInitial(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_28setObjective(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_objective, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_30setSeparableObjective(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_separable, struct PyPetscVecObject *__pyx_v_O, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_32setGradient(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_gradient, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_34setObjectiveGradient(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_objgrad, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_36setVariableBounds(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_varbounds, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_38setConstraints(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_constraints, struct PyPetscVecObject *__pyx_v_C, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_40setHessian(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_hessian, struct PyPetscMatObject *__pyx_v_H, struct PyPetscMatObject *__pyx_v_P, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_42setJacobian(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_jacobian, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_44setStateDesignIS(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_state, struct PyPetscISObject *__pyx_v_design); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_46setJacobianState(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_jacobian_state, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P, struct PyPetscMatObject *__pyx_v_I, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_48setJacobianDesign(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_jacobian_design, struct PyPetscMatObject *__pyx_v_J, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_50computeObjective(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_52computeSeparableObjective(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_54computeGradient(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_g); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_56computeObjectiveGradient(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_g); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_58computeDualVariables(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_xl, struct PyPetscVecObject *__pyx_v_xu); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_60computeVariableBounds(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_xl, struct PyPetscVecObject *__pyx_v_xu); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_62computeConstraints(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_c); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_64computeHessian(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscMatObject *__pyx_v_H, struct PyPetscMatObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_66computeJacobian(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_68setTolerances(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_gatol, PyObject *__pyx_v_grtol, PyObject *__pyx_v_gttol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_70getTolerances(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_72setConstraintTolerances(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_catol, PyObject *__pyx_v_crtol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_74getConstraintTolerances(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_76setConvergenceTest(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_converged, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_78getConvergenceTest(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_80setConvergedReason(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_reason); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_82getConvergedReason(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_84setMonitor(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_monitor, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_86getMonitor(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_88cancelMonitor(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_90solve(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_92getSolution(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_94getGradient(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_96setGradientNorm(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_98getGradientNorm(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_100setLMVMH0(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_102getLMVMH0(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_104getLMVMH0KSP(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_106getVariableBounds(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_108getIterationNumber(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_110getObjectiveValue(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_112getConvergedReason(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_114getSolutionNorm(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_116getSolutionStatus(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_118getKSP(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_6appctx___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3TAO_6appctx_2__set__(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_3ksp___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_4ftol___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3TAO_4ftol_2__set__(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_4gtol___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3TAO_4gtol_2__set__(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_4ctol___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_3TAO_4ctol_2__set__(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_3its___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_5gnorm___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_5cnorm___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_8solution___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_9objective___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_8function___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_8gradient___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_6reason___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_9iterating___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_9converged___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_8diverged___get__(struct PyPetscTAOObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2AO___cinit__(struct PyPetscAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_2view(struct PyPetscAOObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_4destroy(struct PyPetscAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_6createBasic(struct PyPetscAOObject *__pyx_v_self, PyObject *__pyx_v_app, PyObject *__pyx_v_petsc, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_8createMemoryScalable(struct PyPetscAOObject *__pyx_v_self, PyObject *__pyx_v_app, PyObject *__pyx_v_petsc, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_10createMapping(struct PyPetscAOObject *__pyx_v_self, PyObject *__pyx_v_app, PyObject *__pyx_v_petsc, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_12getType(struct PyPetscAOObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_14app2petsc(struct PyPetscAOObject *__pyx_v_self, PyObject *__pyx_v_indices); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_16petsc2app(struct PyPetscAOObject *__pyx_v_self, PyObject *__pyx_v_indices); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2DM___cinit__(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_2view(struct PyPetscDMObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_4destroy(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_6create(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_8clone(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_10setType(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_dm_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_12getType(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_14getDimension(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_16setDimension(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_dim); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_18setOptionsPrefix(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_20setFromOptions(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_22setUp(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_24setAppCtx(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_appctx); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_26getAppCtx(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_28getBlockSize(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_30setVecType(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_vec_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_32createGlobalVec(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_34createLocalVec(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_36globalToLocal(struct PyPetscDMObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vg, struct PyPetscVecObject *__pyx_v_vl, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_38localToGlobal(struct PyPetscDMObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vl, struct PyPetscVecObject *__pyx_v_vg, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_40localToLocal(struct PyPetscDMObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vl, struct PyPetscVecObject *__pyx_v_vlg, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_42getLGMap(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_44getCoordinateDM(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_46getCoordinateSection(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_48setCoordinates(struct PyPetscDMObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_c); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_50getCoordinates(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_52setCoordinatesLocal(struct PyPetscDMObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_c); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_54getCoordinatesLocal(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_56setMatType(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_mat_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_58createMat(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_60createInterpolation(struct PyPetscDMObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_62createInjection(struct PyPetscDMObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_64createAggregates(struct PyPetscDMObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_66convert(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_dm_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_68refine(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_70coarsen(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_72refineHierarchy(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_nlevels); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_74coarsenHierarchy(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_nlevels); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_76setDefaultSection(struct PyPetscDMObject *__pyx_v_self, struct PyPetscSectionObject *__pyx_v_sec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_78getDefaultSection(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_80setDefaultGlobalSection(struct PyPetscDMObject *__pyx_v_self, struct PyPetscSectionObject *__pyx_v_sec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_82getDefaultGlobalSection(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_84createDefaultSF(struct PyPetscDMObject *__pyx_v_self, struct PyPetscSectionObject *__pyx_v_localsec, struct PyPetscSectionObject *__pyx_v_globalsec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_86getDefaultSF(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_88getPointSF(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_90setPointSF(struct PyPetscDMObject *__pyx_v_self, struct PyPetscSFObject *__pyx_v_sf); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_92getNumLabels(struct PyPetscDMObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_94getLabelName(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_96hasLabel(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_98createLabel(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_100removeLabel(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_102getLabelValue(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_point); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_104setLabelValue(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_point, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_106clearLabelValue(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_point, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_108getLabelSize(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_110getLabelIdIS(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_112getStratumSize(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_114getStratumIS(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_116clearLabelStratum(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_118setLabelOutput(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_output); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_120getLabelOutput(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_create(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_dim, PyObject *__pyx_v_dof, PyObject *__pyx_v_sizes, PyObject *__pyx_v_proc_sizes, PyObject *__pyx_v_boundary_type, PyObject *__pyx_v_stencil_type, PyObject *__pyx_v_stencil_width, int __pyx_v_setup, PyObject *__pyx_v_ownership_ranges, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_2duplicate(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_dof, PyObject *__pyx_v_boundary_type, PyObject *__pyx_v_stencil_type, PyObject *__pyx_v_stencil_width); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_4setDim(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_dim); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_6getDim(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_8setDof(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_dof); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_10getDof(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_12setSizes(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_sizes); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_14getSizes(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_16setProcSizes(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_proc_sizes); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_18getProcSizes(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_20setBoundaryType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_boundary_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_22getBoundaryType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_24setStencilType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_stencil_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_26getStencilType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_28setStencilWidth(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_stencil_width); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_30getStencilWidth(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_32setStencil(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_stencil_type, PyObject *__pyx_v_stencil_width); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_34getStencil(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_36getRanges(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_38getGhostRanges(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_40getOwnershipRanges(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_42getCorners(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_44getGhostCorners(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_46setFieldName(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_48getFieldName(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_field); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_50getVecArray(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_52setUniformCoordinates(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_xmin, PyObject *__pyx_v_xmax, PyObject *__pyx_v_ymin, PyObject *__pyx_v_ymax, PyObject *__pyx_v_zmin, PyObject *__pyx_v_zmax); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_54setCoordinateName(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_56getCoordinateName(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_58getBoundingBox(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_60getLocalBoundingBox(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_62createNaturalVec(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_64globalToNatural(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vg, struct PyPetscVecObject *__pyx_v_vn, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_66naturalToGlobal(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vn, struct PyPetscVecObject *__pyx_v_vg, PyObject *__pyx_v_addv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_68getAO(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_70getScatter(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_72setRefinementFactor(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_refine_x, PyObject *__pyx_v_refine_y, PyObject *__pyx_v_refine_z); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_74getRefinementFactor(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_76setInterpolationType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_interp_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_78getInterpolationType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_80setElementType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_elem_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_82getElementType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_84getElements(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_elem_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_3dim___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_3dof___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_5sizes___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_10proc_sizes___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_13boundary_type___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_7stencil___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_12stencil_type___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_13stencil_width___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_6ranges___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_12ghost_ranges___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_7corners___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_13ghost_corners___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_create(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_2createFromCellList(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_dim, PyObject *__pyx_v_cells, PyObject *__pyx_v_coords, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_4createBoxMesh(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_dim, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_6createHexBoxMesh(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_numcells, PyObject *__pyx_v_boundary_type, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_8createCGNS(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_cgid, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_10createCGNSFromFile(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_12createExodusFromFile(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_14createExodus(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_exoid, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_16createGmsh(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_18createCohesiveSubmesh(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_hasLagrange, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_20getChart(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_22setChart(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_pStart, PyObject *__pyx_v_pEnd); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_24getConeSize(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_26setConeSize(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_size); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_28getCone(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_30setCone(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_cone, PyObject *__pyx_v_orientation); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_32insertCone(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_conePos, PyObject *__pyx_v_conePoint); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_34insertConeOrientation(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_conePos, PyObject *__pyx_v_coneOrientation); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_36getConeOrientation(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_38setConeOrientation(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_orientation); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_40getSupportSize(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_42setSupportSize(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_size); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_44getSupport(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_46setSupport(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_supp); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_48getMaxSizes(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_50symmetrize(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_52stratify(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_54orient(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_56getCellNumbering(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_58getVertexNumbering(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_60createPointNumbering(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_62getDepth(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_64getDepthStratum(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_svalue); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_66getHeightStratum(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_svalue); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_68getMeet(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_points); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_70getJoin(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_points); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_72getTransitiveClosure(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_useCone); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_74vecGetClosure(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, struct PyPetscSectionObject *__pyx_v_sec, struct PyPetscVecObject *__pyx_v_vec, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_76generate(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_boundary, PyObject *__pyx_v_name, PyObject *__pyx_v_interpolate); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_78setTriangleOptions(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_opts); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_80setTetGenOptions(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_opts); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_82createSquareBoundary(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_lower, PyObject *__pyx_v_upper, PyObject *__pyx_v_edges); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_84createCubeBoundary(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_lower, PyObject *__pyx_v_upper, PyObject *__pyx_v_faces); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_86markBoundaryFaces(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_label); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_88setAdjacencyUseCone(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_useCone); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_90setAdjacencyUseClosure(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_useClosure); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_92getPartitioner(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_94distribute(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_overlap); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_96distributeOverlap(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_overlap); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_98distributeField(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, struct PyPetscSFObject *__pyx_v_sf, struct PyPetscSectionObject *__pyx_v_sec, struct PyPetscVecObject *__pyx_v_vec, struct PyPetscSectionObject *__pyx_v_newsec, struct PyPetscVecObject *__pyx_v_newvec); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_100createCoarsePointIS(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_102createSection(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_numComp, PyObject *__pyx_v_numDof, PyObject *__pyx_v_bcField, PyObject *__pyx_v_bcComps, PyObject *__pyx_v_bcPoints, struct PyPetscISObject *__pyx_v_perm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_104setRefinementUniform(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_refinementUniform); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_106getRefinementUniform(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_108setRefinementLimit(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_refinementLimit); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_110getRefinementLimit(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_112getOrdering(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_otype); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_114permute(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, struct PyPetscISObject *__pyx_v_perm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_116computeCellGeometryFVM(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_cell); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_create(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_2addDM(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_4getNumber(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_6getEntries(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_8scatter(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self, struct PyPetscVecObject *__pyx_v_gvec, PyObject *__pyx_v_lvecs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_10gather(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self, struct PyPetscVecObject *__pyx_v_gvec, PyObject *__pyx_v_imode, PyObject *__pyx_v_lvecs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_12getGlobalISs(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_14getLocalISs(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_16getLGMaps(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_18getAccess(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self, struct PyPetscVecObject *__pyx_v_gvec, PyObject *__pyx_v_locs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_create(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_2setMatrix(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_4setGlobalVector(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, struct PyPetscVecObject *__pyx_v_gv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_6setLocalVector(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, struct PyPetscVecObject *__pyx_v_lv); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_8setCreateGlobalVector(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_create_gvec, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_10setCreateLocalVector(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_create_lvec, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_12setGlobalToLocal(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_begin, PyObject *__pyx_v_end, PyObject *__pyx_v_begin_args, PyObject *__pyx_v_begin_kargs, PyObject *__pyx_v_end_args, PyObject *__pyx_v_end_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_14setGlobalToLocalVecScatter(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, struct PyPetscScatterObject *__pyx_v_gtol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_16setLocalToGlobal(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_begin, PyObject *__pyx_v_end, PyObject *__pyx_v_begin_args, PyObject *__pyx_v_begin_kargs, PyObject *__pyx_v_end_args, PyObject *__pyx_v_end_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_18setLocalToGlobalVecScatter(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, struct PyPetscScatterObject *__pyx_v_ltog); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_20setLocalToLocal(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_begin, PyObject *__pyx_v_end, PyObject *__pyx_v_begin_args, PyObject *__pyx_v_begin_kargs, PyObject *__pyx_v_end_args, PyObject *__pyx_v_end_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_22setLocalToLocalVecScatter(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, struct PyPetscScatterObject *__pyx_v_ltol); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_24setCreateMatrix(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_create_matrix, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_26setCoarsen(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_coarsen, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_28setRefine(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_refine, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_30setCreateInterpolation(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_create_interpolation, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_32setCreateInjection(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_create_injection, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_34setCreateFieldDecomposition(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_decomp, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_36setCreateSubDM(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_create_subdm, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_2SF___cinit__(struct PyPetscSFObject *__pyx_v_self); /* proto */
static void __pyx_pf_8petsc4py_5PETSc_2SF_2__dealloc__(struct PyPetscSFObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_4view(struct PyPetscSFObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_6destroy(struct PyPetscSFObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_8create(struct PyPetscSFObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_10setType(struct PyPetscSFObject *__pyx_v_self, PyObject *__pyx_v_sf_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_12getType(struct PyPetscSFObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_14setFromOptions(struct PyPetscSFObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_16setUp(struct PyPetscSFObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_18reset(struct PyPetscSFObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_20getGraph(struct PyPetscSFObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_22setGraph(struct PyPetscSFObject *__pyx_v_self, PyObject *__pyx_v_nroots, PyObject *__pyx_v_nleaves, PyObject *__pyx_v_local, PyObject *__pyx_v_remote); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_24setRankOrder(struct PyPetscSFObject *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_26getMulti(struct PyPetscSFObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_28createInverse(struct PyPetscSFObject *__pyx_v_self); /* proto */
static int __pyx_pf_8petsc4py_5PETSc_11Partitioner___cinit__(struct PyPetscPartitionerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_2view(struct PyPetscPartitionerObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_4destroy(struct PyPetscPartitionerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_6create(struct PyPetscPartitionerObject *__pyx_v_self, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_8setType(struct PyPetscPartitionerObject *__pyx_v_self, PyObject *__pyx_v_part_type); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_10getType(struct PyPetscPartitionerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_12setFromOptions(struct PyPetscPartitionerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_14setUp(struct PyPetscPartitionerObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_16setShellPartition(struct PyPetscPartitionerObject *__pyx_v_self, PyObject *__pyx_v_numProcs, PyObject *__pyx_v_sizes, PyObject *__pyx_v_points); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc__initialize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args, PyObject *__pyx_v_comm); /* proto */
static PyObject *__pyx_pf_8petsc4py_5PETSc_2_finalize(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Comm(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Object(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Viewer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Random(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_IS(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_LGMap(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_SF(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Vec(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Scatter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Section(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Mat(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_NullSpace(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_PC(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_KSP(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_SNES(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_TS(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_TAO(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_AO(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_DM(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Partitioner(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc__IS_buffer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc__Vec_buffer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc__Vec_LocalForm(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc__Mat_Stencil(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc__DMDA_Vec_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc__DMComposite_access(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Options(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Sys(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Log(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_LogStage(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_LogClass(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_LogEvent(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_ViewerHDF5(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_DMDA(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_DMPlex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_DMComposite(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8petsc4py_5PETSc_DMShell(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_pop = {0, &__pyx_n_s_pop, 0, 0, 0};
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_float_1_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_slice__8;
static PyObject *__pyx_slice__9;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_slice__55;
static PyObject *__pyx_slice__63;
static PyObject *__pyx_slice__64;
static PyObject *__pyx_slice__67;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_codeobj__69;
static PyObject *__pyx_codeobj__71;
static PyObject *__pyx_codeobj__73;
static PyObject *__pyx_codeobj__75;
static PyObject *__pyx_codeobj__77;
static PyObject *__pyx_codeobj__78;

/* "PETSc/PETSc.pyx":12
 *     ctypedef char const_char "const char"
 * 
 * cdef inline object bytes2str(const_char p[]):             # <<<<<<<<<<<<<<
 *      if p == NULL:
 *          return None
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_bytes2str(const char *__pyx_v_p) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("bytes2str", 0);

  /* "PETSc/PETSc.pyx":13
 * 
 * cdef inline object bytes2str(const_char p[]):
 *      if p == NULL:             # <<<<<<<<<<<<<<
 *          return None
 *      cdef bytes s = <char*>p
 */
  __pyx_t_1 = ((__pyx_v_p == NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/PETSc.pyx":14
 * cdef inline object bytes2str(const_char p[]):
 *      if p == NULL:
 *          return None             # <<<<<<<<<<<<<<
 *      cdef bytes s = <char*>p
 *      if isinstance(s, str):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "PETSc/PETSc.pyx":13
 * 
 * cdef inline object bytes2str(const_char p[]):
 *      if p == NULL:             # <<<<<<<<<<<<<<
 *          return None
 *      cdef bytes s = <char*>p
 */
  }

  /* "PETSc/PETSc.pyx":15
 *      if p == NULL:
 *          return None
 *      cdef bytes s = <char*>p             # <<<<<<<<<<<<<<
 *      if isinstance(s, str):
 *          return s
 */
  __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)__pyx_v_p)); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_s = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/PETSc.pyx":16
 *          return None
 *      cdef bytes s = <char*>p
 *      if isinstance(s, str):             # <<<<<<<<<<<<<<
 *          return s
 *      else:
 */
  __pyx_t_1 = PyString_Check(__pyx_v_s); 
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (__pyx_t_3) {

    /* "PETSc/PETSc.pyx":17
 *      cdef bytes s = <char*>p
 *      if isinstance(s, str):
 *          return s             # <<<<<<<<<<<<<<
 *      else:
 *          return s.decode()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_s);
    __pyx_r = __pyx_v_s;
    goto __pyx_L0;

    /* "PETSc/PETSc.pyx":16
 *          return None
 *      cdef bytes s = <char*>p
 *      if isinstance(s, str):             # <<<<<<<<<<<<<<
 *          return s
 *      else:
 */
  }

  /* "PETSc/PETSc.pyx":19
 *          return s
 *      else:
 *          return s.decode()             # <<<<<<<<<<<<<<
 * 
 * cdef inline object str2bytes(object s, const_char *p[]):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_decode_bytes(__pyx_v_s, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 19, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/PETSc.pyx":12
 *     ctypedef char const_char "const char"
 * 
 * cdef inline object bytes2str(const_char p[]):             # <<<<<<<<<<<<<<
 *      if p == NULL:
 *          return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.bytes2str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":21
 *          return s.decode()
 * 
 * cdef inline object str2bytes(object s, const_char *p[]):             # <<<<<<<<<<<<<<
 *     if s is None:
 *         p[0] = NULL
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_str2bytes(PyObject *__pyx_v_s, const char **__pyx_v_p) {
  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("str2bytes", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "PETSc/PETSc.pyx":22
 * 
 * cdef inline object str2bytes(object s, const_char *p[]):
 *     if s is None:             # <<<<<<<<<<<<<<
 *         p[0] = NULL
 *         return None
 */
  __pyx_t_1 = (__pyx_v_s == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/PETSc.pyx":23
 * cdef inline object str2bytes(object s, const_char *p[]):
 *     if s is None:
 *         p[0] = NULL             # <<<<<<<<<<<<<<
 *         return None
 *     if not isinstance(s, bytes):
 */
    (__pyx_v_p[0]) = NULL;

    /* "PETSc/PETSc.pyx":24
 *     if s is None:
 *         p[0] = NULL
 *         return None             # <<<<<<<<<<<<<<
 *     if not isinstance(s, bytes):
 *         s = s.encode()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "PETSc/PETSc.pyx":22
 * 
 * cdef inline object str2bytes(object s, const_char *p[]):
 *     if s is None:             # <<<<<<<<<<<<<<
 *         p[0] = NULL
 *         return None
 */
  }

  /* "PETSc/PETSc.pyx":25
 *         p[0] = NULL
 *         return None
 *     if not isinstance(s, bytes):             # <<<<<<<<<<<<<<
 *         s = s.encode()
 *     p[0] = <const_char*>(<char*>s)
 */
  __pyx_t_2 = PyBytes_Check(__pyx_v_s); 
  __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_1) {

    /* "PETSc/PETSc.pyx":26
 *         return None
 *     if not isinstance(s, bytes):
 *         s = s.encode()             # <<<<<<<<<<<<<<
 *     p[0] = <const_char*>(<char*>s)
 *     return s
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 26, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 26, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 26, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/PETSc.pyx":25
 *         p[0] = NULL
 *         return None
 *     if not isinstance(s, bytes):             # <<<<<<<<<<<<<<
 *         s = s.encode()
 *     p[0] = <const_char*>(<char*>s)
 */
  }

  /* "PETSc/PETSc.pyx":27
 *     if not isinstance(s, bytes):
 *         s = s.encode()
 *     p[0] = <const_char*>(<char*>s)             # <<<<<<<<<<<<<<
 *     return s
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_s); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(11, 27, __pyx_L1_error)
  (__pyx_v_p[0]) = ((const char *)((char *)__pyx_t_6));

  /* "PETSc/PETSc.pyx":28
 *         s = s.encode()
 *     p[0] = <const_char*>(<char*>s)
 *     return s             # <<<<<<<<<<<<<<
 * 
 * cdef inline object S_(const_char p[]):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_s);
  __pyx_r = __pyx_v_s;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":21
 *          return s.decode()
 * 
 * cdef inline object str2bytes(object s, const_char *p[]):             # <<<<<<<<<<<<<<
 *     if s is None:
 *         p[0] = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.str2bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":30
 *     return s
 * 
 * cdef inline object S_(const_char p[]):             # <<<<<<<<<<<<<<
 *      if p == NULL: return None
 *      cdef object s = <char*>p
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_S_(const char *__pyx_v_p) {
  PyObject *__pyx_v_s = 0;
  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;
  __Pyx_RefNannySetupContext("S_", 0);

  /* "PETSc/PETSc.pyx":31
 * 
 * cdef inline object S_(const_char p[]):
 *      if p == NULL: return None             # <<<<<<<<<<<<<<
 *      cdef object s = <char*>p
 *      return s if isinstance(s, str) else s.decode()
 */
  __pyx_t_1 = ((__pyx_v_p == NULL) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "PETSc/PETSc.pyx":32
 * cdef inline object S_(const_char p[]):
 *      if p == NULL: return None
 *      cdef object s = <char*>p             # <<<<<<<<<<<<<<
 *      return s if isinstance(s, str) else s.decode()
 * 
 */
  __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)__pyx_v_p)); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_s = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/PETSc.pyx":33
 *      if p == NULL: return None
 *      cdef object s = <char*>p
 *      return s if isinstance(s, str) else s.decode()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyString_Check(__pyx_v_s); 
  if ((__pyx_t_1 != 0)) {
    __Pyx_INCREF(__pyx_v_s);
    __pyx_t_2 = __pyx_v_s;
  } else {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 33, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 33, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 33, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":30
 *     return s
 * 
 * cdef inline object S_(const_char p[]):             # <<<<<<<<<<<<<<
 *      if p == NULL: return None
 *      cdef object s = <char*>p
 */

  /* 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("petsc4py.PETSc.S_", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":49
 * cdef object PetscError = <object>PyExc_RuntimeError
 * 
 * cdef inline int SETERR(int ierr) with gil:             # <<<<<<<<<<<<<<
 *     if (<void*>PetscError) != NULL:
 *         PyErr_SetObject(PetscError, <long>ierr)
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_SETERR(int __pyx_v_ierr) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("SETERR", 0);

  /* "PETSc/PETSc.pyx":50
 * 
 * cdef inline int SETERR(int ierr) with gil:
 *     if (<void*>PetscError) != NULL:             # <<<<<<<<<<<<<<
 *         PyErr_SetObject(PetscError, <long>ierr)
 *     else:
 */
  __pyx_t_1 = ((((void *)__pyx_v_8petsc4py_5PETSc_PetscError) != NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/PETSc.pyx":51
 * cdef inline int SETERR(int ierr) with gil:
 *     if (<void*>PetscError) != NULL:
 *         PyErr_SetObject(PetscError, <long>ierr)             # <<<<<<<<<<<<<<
 *     else:
 *         PyErr_SetObject(<object>PyExc_RuntimeError, <long>ierr)
 */
    __pyx_t_2 = __pyx_v_8petsc4py_5PETSc_PetscError;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_long(((long)__pyx_v_ierr)); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    PyErr_SetObject(__pyx_t_2, __pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/PETSc.pyx":50
 * 
 * cdef inline int SETERR(int ierr) with gil:
 *     if (<void*>PetscError) != NULL:             # <<<<<<<<<<<<<<
 *         PyErr_SetObject(PetscError, <long>ierr)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/PETSc.pyx":53
 *         PyErr_SetObject(PetscError, <long>ierr)
 *     else:
 *         PyErr_SetObject(<object>PyExc_RuntimeError, <long>ierr)             # <<<<<<<<<<<<<<
 *     return ierr
 * 
 */
  /*else*/ {
    __pyx_t_3 = ((PyObject *)PyExc_RuntimeError);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyInt_From_long(((long)__pyx_v_ierr)); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    PyErr_SetObject(__pyx_t_3, __pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "PETSc/PETSc.pyx":54
 *     else:
 *         PyErr_SetObject(<object>PyExc_RuntimeError, <long>ierr)
 *     return ierr             # <<<<<<<<<<<<<<
 * 
 * cdef inline int CHKERR(int ierr) nogil except -1:
 */
  __pyx_r = __pyx_v_ierr;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":49
 * cdef object PetscError = <object>PyExc_RuntimeError
 * 
 * cdef inline int SETERR(int ierr) with gil:             # <<<<<<<<<<<<<<
 *     if (<void*>PetscError) != NULL:
 *         PyErr_SetObject(PetscError, <long>ierr)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("petsc4py.PETSc.SETERR", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":56
 *     return ierr
 * 
 * cdef inline int CHKERR(int ierr) nogil except -1:             # <<<<<<<<<<<<<<
 *     if ierr == 0:
 *         return 0 # no error
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_CHKERR(int __pyx_v_ierr) {
  int __pyx_r;
  int __pyx_t_1;

  /* "PETSc/PETSc.pyx":57
 * 
 * cdef inline int CHKERR(int ierr) nogil except -1:
 *     if ierr == 0:             # <<<<<<<<<<<<<<
 *         return 0 # no error
 *     if ierr == PETSC_ERR_PYTHON:
 */
  __pyx_t_1 = ((__pyx_v_ierr == 0) != 0);
  if (__pyx_t_1) {

    /* "PETSc/PETSc.pyx":58
 * cdef inline int CHKERR(int ierr) nogil except -1:
 *     if ierr == 0:
 *         return 0 # no error             # <<<<<<<<<<<<<<
 *     if ierr == PETSC_ERR_PYTHON:
 *         return -1 # error in Python call
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "PETSc/PETSc.pyx":57
 * 
 * cdef inline int CHKERR(int ierr) nogil except -1:
 *     if ierr == 0:             # <<<<<<<<<<<<<<
 *         return 0 # no error
 *     if ierr == PETSC_ERR_PYTHON:
 */
  }

  /* "PETSc/PETSc.pyx":59
 *     if ierr == 0:
 *         return 0 # no error
 *     if ierr == PETSC_ERR_PYTHON:             # <<<<<<<<<<<<<<
 *         return -1 # error in Python call
 *     <void>SETERR(ierr)
 */
  __pyx_t_1 = ((__pyx_v_ierr == PETSC_ERR_PYTHON) != 0);
  if (__pyx_t_1) {

    /* "PETSc/PETSc.pyx":60
 *         return 0 # no error
 *     if ierr == PETSC_ERR_PYTHON:
 *         return -1 # error in Python call             # <<<<<<<<<<<<<<
 *     <void>SETERR(ierr)
 *     return -1
 */
    __pyx_r = -1;
    goto __pyx_L0;

    /* "PETSc/PETSc.pyx":59
 *     if ierr == 0:
 *         return 0 # no error
 *     if ierr == PETSC_ERR_PYTHON:             # <<<<<<<<<<<<<<
 *         return -1 # error in Python call
 *     <void>SETERR(ierr)
 */
  }

  /* "PETSc/PETSc.pyx":61
 *     if ierr == PETSC_ERR_PYTHON:
 *         return -1 # error in Python call
 *     <void>SETERR(ierr)             # <<<<<<<<<<<<<<
 *     return -1
 * 
 */
  ((void)__pyx_f_8petsc4py_5PETSc_SETERR(__pyx_v_ierr));

  /* "PETSc/PETSc.pyx":62
 *         return -1 # error in Python call
 *     <void>SETERR(ierr)
 *     return -1             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_r = -1;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":56
 *     return ierr
 * 
 * cdef inline int CHKERR(int ierr) nogil except -1:             # <<<<<<<<<<<<<<
 *     if ierr == 0:
 *         return 0 # no error
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":84
 *     PetscScalar PyPetscScalar_AsPetscScalar(object) except*
 * 
 * cdef inline object toInt(PetscInt value):             # <<<<<<<<<<<<<<
 *     return value
 * cdef inline PetscInt asInt(object value) except? -1:
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toInt(PetscInt __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("toInt", 0);

  /* "PETSc/PETSc.pyx":85
 * 
 * cdef inline object toInt(PetscInt value):
 *     return value             # <<<<<<<<<<<<<<
 * cdef inline PetscInt asInt(object value) except? -1:
 *     return value
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_PetscInt(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":84
 *     PetscScalar PyPetscScalar_AsPetscScalar(object) except*
 * 
 * cdef inline object toInt(PetscInt value):             # <<<<<<<<<<<<<<
 *     return value
 * cdef inline PetscInt asInt(object value) except? -1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.toInt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":86
 * cdef inline object toInt(PetscInt value):
 *     return value
 * cdef inline PetscInt asInt(object value) except? -1:             # <<<<<<<<<<<<<<
 *     return value
 * 
 */

static CYTHON_INLINE PetscInt __pyx_f_8petsc4py_5PETSc_asInt(PyObject *__pyx_v_value) {
  PetscInt __pyx_r;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  __Pyx_RefNannySetupContext("asInt", 0);

  /* "PETSc/PETSc.pyx":87
 *     return value
 * cdef inline PetscInt asInt(object value) except? -1:
 *     return value             # <<<<<<<<<<<<<<
 * 
 * cdef inline object toReal(PetscReal value):
 */
  __pyx_t_1 = __Pyx_PyInt_As_PetscInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (PetscInt)-1) && PyErr_Occurred())) __PYX_ERR(11, 87, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":86
 * cdef inline object toInt(PetscInt value):
 *     return value
 * cdef inline PetscInt asInt(object value) except? -1:             # <<<<<<<<<<<<<<
 *     return value
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.asInt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1L;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":89
 *     return value
 * 
 * cdef inline object toReal(PetscReal value):             # <<<<<<<<<<<<<<
 *     return value
 * cdef inline PetscReal asReal(object value) except? -1:
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toReal(PetscReal __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("toReal", 0);

  /* "PETSc/PETSc.pyx":90
 * 
 * cdef inline object toReal(PetscReal value):
 *     return value             # <<<<<<<<<<<<<<
 * cdef inline PetscReal asReal(object value) except? -1:
 *     return value
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":89
 *     return value
 * 
 * cdef inline object toReal(PetscReal value):             # <<<<<<<<<<<<<<
 *     return value
 * cdef inline PetscReal asReal(object value) except? -1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.toReal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":91
 * cdef inline object toReal(PetscReal value):
 *     return value
 * cdef inline PetscReal asReal(object value) except? -1:             # <<<<<<<<<<<<<<
 *     return value
 * 
 */

static CYTHON_INLINE PetscReal __pyx_f_8petsc4py_5PETSc_asReal(PyObject *__pyx_v_value) {
  PetscReal __pyx_r;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  __Pyx_RefNannySetupContext("asReal", 0);

  /* "PETSc/PETSc.pyx":92
 *     return value
 * cdef inline PetscReal asReal(object value) except? -1:
 *     return value             # <<<<<<<<<<<<<<
 * 
 * cdef inline object toScalar(PetscScalar value):
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (PetscReal)-1) && PyErr_Occurred())) __PYX_ERR(11, 92, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":91
 * cdef inline object toReal(PetscReal value):
 *     return value
 * cdef inline PetscReal asReal(object value) except? -1:             # <<<<<<<<<<<<<<
 *     return value
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.asReal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1.0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":94
 *     return value
 * 
 * cdef inline object toScalar(PetscScalar value):             # <<<<<<<<<<<<<<
 *     return PyPetscScalar_FromPetscScalar(value)
 * cdef inline PetscScalar asScalar(object value) except*:
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toScalar(PetscScalar __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("toScalar", 0);

  /* "PETSc/PETSc.pyx":95
 * 
 * cdef inline object toScalar(PetscScalar value):
 *     return PyPetscScalar_FromPetscScalar(value)             # <<<<<<<<<<<<<<
 * cdef inline PetscScalar asScalar(object value) except*:
 *     return PyPetscScalar_AsPetscScalar(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyPetscScalar_FromPetscScalar(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":94
 *     return value
 * 
 * cdef inline object toScalar(PetscScalar value):             # <<<<<<<<<<<<<<
 *     return PyPetscScalar_FromPetscScalar(value)
 * cdef inline PetscScalar asScalar(object value) except*:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.toScalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":96
 * cdef inline object toScalar(PetscScalar value):
 *     return PyPetscScalar_FromPetscScalar(value)
 * cdef inline PetscScalar asScalar(object value) except*:             # <<<<<<<<<<<<<<
 *     return PyPetscScalar_AsPetscScalar(value)
 * 
 */

static CYTHON_INLINE PetscScalar __pyx_f_8petsc4py_5PETSc_asScalar(PyObject *__pyx_v_value) {
  PetscScalar __pyx_r;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  __Pyx_RefNannySetupContext("asScalar", 0);

  /* "PETSc/PETSc.pyx":97
 *     return PyPetscScalar_FromPetscScalar(value)
 * cdef inline PetscScalar asScalar(object value) except*:
 *     return PyPetscScalar_AsPetscScalar(value)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_1 = PyPetscScalar_AsPetscScalar(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 97, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":96
 * cdef inline object toScalar(PetscScalar value):
 *     return PyPetscScalar_FromPetscScalar(value)
 * cdef inline PetscScalar asScalar(object value) except*:             # <<<<<<<<<<<<<<
 *     return PyPetscScalar_AsPetscScalar(value)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.asScalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":66
 * # --------------------------------------------------------------------
 * 
 * cdef inline ndarray asarray(object ob):             # <<<<<<<<<<<<<<
 *     return PyArray_FROM_O(ob)
 * 
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_asarray(PyObject *__pyx_v_ob) {
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("asarray", 0);

  /* "PETSc/arraynpy.pxi":67
 * 
 * cdef inline ndarray asarray(object ob):
 *     return PyArray_FROM_O(ob)             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray arange(start, stop, stride):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)PyArray_FROM_O(__pyx_v_ob)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":66
 * # --------------------------------------------------------------------
 * 
 * cdef inline ndarray asarray(object ob):             # <<<<<<<<<<<<<<
 *     return PyArray_FROM_O(ob)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.asarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":69
 *     return PyArray_FROM_O(ob)
 * 
 * cdef inline ndarray arange(start, stop, stride):             # <<<<<<<<<<<<<<
 *     cdef dtype descr = <dtype> PyArray_DescrFromType(NPY_PETSC_INT)
 *     return PyArray_ArangeObj(start, stop, stride, descr)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_arange(PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_stride) {
  PyArray_Descr *__pyx_v_descr = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("arange", 0);

  /* "PETSc/arraynpy.pxi":70
 * 
 * cdef inline ndarray arange(start, stop, stride):
 *     cdef dtype descr = <dtype> PyArray_DescrFromType(NPY_PETSC_INT)             # <<<<<<<<<<<<<<
 *     return PyArray_ArangeObj(start, stop, stride, descr)
 * 
 */
  __pyx_t_1 = ((PyObject *)PyArray_DescrFromType(NPY_PETSC_INT)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/arraynpy.pxi":71
 * cdef inline ndarray arange(start, stop, stride):
 *     cdef dtype descr = <dtype> PyArray_DescrFromType(NPY_PETSC_INT)
 *     return PyArray_ArangeObj(start, stop, stride, descr)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = ((PyObject *)PyArray_ArangeObj(__pyx_v_start, __pyx_v_stop, __pyx_v_stride, __pyx_v_descr)); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":69
 *     return PyArray_FROM_O(ob)
 * 
 * cdef inline ndarray arange(start, stop, stride):             # <<<<<<<<<<<<<<
 *     cdef dtype descr = <dtype> PyArray_DescrFromType(NPY_PETSC_INT)
 *     return PyArray_ArangeObj(start, stop, stride, descr)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.arange", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":75
 * # --------------------------------------------------------------------
 * 
 * cdef inline ndarray empty_i(PetscInt size):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_empty_i(PetscInt __pyx_v_size) {
  npy_intp __pyx_v_s;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("empty_i", 0);

  /* "PETSc/arraynpy.pxi":76
 * 
 * cdef inline ndarray empty_i(PetscInt size):
 *     cdef npy_intp s = <npy_intp> size             # <<<<<<<<<<<<<<
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)
 * 
 */
  __pyx_v_s = ((npy_intp)__pyx_v_size);

  /* "PETSc/arraynpy.pxi":77
 * cdef inline ndarray empty_i(PetscInt size):
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray empty_r(PetscInt size):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)PyArray_EMPTY(1, (&__pyx_v_s), NPY_PETSC_INT, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":75
 * # --------------------------------------------------------------------
 * 
 * cdef inline ndarray empty_i(PetscInt size):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.empty_i", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":79
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)
 * 
 * cdef inline ndarray empty_r(PetscInt size):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_empty_r(PetscInt __pyx_v_size) {
  npy_intp __pyx_v_s;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("empty_r", 0);

  /* "PETSc/arraynpy.pxi":80
 * 
 * cdef inline ndarray empty_r(PetscInt size):
 *     cdef npy_intp s = <npy_intp> size             # <<<<<<<<<<<<<<
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)
 * 
 */
  __pyx_v_s = ((npy_intp)__pyx_v_size);

  /* "PETSc/arraynpy.pxi":81
 * cdef inline ndarray empty_r(PetscInt size):
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray empty_s(PetscInt size):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)PyArray_EMPTY(1, (&__pyx_v_s), NPY_PETSC_REAL, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":79
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)
 * 
 * cdef inline ndarray empty_r(PetscInt size):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.empty_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":83
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)
 * 
 * cdef inline ndarray empty_s(PetscInt size):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_empty_s(PetscInt __pyx_v_size) {
  npy_intp __pyx_v_s;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("empty_s", 0);

  /* "PETSc/arraynpy.pxi":84
 * 
 * cdef inline ndarray empty_s(PetscInt size):
 *     cdef npy_intp s = <npy_intp> size             # <<<<<<<<<<<<<<
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)
 * 
 */
  __pyx_v_s = ((npy_intp)__pyx_v_size);

  /* "PETSc/arraynpy.pxi":85
 * cdef inline ndarray empty_s(PetscInt size):
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray empty_c(PetscInt size):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)PyArray_EMPTY(1, (&__pyx_v_s), NPY_PETSC_SCALAR, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":83
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)
 * 
 * cdef inline ndarray empty_s(PetscInt size):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.empty_s", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":87
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)
 * 
 * cdef inline ndarray empty_c(PetscInt size):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_COMPLEX, 0)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_empty_c(PetscInt __pyx_v_size) {
  npy_intp __pyx_v_s;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("empty_c", 0);

  /* "PETSc/arraynpy.pxi":88
 * 
 * cdef inline ndarray empty_c(PetscInt size):
 *     cdef npy_intp s = <npy_intp> size             # <<<<<<<<<<<<<<
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_COMPLEX, 0)
 * 
 */
  __pyx_v_s = ((npy_intp)__pyx_v_size);

  /* "PETSc/arraynpy.pxi":89
 * cdef inline ndarray empty_c(PetscInt size):
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_COMPLEX, 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray empty_p(PetscInt size):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)PyArray_EMPTY(1, (&__pyx_v_s), NPY_PETSC_COMPLEX, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":87
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)
 * 
 * cdef inline ndarray empty_c(PetscInt size):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_COMPLEX, 0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.empty_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":91
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_COMPLEX, 0)
 * 
 * cdef inline ndarray empty_p(PetscInt size):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_INTP, 0)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_empty_p(PetscInt __pyx_v_size) {
  npy_intp __pyx_v_s;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("empty_p", 0);

  /* "PETSc/arraynpy.pxi":92
 * 
 * cdef inline ndarray empty_p(PetscInt size):
 *     cdef npy_intp s = <npy_intp> size             # <<<<<<<<<<<<<<
 *     return PyArray_EMPTY(1, &s, NPY_INTP, 0)
 * 
 */
  __pyx_v_s = ((npy_intp)__pyx_v_size);

  /* "PETSc/arraynpy.pxi":93
 * cdef inline ndarray empty_p(PetscInt size):
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_INTP, 0)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)PyArray_EMPTY(1, (&__pyx_v_s), NPY_INTP, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":91
 *     return PyArray_EMPTY(1, &s, NPY_PETSC_COMPLEX, 0)
 * 
 * cdef inline ndarray empty_p(PetscInt size):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     return PyArray_EMPTY(1, &s, NPY_INTP, 0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.empty_p", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":97
 * # --------------------------------------------------------------------
 * 
 * cdef inline ndarray array_i(PetscInt size, const_PetscInt* data):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_array_i(PetscInt __pyx_v_size, const PetscInt *__pyx_v_data) {
  npy_intp __pyx_v_s;
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("array_i", 0);

  /* "PETSc/arraynpy.pxi":98
 * 
 * cdef inline ndarray array_i(PetscInt size, const_PetscInt* data):
 *     cdef npy_intp s = <npy_intp> size             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)
 *     if data != NULL:
 */
  __pyx_v_s = ((npy_intp)__pyx_v_size);

  /* "PETSc/arraynpy.pxi":99
 * cdef inline ndarray array_i(PetscInt size, const_PetscInt* data):
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)             # <<<<<<<<<<<<<<
 *     if data != NULL:
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscInt))
 */
  __pyx_t_1 = ((PyObject *)PyArray_EMPTY(1, (&__pyx_v_s), NPY_PETSC_INT, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":100
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)
 *     if data != NULL:             # <<<<<<<<<<<<<<
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscInt))
 *     return ary
 */
  __pyx_t_2 = ((__pyx_v_data != NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/arraynpy.pxi":101
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)
 *     if data != NULL:
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscInt))             # <<<<<<<<<<<<<<
 *     return ary
 * 
 */
    memcpy(PyArray_DATA(__pyx_v_ary), __pyx_v_data, (((size_t)__pyx_v_size) * (sizeof(PetscInt))));

    /* "PETSc/arraynpy.pxi":100
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)
 *     if data != NULL:             # <<<<<<<<<<<<<<
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscInt))
 *     return ary
 */
  }

  /* "PETSc/arraynpy.pxi":102
 *     if data != NULL:
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscInt))
 *     return ary             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray array_r(PetscInt size, const_PetscReal* data):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ary));
  __pyx_r = __pyx_v_ary;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":97
 * # --------------------------------------------------------------------
 * 
 * cdef inline ndarray array_i(PetscInt size, const_PetscInt* data):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_INT, 0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.array_i", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":104
 *     return ary
 * 
 * cdef inline ndarray array_r(PetscInt size, const_PetscReal* data):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_array_r(PetscInt __pyx_v_size, const PetscReal *__pyx_v_data) {
  npy_intp __pyx_v_s;
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("array_r", 0);

  /* "PETSc/arraynpy.pxi":105
 * 
 * cdef inline ndarray array_r(PetscInt size, const_PetscReal* data):
 *     cdef npy_intp s = <npy_intp> size             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)
 *     if data != NULL:
 */
  __pyx_v_s = ((npy_intp)__pyx_v_size);

  /* "PETSc/arraynpy.pxi":106
 * cdef inline ndarray array_r(PetscInt size, const_PetscReal* data):
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)             # <<<<<<<<<<<<<<
 *     if data != NULL:
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscReal))
 */
  __pyx_t_1 = ((PyObject *)PyArray_EMPTY(1, (&__pyx_v_s), NPY_PETSC_REAL, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":107
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)
 *     if data != NULL:             # <<<<<<<<<<<<<<
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscReal))
 *     return ary
 */
  __pyx_t_2 = ((__pyx_v_data != NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/arraynpy.pxi":108
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)
 *     if data != NULL:
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscReal))             # <<<<<<<<<<<<<<
 *     return ary
 * 
 */
    memcpy(PyArray_DATA(__pyx_v_ary), __pyx_v_data, (((size_t)__pyx_v_size) * (sizeof(PetscReal))));

    /* "PETSc/arraynpy.pxi":107
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)
 *     if data != NULL:             # <<<<<<<<<<<<<<
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscReal))
 *     return ary
 */
  }

  /* "PETSc/arraynpy.pxi":109
 *     if data != NULL:
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscReal))
 *     return ary             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray array_s(PetscInt size, const_PetscScalar* data):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ary));
  __pyx_r = __pyx_v_ary;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":104
 *     return ary
 * 
 * cdef inline ndarray array_r(PetscInt size, const_PetscReal* data):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_REAL, 0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.array_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":111
 *     return ary
 * 
 * cdef inline ndarray array_s(PetscInt size, const_PetscScalar* data):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_array_s(PetscInt __pyx_v_size, const PetscScalar *__pyx_v_data) {
  npy_intp __pyx_v_s;
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("array_s", 0);

  /* "PETSc/arraynpy.pxi":112
 * 
 * cdef inline ndarray array_s(PetscInt size, const_PetscScalar* data):
 *     cdef npy_intp s = <npy_intp> size             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)
 *     if data != NULL:
 */
  __pyx_v_s = ((npy_intp)__pyx_v_size);

  /* "PETSc/arraynpy.pxi":113
 * cdef inline ndarray array_s(PetscInt size, const_PetscScalar* data):
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)             # <<<<<<<<<<<<<<
 *     if data != NULL:
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscScalar))
 */
  __pyx_t_1 = ((PyObject *)PyArray_EMPTY(1, (&__pyx_v_s), NPY_PETSC_SCALAR, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":114
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)
 *     if data != NULL:             # <<<<<<<<<<<<<<
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscScalar))
 *     return ary
 */
  __pyx_t_2 = ((__pyx_v_data != NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/arraynpy.pxi":115
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)
 *     if data != NULL:
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscScalar))             # <<<<<<<<<<<<<<
 *     return ary
 * 
 */
    memcpy(PyArray_DATA(__pyx_v_ary), __pyx_v_data, (((size_t)__pyx_v_size) * (sizeof(PetscScalar))));

    /* "PETSc/arraynpy.pxi":114
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)
 *     if data != NULL:             # <<<<<<<<<<<<<<
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscScalar))
 *     return ary
 */
  }

  /* "PETSc/arraynpy.pxi":116
 *     if data != NULL:
 *         memcpy(PyArray_DATA(ary), data, <size_t>size*sizeof(PetscScalar))
 *     return ary             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ary));
  __pyx_r = __pyx_v_ary;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":111
 *     return ary
 * 
 * cdef inline ndarray array_s(PetscInt size, const_PetscScalar* data):             # <<<<<<<<<<<<<<
 *     cdef npy_intp s = <npy_intp> size
 *     cdef ndarray ary = PyArray_EMPTY(1, &s, NPY_PETSC_SCALAR, 0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.array_s", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":120
 * # --------------------------------------------------------------------
 * 
 * cdef inline ndarray iarray(object ob, int typenum):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = PyArray_FROM_OTF(
 *         ob, typenum, NPY_ARRAY_ALIGNED|NPY_ARRAY_NOTSWAPPED)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_iarray(PyObject *__pyx_v_ob, int __pyx_v_typenum) {
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("iarray", 0);

  /* "PETSc/arraynpy.pxi":121
 * 
 * cdef inline ndarray iarray(object ob, int typenum):
 *     cdef ndarray ary = PyArray_FROM_OTF(             # <<<<<<<<<<<<<<
 *         ob, typenum, NPY_ARRAY_ALIGNED|NPY_ARRAY_NOTSWAPPED)
 *     if PyArray_ISCONTIGUOUS(ary): return ary
 */
  __pyx_t_1 = ((PyObject *)PyArray_FROM_OTF(__pyx_v_ob, __pyx_v_typenum, (NPY_ARRAY_ALIGNED | NPY_ARRAY_NOTSWAPPED))); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":123
 *     cdef ndarray ary = PyArray_FROM_OTF(
 *         ob, typenum, NPY_ARRAY_ALIGNED|NPY_ARRAY_NOTSWAPPED)
 *     if PyArray_ISCONTIGUOUS(ary): return ary             # <<<<<<<<<<<<<<
 *     if PyArray_ISFORTRAN(ary):    return ary
 *     return PyArray_Copy(ary)
 */
  __pyx_t_2 = (PyArray_ISCONTIGUOUS(__pyx_v_ary) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_ary));
    __pyx_r = __pyx_v_ary;
    goto __pyx_L0;
  }

  /* "PETSc/arraynpy.pxi":124
 *         ob, typenum, NPY_ARRAY_ALIGNED|NPY_ARRAY_NOTSWAPPED)
 *     if PyArray_ISCONTIGUOUS(ary): return ary
 *     if PyArray_ISFORTRAN(ary):    return ary             # <<<<<<<<<<<<<<
 *     return PyArray_Copy(ary)
 * 
 */
  __pyx_t_2 = (PyArray_ISFORTRAN(__pyx_v_ary) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_ary));
    __pyx_r = __pyx_v_ary;
    goto __pyx_L0;
  }

  /* "PETSc/arraynpy.pxi":125
 *     if PyArray_ISCONTIGUOUS(ary): return ary
 *     if PyArray_ISFORTRAN(ary):    return ary
 *     return PyArray_Copy(ary)             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray iarray_i(object ob, PetscInt* size, PetscInt** data):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)PyArray_Copy(__pyx_v_ary)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":120
 * # --------------------------------------------------------------------
 * 
 * cdef inline ndarray iarray(object ob, int typenum):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = PyArray_FROM_OTF(
 *         ob, typenum, NPY_ARRAY_ALIGNED|NPY_ARRAY_NOTSWAPPED)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.iarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":127
 *     return PyArray_Copy(ary)
 * 
 * cdef inline ndarray iarray_i(object ob, PetscInt* size, PetscInt** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_INT)
 *     if size != NULL: size[0] = <PetscInt>  PyArray_SIZE(ary)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_iarray_i(PyObject *__pyx_v_ob, PetscInt *__pyx_v_size, PetscInt **__pyx_v_data) {
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("iarray_i", 0);

  /* "PETSc/arraynpy.pxi":128
 * 
 * cdef inline ndarray iarray_i(object ob, PetscInt* size, PetscInt** data):
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_INT)             # <<<<<<<<<<<<<<
 *     if size != NULL: size[0] = <PetscInt>  PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscInt*> PyArray_DATA(ary)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray(__pyx_v_ob, NPY_PETSC_INT)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":129
 * cdef inline ndarray iarray_i(object ob, PetscInt* size, PetscInt** data):
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_INT)
 *     if size != NULL: size[0] = <PetscInt>  PyArray_SIZE(ary)             # <<<<<<<<<<<<<<
 *     if data != NULL: data[0] = <PetscInt*> PyArray_DATA(ary)
 *     return ary
 */
  __pyx_t_2 = ((__pyx_v_size != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_size[0]) = ((PetscInt)PyArray_SIZE(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":130
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_INT)
 *     if size != NULL: size[0] = <PetscInt>  PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscInt*> PyArray_DATA(ary)             # <<<<<<<<<<<<<<
 *     return ary
 * 
 */
  __pyx_t_2 = ((__pyx_v_data != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_data[0]) = ((PetscInt *)PyArray_DATA(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":131
 *     if size != NULL: size[0] = <PetscInt>  PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscInt*> PyArray_DATA(ary)
 *     return ary             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray iarray_r(object ob, PetscInt* size, PetscReal** data):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ary));
  __pyx_r = __pyx_v_ary;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":127
 *     return PyArray_Copy(ary)
 * 
 * cdef inline ndarray iarray_i(object ob, PetscInt* size, PetscInt** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_INT)
 *     if size != NULL: size[0] = <PetscInt>  PyArray_SIZE(ary)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.iarray_i", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":133
 *     return ary
 * 
 * cdef inline ndarray iarray_r(object ob, PetscInt* size, PetscReal** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_REAL)
 *     if size != NULL: size[0] = <PetscInt>   PyArray_SIZE(ary)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_iarray_r(PyObject *__pyx_v_ob, PetscInt *__pyx_v_size, PetscReal **__pyx_v_data) {
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("iarray_r", 0);

  /* "PETSc/arraynpy.pxi":134
 * 
 * cdef inline ndarray iarray_r(object ob, PetscInt* size, PetscReal** data):
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_REAL)             # <<<<<<<<<<<<<<
 *     if size != NULL: size[0] = <PetscInt>   PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscReal*> PyArray_DATA(ary)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray(__pyx_v_ob, NPY_PETSC_REAL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":135
 * cdef inline ndarray iarray_r(object ob, PetscInt* size, PetscReal** data):
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_REAL)
 *     if size != NULL: size[0] = <PetscInt>   PyArray_SIZE(ary)             # <<<<<<<<<<<<<<
 *     if data != NULL: data[0] = <PetscReal*> PyArray_DATA(ary)
 *     return ary
 */
  __pyx_t_2 = ((__pyx_v_size != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_size[0]) = ((PetscInt)PyArray_SIZE(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":136
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_REAL)
 *     if size != NULL: size[0] = <PetscInt>   PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscReal*> PyArray_DATA(ary)             # <<<<<<<<<<<<<<
 *     return ary
 * 
 */
  __pyx_t_2 = ((__pyx_v_data != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_data[0]) = ((PetscReal *)PyArray_DATA(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":137
 *     if size != NULL: size[0] = <PetscInt>   PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscReal*> PyArray_DATA(ary)
 *     return ary             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray iarray_s(object ob, PetscInt* size, PetscScalar** data):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ary));
  __pyx_r = __pyx_v_ary;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":133
 *     return ary
 * 
 * cdef inline ndarray iarray_r(object ob, PetscInt* size, PetscReal** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_REAL)
 *     if size != NULL: size[0] = <PetscInt>   PyArray_SIZE(ary)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.iarray_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":139
 *     return ary
 * 
 * cdef inline ndarray iarray_s(object ob, PetscInt* size, PetscScalar** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_SCALAR)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_iarray_s(PyObject *__pyx_v_ob, PetscInt *__pyx_v_size, PetscScalar **__pyx_v_data) {
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("iarray_s", 0);

  /* "PETSc/arraynpy.pxi":140
 * 
 * cdef inline ndarray iarray_s(object ob, PetscInt* size, PetscScalar** data):
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_SCALAR)             # <<<<<<<<<<<<<<
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray(__pyx_v_ob, NPY_PETSC_SCALAR)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":141
 * cdef inline ndarray iarray_s(object ob, PetscInt* size, PetscScalar** data):
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_SCALAR)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)             # <<<<<<<<<<<<<<
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)
 *     return ary
 */
  __pyx_t_2 = ((__pyx_v_size != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_size[0]) = ((PetscInt)PyArray_SIZE(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":142
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_SCALAR)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)             # <<<<<<<<<<<<<<
 *     return ary
 * 
 */
  __pyx_t_2 = ((__pyx_v_data != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_data[0]) = ((PetscScalar *)PyArray_DATA(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":143
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)
 *     return ary             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ary));
  __pyx_r = __pyx_v_ary;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":139
 *     return ary
 * 
 * cdef inline ndarray iarray_s(object ob, PetscInt* size, PetscScalar** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = iarray(ob, NPY_PETSC_SCALAR)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.iarray_s", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":147
 * # --------------------------------------------------------------------
 * 
 * cdef inline ndarray oarray(object ob, int typenum):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = PyArray_FROM_OTF(
 *         ob, typenum, NPY_ARRAY_ALIGNED|NPY_ARRAY_WRITEABLE|NPY_ARRAY_NOTSWAPPED)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_oarray(PyObject *__pyx_v_ob, int __pyx_v_typenum) {
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("oarray", 0);

  /* "PETSc/arraynpy.pxi":148
 * 
 * cdef inline ndarray oarray(object ob, int typenum):
 *     cdef ndarray ary = PyArray_FROM_OTF(             # <<<<<<<<<<<<<<
 *         ob, typenum, NPY_ARRAY_ALIGNED|NPY_ARRAY_WRITEABLE|NPY_ARRAY_NOTSWAPPED)
 *     if PyArray_ISCONTIGUOUS(ary): return ary
 */
  __pyx_t_1 = ((PyObject *)PyArray_FROM_OTF(__pyx_v_ob, __pyx_v_typenum, ((NPY_ARRAY_ALIGNED | NPY_ARRAY_WRITEABLE) | NPY_ARRAY_NOTSWAPPED))); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":150
 *     cdef ndarray ary = PyArray_FROM_OTF(
 *         ob, typenum, NPY_ARRAY_ALIGNED|NPY_ARRAY_WRITEABLE|NPY_ARRAY_NOTSWAPPED)
 *     if PyArray_ISCONTIGUOUS(ary): return ary             # <<<<<<<<<<<<<<
 *     if PyArray_ISFORTRAN(ary):    return ary
 *     return PyArray_Copy(ary)
 */
  __pyx_t_2 = (PyArray_ISCONTIGUOUS(__pyx_v_ary) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_ary));
    __pyx_r = __pyx_v_ary;
    goto __pyx_L0;
  }

  /* "PETSc/arraynpy.pxi":151
 *         ob, typenum, NPY_ARRAY_ALIGNED|NPY_ARRAY_WRITEABLE|NPY_ARRAY_NOTSWAPPED)
 *     if PyArray_ISCONTIGUOUS(ary): return ary
 *     if PyArray_ISFORTRAN(ary):    return ary             # <<<<<<<<<<<<<<
 *     return PyArray_Copy(ary)
 * 
 */
  __pyx_t_2 = (PyArray_ISFORTRAN(__pyx_v_ary) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_ary));
    __pyx_r = __pyx_v_ary;
    goto __pyx_L0;
  }

  /* "PETSc/arraynpy.pxi":152
 *     if PyArray_ISCONTIGUOUS(ary): return ary
 *     if PyArray_ISFORTRAN(ary):    return ary
 *     return PyArray_Copy(ary)             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray oarray_i(object ob, PetscInt* size, PetscInt** data):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)PyArray_Copy(__pyx_v_ary)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":147
 * # --------------------------------------------------------------------
 * 
 * cdef inline ndarray oarray(object ob, int typenum):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = PyArray_FROM_OTF(
 *         ob, typenum, NPY_ARRAY_ALIGNED|NPY_ARRAY_WRITEABLE|NPY_ARRAY_NOTSWAPPED)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.oarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":154
 *     return PyArray_Copy(ary)
 * 
 * cdef inline ndarray oarray_i(object ob, PetscInt* size, PetscInt** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_INT)
 *     if size != NULL: size[0] = <PetscInt>  PyArray_SIZE(ary)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_oarray_i(PyObject *__pyx_v_ob, PetscInt *__pyx_v_size, PetscInt **__pyx_v_data) {
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("oarray_i", 0);

  /* "PETSc/arraynpy.pxi":155
 * 
 * cdef inline ndarray oarray_i(object ob, PetscInt* size, PetscInt** data):
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_INT)             # <<<<<<<<<<<<<<
 *     if size != NULL: size[0] = <PetscInt>  PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscInt*> PyArray_DATA(ary)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray(__pyx_v_ob, NPY_PETSC_INT)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":156
 * cdef inline ndarray oarray_i(object ob, PetscInt* size, PetscInt** data):
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_INT)
 *     if size != NULL: size[0] = <PetscInt>  PyArray_SIZE(ary)             # <<<<<<<<<<<<<<
 *     if data != NULL: data[0] = <PetscInt*> PyArray_DATA(ary)
 *     return ary
 */
  __pyx_t_2 = ((__pyx_v_size != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_size[0]) = ((PetscInt)PyArray_SIZE(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":157
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_INT)
 *     if size != NULL: size[0] = <PetscInt>  PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscInt*> PyArray_DATA(ary)             # <<<<<<<<<<<<<<
 *     return ary
 * 
 */
  __pyx_t_2 = ((__pyx_v_data != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_data[0]) = ((PetscInt *)PyArray_DATA(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":158
 *     if size != NULL: size[0] = <PetscInt>  PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscInt*> PyArray_DATA(ary)
 *     return ary             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray oarray_r(object ob, PetscInt* size, PetscReal** data):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ary));
  __pyx_r = __pyx_v_ary;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":154
 *     return PyArray_Copy(ary)
 * 
 * cdef inline ndarray oarray_i(object ob, PetscInt* size, PetscInt** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_INT)
 *     if size != NULL: size[0] = <PetscInt>  PyArray_SIZE(ary)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.oarray_i", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":160
 *     return ary
 * 
 * cdef inline ndarray oarray_r(object ob, PetscInt* size, PetscReal** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_REAL)
 *     if size != NULL: size[0] = <PetscInt>   PyArray_SIZE(ary)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_oarray_r(PyObject *__pyx_v_ob, PetscInt *__pyx_v_size, PetscReal **__pyx_v_data) {
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("oarray_r", 0);

  /* "PETSc/arraynpy.pxi":161
 * 
 * cdef inline ndarray oarray_r(object ob, PetscInt* size, PetscReal** data):
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_REAL)             # <<<<<<<<<<<<<<
 *     if size != NULL: size[0] = <PetscInt>   PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscReal*> PyArray_DATA(ary)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray(__pyx_v_ob, NPY_PETSC_REAL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":162
 * cdef inline ndarray oarray_r(object ob, PetscInt* size, PetscReal** data):
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_REAL)
 *     if size != NULL: size[0] = <PetscInt>   PyArray_SIZE(ary)             # <<<<<<<<<<<<<<
 *     if data != NULL: data[0] = <PetscReal*> PyArray_DATA(ary)
 *     return ary
 */
  __pyx_t_2 = ((__pyx_v_size != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_size[0]) = ((PetscInt)PyArray_SIZE(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":163
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_REAL)
 *     if size != NULL: size[0] = <PetscInt>   PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscReal*> PyArray_DATA(ary)             # <<<<<<<<<<<<<<
 *     return ary
 * 
 */
  __pyx_t_2 = ((__pyx_v_data != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_data[0]) = ((PetscReal *)PyArray_DATA(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":164
 *     if size != NULL: size[0] = <PetscInt>   PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscReal*> PyArray_DATA(ary)
 *     return ary             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray oarray_s(object ob, PetscInt* size, PetscScalar** data):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ary));
  __pyx_r = __pyx_v_ary;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":160
 *     return ary
 * 
 * cdef inline ndarray oarray_r(object ob, PetscInt* size, PetscReal** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_REAL)
 *     if size != NULL: size[0] = <PetscInt>   PyArray_SIZE(ary)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.oarray_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":166
 *     return ary
 * 
 * cdef inline ndarray oarray_s(object ob, PetscInt* size, PetscScalar** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_SCALAR)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_oarray_s(PyObject *__pyx_v_ob, PetscInt *__pyx_v_size, PetscScalar **__pyx_v_data) {
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("oarray_s", 0);

  /* "PETSc/arraynpy.pxi":167
 * 
 * cdef inline ndarray oarray_s(object ob, PetscInt* size, PetscScalar** data):
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_SCALAR)             # <<<<<<<<<<<<<<
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray(__pyx_v_ob, NPY_PETSC_SCALAR)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":168
 * cdef inline ndarray oarray_s(object ob, PetscInt* size, PetscScalar** data):
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_SCALAR)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)             # <<<<<<<<<<<<<<
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)
 *     return ary
 */
  __pyx_t_2 = ((__pyx_v_size != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_size[0]) = ((PetscInt)PyArray_SIZE(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":169
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_SCALAR)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)             # <<<<<<<<<<<<<<
 *     return ary
 * 
 */
  __pyx_t_2 = ((__pyx_v_data != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_data[0]) = ((PetscScalar *)PyArray_DATA(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":170
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)
 *     return ary             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray oarray_p(object ob, PetscInt* size, void** data):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ary));
  __pyx_r = __pyx_v_ary;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":166
 *     return ary
 * 
 * cdef inline ndarray oarray_s(object ob, PetscInt* size, PetscScalar** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = oarray(ob, NPY_PETSC_SCALAR)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.oarray_s", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":172
 *     return ary
 * 
 * cdef inline ndarray oarray_p(object ob, PetscInt* size, void** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = oarray(ob, NPY_INTP)
 *     if size != NULL: size[0] = <PetscInt> PyArray_SIZE(ary)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_oarray_p(PyObject *__pyx_v_ob, PetscInt *__pyx_v_size, void **__pyx_v_data) {
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("oarray_p", 0);

  /* "PETSc/arraynpy.pxi":173
 * 
 * cdef inline ndarray oarray_p(object ob, PetscInt* size, void** data):
 *     cdef ndarray ary = oarray(ob, NPY_INTP)             # <<<<<<<<<<<<<<
 *     if size != NULL: size[0] = <PetscInt> PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <void*>    PyArray_DATA(ary)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray(__pyx_v_ob, NPY_INTP)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":174
 * cdef inline ndarray oarray_p(object ob, PetscInt* size, void** data):
 *     cdef ndarray ary = oarray(ob, NPY_INTP)
 *     if size != NULL: size[0] = <PetscInt> PyArray_SIZE(ary)             # <<<<<<<<<<<<<<
 *     if data != NULL: data[0] = <void*>    PyArray_DATA(ary)
 *     return ary
 */
  __pyx_t_2 = ((__pyx_v_size != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_size[0]) = ((PetscInt)PyArray_SIZE(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":175
 *     cdef ndarray ary = oarray(ob, NPY_INTP)
 *     if size != NULL: size[0] = <PetscInt> PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <void*>    PyArray_DATA(ary)             # <<<<<<<<<<<<<<
 *     return ary
 * 
 */
  __pyx_t_2 = ((__pyx_v_data != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_data[0]) = ((void *)PyArray_DATA(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":176
 *     if size != NULL: size[0] = <PetscInt> PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <void*>    PyArray_DATA(ary)
 *     return ary             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ary));
  __pyx_r = __pyx_v_ary;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":172
 *     return ary
 * 
 * cdef inline ndarray oarray_p(object ob, PetscInt* size, void** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = oarray(ob, NPY_INTP)
 *     if size != NULL: size[0] = <PetscInt> PyArray_SIZE(ary)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.oarray_p", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":180
 * # --------------------------------------------------------------------
 * 
 * cdef inline ndarray ocarray_s(object ob, PetscInt* size, PetscScalar** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = PyArray_FROM_OTF(
 *         ob, NPY_PETSC_SCALAR, NPY_ARRAY_CARRAY|NPY_ARRAY_NOTSWAPPED)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_ocarray_s(PyObject *__pyx_v_ob, PetscInt *__pyx_v_size, PetscScalar **__pyx_v_data) {
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("ocarray_s", 0);

  /* "PETSc/arraynpy.pxi":181
 * 
 * cdef inline ndarray ocarray_s(object ob, PetscInt* size, PetscScalar** data):
 *     cdef ndarray ary = PyArray_FROM_OTF(             # <<<<<<<<<<<<<<
 *         ob, NPY_PETSC_SCALAR, NPY_ARRAY_CARRAY|NPY_ARRAY_NOTSWAPPED)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 */
  __pyx_t_1 = ((PyObject *)PyArray_FROM_OTF(__pyx_v_ob, NPY_PETSC_SCALAR, (NPY_ARRAY_CARRAY | NPY_ARRAY_NOTSWAPPED))); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":183
 *     cdef ndarray ary = PyArray_FROM_OTF(
 *         ob, NPY_PETSC_SCALAR, NPY_ARRAY_CARRAY|NPY_ARRAY_NOTSWAPPED)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)             # <<<<<<<<<<<<<<
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)
 *     return ary
 */
  __pyx_t_2 = ((__pyx_v_size != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_size[0]) = ((PetscInt)PyArray_SIZE(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":184
 *         ob, NPY_PETSC_SCALAR, NPY_ARRAY_CARRAY|NPY_ARRAY_NOTSWAPPED)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)             # <<<<<<<<<<<<<<
 *     return ary
 * 
 */
  __pyx_t_2 = ((__pyx_v_data != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_data[0]) = ((PetscScalar *)PyArray_DATA(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":185
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)
 *     return ary             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray ofarray_s(object ob, PetscInt* size, PetscScalar** data):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ary));
  __pyx_r = __pyx_v_ary;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":180
 * # --------------------------------------------------------------------
 * 
 * cdef inline ndarray ocarray_s(object ob, PetscInt* size, PetscScalar** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = PyArray_FROM_OTF(
 *         ob, NPY_PETSC_SCALAR, NPY_ARRAY_CARRAY|NPY_ARRAY_NOTSWAPPED)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.ocarray_s", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/arraynpy.pxi":187
 *     return ary
 * 
 * cdef inline ndarray ofarray_s(object ob, PetscInt* size, PetscScalar** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = PyArray_FROM_OTF(
 *         ob, NPY_PETSC_SCALAR, NPY_ARRAY_FARRAY|NPY_ARRAY_NOTSWAPPED)
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_ofarray_s(PyObject *__pyx_v_ob, PetscInt *__pyx_v_size, PetscScalar **__pyx_v_data) {
  PyArrayObject *__pyx_v_ary = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("ofarray_s", 0);

  /* "PETSc/arraynpy.pxi":188
 * 
 * cdef inline ndarray ofarray_s(object ob, PetscInt* size, PetscScalar** data):
 *     cdef ndarray ary = PyArray_FROM_OTF(             # <<<<<<<<<<<<<<
 *         ob, NPY_PETSC_SCALAR, NPY_ARRAY_FARRAY|NPY_ARRAY_NOTSWAPPED)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 */
  __pyx_t_1 = ((PyObject *)PyArray_FROM_OTF(__pyx_v_ob, NPY_PETSC_SCALAR, (NPY_ARRAY_FARRAY | NPY_ARRAY_NOTSWAPPED))); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/arraynpy.pxi":190
 *     cdef ndarray ary = PyArray_FROM_OTF(
 *         ob, NPY_PETSC_SCALAR, NPY_ARRAY_FARRAY|NPY_ARRAY_NOTSWAPPED)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)             # <<<<<<<<<<<<<<
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)
 *     return ary
 */
  __pyx_t_2 = ((__pyx_v_size != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_size[0]) = ((PetscInt)PyArray_SIZE(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":191
 *         ob, NPY_PETSC_SCALAR, NPY_ARRAY_FARRAY|NPY_ARRAY_NOTSWAPPED)
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)             # <<<<<<<<<<<<<<
 *     return ary
 * 
 */
  __pyx_t_2 = ((__pyx_v_data != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v_data[0]) = ((PetscScalar *)PyArray_DATA(__pyx_v_ary));
  }

  /* "PETSc/arraynpy.pxi":192
 *     if size != NULL: size[0] = <PetscInt>     PyArray_SIZE(ary)
 *     if data != NULL: data[0] = <PetscScalar*> PyArray_DATA(ary)
 *     return ary             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ary));
  __pyx_r = __pyx_v_ary;
  goto __pyx_L0;

  /* "PETSc/arraynpy.pxi":187
 *     return ary
 * 
 * cdef inline ndarray ofarray_s(object ob, PetscInt* size, PetscScalar** data):             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = PyArray_FROM_OTF(
 *         ob, NPY_PETSC_SCALAR, NPY_ARRAY_FARRAY|NPY_ARRAY_NOTSWAPPED)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.ofarray_s", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdef.pxi":55
 * 
 * 
 * cdef inline PetscInsertMode insertmode(object mode) \             # <<<<<<<<<<<<<<
 *     except <PetscInsertMode>(-1):
 *     if   mode is None:  return PETSC_INSERT_VALUES
 */

static CYTHON_INLINE InsertMode __pyx_f_8petsc4py_5PETSc_insertmode(PyObject *__pyx_v_mode) {
  InsertMode __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  InsertMode __pyx_t_3;
  __Pyx_RefNannySetupContext("insertmode", 0);

  /* "PETSc/petscdef.pxi":57
 * cdef inline PetscInsertMode insertmode(object mode) \
 *     except <PetscInsertMode>(-1):
 *     if   mode is None:  return PETSC_INSERT_VALUES             # <<<<<<<<<<<<<<
 *     elif mode is True:  return PETSC_ADD_VALUES
 *     elif mode is False: return PETSC_INSERT_VALUES
 */
  __pyx_t_1 = (__pyx_v_mode == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_r = INSERT_VALUES;
    goto __pyx_L0;
  }

  /* "PETSc/petscdef.pxi":58
 *     except <PetscInsertMode>(-1):
 *     if   mode is None:  return PETSC_INSERT_VALUES
 *     elif mode is True:  return PETSC_ADD_VALUES             # <<<<<<<<<<<<<<
 *     elif mode is False: return PETSC_INSERT_VALUES
 *     else:               return mode
 */
  __pyx_t_2 = (__pyx_v_mode == Py_True);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_r = ADD_VALUES;
    goto __pyx_L0;
  }

  /* "PETSc/petscdef.pxi":59
 *     if   mode is None:  return PETSC_INSERT_VALUES
 *     elif mode is True:  return PETSC_ADD_VALUES
 *     elif mode is False: return PETSC_INSERT_VALUES             # <<<<<<<<<<<<<<
 *     else:               return mode
 * 
 */
  __pyx_t_1 = (__pyx_v_mode == Py_False);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_r = INSERT_VALUES;
    goto __pyx_L0;
  }

  /* "PETSc/petscdef.pxi":60
 *     elif mode is True:  return PETSC_ADD_VALUES
 *     elif mode is False: return PETSC_INSERT_VALUES
 *     else:               return mode             # <<<<<<<<<<<<<<
 * 
 * cdef inline PetscScatterMode scattermode(object mode) \
 */
  /*else*/ {
    __pyx_t_3 = ((InsertMode)__Pyx_PyInt_As_InsertMode(__pyx_v_mode)); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 60, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;
  }

  /* "PETSc/petscdef.pxi":55
 * 
 * 
 * cdef inline PetscInsertMode insertmode(object mode) \             # <<<<<<<<<<<<<<
 *     except <PetscInsertMode>(-1):
 *     if   mode is None:  return PETSC_INSERT_VALUES
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.insertmode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = ((InsertMode)-1L);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdef.pxi":62
 *     else:               return mode
 * 
 * cdef inline PetscScatterMode scattermode(object mode) \             # <<<<<<<<<<<<<<
 *     except <PetscScatterMode>(-1):
 *     if mode is None:  return PETSC_SCATTER_FORWARD
 */

static CYTHON_INLINE ScatterMode __pyx_f_8petsc4py_5PETSc_scattermode(PyObject *__pyx_v_mode) {
  ScatterMode __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  ScatterMode __pyx_t_5;
  __Pyx_RefNannySetupContext("scattermode", 0);

  /* "PETSc/petscdef.pxi":64
 * cdef inline PetscScatterMode scattermode(object mode) \
 *     except <PetscScatterMode>(-1):
 *     if mode is None:  return PETSC_SCATTER_FORWARD             # <<<<<<<<<<<<<<
 *     if mode is False: return PETSC_SCATTER_FORWARD
 *     if mode is True:  return PETSC_SCATTER_REVERSE
 */
  __pyx_t_1 = (__pyx_v_mode == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_r = SCATTER_FORWARD;
    goto __pyx_L0;
  }

  /* "PETSc/petscdef.pxi":65
 *     except <PetscScatterMode>(-1):
 *     if mode is None:  return PETSC_SCATTER_FORWARD
 *     if mode is False: return PETSC_SCATTER_FORWARD             # <<<<<<<<<<<<<<
 *     if mode is True:  return PETSC_SCATTER_REVERSE
 *     if isinstance(mode, str):
 */
  __pyx_t_2 = (__pyx_v_mode == Py_False);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_r = SCATTER_FORWARD;
    goto __pyx_L0;
  }

  /* "PETSc/petscdef.pxi":66
 *     if mode is None:  return PETSC_SCATTER_FORWARD
 *     if mode is False: return PETSC_SCATTER_FORWARD
 *     if mode is True:  return PETSC_SCATTER_REVERSE             # <<<<<<<<<<<<<<
 *     if isinstance(mode, str):
 *         if mode == 'forward': return PETSC_SCATTER_FORWARD
 */
  __pyx_t_1 = (__pyx_v_mode == Py_True);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_r = SCATTER_REVERSE;
    goto __pyx_L0;
  }

  /* "PETSc/petscdef.pxi":67
 *     if mode is False: return PETSC_SCATTER_FORWARD
 *     if mode is True:  return PETSC_SCATTER_REVERSE
 *     if isinstance(mode, str):             # <<<<<<<<<<<<<<
 *         if mode == 'forward': return PETSC_SCATTER_FORWARD
 *         if mode == 'reverse': return PETSC_SCATTER_REVERSE
 */
  __pyx_t_2 = PyString_Check(__pyx_v_mode); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscdef.pxi":68
 *     if mode is True:  return PETSC_SCATTER_REVERSE
 *     if isinstance(mode, str):
 *         if mode == 'forward': return PETSC_SCATTER_FORWARD             # <<<<<<<<<<<<<<
 *         if mode == 'reverse': return PETSC_SCATTER_REVERSE
 *         else: raise ValueError("unknown scatter mode: %s" % mode)
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_forward, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 68, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_r = SCATTER_FORWARD;
      goto __pyx_L0;
    }

    /* "PETSc/petscdef.pxi":69
 *     if isinstance(mode, str):
 *         if mode == 'forward': return PETSC_SCATTER_FORWARD
 *         if mode == 'reverse': return PETSC_SCATTER_REVERSE             # <<<<<<<<<<<<<<
 *         else: raise ValueError("unknown scatter mode: %s" % mode)
 *     return mode
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_reverse, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 69, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_r = SCATTER_REVERSE;
      goto __pyx_L0;
    }

    /* "PETSc/petscdef.pxi":70
 *         if mode == 'forward': return PETSC_SCATTER_FORWARD
 *         if mode == 'reverse': return PETSC_SCATTER_REVERSE
 *         else: raise ValueError("unknown scatter mode: %s" % mode)             # <<<<<<<<<<<<<<
 *     return mode
 * 
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unknown_scatter_mode_s, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 70, __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, 70, __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, 70, __pyx_L1_error)
    }

    /* "PETSc/petscdef.pxi":67
 *     if mode is False: return PETSC_SCATTER_FORWARD
 *     if mode is True:  return PETSC_SCATTER_REVERSE
 *     if isinstance(mode, str):             # <<<<<<<<<<<<<<
 *         if mode == 'forward': return PETSC_SCATTER_FORWARD
 *         if mode == 'reverse': return PETSC_SCATTER_REVERSE
 */
  }

  /* "PETSc/petscdef.pxi":71
 *         if mode == 'reverse': return PETSC_SCATTER_REVERSE
 *         else: raise ValueError("unknown scatter mode: %s" % mode)
 *     return mode             # <<<<<<<<<<<<<<
 * 
 */
  __pyx_t_5 = ((ScatterMode)__Pyx_PyInt_As_ScatterMode(__pyx_v_mode)); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 71, __pyx_L1_error)
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "PETSc/petscdef.pxi":62
 *     else:               return mode
 * 
 * cdef inline PetscScatterMode scattermode(object mode) \             # <<<<<<<<<<<<<<
 *     except <PetscScatterMode>(-1):
 *     if mode is None:  return PETSC_SCATTER_FORWARD
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.scattermode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = ((ScatterMode)-1L);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":39
 * #
 * 
 * cdef getprefix(prefix, deft=None):             # <<<<<<<<<<<<<<
 *     if prefix is None:
 *         prefix = deft
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_getprefix(PyObject *__pyx_v_prefix, struct __pyx_opt_args_8petsc4py_5PETSc_getprefix *__pyx_optional_args) {
  PyObject *__pyx_v_deft = ((PyObject *)Py_None);
  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;
  __Pyx_RefNannySetupContext("getprefix", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_deft = __pyx_optional_args->deft;
    }
  }
  __Pyx_INCREF(__pyx_v_prefix);

  /* "PETSc/petscopt.pxi":40
 * 
 * cdef getprefix(prefix, deft=None):
 *     if prefix is None:             # <<<<<<<<<<<<<<
 *         prefix = deft
 *     elif isinstance(prefix, Options):
 */
  __pyx_t_1 = (__pyx_v_prefix == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscopt.pxi":41
 * cdef getprefix(prefix, deft=None):
 *     if prefix is None:
 *         prefix = deft             # <<<<<<<<<<<<<<
 *     elif isinstance(prefix, Options):
 *         prefix = prefix.prefix
 */
    __Pyx_INCREF(__pyx_v_deft);
    __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_v_deft);

    /* "PETSc/petscopt.pxi":40
 * 
 * cdef getprefix(prefix, deft=None):
 *     if prefix is None:             # <<<<<<<<<<<<<<
 *         prefix = deft
 *     elif isinstance(prefix, Options):
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscopt.pxi":42
 *     if prefix is None:
 *         prefix = deft
 *     elif isinstance(prefix, Options):             # <<<<<<<<<<<<<<
 *         prefix = prefix.prefix
 *     elif isinstance(prefix, Object):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_prefix, __pyx_ptype_8petsc4py_5PETSc_Options); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscopt.pxi":43
 *         prefix = deft
 *     elif isinstance(prefix, Options):
 *         prefix = prefix.prefix             # <<<<<<<<<<<<<<
 *     elif isinstance(prefix, Object):
 *         prefix = prefix.getOptionsPrefix()
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix, __pyx_n_s_prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 43, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/petscopt.pxi":42
 *     if prefix is None:
 *         prefix = deft
 *     elif isinstance(prefix, Options):             # <<<<<<<<<<<<<<
 *         prefix = prefix.prefix
 *     elif isinstance(prefix, Object):
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscopt.pxi":44
 *     elif isinstance(prefix, Options):
 *         prefix = prefix.prefix
 *     elif isinstance(prefix, Object):             # <<<<<<<<<<<<<<
 *         prefix = prefix.getOptionsPrefix()
 *     elif not isinstance(prefix, str):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_prefix, __pyx_ptype_8petsc4py_5PETSc_Object); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscopt.pxi":45
 *         prefix = prefix.prefix
 *     elif isinstance(prefix, Object):
 *         prefix = prefix.getOptionsPrefix()             # <<<<<<<<<<<<<<
 *     elif not isinstance(prefix, str):
 *         raise TypeError('option prefix must be string')
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix, __pyx_n_s_getOptionsPrefix); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 45, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 45, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 45, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/petscopt.pxi":44
 *     elif isinstance(prefix, Options):
 *         prefix = prefix.prefix
 *     elif isinstance(prefix, Object):             # <<<<<<<<<<<<<<
 *         prefix = prefix.getOptionsPrefix()
 *     elif not isinstance(prefix, str):
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscopt.pxi":46
 *     elif isinstance(prefix, Object):
 *         prefix = prefix.getOptionsPrefix()
 *     elif not isinstance(prefix, str):             # <<<<<<<<<<<<<<
 *         raise TypeError('option prefix must be string')
 *     if not prefix:
 */
  __pyx_t_2 = PyString_Check(__pyx_v_prefix); 
  __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscopt.pxi":47
 *         prefix = prefix.getOptionsPrefix()
 *     elif not isinstance(prefix, str):
 *         raise TypeError('option prefix must be string')             # <<<<<<<<<<<<<<
 *     if not prefix:
 *         return None
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 47, __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(3, 47, __pyx_L1_error)

    /* "PETSc/petscopt.pxi":46
 *     elif isinstance(prefix, Object):
 *         prefix = prefix.getOptionsPrefix()
 *     elif not isinstance(prefix, str):             # <<<<<<<<<<<<<<
 *         raise TypeError('option prefix must be string')
 *     if not prefix:
 */
  }
  __pyx_L3:;

  /* "PETSc/petscopt.pxi":48
 *     elif not isinstance(prefix, str):
 *         raise TypeError('option prefix must be string')
 *     if not prefix:             # <<<<<<<<<<<<<<
 *         return None
 *     if prefix.count(' '):
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 48, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscopt.pxi":49
 *         raise TypeError('option prefix must be string')
 *     if not prefix:
 *         return None             # <<<<<<<<<<<<<<
 *     if prefix.count(' '):
 *         raise ValueError('option prefix should not have spaces')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "PETSc/petscopt.pxi":48
 *     elif not isinstance(prefix, str):
 *         raise TypeError('option prefix must be string')
 *     if not prefix:             # <<<<<<<<<<<<<<
 *         return None
 *     if prefix.count(' '):
 */
  }

  /* "PETSc/petscopt.pxi":50
 *     if not prefix:
 *         return None
 *     if prefix.count(' '):             # <<<<<<<<<<<<<<
 *         raise ValueError('option prefix should not have spaces')
 *     if prefix.startswith('-'):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix, __pyx_n_s_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 50, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "PETSc/petscopt.pxi":51
 *         return None
 *     if prefix.count(' '):
 *         raise ValueError('option prefix should not have spaces')             # <<<<<<<<<<<<<<
 *     if prefix.startswith('-'):
 *         raise ValueError('option prefix should not start with a hypen')
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 51, __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(3, 51, __pyx_L1_error)

    /* "PETSc/petscopt.pxi":50
 *     if not prefix:
 *         return None
 *     if prefix.count(' '):             # <<<<<<<<<<<<<<
 *         raise ValueError('option prefix should not have spaces')
 *     if prefix.startswith('-'):
 */
  }

  /* "PETSc/petscopt.pxi":52
 *     if prefix.count(' '):
 *         raise ValueError('option prefix should not have spaces')
 *     if prefix.startswith('-'):             # <<<<<<<<<<<<<<
 *         raise ValueError('option prefix should not start with a hypen')
 *     return prefix
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix, __pyx_n_s_startswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 52, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "PETSc/petscopt.pxi":53
 *         raise ValueError('option prefix should not have spaces')
 *     if prefix.startswith('-'):
 *         raise ValueError('option prefix should not start with a hypen')             # <<<<<<<<<<<<<<
 *     return prefix
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 53, __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(3, 53, __pyx_L1_error)

    /* "PETSc/petscopt.pxi":52
 *     if prefix.count(' '):
 *         raise ValueError('option prefix should not have spaces')
 *     if prefix.startswith('-'):             # <<<<<<<<<<<<<<
 *         raise ValueError('option prefix should not start with a hypen')
 *     return prefix
 */
  }

  /* "PETSc/petscopt.pxi":54
 *     if prefix.startswith('-'):
 *         raise ValueError('option prefix should not start with a hypen')
 *     return prefix             # <<<<<<<<<<<<<<
 * 
 * #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_prefix);
  __pyx_r = __pyx_v_prefix;
  goto __pyx_L0;

  /* "PETSc/petscopt.pxi":39
 * #
 * 
 * cdef getprefix(prefix, deft=None):             # <<<<<<<<<<<<<<
 *     if prefix is None:
 *         prefix = deft
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.getprefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":58
 * #
 * 
 * cdef opt2str(const_char *pre, const_char *name):             # <<<<<<<<<<<<<<
 *     p = bytes2str(pre)  if pre!=NULL else None
 *     n = bytes2str(name) if name[0]!=c'-' else bytes2str(&name[1])
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_opt2str(const char *__pyx_v_pre, const char *__pyx_v_name) {
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("opt2str", 0);

  /* "PETSc/petscopt.pxi":59
 * 
 * cdef opt2str(const_char *pre, const_char *name):
 *     p = bytes2str(pre)  if pre!=NULL else None             # <<<<<<<<<<<<<<
 *     n = bytes2str(name) if name[0]!=c'-' else bytes2str(&name[1])
 *     return '(prefix:%s, name:%s)' % (p, n)
 */
  if (((__pyx_v_pre != NULL) != 0)) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_pre); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_v_p = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscopt.pxi":60
 * cdef opt2str(const_char *pre, const_char *name):
 *     p = bytes2str(pre)  if pre!=NULL else None
 *     n = bytes2str(name) if name[0]!=c'-' else bytes2str(&name[1])             # <<<<<<<<<<<<<<
 *     return '(prefix:%s, name:%s)' % (p, n)
 * 
 */
  if ((((__pyx_v_name[0]) != '-') != 0)) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str((&(__pyx_v_name[1]))); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_v_n = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscopt.pxi":61
 *     p = bytes2str(pre)  if pre!=NULL else None
 *     n = bytes2str(name) if name[0]!=c'-' else bytes2str(&name[1])
 *     return '(prefix:%s, name:%s)' % (p, n)             # <<<<<<<<<<<<<<
 * 
 * cdef getopt_Bool(PetscOptions opt, const_char *pre, const_char *name, object deft):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_GIVEREF(__pyx_v_p);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_p);
  __Pyx_INCREF(__pyx_v_n);
  __Pyx_GIVEREF(__pyx_v_n);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_n);
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_prefix_s_name_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 61, __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;

  /* "PETSc/petscopt.pxi":58
 * #
 * 
 * cdef opt2str(const_char *pre, const_char *name):             # <<<<<<<<<<<<<<
 *     p = bytes2str(pre)  if pre!=NULL else None
 *     n = bytes2str(name) if name[0]!=c'-' else bytes2str(&name[1])
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.opt2str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":63
 *     return '(prefix:%s, name:%s)' % (p, n)
 * 
 * cdef getopt_Bool(PetscOptions opt, const_char *pre, const_char *name, object deft):             # <<<<<<<<<<<<<<
 *     cdef PetscBool value = PETSC_FALSE
 *     cdef PetscBool flag  = PETSC_FALSE
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_getopt_Bool(PetscOptions __pyx_v_opt, const char *__pyx_v_pre, const char *__pyx_v_name, PyObject *__pyx_v_deft) {
  PetscBool __pyx_v_value;
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getopt_Bool", 0);

  /* "PETSc/petscopt.pxi":64
 * 
 * cdef getopt_Bool(PetscOptions opt, const_char *pre, const_char *name, object deft):
 *     cdef PetscBool value = PETSC_FALSE             # <<<<<<<<<<<<<<
 *     cdef PetscBool flag  = PETSC_FALSE
 *     CHKERR( PetscOptionsGetBool(opt, pre, name, &value, &flag) )
 */
  __pyx_v_value = PETSC_FALSE;

  /* "PETSc/petscopt.pxi":65
 * cdef getopt_Bool(PetscOptions opt, const_char *pre, const_char *name, object deft):
 *     cdef PetscBool value = PETSC_FALSE
 *     cdef PetscBool flag  = PETSC_FALSE             # <<<<<<<<<<<<<<
 *     CHKERR( PetscOptionsGetBool(opt, pre, name, &value, &flag) )
 *     if flag==PETSC_TRUE: return <bint>value
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/petscopt.pxi":66
 *     cdef PetscBool value = PETSC_FALSE
 *     cdef PetscBool flag  = PETSC_FALSE
 *     CHKERR( PetscOptionsGetBool(opt, pre, name, &value, &flag) )             # <<<<<<<<<<<<<<
 *     if flag==PETSC_TRUE: return <bint>value
 *     if deft is not None: return deft
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsGetBool(__pyx_v_opt, __pyx_v_pre, __pyx_v_name, (&__pyx_v_value), (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 66, __pyx_L1_error)

  /* "PETSc/petscopt.pxi":67
 *     cdef PetscBool flag  = PETSC_FALSE
 *     CHKERR( PetscOptionsGetBool(opt, pre, name, &value, &flag) )
 *     if flag==PETSC_TRUE: return <bint>value             # <<<<<<<<<<<<<<
 *     if deft is not None: return deft
 *     raise KeyError(opt2str(pre, name))
 */
  __pyx_t_2 = ((__pyx_v_flag == PETSC_TRUE) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyInt_From_PetscBool(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 67, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":68
 *     CHKERR( PetscOptionsGetBool(opt, pre, name, &value, &flag) )
 *     if flag==PETSC_TRUE: return <bint>value
 *     if deft is not None: return deft             # <<<<<<<<<<<<<<
 *     raise KeyError(opt2str(pre, name))
 * 
 */
  __pyx_t_2 = (__pyx_v_deft != Py_None);
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_deft);
    __pyx_r = __pyx_v_deft;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":69
 *     if flag==PETSC_TRUE: return <bint>value
 *     if deft is not None: return deft
 *     raise KeyError(opt2str(pre, name))             # <<<<<<<<<<<<<<
 * 
 * cdef getopt_Int(PetscOptions opt, const_char *pre, const_char *name, object deft):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_opt2str(__pyx_v_pre, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 69, __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_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(3, 69, __pyx_L1_error)

  /* "PETSc/petscopt.pxi":63
 *     return '(prefix:%s, name:%s)' % (p, n)
 * 
 * cdef getopt_Bool(PetscOptions opt, const_char *pre, const_char *name, object deft):             # <<<<<<<<<<<<<<
 *     cdef PetscBool value = PETSC_FALSE
 *     cdef PetscBool flag  = PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.getopt_Bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":71
 *     raise KeyError(opt2str(pre, name))
 * 
 * cdef getopt_Int(PetscOptions opt, const_char *pre, const_char *name, object deft):             # <<<<<<<<<<<<<<
 *     cdef PetscInt value = 0
 *     cdef PetscBool flag = PETSC_FALSE
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_getopt_Int(PetscOptions __pyx_v_opt, const char *__pyx_v_pre, const char *__pyx_v_name, PyObject *__pyx_v_deft) {
  PetscInt __pyx_v_value;
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getopt_Int", 0);

  /* "PETSc/petscopt.pxi":72
 * 
 * cdef getopt_Int(PetscOptions opt, const_char *pre, const_char *name, object deft):
 *     cdef PetscInt value = 0             # <<<<<<<<<<<<<<
 *     cdef PetscBool flag = PETSC_FALSE
 *     CHKERR( PetscOptionsGetInt(opt, pre, name, &value, &flag) )
 */
  __pyx_v_value = 0;

  /* "PETSc/petscopt.pxi":73
 * cdef getopt_Int(PetscOptions opt, const_char *pre, const_char *name, object deft):
 *     cdef PetscInt value = 0
 *     cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *     CHKERR( PetscOptionsGetInt(opt, pre, name, &value, &flag) )
 *     if flag==PETSC_TRUE: return toInt(value)
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/petscopt.pxi":74
 *     cdef PetscInt value = 0
 *     cdef PetscBool flag = PETSC_FALSE
 *     CHKERR( PetscOptionsGetInt(opt, pre, name, &value, &flag) )             # <<<<<<<<<<<<<<
 *     if flag==PETSC_TRUE: return toInt(value)
 *     if deft is not None: return deft
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsGetInt(__pyx_v_opt, __pyx_v_pre, __pyx_v_name, (&__pyx_v_value), (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 74, __pyx_L1_error)

  /* "PETSc/petscopt.pxi":75
 *     cdef PetscBool flag = PETSC_FALSE
 *     CHKERR( PetscOptionsGetInt(opt, pre, name, &value, &flag) )
 *     if flag==PETSC_TRUE: return toInt(value)             # <<<<<<<<<<<<<<
 *     if deft is not None: return deft
 *     raise KeyError(opt2str(pre, name))
 */
  __pyx_t_2 = ((__pyx_v_flag == PETSC_TRUE) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 75, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":76
 *     CHKERR( PetscOptionsGetInt(opt, pre, name, &value, &flag) )
 *     if flag==PETSC_TRUE: return toInt(value)
 *     if deft is not None: return deft             # <<<<<<<<<<<<<<
 *     raise KeyError(opt2str(pre, name))
 * 
 */
  __pyx_t_2 = (__pyx_v_deft != Py_None);
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_deft);
    __pyx_r = __pyx_v_deft;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":77
 *     if flag==PETSC_TRUE: return toInt(value)
 *     if deft is not None: return deft
 *     raise KeyError(opt2str(pre, name))             # <<<<<<<<<<<<<<
 * 
 * cdef getopt_Real(PetscOptions opt, const_char *pre, const_char *name, object deft):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_opt2str(__pyx_v_pre, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 77, __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_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(3, 77, __pyx_L1_error)

  /* "PETSc/petscopt.pxi":71
 *     raise KeyError(opt2str(pre, name))
 * 
 * cdef getopt_Int(PetscOptions opt, const_char *pre, const_char *name, object deft):             # <<<<<<<<<<<<<<
 *     cdef PetscInt value = 0
 *     cdef PetscBool flag = PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.getopt_Int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":79
 *     raise KeyError(opt2str(pre, name))
 * 
 * cdef getopt_Real(PetscOptions opt, const_char *pre, const_char *name, object deft):             # <<<<<<<<<<<<<<
 *     cdef PetscReal value = 0
 *     cdef PetscBool flag = PETSC_FALSE
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_getopt_Real(PetscOptions __pyx_v_opt, const char *__pyx_v_pre, const char *__pyx_v_name, PyObject *__pyx_v_deft) {
  PetscReal __pyx_v_value;
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getopt_Real", 0);

  /* "PETSc/petscopt.pxi":80
 * 
 * cdef getopt_Real(PetscOptions opt, const_char *pre, const_char *name, object deft):
 *     cdef PetscReal value = 0             # <<<<<<<<<<<<<<
 *     cdef PetscBool flag = PETSC_FALSE
 *     CHKERR( PetscOptionsGetReal(opt, pre, name, &value, &flag) )
 */
  __pyx_v_value = 0.0;

  /* "PETSc/petscopt.pxi":81
 * cdef getopt_Real(PetscOptions opt, const_char *pre, const_char *name, object deft):
 *     cdef PetscReal value = 0
 *     cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *     CHKERR( PetscOptionsGetReal(opt, pre, name, &value, &flag) )
 *     if flag==PETSC_TRUE: return toReal(value)
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/petscopt.pxi":82
 *     cdef PetscReal value = 0
 *     cdef PetscBool flag = PETSC_FALSE
 *     CHKERR( PetscOptionsGetReal(opt, pre, name, &value, &flag) )             # <<<<<<<<<<<<<<
 *     if flag==PETSC_TRUE: return toReal(value)
 *     if deft is not None: return deft
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsGetReal(__pyx_v_opt, __pyx_v_pre, __pyx_v_name, (&__pyx_v_value), (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 82, __pyx_L1_error)

  /* "PETSc/petscopt.pxi":83
 *     cdef PetscBool flag = PETSC_FALSE
 *     CHKERR( PetscOptionsGetReal(opt, pre, name, &value, &flag) )
 *     if flag==PETSC_TRUE: return toReal(value)             # <<<<<<<<<<<<<<
 *     if deft is not None: return deft
 *     raise KeyError(opt2str(pre, name))
 */
  __pyx_t_2 = ((__pyx_v_flag == PETSC_TRUE) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 83, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":84
 *     CHKERR( PetscOptionsGetReal(opt, pre, name, &value, &flag) )
 *     if flag==PETSC_TRUE: return toReal(value)
 *     if deft is not None: return deft             # <<<<<<<<<<<<<<
 *     raise KeyError(opt2str(pre, name))
 * 
 */
  __pyx_t_2 = (__pyx_v_deft != Py_None);
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_deft);
    __pyx_r = __pyx_v_deft;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":85
 *     if flag==PETSC_TRUE: return toReal(value)
 *     if deft is not None: return deft
 *     raise KeyError(opt2str(pre, name))             # <<<<<<<<<<<<<<
 * 
 * cdef getopt_Scalar(PetscOptions opt, const_char *pre, const_char *name, object deft):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_opt2str(__pyx_v_pre, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 85, __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_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(3, 85, __pyx_L1_error)

  /* "PETSc/petscopt.pxi":79
 *     raise KeyError(opt2str(pre, name))
 * 
 * cdef getopt_Real(PetscOptions opt, const_char *pre, const_char *name, object deft):             # <<<<<<<<<<<<<<
 *     cdef PetscReal value = 0
 *     cdef PetscBool flag = PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.getopt_Real", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":87
 *     raise KeyError(opt2str(pre, name))
 * 
 * cdef getopt_Scalar(PetscOptions opt, const_char *pre, const_char *name, object deft):             # <<<<<<<<<<<<<<
 *     cdef PetscScalar value = 0
 *     cdef PetscBool flag = PETSC_FALSE
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_getopt_Scalar(PetscOptions __pyx_v_opt, const char *__pyx_v_pre, const char *__pyx_v_name, PyObject *__pyx_v_deft) {
  PetscScalar __pyx_v_value;
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getopt_Scalar", 0);

  /* "PETSc/petscopt.pxi":88
 * 
 * cdef getopt_Scalar(PetscOptions opt, const_char *pre, const_char *name, object deft):
 *     cdef PetscScalar value = 0             # <<<<<<<<<<<<<<
 *     cdef PetscBool flag = PETSC_FALSE
 *     CHKERR( PetscOptionsGetScalar(opt, pre, name, &value, &flag) )
 */
  __pyx_v_value = 0.0;

  /* "PETSc/petscopt.pxi":89
 * cdef getopt_Scalar(PetscOptions opt, const_char *pre, const_char *name, object deft):
 *     cdef PetscScalar value = 0
 *     cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *     CHKERR( PetscOptionsGetScalar(opt, pre, name, &value, &flag) )
 *     if flag==PETSC_TRUE: return toScalar(value)
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/petscopt.pxi":90
 *     cdef PetscScalar value = 0
 *     cdef PetscBool flag = PETSC_FALSE
 *     CHKERR( PetscOptionsGetScalar(opt, pre, name, &value, &flag) )             # <<<<<<<<<<<<<<
 *     if flag==PETSC_TRUE: return toScalar(value)
 *     if deft is not None: return deft
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsGetScalar(__pyx_v_opt, __pyx_v_pre, __pyx_v_name, (&__pyx_v_value), (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 90, __pyx_L1_error)

  /* "PETSc/petscopt.pxi":91
 *     cdef PetscBool flag = PETSC_FALSE
 *     CHKERR( PetscOptionsGetScalar(opt, pre, name, &value, &flag) )
 *     if flag==PETSC_TRUE: return toScalar(value)             # <<<<<<<<<<<<<<
 *     if deft is not None: return deft
 *     raise KeyError(opt2str(pre, name))
 */
  __pyx_t_2 = ((__pyx_v_flag == PETSC_TRUE) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toScalar(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":92
 *     CHKERR( PetscOptionsGetScalar(opt, pre, name, &value, &flag) )
 *     if flag==PETSC_TRUE: return toScalar(value)
 *     if deft is not None: return deft             # <<<<<<<<<<<<<<
 *     raise KeyError(opt2str(pre, name))
 * 
 */
  __pyx_t_2 = (__pyx_v_deft != Py_None);
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_deft);
    __pyx_r = __pyx_v_deft;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":93
 *     if flag==PETSC_TRUE: return toScalar(value)
 *     if deft is not None: return deft
 *     raise KeyError(opt2str(pre, name))             # <<<<<<<<<<<<<<
 * 
 * cdef getopt_String(PetscOptions opt, const_char *pre, const_char *name, object deft):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_opt2str(__pyx_v_pre, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 93, __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_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(3, 93, __pyx_L1_error)

  /* "PETSc/petscopt.pxi":87
 *     raise KeyError(opt2str(pre, name))
 * 
 * cdef getopt_Scalar(PetscOptions opt, const_char *pre, const_char *name, object deft):             # <<<<<<<<<<<<<<
 *     cdef PetscScalar value = 0
 *     cdef PetscBool flag = PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.getopt_Scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":95
 *     raise KeyError(opt2str(pre, name))
 * 
 * cdef getopt_String(PetscOptions opt, const_char *pre, const_char *name, object deft):             # <<<<<<<<<<<<<<
 *     cdef char value[1024+1]
 *     cdef PetscBool flag = PETSC_FALSE
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_getopt_String(PetscOptions __pyx_v_opt, const char *__pyx_v_pre, const char *__pyx_v_name, PyObject *__pyx_v_deft) {
  char __pyx_v_value[(0x400 + 1)];
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getopt_String", 0);

  /* "PETSc/petscopt.pxi":97
 * cdef getopt_String(PetscOptions opt, const_char *pre, const_char *name, object deft):
 *     cdef char value[1024+1]
 *     cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *     CHKERR( PetscOptionsGetString(opt, pre, name, value, 1024, &flag) )
 *     if flag==PETSC_TRUE: return bytes2str(value)
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/petscopt.pxi":98
 *     cdef char value[1024+1]
 *     cdef PetscBool flag = PETSC_FALSE
 *     CHKERR( PetscOptionsGetString(opt, pre, name, value, 1024, &flag) )             # <<<<<<<<<<<<<<
 *     if flag==PETSC_TRUE: return bytes2str(value)
 *     if deft is not None: return deft
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsGetString(__pyx_v_opt, __pyx_v_pre, __pyx_v_name, __pyx_v_value, 0x400, (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 98, __pyx_L1_error)

  /* "PETSc/petscopt.pxi":99
 *     cdef PetscBool flag = PETSC_FALSE
 *     CHKERR( PetscOptionsGetString(opt, pre, name, value, 1024, &flag) )
 *     if flag==PETSC_TRUE: return bytes2str(value)             # <<<<<<<<<<<<<<
 *     if deft is not None: return deft
 *     raise KeyError(opt2str(pre, name))
 */
  __pyx_t_2 = ((__pyx_v_flag == PETSC_TRUE) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":100
 *     CHKERR( PetscOptionsGetString(opt, pre, name, value, 1024, &flag) )
 *     if flag==PETSC_TRUE: return bytes2str(value)
 *     if deft is not None: return deft             # <<<<<<<<<<<<<<
 *     raise KeyError(opt2str(pre, name))
 * 
 */
  __pyx_t_2 = (__pyx_v_deft != Py_None);
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_deft);
    __pyx_r = __pyx_v_deft;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":101
 *     if flag==PETSC_TRUE: return bytes2str(value)
 *     if deft is not None: return deft
 *     raise KeyError(opt2str(pre, name))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_opt2str(__pyx_v_pre, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 101, __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_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(3, 101, __pyx_L1_error)

  /* "PETSc/petscopt.pxi":95
 *     raise KeyError(opt2str(pre, name))
 * 
 * cdef getopt_String(PetscOptions opt, const_char *pre, const_char *name, object deft):             # <<<<<<<<<<<<<<
 *     cdef char value[1024+1]
 *     cdef PetscBool flag = PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.getopt_String", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":111
 *     OPT_STRING
 * 
 * cdef getpair(prefix, name, const_char **pr, const_char **nm):             # <<<<<<<<<<<<<<
 *     # --
 *     cdef const_char *p = NULL
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_getpair(PyObject *__pyx_v_prefix, PyObject *__pyx_v_name, const char **__pyx_v_pr, const char **__pyx_v_nm) {
  const char *__pyx_v_p;
  const char *__pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getpair", 0);
  __Pyx_INCREF(__pyx_v_prefix);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/petscopt.pxi":113
 * cdef getpair(prefix, name, const_char **pr, const_char **nm):
 *     # --
 *     cdef const_char *p = NULL             # <<<<<<<<<<<<<<
 *     prefix = str2bytes(prefix, &p)
 *     if p != NULL and p[0] == c'-':
 */
  __pyx_v_p = NULL;

  /* "PETSc/petscopt.pxi":114
 *     # --
 *     cdef const_char *p = NULL
 *     prefix = str2bytes(prefix, &p)             # <<<<<<<<<<<<<<
 *     if p != NULL and p[0] == c'-':
 *         p = &p[1]
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_prefix, (&__pyx_v_p)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscopt.pxi":115
 *     cdef const_char *p = NULL
 *     prefix = str2bytes(prefix, &p)
 *     if p != NULL and p[0] == c'-':             # <<<<<<<<<<<<<<
 *         p = &p[1]
 *     # --
 */
  __pyx_t_3 = ((__pyx_v_p != NULL) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (((__pyx_v_p[0]) == '-') != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PETSc/petscopt.pxi":116
 *     prefix = str2bytes(prefix, &p)
 *     if p != NULL and p[0] == c'-':
 *         p = &p[1]             # <<<<<<<<<<<<<<
 *     # --
 *     cdef const_char *n = NULL
 */
    __pyx_v_p = (&(__pyx_v_p[1]));

    /* "PETSc/petscopt.pxi":115
 *     cdef const_char *p = NULL
 *     prefix = str2bytes(prefix, &p)
 *     if p != NULL and p[0] == c'-':             # <<<<<<<<<<<<<<
 *         p = &p[1]
 *     # --
 */
  }

  /* "PETSc/petscopt.pxi":118
 *         p = &p[1]
 *     # --
 *     cdef const_char *n = NULL             # <<<<<<<<<<<<<<
 *     name = str2bytes(name, &n)
 *     if n != NULL and n[0] != c'-':
 */
  __pyx_v_n = NULL;

  /* "PETSc/petscopt.pxi":119
 *     # --
 *     cdef const_char *n = NULL
 *     name = str2bytes(name, &n)             # <<<<<<<<<<<<<<
 *     if n != NULL and n[0] != c'-':
 *         name = b'-' + name
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscopt.pxi":120
 *     cdef const_char *n = NULL
 *     name = str2bytes(name, &n)
 *     if n != NULL and n[0] != c'-':             # <<<<<<<<<<<<<<
 *         name = b'-' + name
 *         name = str2bytes(name, &n)
 */
  __pyx_t_3 = ((__pyx_v_n != NULL) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_3 = (((__pyx_v_n[0]) != '-') != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PETSc/petscopt.pxi":121
 *     name = str2bytes(name, &n)
 *     if n != NULL and n[0] != c'-':
 *         name = b'-' + name             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &n)
 *     # --
 */
    __pyx_t_1 = PyNumber_Add(__pyx_kp_b__5, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "PETSc/petscopt.pxi":122
 *     if n != NULL and n[0] != c'-':
 *         name = b'-' + name
 *         name = str2bytes(name, &n)             # <<<<<<<<<<<<<<
 *     # --
 *     pr[0] = p
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "PETSc/petscopt.pxi":120
 *     cdef const_char *n = NULL
 *     name = str2bytes(name, &n)
 *     if n != NULL and n[0] != c'-':             # <<<<<<<<<<<<<<
 *         name = b'-' + name
 *         name = str2bytes(name, &n)
 */
  }

  /* "PETSc/petscopt.pxi":124
 *         name = str2bytes(name, &n)
 *     # --
 *     pr[0] = p             # <<<<<<<<<<<<<<
 *     nm[0] = n
 *     return (prefix, name)
 */
  (__pyx_v_pr[0]) = __pyx_v_p;

  /* "PETSc/petscopt.pxi":125
 *     # --
 *     pr[0] = p
 *     nm[0] = n             # <<<<<<<<<<<<<<
 *     return (prefix, name)
 * 
 */
  (__pyx_v_nm[0]) = __pyx_v_n;

  /* "PETSc/petscopt.pxi":126
 *     pr[0] = p
 *     nm[0] = n
 *     return (prefix, name)             # <<<<<<<<<<<<<<
 * 
 * cdef getopt(PetscOptions opt, PetscOptType otype, prefix, name, deft):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_prefix);
  __Pyx_GIVEREF(__pyx_v_prefix);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_prefix);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_name);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/petscopt.pxi":111
 *     OPT_STRING
 * 
 * cdef getpair(prefix, name, const_char **pr, const_char **nm):             # <<<<<<<<<<<<<<
 *     # --
 *     cdef const_char *p = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.getpair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":128
 *     return (prefix, name)
 * 
 * cdef getopt(PetscOptions opt, PetscOptType otype, prefix, name, deft):             # <<<<<<<<<<<<<<
 *     cdef const_char *pr = NULL
 *     cdef const_char *nm = NULL
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_getopt(PetscOptions __pyx_v_opt, enum __pyx_t_8petsc4py_5PETSc_PetscOptType __pyx_v_otype, PyObject *__pyx_v_prefix, PyObject *__pyx_v_name, PyObject *__pyx_v_deft) {
  const char *__pyx_v_pr;
  const char *__pyx_v_nm;
  CYTHON_UNUSED PyObject *__pyx_v_tmp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getopt", 0);

  /* "PETSc/petscopt.pxi":129
 * 
 * cdef getopt(PetscOptions opt, PetscOptType otype, prefix, name, deft):
 *     cdef const_char *pr = NULL             # <<<<<<<<<<<<<<
 *     cdef const_char *nm = NULL
 *     tmp = getpair(prefix, name, &pr, &nm)
 */
  __pyx_v_pr = NULL;

  /* "PETSc/petscopt.pxi":130
 * cdef getopt(PetscOptions opt, PetscOptType otype, prefix, name, deft):
 *     cdef const_char *pr = NULL
 *     cdef const_char *nm = NULL             # <<<<<<<<<<<<<<
 *     tmp = getpair(prefix, name, &pr, &nm)
 *     if otype == OPT_BOOL   : return getopt_Bool   (opt, pr, nm, deft)
 */
  __pyx_v_nm = NULL;

  /* "PETSc/petscopt.pxi":131
 *     cdef const_char *pr = NULL
 *     cdef const_char *nm = NULL
 *     tmp = getpair(prefix, name, &pr, &nm)             # <<<<<<<<<<<<<<
 *     if otype == OPT_BOOL   : return getopt_Bool   (opt, pr, nm, deft)
 *     if otype == OPT_INT    : return getopt_Int    (opt, pr, nm, deft)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_getpair(__pyx_v_prefix, __pyx_v_name, (&__pyx_v_pr), (&__pyx_v_nm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tmp = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscopt.pxi":132
 *     cdef const_char *nm = NULL
 *     tmp = getpair(prefix, name, &pr, &nm)
 *     if otype == OPT_BOOL   : return getopt_Bool   (opt, pr, nm, deft)             # <<<<<<<<<<<<<<
 *     if otype == OPT_INT    : return getopt_Int    (opt, pr, nm, deft)
 *     if otype == OPT_REAL   : return getopt_Real   (opt, pr, nm, deft)
 */
  __pyx_t_2 = ((__pyx_v_otype == __pyx_e_8petsc4py_5PETSc_OPT_BOOL) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_getopt_Bool(__pyx_v_opt, __pyx_v_pr, __pyx_v_nm, __pyx_v_deft); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":133
 *     tmp = getpair(prefix, name, &pr, &nm)
 *     if otype == OPT_BOOL   : return getopt_Bool   (opt, pr, nm, deft)
 *     if otype == OPT_INT    : return getopt_Int    (opt, pr, nm, deft)             # <<<<<<<<<<<<<<
 *     if otype == OPT_REAL   : return getopt_Real   (opt, pr, nm, deft)
 *     if otype == OPT_SCALAR : return getopt_Scalar (opt, pr, nm, deft)
 */
  __pyx_t_2 = ((__pyx_v_otype == __pyx_e_8petsc4py_5PETSc_OPT_INT) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_getopt_Int(__pyx_v_opt, __pyx_v_pr, __pyx_v_nm, __pyx_v_deft); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":134
 *     if otype == OPT_BOOL   : return getopt_Bool   (opt, pr, nm, deft)
 *     if otype == OPT_INT    : return getopt_Int    (opt, pr, nm, deft)
 *     if otype == OPT_REAL   : return getopt_Real   (opt, pr, nm, deft)             # <<<<<<<<<<<<<<
 *     if otype == OPT_SCALAR : return getopt_Scalar (opt, pr, nm, deft)
 *     if otype == OPT_STRING : return getopt_String (opt, pr, nm, deft)
 */
  __pyx_t_2 = ((__pyx_v_otype == __pyx_e_8petsc4py_5PETSc_OPT_REAL) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_getopt_Real(__pyx_v_opt, __pyx_v_pr, __pyx_v_nm, __pyx_v_deft); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":135
 *     if otype == OPT_INT    : return getopt_Int    (opt, pr, nm, deft)
 *     if otype == OPT_REAL   : return getopt_Real   (opt, pr, nm, deft)
 *     if otype == OPT_SCALAR : return getopt_Scalar (opt, pr, nm, deft)             # <<<<<<<<<<<<<<
 *     if otype == OPT_STRING : return getopt_String (opt, pr, nm, deft)
 * 
 */
  __pyx_t_2 = ((__pyx_v_otype == __pyx_e_8petsc4py_5PETSc_OPT_SCALAR) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_getopt_Scalar(__pyx_v_opt, __pyx_v_pr, __pyx_v_nm, __pyx_v_deft); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":136
 *     if otype == OPT_REAL   : return getopt_Real   (opt, pr, nm, deft)
 *     if otype == OPT_SCALAR : return getopt_Scalar (opt, pr, nm, deft)
 *     if otype == OPT_STRING : return getopt_String (opt, pr, nm, deft)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = ((__pyx_v_otype == __pyx_e_8petsc4py_5PETSc_OPT_STRING) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_getopt_String(__pyx_v_opt, __pyx_v_pr, __pyx_v_nm, __pyx_v_deft); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":128
 *     return (prefix, name)
 * 
 * cdef getopt(PetscOptions opt, PetscOptType otype, prefix, name, deft):             # <<<<<<<<<<<<<<
 *     cdef const_char *pr = NULL
 *     cdef const_char *nm = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.getopt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":141
 * # simple minded options parser
 * 
 * cdef tokenize(options):             # <<<<<<<<<<<<<<
 *   cdef PetscToken t = NULL
 *   cdef const_char *s = NULL
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_tokenize(PyObject *__pyx_v_options) {
  PetscToken __pyx_v_t;
  const char *__pyx_v_s;
  const char *__pyx_v_p;
  PyObject *__pyx_v_tokens = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  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;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("tokenize", 0);
  __Pyx_INCREF(__pyx_v_options);

  /* "PETSc/petscopt.pxi":142
 * 
 * cdef tokenize(options):
 *   cdef PetscToken t = NULL             # <<<<<<<<<<<<<<
 *   cdef const_char *s = NULL
 *   cdef const_char *p = NULL
 */
  __pyx_v_t = NULL;

  /* "PETSc/petscopt.pxi":143
 * cdef tokenize(options):
 *   cdef PetscToken t = NULL
 *   cdef const_char *s = NULL             # <<<<<<<<<<<<<<
 *   cdef const_char *p = NULL
 *   options = str2bytes(options, &s)
 */
  __pyx_v_s = NULL;

  /* "PETSc/petscopt.pxi":144
 *   cdef PetscToken t = NULL
 *   cdef const_char *s = NULL
 *   cdef const_char *p = NULL             # <<<<<<<<<<<<<<
 *   options = str2bytes(options, &s)
 *   cdef list tokens = []
 */
  __pyx_v_p = NULL;

  /* "PETSc/petscopt.pxi":145
 *   cdef const_char *s = NULL
 *   cdef const_char *p = NULL
 *   options = str2bytes(options, &s)             # <<<<<<<<<<<<<<
 *   cdef list tokens = []
 *   CHKERR( PetscTokenCreate(s, c' ', &t) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_options, (&__pyx_v_s)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_options, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscopt.pxi":146
 *   cdef const_char *p = NULL
 *   options = str2bytes(options, &s)
 *   cdef list tokens = []             # <<<<<<<<<<<<<<
 *   CHKERR( PetscTokenCreate(s, c' ', &t) )
 *   try:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tokens = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscopt.pxi":147
 *   options = str2bytes(options, &s)
 *   cdef list tokens = []
 *   CHKERR( PetscTokenCreate(s, c' ', &t) )             # <<<<<<<<<<<<<<
 *   try:
 *       CHKERR( PetscTokenFind(t, <char**>&p) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscTokenCreate(__pyx_v_s, ' ', (&__pyx_v_t))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(3, 147, __pyx_L1_error)

  /* "PETSc/petscopt.pxi":148
 *   cdef list tokens = []
 *   CHKERR( PetscTokenCreate(s, c' ', &t) )
 *   try:             # <<<<<<<<<<<<<<
 *       CHKERR( PetscTokenFind(t, <char**>&p) )
 *       while p != NULL:
 */
  /*try:*/ {

    /* "PETSc/petscopt.pxi":149
 *   CHKERR( PetscTokenCreate(s, c' ', &t) )
 *   try:
 *       CHKERR( PetscTokenFind(t, <char**>&p) )             # <<<<<<<<<<<<<<
 *       while p != NULL:
 *           tokens.append(bytes2str(p))
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscTokenFind(__pyx_v_t, ((char **)(&__pyx_v_p)))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(3, 149, __pyx_L4_error)

    /* "PETSc/petscopt.pxi":150
 *   try:
 *       CHKERR( PetscTokenFind(t, <char**>&p) )
 *       while p != NULL:             # <<<<<<<<<<<<<<
 *           tokens.append(bytes2str(p))
 *           CHKERR( PetscTokenFind(t, <char**>&p) )
 */
    while (1) {
      __pyx_t_3 = ((__pyx_v_p != NULL) != 0);
      if (!__pyx_t_3) break;

      /* "PETSc/petscopt.pxi":151
 *       CHKERR( PetscTokenFind(t, <char**>&p) )
 *       while p != NULL:
 *           tokens.append(bytes2str(p))             # <<<<<<<<<<<<<<
 *           CHKERR( PetscTokenFind(t, <char**>&p) )
 *   finally:
 */
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 151, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_tokens, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(3, 151, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "PETSc/petscopt.pxi":152
 *       while p != NULL:
 *           tokens.append(bytes2str(p))
 *           CHKERR( PetscTokenFind(t, <char**>&p) )             # <<<<<<<<<<<<<<
 *   finally:
 *       CHKERR( PetscTokenDestroy(&t) )
 */
      __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscTokenFind(__pyx_v_t, ((char **)(&__pyx_v_p)))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(3, 152, __pyx_L4_error)
    }
  }

  /* "PETSc/petscopt.pxi":154
 *           CHKERR( PetscTokenFind(t, <char**>&p) )
 *   finally:
 *       CHKERR( PetscTokenDestroy(&t) )             # <<<<<<<<<<<<<<
 *   return tokens
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscTokenDestroy((&__pyx_v_t))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(3, 154, __pyx_L1_error)
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L4_error:;
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __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_XGOTREF(__pyx_t_12);
      __pyx_t_2 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        __pyx_t_13 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscTokenDestroy((&__pyx_v_t))); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(3, 154, __pyx_L9_error)
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
      __pyx_L9_error:;
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "PETSc/petscopt.pxi":155
 *   finally:
 *       CHKERR( PetscTokenDestroy(&t) )
 *   return tokens             # <<<<<<<<<<<<<<
 * 
 * cdef bint iskey(key):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_tokens);
  __pyx_r = __pyx_v_tokens;
  goto __pyx_L0;

  /* "PETSc/petscopt.pxi":141
 * # simple minded options parser
 * 
 * cdef tokenize(options):             # <<<<<<<<<<<<<<
 *   cdef PetscToken t = NULL
 *   cdef const_char *s = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.tokenize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tokens);
  __Pyx_XDECREF(__pyx_v_options);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":157
 *   return tokens
 * 
 * cdef bint iskey(key):             # <<<<<<<<<<<<<<
 *     cdef const_char *k = NULL
 *     cdef PetscBool b = PETSC_FALSE
 */

static int __pyx_f_8petsc4py_5PETSc_iskey(PyObject *__pyx_v_key) {
  const char *__pyx_v_k;
  PetscBool __pyx_v_b;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("iskey", 0);
  __Pyx_INCREF(__pyx_v_key);

  /* "PETSc/petscopt.pxi":158
 * 
 * cdef bint iskey(key):
 *     cdef const_char *k = NULL             # <<<<<<<<<<<<<<
 *     cdef PetscBool b = PETSC_FALSE
 *     if key:
 */
  __pyx_v_k = NULL;

  /* "PETSc/petscopt.pxi":159
 * cdef bint iskey(key):
 *     cdef const_char *k = NULL
 *     cdef PetscBool b = PETSC_FALSE             # <<<<<<<<<<<<<<
 *     if key:
 *         key = str2bytes(key, &k)
 */
  __pyx_v_b = PETSC_FALSE;

  /* "PETSc/petscopt.pxi":160
 *     cdef const_char *k = NULL
 *     cdef PetscBool b = PETSC_FALSE
 *     if key:             # <<<<<<<<<<<<<<
 *         key = str2bytes(key, &k)
 *         CHKERR( PetscOptionsValidKey(k, &b) )
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_key); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 160, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/petscopt.pxi":161
 *     cdef PetscBool b = PETSC_FALSE
 *     if key:
 *         key = str2bytes(key, &k)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsValidKey(k, &b) )
 *         if b == PETSC_TRUE:
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_key, (&__pyx_v_k)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PETSc/petscopt.pxi":162
 *     if key:
 *         key = str2bytes(key, &k)
 *         CHKERR( PetscOptionsValidKey(k, &b) )             # <<<<<<<<<<<<<<
 *         if b == PETSC_TRUE:
 *             return True
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsValidKey(__pyx_v_k, (&__pyx_v_b))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(3, 162, __pyx_L1_error)

    /* "PETSc/petscopt.pxi":163
 *         key = str2bytes(key, &k)
 *         CHKERR( PetscOptionsValidKey(k, &b) )
 *         if b == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *             return True
 *     return False
 */
    __pyx_t_1 = ((__pyx_v_b == PETSC_TRUE) != 0);
    if (__pyx_t_1) {

      /* "PETSc/petscopt.pxi":164
 *         CHKERR( PetscOptionsValidKey(k, &b) )
 *         if b == PETSC_TRUE:
 *             return True             # <<<<<<<<<<<<<<
 *     return False
 * 
 */
      __pyx_r = 1;
      goto __pyx_L0;

      /* "PETSc/petscopt.pxi":163
 *         key = str2bytes(key, &k)
 *         CHKERR( PetscOptionsValidKey(k, &b) )
 *         if b == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *             return True
 *     return False
 */
    }

    /* "PETSc/petscopt.pxi":160
 *     cdef const_char *k = NULL
 *     cdef PetscBool b = PETSC_FALSE
 *     if key:             # <<<<<<<<<<<<<<
 *         key = str2bytes(key, &k)
 *         CHKERR( PetscOptionsValidKey(k, &b) )
 */
  }

  /* "PETSc/petscopt.pxi":165
 *         if b == PETSC_TRUE:
 *             return True
 *     return False             # <<<<<<<<<<<<<<
 * 
 * cdef gettok(tokens):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscopt.pxi":157
 *   return tokens
 * 
 * cdef bint iskey(key):             # <<<<<<<<<<<<<<
 *     cdef const_char *k = NULL
 *     cdef PetscBool b = PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("petsc4py.PETSc.iskey", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":167
 *     return False
 * 
 * cdef gettok(tokens):             # <<<<<<<<<<<<<<
 *     if tokens:
 *         return tokens.pop(0)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_gettok(PyObject *__pyx_v_tokens) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("gettok", 0);

  /* "PETSc/petscopt.pxi":168
 * 
 * cdef gettok(tokens):
 *     if tokens:             # <<<<<<<<<<<<<<
 *         return tokens.pop(0)
 *     else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_tokens); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 168, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/petscopt.pxi":169
 * cdef gettok(tokens):
 *     if tokens:
 *         return tokens.pop(0)             # <<<<<<<<<<<<<<
 *     else:
 *         return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_PopIndex(__pyx_v_tokens, __pyx_int_0, 0, 1, Py_ssize_t, PyInt_FromSsize_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "PETSc/petscopt.pxi":168
 * 
 * cdef gettok(tokens):
 *     if tokens:             # <<<<<<<<<<<<<<
 *         return tokens.pop(0)
 *     else:
 */
  }

  /* "PETSc/petscopt.pxi":171
 *         return tokens.pop(0)
 *     else:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef getkey(key, prefix):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "PETSc/petscopt.pxi":167
 *     return False
 * 
 * cdef gettok(tokens):             # <<<<<<<<<<<<<<
 *     if tokens:
 *         return tokens.pop(0)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.gettok", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":173
 *         return None
 * 
 * cdef getkey(key, prefix):             # <<<<<<<<<<<<<<
 *     if not iskey(key):
 *         return None
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_getkey(PyObject *__pyx_v_key, PyObject *__pyx_v_prefix) {
  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;
  Py_ssize_t __pyx_t_7;
  __Pyx_RefNannySetupContext("getkey", 0);
  __Pyx_INCREF(__pyx_v_key);

  /* "PETSc/petscopt.pxi":174
 * 
 * cdef getkey(key, prefix):
 *     if not iskey(key):             # <<<<<<<<<<<<<<
 *         return None
 *     key = key[1:]
 */
  __pyx_t_1 = ((!(__pyx_f_8petsc4py_5PETSc_iskey(__pyx_v_key) != 0)) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscopt.pxi":175
 * cdef getkey(key, prefix):
 *     if not iskey(key):
 *         return None             # <<<<<<<<<<<<<<
 *     key = key[1:]
 *     if key[0] == '-':
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "PETSc/petscopt.pxi":174
 * 
 * cdef getkey(key, prefix):
 *     if not iskey(key):             # <<<<<<<<<<<<<<
 *         return None
 *     key = key[1:]
 */
  }

  /* "PETSc/petscopt.pxi":176
 *     if not iskey(key):
 *         return None
 *     key = key[1:]             # <<<<<<<<<<<<<<
 *     if key[0] == '-':
 *         key = key[1:]
 */
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_key, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscopt.pxi":177
 *         return None
 *     key = key[1:]
 *     if key[0] == '-':             # <<<<<<<<<<<<<<
 *         key = key[1:]
 *     if not key.startswith(prefix):
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_key, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__5, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 177, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "PETSc/petscopt.pxi":178
 *     key = key[1:]
 *     if key[0] == '-':
 *         key = key[1:]             # <<<<<<<<<<<<<<
 *     if not key.startswith(prefix):
 *         return None
 */
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_key, 1, 0, NULL, NULL, &__pyx_slice__9, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PETSc/petscopt.pxi":177
 *         return None
 *     key = key[1:]
 *     if key[0] == '-':             # <<<<<<<<<<<<<<
 *         key = key[1:]
 *     if not key.startswith(prefix):
 */
  }

  /* "PETSc/petscopt.pxi":179
 *     if key[0] == '-':
 *         key = key[1:]
 *     if not key.startswith(prefix):             # <<<<<<<<<<<<<<
 *         return None
 *     return key.replace(prefix, '', 1)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_startswith); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 179, __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_prefix);
    __Pyx_GIVEREF(__pyx_v_prefix);
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_prefix);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 179, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = ((!__pyx_t_1) != 0);
  if (__pyx_t_6) {

    /* "PETSc/petscopt.pxi":180
 *         key = key[1:]
 *     if not key.startswith(prefix):
 *         return None             # <<<<<<<<<<<<<<
 *     return key.replace(prefix, '', 1)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "PETSc/petscopt.pxi":179
 *     if key[0] == '-':
 *         key = key[1:]
 *     if not key.startswith(prefix):             # <<<<<<<<<<<<<<
 *         return None
 *     return key.replace(prefix, '', 1)
 */
  }

  /* "PETSc/petscopt.pxi":181
 *     if not key.startswith(prefix):
 *         return None
 *     return key.replace(prefix, '', 1)             # <<<<<<<<<<<<<<
 * 
 * cdef parseopt(options, prefix):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_replace); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_4 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_v_prefix);
  __Pyx_GIVEREF(__pyx_v_prefix);
  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_v_prefix);
  __Pyx_INCREF(__pyx_kp_s__10);
  __Pyx_GIVEREF(__pyx_kp_s__10);
  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_kp_s__10);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_7, __pyx_int_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 181, __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_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscopt.pxi":173
 *         return None
 * 
 * cdef getkey(key, prefix):             # <<<<<<<<<<<<<<
 *     if not iskey(key):
 *         return 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_AddTraceback("petsc4py.PETSc.getkey", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscopt.pxi":183
 *     return key.replace(prefix, '', 1)
 * 
 * cdef parseopt(options, prefix):             # <<<<<<<<<<<<<<
 *     if isinstance(options, str):
 *         tokens = tokenize(options)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_parseopt(PyObject *__pyx_v_options, PyObject *__pyx_v_prefix) {
  PyObject *__pyx_v_tokens = NULL;
  PyObject *__pyx_v_opts = NULL;
  PyObject *__pyx_v_first = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_second = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("parseopt", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "PETSc/petscopt.pxi":184
 * 
 * cdef parseopt(options, prefix):
 *     if isinstance(options, str):             # <<<<<<<<<<<<<<
 *         tokens = tokenize(options)
 *     else:
 */
  __pyx_t_1 = PyString_Check(__pyx_v_options); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscopt.pxi":185
 * cdef parseopt(options, prefix):
 *     if isinstance(options, str):
 *         tokens = tokenize(options)             # <<<<<<<<<<<<<<
 *     else:
 *         tokens = list(options)
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_tokenize(__pyx_v_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_tokens = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PETSc/petscopt.pxi":184
 * 
 * cdef parseopt(options, prefix):
 *     if isinstance(options, str):             # <<<<<<<<<<<<<<
 *         tokens = tokenize(options)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscopt.pxi":187
 *         tokens = tokenize(options)
 *     else:
 *         tokens = list(options)             # <<<<<<<<<<<<<<
 *     prefix = prefix or ''
 *     # parser loop
 */
  /*else*/ {
    __pyx_t_3 = PySequence_List(__pyx_v_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_tokens = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "PETSc/petscopt.pxi":188
 *     else:
 *         tokens = list(options)
 *     prefix = prefix or ''             # <<<<<<<<<<<<<<
 *     # parser loop
 *     opts = {}
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 188, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __Pyx_INCREF(__pyx_v_prefix);
    __pyx_t_3 = __pyx_v_prefix;
    goto __pyx_L4_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_kp_s__10);
  __pyx_t_3 = __pyx_kp_s__10;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscopt.pxi":190
 *     prefix = prefix or ''
 *     # parser loop
 *     opts = {}             # <<<<<<<<<<<<<<
 *     first = gettok(tokens)
 *     while first:
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_opts = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscopt.pxi":191
 *     # parser loop
 *     opts = {}
 *     first = gettok(tokens)             # <<<<<<<<<<<<<<
 *     while first:
 *         key = getkey(first, prefix)
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_gettok(__pyx_v_tokens); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_first = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/petscopt.pxi":192
 *     opts = {}
 *     first = gettok(tokens)
 *     while first:             # <<<<<<<<<<<<<<
 *         key = getkey(first, prefix)
 *         if not key:
 */
  while (1) {
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_first); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 192, __pyx_L1_error)
    if (!__pyx_t_2) break;

    /* "PETSc/petscopt.pxi":193
 *     first = gettok(tokens)
 *     while first:
 *         key = getkey(first, prefix)             # <<<<<<<<<<<<<<
 *         if not key:
 *             first = gettok(tokens)
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_getkey(__pyx_v_first, __pyx_v_prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/petscopt.pxi":194
 *     while first:
 *         key = getkey(first, prefix)
 *         if not key:             # <<<<<<<<<<<<<<
 *             first = gettok(tokens)
 *         else:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_key); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 194, __pyx_L1_error)
    __pyx_t_1 = ((!__pyx_t_2) != 0);
    if (__pyx_t_1) {

      /* "PETSc/petscopt.pxi":195
 *         key = getkey(first, prefix)
 *         if not key:
 *             first = gettok(tokens)             # <<<<<<<<<<<<<<
 *         else:
 *             second = gettok(tokens)
 */
      __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_gettok(__pyx_v_tokens); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_first, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "PETSc/petscopt.pxi":194
 *     while first:
 *         key = getkey(first, prefix)
 *         if not key:             # <<<<<<<<<<<<<<
 *             first = gettok(tokens)
 *         else:
 */
      goto __pyx_L8;
    }

    /* "PETSc/petscopt.pxi":197
 *             first = gettok(tokens)
 *         else:
 *             second = gettok(tokens)             # <<<<<<<<<<<<<<
 *             if getkey(second, prefix):
 *                 value = None
 */
    /*else*/ {
      __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_gettok(__pyx_v_tokens); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_second, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "PETSc/petscopt.pxi":198
 *         else:
 *             second = gettok(tokens)
 *             if getkey(second, prefix):             # <<<<<<<<<<<<<<
 *                 value = None
 *                 first = second
 */
      __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_getkey(__pyx_v_second, __pyx_v_prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 198, __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(3, 198, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_1) {

        /* "PETSc/petscopt.pxi":199
 *             second = gettok(tokens)
 *             if getkey(second, prefix):
 *                 value = None             # <<<<<<<<<<<<<<
 *                 first = second
 *             else:
 */
        __Pyx_INCREF(Py_None);
        __Pyx_XDECREF_SET(__pyx_v_value, Py_None);

        /* "PETSc/petscopt.pxi":200
 *             if getkey(second, prefix):
 *                 value = None
 *                 first = second             # <<<<<<<<<<<<<<
 *             else:
 *                 value = second
 */
        __Pyx_INCREF(__pyx_v_second);
        __Pyx_DECREF_SET(__pyx_v_first, __pyx_v_second);

        /* "PETSc/petscopt.pxi":198
 *         else:
 *             second = gettok(tokens)
 *             if getkey(second, prefix):             # <<<<<<<<<<<<<<
 *                 value = None
 *                 first = second
 */
        goto __pyx_L9;
      }

      /* "PETSc/petscopt.pxi":202
 *                 first = second
 *             else:
 *                 value = second             # <<<<<<<<<<<<<<
 *                 first = gettok(tokens)
 *             opts[key] = value
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_v_second);
        __Pyx_XDECREF_SET(__pyx_v_value, __pyx_v_second);

        /* "PETSc/petscopt.pxi":203
 *             else:
 *                 value = second
 *                 first = gettok(tokens)             # <<<<<<<<<<<<<<
 *             opts[key] = value
 *     # we are done
 */
        __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_gettok(__pyx_v_tokens); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 203, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_first, __pyx_t_3);
        __pyx_t_3 = 0;
      }
      __pyx_L9:;

      /* "PETSc/petscopt.pxi":204
 *                 value = second
 *                 first = gettok(tokens)
 *             opts[key] = value             # <<<<<<<<<<<<<<
 *     # we are done
 *     return opts
 */
      if (unlikely(PyDict_SetItem(__pyx_v_opts, __pyx_v_key, __pyx_v_value) < 0)) __PYX_ERR(3, 204, __pyx_L1_error)
    }
    __pyx_L8:;
  }

  /* "PETSc/petscopt.pxi":206
 *             opts[key] = value
 *     # we are done
 *     return opts             # <<<<<<<<<<<<<<
 * 
 * #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_opts);
  __pyx_r = __pyx_v_opts;
  goto __pyx_L0;

  /* "PETSc/petscopt.pxi":183
 *     return key.replace(prefix, '', 1)
 * 
 * cdef parseopt(options, prefix):             # <<<<<<<<<<<<<<
 *     if isinstance(options, str):
 *         tokens = tokenize(options)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.parseopt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tokens);
  __Pyx_XDECREF(__pyx_v_opts);
  __Pyx_XDECREF(__pyx_v_first);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_second);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmpi.pxi":39
 * ctypedef object    PyMPICommNew(MPI_Comm)
 * 
 * cdef inline MPI_Comm mpi4py_Comm_Get(object comm) except *:             # <<<<<<<<<<<<<<
 *     from mpi4py import MPI
 *     cdef PyMPICommGet *commget = \
 */

static CYTHON_INLINE MPI_Comm __pyx_f_8petsc4py_5PETSc_mpi4py_Comm_Get(PyObject *__pyx_v_comm) {
  PyObject *__pyx_v_MPI = NULL;
  __pyx_t_8petsc4py_5PETSc_PyMPICommGet *__pyx_v_commget;
  MPI_Comm *__pyx_v_ptr;
  MPI_Comm __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  void *__pyx_t_3;
  int __pyx_t_4;
  MPI_Comm *__pyx_t_5;
  __Pyx_RefNannySetupContext("mpi4py_Comm_Get", 0);

  /* "PETSc/petscmpi.pxi":40
 * 
 * cdef inline MPI_Comm mpi4py_Comm_Get(object comm) except *:
 *     from mpi4py import MPI             # <<<<<<<<<<<<<<
 *     cdef PyMPICommGet *commget = \
 *         <PyMPICommGet*> Cython_ImportFunction(
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_MPI);
  __Pyx_GIVEREF(__pyx_n_s_MPI);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_MPI);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mpi4py, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 40, __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_MPI); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_MPI = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/petscmpi.pxi":42
 *     from mpi4py import MPI
 *     cdef PyMPICommGet *commget = \
 *         <PyMPICommGet*> Cython_ImportFunction(             # <<<<<<<<<<<<<<
 *         MPI, b"PyMPIComm_Get", b"MPI_Comm *(PyObject *)")
 *     if commget == NULL: return MPI_COMM_NULL
 */
  __pyx_t_3 = Cython_ImportFunction(__pyx_v_MPI, ((char *)"PyMPIComm_Get"), ((char *)"MPI_Comm *(PyObject *)")); if (unlikely(__pyx_t_3 == NULL && PyErr_Occurred())) __PYX_ERR(13, 42, __pyx_L1_error)
  __pyx_v_commget = ((__pyx_t_8petsc4py_5PETSc_PyMPICommGet *)__pyx_t_3);

  /* "PETSc/petscmpi.pxi":44
 *         <PyMPICommGet*> Cython_ImportFunction(
 *         MPI, b"PyMPIComm_Get", b"MPI_Comm *(PyObject *)")
 *     if commget == NULL: return MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *     cdef MPI_Comm *ptr = commget(comm)
 *     if ptr == NULL: return MPI_COMM_NULL
 */
  __pyx_t_4 = ((__pyx_v_commget == NULL) != 0);
  if (__pyx_t_4) {
    __pyx_r = MPI_COMM_NULL;
    goto __pyx_L0;
  }

  /* "PETSc/petscmpi.pxi":45
 *         MPI, b"PyMPIComm_Get", b"MPI_Comm *(PyObject *)")
 *     if commget == NULL: return MPI_COMM_NULL
 *     cdef MPI_Comm *ptr = commget(comm)             # <<<<<<<<<<<<<<
 *     if ptr == NULL: return MPI_COMM_NULL
 *     return ptr[0]
 */
  __pyx_t_5 = __pyx_v_commget(__pyx_v_comm); if (unlikely(__pyx_t_5 == NULL)) __PYX_ERR(13, 45, __pyx_L1_error)
  __pyx_v_ptr = __pyx_t_5;

  /* "PETSc/petscmpi.pxi":46
 *     if commget == NULL: return MPI_COMM_NULL
 *     cdef MPI_Comm *ptr = commget(comm)
 *     if ptr == NULL: return MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *     return ptr[0]
 * 
 */
  __pyx_t_4 = ((__pyx_v_ptr == NULL) != 0);
  if (__pyx_t_4) {
    __pyx_r = MPI_COMM_NULL;
    goto __pyx_L0;
  }

  /* "PETSc/petscmpi.pxi":47
 *     cdef MPI_Comm *ptr = commget(comm)
 *     if ptr == NULL: return MPI_COMM_NULL
 *     return ptr[0]             # <<<<<<<<<<<<<<
 * 
 * cdef inline object mpi4py_Comm_New(MPI_Comm comm):
 */
  __pyx_r = (__pyx_v_ptr[0]);
  goto __pyx_L0;

  /* "PETSc/petscmpi.pxi":39
 * ctypedef object    PyMPICommNew(MPI_Comm)
 * 
 * cdef inline MPI_Comm mpi4py_Comm_Get(object comm) except *:             # <<<<<<<<<<<<<<
 *     from mpi4py import MPI
 *     cdef PyMPICommGet *commget = \
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.mpi4py_Comm_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_MPI);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmpi.pxi":49
 *     return ptr[0]
 * 
 * cdef inline object mpi4py_Comm_New(MPI_Comm comm):             # <<<<<<<<<<<<<<
 *     from mpi4py import MPI
 *     cdef PyMPICommNew *commnew = \
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_mpi4py_Comm_New(MPI_Comm __pyx_v_comm) {
  PyObject *__pyx_v_MPI = NULL;
  __pyx_t_8petsc4py_5PETSc_PyMPICommNew *__pyx_v_commnew;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  void *__pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("mpi4py_Comm_New", 0);

  /* "PETSc/petscmpi.pxi":50
 * 
 * cdef inline object mpi4py_Comm_New(MPI_Comm comm):
 *     from mpi4py import MPI             # <<<<<<<<<<<<<<
 *     cdef PyMPICommNew *commnew = \
 *         <PyMPICommNew*> Cython_ImportFunction(
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_MPI);
  __Pyx_GIVEREF(__pyx_n_s_MPI);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_MPI);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mpi4py, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 50, __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_MPI); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_MPI = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/petscmpi.pxi":52
 *     from mpi4py import MPI
 *     cdef PyMPICommNew *commnew = \
 *         <PyMPICommNew*> Cython_ImportFunction(             # <<<<<<<<<<<<<<
 *         MPI, b"PyMPIComm_New", b"PyObject *(MPI_Comm)")
 *     if commnew == NULL: return None
 */
  __pyx_t_3 = Cython_ImportFunction(__pyx_v_MPI, ((char *)"PyMPIComm_New"), ((char *)"PyObject *(MPI_Comm)")); if (unlikely(__pyx_t_3 == NULL && PyErr_Occurred())) __PYX_ERR(13, 52, __pyx_L1_error)
  __pyx_v_commnew = ((__pyx_t_8petsc4py_5PETSc_PyMPICommNew *)__pyx_t_3);

  /* "PETSc/petscmpi.pxi":54
 *         <PyMPICommNew*> Cython_ImportFunction(
 *         MPI, b"PyMPIComm_New", b"PyObject *(MPI_Comm)")
 *     if commnew == NULL: return None             # <<<<<<<<<<<<<<
 *     return commnew(comm)
 * 
 */
  __pyx_t_4 = ((__pyx_v_commnew == NULL) != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "PETSc/petscmpi.pxi":55
 *         MPI, b"PyMPIComm_New", b"PyObject *(MPI_Comm)")
 *     if commnew == NULL: return None
 *     return commnew(comm)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_v_commnew(__pyx_v_comm); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscmpi.pxi":49
 *     return ptr[0]
 * 
 * cdef inline object mpi4py_Comm_New(MPI_Comm comm):             # <<<<<<<<<<<<<<
 *     from mpi4py import MPI
 *     cdef PyMPICommNew *commnew = \
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.mpi4py_Comm_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_MPI);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmpi.pxi":59
 * # --------------------------------------------------------------------
 * 
 * cdef inline int PetscCommDEALLOC(MPI_Comm* comm):             # <<<<<<<<<<<<<<
 *     if comm == NULL: return 0
 *     cdef MPI_Comm tmp = comm[0]
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_PetscCommDEALLOC(MPI_Comm *__pyx_v_comm) {
  MPI_Comm __pyx_v_tmp;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("PetscCommDEALLOC", 0);

  /* "PETSc/petscmpi.pxi":60
 * 
 * cdef inline int PetscCommDEALLOC(MPI_Comm* comm):
 *     if comm == NULL: return 0             # <<<<<<<<<<<<<<
 *     cdef MPI_Comm tmp = comm[0]
 *     if tmp == MPI_COMM_NULL: return 0
 */
  __pyx_t_1 = ((__pyx_v_comm == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscmpi.pxi":61
 * cdef inline int PetscCommDEALLOC(MPI_Comm* comm):
 *     if comm == NULL: return 0
 *     cdef MPI_Comm tmp = comm[0]             # <<<<<<<<<<<<<<
 *     if tmp == MPI_COMM_NULL: return 0
 *     comm[0] = MPI_COMM_NULL
 */
  __pyx_v_tmp = (__pyx_v_comm[0]);

  /* "PETSc/petscmpi.pxi":62
 *     if comm == NULL: return 0
 *     cdef MPI_Comm tmp = comm[0]
 *     if tmp == MPI_COMM_NULL: return 0             # <<<<<<<<<<<<<<
 *     comm[0] = MPI_COMM_NULL
 *     if not (<int>PetscInitializeCalled): return 0
 */
  __pyx_t_1 = ((__pyx_v_tmp == MPI_COMM_NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscmpi.pxi":63
 *     cdef MPI_Comm tmp = comm[0]
 *     if tmp == MPI_COMM_NULL: return 0
 *     comm[0] = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *     if not (<int>PetscInitializeCalled): return 0
 *     if (<int>PetscFinalizeCalled): return 0
 */
  (__pyx_v_comm[0]) = MPI_COMM_NULL;

  /* "PETSc/petscmpi.pxi":64
 *     if tmp == MPI_COMM_NULL: return 0
 *     comm[0] = MPI_COMM_NULL
 *     if not (<int>PetscInitializeCalled): return 0             # <<<<<<<<<<<<<<
 *     if (<int>PetscFinalizeCalled): return 0
 *     return PetscCommDestroy(&tmp)
 */
  __pyx_t_1 = ((!(((int)PetscInitializeCalled) != 0)) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscmpi.pxi":65
 *     comm[0] = MPI_COMM_NULL
 *     if not (<int>PetscInitializeCalled): return 0
 *     if (<int>PetscFinalizeCalled): return 0             # <<<<<<<<<<<<<<
 *     return PetscCommDestroy(&tmp)
 * 
 */
  __pyx_t_1 = (((int)PetscFinalizeCalled) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscmpi.pxi":66
 *     if not (<int>PetscInitializeCalled): return 0
 *     if (<int>PetscFinalizeCalled): return 0
 *     return PetscCommDestroy(&tmp)             # <<<<<<<<<<<<<<
 * 
 * cdef inline MPI_Comm def_Comm(object comm, MPI_Comm defv) except *:
 */
  __pyx_r = PetscCommDestroy((&__pyx_v_tmp));
  goto __pyx_L0;

  /* "PETSc/petscmpi.pxi":59
 * # --------------------------------------------------------------------
 * 
 * cdef inline int PetscCommDEALLOC(MPI_Comm* comm):             # <<<<<<<<<<<<<<
 *     if comm == NULL: return 0
 *     cdef MPI_Comm tmp = comm[0]
 */

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

/* "PETSc/petscmpi.pxi":68
 *     return PetscCommDestroy(&tmp)
 * 
 * cdef inline MPI_Comm def_Comm(object comm, MPI_Comm defv) except *:             # <<<<<<<<<<<<<<
 *     cdef MPI_Comm retv = MPI_COMM_NULL
 *     if comm is None:
 */

static CYTHON_INLINE MPI_Comm __pyx_f_8petsc4py_5PETSc_def_Comm(PyObject *__pyx_v_comm, MPI_Comm __pyx_v_defv) {
  MPI_Comm __pyx_v_retv;
  MPI_Comm __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  MPI_Comm __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("def_Comm", 0);

  /* "PETSc/petscmpi.pxi":69
 * 
 * cdef inline MPI_Comm def_Comm(object comm, MPI_Comm defv) except *:
 *     cdef MPI_Comm retv = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *     if comm is None:
 *         retv = defv
 */
  __pyx_v_retv = MPI_COMM_NULL;

  /* "PETSc/petscmpi.pxi":70
 * cdef inline MPI_Comm def_Comm(object comm, MPI_Comm defv) except *:
 *     cdef MPI_Comm retv = MPI_COMM_NULL
 *     if comm is None:             # <<<<<<<<<<<<<<
 *         retv = defv
 *     elif isinstance(comm, Comm):
 */
  __pyx_t_1 = (__pyx_v_comm == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmpi.pxi":71
 *     cdef MPI_Comm retv = MPI_COMM_NULL
 *     if comm is None:
 *         retv = defv             # <<<<<<<<<<<<<<
 *     elif isinstance(comm, Comm):
 *         retv = (<Comm>comm).comm
 */
    __pyx_v_retv = __pyx_v_defv;

    /* "PETSc/petscmpi.pxi":70
 * cdef inline MPI_Comm def_Comm(object comm, MPI_Comm defv) except *:
 *     cdef MPI_Comm retv = MPI_COMM_NULL
 *     if comm is None:             # <<<<<<<<<<<<<<
 *         retv = defv
 *     elif isinstance(comm, Comm):
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscmpi.pxi":72
 *     if comm is None:
 *         retv = defv
 *     elif isinstance(comm, Comm):             # <<<<<<<<<<<<<<
 *         retv = (<Comm>comm).comm
 *     elif type(comm).__module__ == 'mpi4py.MPI':
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_comm, __pyx_ptype_8petsc4py_5PETSc_Comm); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscmpi.pxi":73
 *         retv = defv
 *     elif isinstance(comm, Comm):
 *         retv = (<Comm>comm).comm             # <<<<<<<<<<<<<<
 *     elif type(comm).__module__ == 'mpi4py.MPI':
 *         retv = mpi4py_Comm_Get(comm)
 */
    __pyx_t_3 = ((struct PyPetscCommObject *)__pyx_v_comm)->comm;
    __pyx_v_retv = __pyx_t_3;

    /* "PETSc/petscmpi.pxi":72
 *     if comm is None:
 *         retv = defv
 *     elif isinstance(comm, Comm):             # <<<<<<<<<<<<<<
 *         retv = (<Comm>comm).comm
 *     elif type(comm).__module__ == 'mpi4py.MPI':
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscmpi.pxi":74
 *     elif isinstance(comm, Comm):
 *         retv = (<Comm>comm).comm
 *     elif type(comm).__module__ == 'mpi4py.MPI':             # <<<<<<<<<<<<<<
 *         retv = mpi4py_Comm_Get(comm)
 *     else:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_comm)), __pyx_n_s_module); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s_mpi4py_MPI, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(13, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "PETSc/petscmpi.pxi":75
 *         retv = (<Comm>comm).comm
 *     elif type(comm).__module__ == 'mpi4py.MPI':
 *         retv = mpi4py_Comm_Get(comm)             # <<<<<<<<<<<<<<
 *     else:
 *         retv = (<Comm?>comm).comm
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_mpi4py_Comm_Get(__pyx_v_comm); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 75, __pyx_L1_error)
    __pyx_v_retv = __pyx_t_3;

    /* "PETSc/petscmpi.pxi":74
 *     elif isinstance(comm, Comm):
 *         retv = (<Comm>comm).comm
 *     elif type(comm).__module__ == 'mpi4py.MPI':             # <<<<<<<<<<<<<<
 *         retv = mpi4py_Comm_Get(comm)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscmpi.pxi":77
 *         retv = mpi4py_Comm_Get(comm)
 *     else:
 *         retv = (<Comm?>comm).comm             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  /*else*/ {
    if (!(likely(__Pyx_TypeTest(__pyx_v_comm, __pyx_ptype_8petsc4py_5PETSc_Comm)))) __PYX_ERR(13, 77, __pyx_L1_error)
    __pyx_t_3 = ((struct PyPetscCommObject *)__pyx_v_comm)->comm;
    __pyx_v_retv = __pyx_t_3;
  }
  __pyx_L3:;

  /* "PETSc/petscmpi.pxi":78
 *     else:
 *         retv = (<Comm?>comm).comm
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef inline Comm new_Comm(MPI_Comm comm):
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/petscmpi.pxi":68
 *     return PetscCommDestroy(&tmp)
 * 
 * cdef inline MPI_Comm def_Comm(object comm, MPI_Comm defv) except *:             # <<<<<<<<<<<<<<
 *     cdef MPI_Comm retv = MPI_COMM_NULL
 *     if comm is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.def_Comm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmpi.pxi":80
 *     return retv
 * 
 * cdef inline Comm new_Comm(MPI_Comm comm):             # <<<<<<<<<<<<<<
 *     cdef Comm ob = <Comm> Comm()
 *     ob.comm = comm
 */

static CYTHON_INLINE struct PyPetscCommObject *__pyx_f_8petsc4py_5PETSc_new_Comm(MPI_Comm __pyx_v_comm) {
  struct PyPetscCommObject *__pyx_v_ob = 0;
  struct PyPetscCommObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("new_Comm", 0);

  /* "PETSc/petscmpi.pxi":81
 * 
 * cdef inline Comm new_Comm(MPI_Comm comm):
 *     cdef Comm ob = <Comm> Comm()             # <<<<<<<<<<<<<<
 *     ob.comm = comm
 *     return ob
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ob = ((struct PyPetscCommObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscmpi.pxi":82
 * cdef inline Comm new_Comm(MPI_Comm comm):
 *     cdef Comm ob = <Comm> Comm()
 *     ob.comm = comm             # <<<<<<<<<<<<<<
 *     return ob
 * 
 */
  __pyx_v_ob->comm = __pyx_v_comm;

  /* "PETSc/petscmpi.pxi":83
 *     cdef Comm ob = <Comm> Comm()
 *     ob.comm = comm
 *     return ob             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ob));
  __pyx_r = __pyx_v_ob;
  goto __pyx_L0;

  /* "PETSc/petscmpi.pxi":80
 *     return retv
 * 
 * cdef inline Comm new_Comm(MPI_Comm comm):             # <<<<<<<<<<<<<<
 *     cdef Comm ob = <Comm> Comm()
 *     ob.comm = comm
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.new_Comm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmpi.pxi":87
 * # --------------------------------------------------------------------
 * 
 * cdef inline int comm_size(MPI_Comm comm) except ? -1:             # <<<<<<<<<<<<<<
 *     if comm == MPI_COMM_NULL: raise ValueError("null communicator")
 *     cdef int size = 0
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_comm_size(MPI_Comm __pyx_v_comm) {
  int __pyx_v_size;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("comm_size", 0);

  /* "PETSc/petscmpi.pxi":88
 * 
 * cdef inline int comm_size(MPI_Comm comm) except ? -1:
 *     if comm == MPI_COMM_NULL: raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *     cdef int size = 0
 *     CHKERR( MPI_Comm_size(comm, &size) )
 */
  __pyx_t_1 = ((__pyx_v_comm == MPI_COMM_NULL) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 88, __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(13, 88, __pyx_L1_error)
  }

  /* "PETSc/petscmpi.pxi":89
 * cdef inline int comm_size(MPI_Comm comm) except ? -1:
 *     if comm == MPI_COMM_NULL: raise ValueError("null communicator")
 *     cdef int size = 0             # <<<<<<<<<<<<<<
 *     CHKERR( MPI_Comm_size(comm, &size) )
 *     return size
 */
  __pyx_v_size = 0;

  /* "PETSc/petscmpi.pxi":90
 *     if comm == MPI_COMM_NULL: raise ValueError("null communicator")
 *     cdef int size = 0
 *     CHKERR( MPI_Comm_size(comm, &size) )             # <<<<<<<<<<<<<<
 *     return size
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MPI_Comm_size(__pyx_v_comm, (&__pyx_v_size))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(13, 90, __pyx_L1_error)

  /* "PETSc/petscmpi.pxi":91
 *     cdef int size = 0
 *     CHKERR( MPI_Comm_size(comm, &size) )
 *     return size             # <<<<<<<<<<<<<<
 * 
 * cdef inline int comm_rank(MPI_Comm comm) except ? -1:
 */
  __pyx_r = __pyx_v_size;
  goto __pyx_L0;

  /* "PETSc/petscmpi.pxi":87
 * # --------------------------------------------------------------------
 * 
 * cdef inline int comm_size(MPI_Comm comm) except ? -1:             # <<<<<<<<<<<<<<
 *     if comm == MPI_COMM_NULL: raise ValueError("null communicator")
 *     cdef int size = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.comm_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmpi.pxi":93
 *     return size
 * 
 * cdef inline int comm_rank(MPI_Comm comm) except ? -1:             # <<<<<<<<<<<<<<
 *     if comm == MPI_COMM_NULL: raise ValueError("null communicator")
 *     cdef int rank = 0
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_comm_rank(MPI_Comm __pyx_v_comm) {
  int __pyx_v_rank;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("comm_rank", 0);

  /* "PETSc/petscmpi.pxi":94
 * 
 * cdef inline int comm_rank(MPI_Comm comm) except ? -1:
 *     if comm == MPI_COMM_NULL: raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *     cdef int rank = 0
 *     CHKERR( MPI_Comm_rank(comm, &rank) )
 */
  __pyx_t_1 = ((__pyx_v_comm == MPI_COMM_NULL) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 94, __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(13, 94, __pyx_L1_error)
  }

  /* "PETSc/petscmpi.pxi":95
 * cdef inline int comm_rank(MPI_Comm comm) except ? -1:
 *     if comm == MPI_COMM_NULL: raise ValueError("null communicator")
 *     cdef int rank = 0             # <<<<<<<<<<<<<<
 *     CHKERR( MPI_Comm_rank(comm, &rank) )
 *     return rank
 */
  __pyx_v_rank = 0;

  /* "PETSc/petscmpi.pxi":96
 *     if comm == MPI_COMM_NULL: raise ValueError("null communicator")
 *     cdef int rank = 0
 *     CHKERR( MPI_Comm_rank(comm, &rank) )             # <<<<<<<<<<<<<<
 *     return rank
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MPI_Comm_rank(__pyx_v_comm, (&__pyx_v_rank))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(13, 96, __pyx_L1_error)

  /* "PETSc/petscmpi.pxi":97
 *     cdef int rank = 0
 *     CHKERR( MPI_Comm_rank(comm, &rank) )
 *     return rank             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_r = __pyx_v_rank;
  goto __pyx_L0;

  /* "PETSc/petscmpi.pxi":93
 *     return size
 * 
 * cdef inline int comm_rank(MPI_Comm comm) except ? -1:             # <<<<<<<<<<<<<<
 *     if comm == MPI_COMM_NULL: raise ValueError("null communicator")
 *     cdef int rank = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.comm_rank", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscsys.pxi":57
 * 
 * 
 * cdef inline int Sys_Sizes(             # <<<<<<<<<<<<<<
 *     object size, object bsize,
 *     PetscInt *_b,
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Sys_Sizes(PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PetscInt *__pyx_v__b, PetscInt *__pyx_v__n, PetscInt *__pyx_v__N) {
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_b;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_N;
  PyObject *__pyx_v_on = 0;
  PyObject *__pyx_v_oN = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscInt __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 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("Sys_Sizes", 0);

  /* "PETSc/petscsys.pxi":64
 *     ) except -1:
 *     # get block size
 *     cdef PetscInt bs=PETSC_DECIDE, b=PETSC_DECIDE             # <<<<<<<<<<<<<<
 *     if bsize is not None: bs = b = asInt(bsize)
 *     if bs == PETSC_DECIDE: bs = 1
 */
  __pyx_v_bs = PETSC_DECIDE;
  __pyx_v_b = PETSC_DECIDE;

  /* "PETSc/petscsys.pxi":65
 *     # get block size
 *     cdef PetscInt bs=PETSC_DECIDE, b=PETSC_DECIDE
 *     if bsize is not None: bs = b = asInt(bsize)             # <<<<<<<<<<<<<<
 *     if bs == PETSC_DECIDE: bs = 1
 *     # unpack and get local and global sizes
 */
  __pyx_t_1 = (__pyx_v_bsize != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_bsize); if (unlikely(__pyx_t_3 == -1L && PyErr_Occurred())) __PYX_ERR(14, 65, __pyx_L1_error)
    __pyx_v_bs = __pyx_t_3;
    __pyx_v_b = __pyx_t_3;
  }

  /* "PETSc/petscsys.pxi":66
 *     cdef PetscInt bs=PETSC_DECIDE, b=PETSC_DECIDE
 *     if bsize is not None: bs = b = asInt(bsize)
 *     if bs == PETSC_DECIDE: bs = 1             # <<<<<<<<<<<<<<
 *     # unpack and get local and global sizes
 *     cdef PetscInt n=PETSC_DECIDE, N=PETSC_DECIDE
 */
  __pyx_t_2 = ((__pyx_v_bs == PETSC_DECIDE) != 0);
  if (__pyx_t_2) {
    __pyx_v_bs = 1;
  }

  /* "PETSc/petscsys.pxi":68
 *     if bs == PETSC_DECIDE: bs = 1
 *     # unpack and get local and global sizes
 *     cdef PetscInt n=PETSC_DECIDE, N=PETSC_DECIDE             # <<<<<<<<<<<<<<
 *     cdef object on, oN
 *     try:
 */
  __pyx_v_n = PETSC_DECIDE;
  __pyx_v_N = PETSC_DECIDE;

  /* "PETSc/petscsys.pxi":70
 *     cdef PetscInt n=PETSC_DECIDE, N=PETSC_DECIDE
 *     cdef object on, oN
 *     try:             # <<<<<<<<<<<<<<
 *         on, oN = size
 *     except (TypeError, ValueError):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "PETSc/petscsys.pxi":71
 *     cdef object on, oN
 *     try:
 *         on, oN = size             # <<<<<<<<<<<<<<
 *     except (TypeError, ValueError):
 *         on = None; oN = size
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_size))) || (PyList_CheckExact(__pyx_v_size))) {
        PyObject* sequence = __pyx_v_size;
        #if CYTHON_COMPILING_IN_CPYTHON
        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(14, 71, __pyx_L5_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        #else
        __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 71, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(14, 71, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_9 = PyObject_GetIter(__pyx_v_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(14, 71, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
        index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(14, 71, __pyx_L5_error)
        __pyx_t_10 = 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_10 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(14, 71, __pyx_L5_error)
        __pyx_L14_unpacking_done:;
      }
      __pyx_v_on = __pyx_t_7;
      __pyx_t_7 = 0;
      __pyx_v_oN = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "PETSc/petscsys.pxi":70
 *     cdef PetscInt n=PETSC_DECIDE, N=PETSC_DECIDE
 *     cdef object on, oN
 *     try:             # <<<<<<<<<<<<<<
 *         on, oN = size
 *     except (TypeError, ValueError):
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "PETSc/petscsys.pxi":72
 *     try:
 *         on, oN = size
 *     except (TypeError, ValueError):             # <<<<<<<<<<<<<<
 *         on = None; oN = size
 *     if on is not None: n = asInt(on)
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("petsc4py.PETSc.Sys_Sizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_9) < 0) __PYX_ERR(14, 72, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_9);

      /* "PETSc/petscsys.pxi":73
 *         on, oN = size
 *     except (TypeError, ValueError):
 *         on = None; oN = size             # <<<<<<<<<<<<<<
 *     if on is not None: n = asInt(on)
 *     if oN is not None: N = asInt(oN)
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_on, Py_None);
      __Pyx_INCREF(__pyx_v_size);
      __Pyx_XDECREF_SET(__pyx_v_oN, __pyx_v_size);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6_exception_handled;
    }
    goto __pyx_L7_except_error;
    __pyx_L7_except_error:;

    /* "PETSc/petscsys.pxi":70
 *     cdef PetscInt n=PETSC_DECIDE, N=PETSC_DECIDE
 *     cdef object on, oN
 *     try:             # <<<<<<<<<<<<<<
 *         on, oN = size
 *     except (TypeError, ValueError):
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L12_try_end:;
  }

  /* "PETSc/petscsys.pxi":74
 *     except (TypeError, ValueError):
 *         on = None; oN = size
 *     if on is not None: n = asInt(on)             # <<<<<<<<<<<<<<
 *     if oN is not None: N = asInt(oN)
 *     # check block, local, and and global sizes
 */
  __pyx_t_2 = (__pyx_v_on != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_on); if (unlikely(__pyx_t_3 == -1L && PyErr_Occurred())) __PYX_ERR(14, 74, __pyx_L1_error)
    __pyx_v_n = __pyx_t_3;
  }

  /* "PETSc/petscsys.pxi":75
 *         on = None; oN = size
 *     if on is not None: n = asInt(on)
 *     if oN is not None: N = asInt(oN)             # <<<<<<<<<<<<<<
 *     # check block, local, and and global sizes
 *     if (bs < 1): raise ValueError(
 */
  __pyx_t_1 = (__pyx_v_oN != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_oN); if (unlikely(__pyx_t_3 == -1L && PyErr_Occurred())) __PYX_ERR(14, 75, __pyx_L1_error)
    __pyx_v_N = __pyx_t_3;
  }

  /* "PETSc/petscsys.pxi":77
 *     if oN is not None: N = asInt(oN)
 *     # check block, local, and and global sizes
 *     if (bs < 1): raise ValueError(             # <<<<<<<<<<<<<<
 *         "block size %d must be positive" % toInt(bs))
 *     if n==PETSC_DECIDE and N==PETSC_DECIDE: raise ValueError(
 */
  __pyx_t_2 = ((__pyx_v_bs < 1) != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscsys.pxi":78
 *     # check block, local, and and global sizes
 *     if (bs < 1): raise ValueError(
 *         "block size %d must be positive" % toInt(bs))             # <<<<<<<<<<<<<<
 *     if n==PETSC_DECIDE and N==PETSC_DECIDE: raise ValueError(
 *         "local and global sizes cannot be both 'DECIDE'")
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_bs); if (unlikely(!__pyx_t_9)) __PYX_ERR(14, 78, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_block_size_d_must_be_positive, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 78, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "PETSc/petscsys.pxi":77
 *     if oN is not None: N = asInt(oN)
 *     # check block, local, and and global sizes
 *     if (bs < 1): raise ValueError(             # <<<<<<<<<<<<<<
 *         "block size %d must be positive" % toInt(bs))
 *     if n==PETSC_DECIDE and N==PETSC_DECIDE: raise ValueError(
 */
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(14, 77, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 77, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(14, 77, __pyx_L1_error)
  }

  /* "PETSc/petscsys.pxi":79
 *     if (bs < 1): raise ValueError(
 *         "block size %d must be positive" % toInt(bs))
 *     if n==PETSC_DECIDE and N==PETSC_DECIDE: raise ValueError(             # <<<<<<<<<<<<<<
 *         "local and global sizes cannot be both 'DECIDE'")
 *     if (n > 0) and (n % bs): raise ValueError(
 */
  __pyx_t_1 = ((__pyx_v_n == PETSC_DECIDE) != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L21_bool_binop_done;
  }
  __pyx_t_1 = ((__pyx_v_N == PETSC_DECIDE) != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L21_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(14, 79, __pyx_L1_error)
  }

  /* "PETSc/petscsys.pxi":81
 *     if n==PETSC_DECIDE and N==PETSC_DECIDE: raise ValueError(
 *         "local and global sizes cannot be both 'DECIDE'")
 *     if (n > 0) and (n % bs): raise ValueError(             # <<<<<<<<<<<<<<
 *         "local size %d not divisible by block size %d" %
 *         (toInt(n), toInt(bs)) )
 */
  __pyx_t_1 = ((__pyx_v_n > 0) != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L24_bool_binop_done;
  }
  __pyx_t_1 = ((__pyx_v_n % __pyx_v_bs) != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L24_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PETSc/petscsys.pxi":83
 *     if (n > 0) and (n % bs): raise ValueError(
 *         "local size %d not divisible by block size %d" %
 *         (toInt(n), toInt(bs)) )             # <<<<<<<<<<<<<<
 *     if (N > 0) and (N % bs): raise ValueError(
 *         "global size %d not divisible by block size %d" %
 */
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 83, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_bs); if (unlikely(!__pyx_t_9)) __PYX_ERR(14, 83, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(14, 83, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
    __pyx_t_7 = 0;
    __pyx_t_9 = 0;

    /* "PETSc/petscsys.pxi":82
 *         "local and global sizes cannot be both 'DECIDE'")
 *     if (n > 0) and (n % bs): raise ValueError(
 *         "local size %d not divisible by block size %d" %             # <<<<<<<<<<<<<<
 *         (toInt(n), toInt(bs)) )
 *     if (N > 0) and (N % bs): raise ValueError(
 */
    __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_local_size_d_not_divisible_by_bl, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(14, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "PETSc/petscsys.pxi":81
 *     if n==PETSC_DECIDE and N==PETSC_DECIDE: raise ValueError(
 *         "local and global sizes cannot be both 'DECIDE'")
 *     if (n > 0) and (n % bs): raise ValueError(             # <<<<<<<<<<<<<<
 *         "local size %d not divisible by block size %d" %
 *         (toInt(n), toInt(bs)) )
 */
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(14, 81, __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 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(14, 81, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_9, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __PYX_ERR(14, 81, __pyx_L1_error)
  }

  /* "PETSc/petscsys.pxi":84
 *         "local size %d not divisible by block size %d" %
 *         (toInt(n), toInt(bs)) )
 *     if (N > 0) and (N % bs): raise ValueError(             # <<<<<<<<<<<<<<
 *         "global size %d not divisible by block size %d" %
 *         (toInt(N), toInt(bs)) )
 */
  __pyx_t_1 = ((__pyx_v_N > 0) != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L27_bool_binop_done;
  }
  __pyx_t_1 = ((__pyx_v_N % __pyx_v_bs) != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L27_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PETSc/petscsys.pxi":86
 *     if (N > 0) and (N % bs): raise ValueError(
 *         "global size %d not divisible by block size %d" %
 *         (toInt(N), toInt(bs)) )             # <<<<<<<<<<<<<<
 *     # return result to the caller
 *     if _b != NULL: _b[0] = b
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_9)) __PYX_ERR(14, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_bs); if (unlikely(!__pyx_t_8)) __PYX_ERR(14, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 86, __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_8);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8);
    __pyx_t_9 = 0;
    __pyx_t_8 = 0;

    /* "PETSc/petscsys.pxi":85
 *         (toInt(n), toInt(bs)) )
 *     if (N > 0) and (N % bs): raise ValueError(
 *         "global size %d not divisible by block size %d" %             # <<<<<<<<<<<<<<
 *         (toInt(N), toInt(bs)) )
 *     # return result to the caller
 */
    __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_global_size_d_not_divisible_by_b, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(14, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "PETSc/petscsys.pxi":84
 *         "local size %d not divisible by block size %d" %
 *         (toInt(n), toInt(bs)) )
 *     if (N > 0) and (N % bs): raise ValueError(             # <<<<<<<<<<<<<<
 *         "global size %d not divisible by block size %d" %
 *         (toInt(N), toInt(bs)) )
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(14, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(14, 84, __pyx_L1_error)
  }

  /* "PETSc/petscsys.pxi":88
 *         (toInt(N), toInt(bs)) )
 *     # return result to the caller
 *     if _b != NULL: _b[0] = b             # <<<<<<<<<<<<<<
 *     if _n != NULL: _n[0] = n
 *     if _N != NULL: _N[0] = N
 */
  __pyx_t_2 = ((__pyx_v__b != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v__b[0]) = __pyx_v_b;
  }

  /* "PETSc/petscsys.pxi":89
 *     # return result to the caller
 *     if _b != NULL: _b[0] = b
 *     if _n != NULL: _n[0] = n             # <<<<<<<<<<<<<<
 *     if _N != NULL: _N[0] = N
 *     return 0
 */
  __pyx_t_2 = ((__pyx_v__n != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v__n[0]) = __pyx_v_n;
  }

  /* "PETSc/petscsys.pxi":90
 *     if _b != NULL: _b[0] = b
 *     if _n != NULL: _n[0] = n
 *     if _N != NULL: _N[0] = N             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_2 = ((__pyx_v__N != NULL) != 0);
  if (__pyx_t_2) {
    (__pyx_v__N[0]) = __pyx_v_N;
  }

  /* "PETSc/petscsys.pxi":91
 *     if _n != NULL: _n[0] = n
 *     if _N != NULL: _N[0] = N
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Sys_Layout(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscsys.pxi":57
 * 
 * 
 * cdef inline int Sys_Sizes(             # <<<<<<<<<<<<<<
 *     object size, object bsize,
 *     PetscInt *_b,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("petsc4py.PETSc.Sys_Sizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_on);
  __Pyx_XDECREF(__pyx_v_oN);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscsys.pxi":93
 *     return 0
 * 
 * cdef inline int Sys_Layout(             # <<<<<<<<<<<<<<
 *     MPI_Comm comm,
 *     PetscInt bs,
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Sys_Layout(MPI_Comm __pyx_v_comm, PetscInt __pyx_v_bs, PetscInt *__pyx_v__n, PetscInt *__pyx_v__N) {
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_N;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("Sys_Layout", 0);

  /* "PETSc/petscsys.pxi":99
 *     PetscInt *_N,
 *     ) except -1:
 *     cdef PetscInt n = _n[0]             # <<<<<<<<<<<<<<
 *     cdef PetscInt N = _N[0]
 *     if bs < 0: bs = 1
 */
  __pyx_v_n = (__pyx_v__n[0]);

  /* "PETSc/petscsys.pxi":100
 *     ) except -1:
 *     cdef PetscInt n = _n[0]
 *     cdef PetscInt N = _N[0]             # <<<<<<<<<<<<<<
 *     if bs < 0: bs = 1
 *     if n  > 0: n = n // bs
 */
  __pyx_v_N = (__pyx_v__N[0]);

  /* "PETSc/petscsys.pxi":101
 *     cdef PetscInt n = _n[0]
 *     cdef PetscInt N = _N[0]
 *     if bs < 0: bs = 1             # <<<<<<<<<<<<<<
 *     if n  > 0: n = n // bs
 *     if N  > 0: N = N // bs
 */
  __pyx_t_1 = ((__pyx_v_bs < 0) != 0);
  if (__pyx_t_1) {
    __pyx_v_bs = 1;
  }

  /* "PETSc/petscsys.pxi":102
 *     cdef PetscInt N = _N[0]
 *     if bs < 0: bs = 1
 *     if n  > 0: n = n // bs             # <<<<<<<<<<<<<<
 *     if N  > 0: N = N // bs
 *     CHKERR( PetscSplitOwnership(comm, &n, &N) )
 */
  __pyx_t_1 = ((__pyx_v_n > 0) != 0);
  if (__pyx_t_1) {
    __pyx_v_n = (__pyx_v_n / __pyx_v_bs);
  }

  /* "PETSc/petscsys.pxi":103
 *     if bs < 0: bs = 1
 *     if n  > 0: n = n // bs
 *     if N  > 0: N = N // bs             # <<<<<<<<<<<<<<
 *     CHKERR( PetscSplitOwnership(comm, &n, &N) )
 *     _n[0] = n * bs
 */
  __pyx_t_1 = ((__pyx_v_N > 0) != 0);
  if (__pyx_t_1) {
    __pyx_v_N = (__pyx_v_N / __pyx_v_bs);
  }

  /* "PETSc/petscsys.pxi":104
 *     if n  > 0: n = n // bs
 *     if N  > 0: N = N // bs
 *     CHKERR( PetscSplitOwnership(comm, &n, &N) )             # <<<<<<<<<<<<<<
 *     _n[0] = n * bs
 *     _N[0] = N * bs
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSplitOwnership(__pyx_v_comm, (&__pyx_v_n), (&__pyx_v_N))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(14, 104, __pyx_L1_error)

  /* "PETSc/petscsys.pxi":105
 *     if N  > 0: N = N // bs
 *     CHKERR( PetscSplitOwnership(comm, &n, &N) )
 *     _n[0] = n * bs             # <<<<<<<<<<<<<<
 *     _N[0] = N * bs
 *     return 0
 */
  (__pyx_v__n[0]) = (__pyx_v_n * __pyx_v_bs);

  /* "PETSc/petscsys.pxi":106
 *     CHKERR( PetscSplitOwnership(comm, &n, &N) )
 *     _n[0] = n * bs
 *     _N[0] = N * bs             # <<<<<<<<<<<<<<
 *     return 0
 */
  (__pyx_v__N[0]) = (__pyx_v_N * __pyx_v_bs);

  /* "PETSc/petscsys.pxi":107
 *     _n[0] = n * bs
 *     _N[0] = N * bs
 *     return 0             # <<<<<<<<<<<<<<
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscsys.pxi":93
 *     return 0
 * 
 * cdef inline int Sys_Layout(             # <<<<<<<<<<<<<<
 *     MPI_Comm comm,
 *     PetscInt bs,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys_Layout", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petsclog.pxi":62
 * 
 * 
 * cdef inline int event_args2objs(object args, PetscObject o[4]) except -1:             # <<<<<<<<<<<<<<
 *         o[0] = o[1] = o[2] = o[3] = NULL
 *         cdef Py_ssize_t i=0, n = len(args)
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_event_args2objs(PyObject *__pyx_v_args, PetscObject *__pyx_v_o) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  struct PyPetscObjectObject *__pyx_v_tmp = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("event_args2objs", 0);

  /* "PETSc/petsclog.pxi":63
 * 
 * cdef inline int event_args2objs(object args, PetscObject o[4]) except -1:
 *         o[0] = o[1] = o[2] = o[3] = NULL             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i=0, n = len(args)
 *         cdef Object tmp = None
 */
  (__pyx_v_o[0]) = NULL;
  (__pyx_v_o[1]) = NULL;
  (__pyx_v_o[2]) = NULL;
  (__pyx_v_o[3]) = NULL;

  /* "PETSc/petsclog.pxi":64
 * cdef inline int event_args2objs(object args, PetscObject o[4]) except -1:
 *         o[0] = o[1] = o[2] = o[3] = NULL
 *         cdef Py_ssize_t i=0, n = len(args)             # <<<<<<<<<<<<<<
 *         cdef Object tmp = None
 *         if n > 4: n = 4
 */
  __pyx_v_i = 0;
  __pyx_t_1 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(15, 64, __pyx_L1_error)
  __pyx_v_n = __pyx_t_1;

  /* "PETSc/petsclog.pxi":65
 *         o[0] = o[1] = o[2] = o[3] = NULL
 *         cdef Py_ssize_t i=0, n = len(args)
 *         cdef Object tmp = None             # <<<<<<<<<<<<<<
 *         if n > 4: n = 4
 *         for 0 <= i < n:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_tmp = ((struct PyPetscObjectObject *)Py_None);

  /* "PETSc/petsclog.pxi":66
 *         cdef Py_ssize_t i=0, n = len(args)
 *         cdef Object tmp = None
 *         if n > 4: n = 4             # <<<<<<<<<<<<<<
 *         for 0 <= i < n:
 *             tmp = args[i]
 */
  __pyx_t_2 = ((__pyx_v_n > 4) != 0);
  if (__pyx_t_2) {
    __pyx_v_n = 4;
  }

  /* "PETSc/petsclog.pxi":67
 *         cdef Object tmp = None
 *         if n > 4: n = 4
 *         for 0 <= i < n:             # <<<<<<<<<<<<<<
 *             tmp = args[i]
 *             if tmp is not None:
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "PETSc/petsclog.pxi":68
 *         if n > 4: n = 4
 *         for 0 <= i < n:
 *             tmp = args[i]             # <<<<<<<<<<<<<<
 *             if tmp is not None:
 *                 o[i] = tmp.obj[0]
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8petsc4py_5PETSc_Object))))) __PYX_ERR(15, 68, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_tmp, ((struct PyPetscObjectObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/petsclog.pxi":69
 *         for 0 <= i < n:
 *             tmp = args[i]
 *             if tmp is not None:             # <<<<<<<<<<<<<<
 *                 o[i] = tmp.obj[0]
 *         return 0
 */
    __pyx_t_2 = (((PyObject *)__pyx_v_tmp) != Py_None);
    __pyx_t_4 = (__pyx_t_2 != 0);
    if (__pyx_t_4) {

      /* "PETSc/petsclog.pxi":70
 *             tmp = args[i]
 *             if tmp is not None:
 *                 o[i] = tmp.obj[0]             # <<<<<<<<<<<<<<
 *         return 0
 */
      (__pyx_v_o[__pyx_v_i]) = (__pyx_v_tmp->obj[0]);

      /* "PETSc/petsclog.pxi":69
 *         for 0 <= i < n:
 *             tmp = args[i]
 *             if tmp is not None:             # <<<<<<<<<<<<<<
 *                 o[i] = tmp.obj[0]
 *         return 0
 */
    }
  }

  /* "PETSc/petsclog.pxi":71
 *             if tmp is not None:
 *                 o[i] = tmp.obj[0]
 *         return 0             # <<<<<<<<<<<<<<
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsclog.pxi":62
 * 
 * 
 * cdef inline int event_args2objs(object args, PetscObject o[4]) except -1:             # <<<<<<<<<<<<<<
 *         o[0] = o[1] = o[2] = o[3] = NULL
 *         cdef Py_ssize_t i=0, n = len(args)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.event_args2objs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tmp);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscobj.pxi":37
 * # --------------------------------------------------------------------
 * 
 * cdef inline int PetscINCREF(PetscObject *obj) nogil:             # <<<<<<<<<<<<<<
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_PetscINCREF(PetscObject *__pyx_v_obj) {
  int __pyx_r;
  int __pyx_t_1;

  /* "PETSc/petscobj.pxi":38
 * 
 * cdef inline int PetscINCREF(PetscObject *obj) nogil:
 *     if obj    == NULL: return 0             # <<<<<<<<<<<<<<
 *     if obj[0] == NULL: return 0
 *     return PetscObjectReference(obj[0])
 */
  __pyx_t_1 = ((__pyx_v_obj == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":39
 * cdef inline int PetscINCREF(PetscObject *obj) nogil:
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0             # <<<<<<<<<<<<<<
 *     return PetscObjectReference(obj[0])
 * 
 */
  __pyx_t_1 = (((__pyx_v_obj[0]) == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":40
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0
 *     return PetscObjectReference(obj[0])             # <<<<<<<<<<<<<<
 * 
 * cdef inline int PetscCLEAR(PetscObject* obj) nogil:
 */
  __pyx_r = PetscObjectReference((__pyx_v_obj[0]));
  goto __pyx_L0;

  /* "PETSc/petscobj.pxi":37
 * # --------------------------------------------------------------------
 * 
 * cdef inline int PetscINCREF(PetscObject *obj) nogil:             # <<<<<<<<<<<<<<
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/petscobj.pxi":42
 *     return PetscObjectReference(obj[0])
 * 
 * cdef inline int PetscCLEAR(PetscObject* obj) nogil:             # <<<<<<<<<<<<<<
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_PetscCLEAR(PetscObject *__pyx_v_obj) {
  PetscObject __pyx_v_tmp;
  int __pyx_r;
  int __pyx_t_1;

  /* "PETSc/petscobj.pxi":43
 * 
 * cdef inline int PetscCLEAR(PetscObject* obj) nogil:
 *     if obj    == NULL: return 0             # <<<<<<<<<<<<<<
 *     if obj[0] == NULL: return 0
 *     cdef PetscObject tmp
 */
  __pyx_t_1 = ((__pyx_v_obj == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":44
 * cdef inline int PetscCLEAR(PetscObject* obj) nogil:
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0             # <<<<<<<<<<<<<<
 *     cdef PetscObject tmp
 *     tmp = obj[0]; obj[0] = NULL
 */
  __pyx_t_1 = (((__pyx_v_obj[0]) == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":46
 *     if obj[0] == NULL: return 0
 *     cdef PetscObject tmp
 *     tmp = obj[0]; obj[0] = NULL             # <<<<<<<<<<<<<<
 *     return PetscObjectDestroy(&tmp)
 * 
 */
  __pyx_v_tmp = (__pyx_v_obj[0]);
  (__pyx_v_obj[0]) = NULL;

  /* "PETSc/petscobj.pxi":47
 *     cdef PetscObject tmp
 *     tmp = obj[0]; obj[0] = NULL
 *     return PetscObjectDestroy(&tmp)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int PetscDEALLOC(PetscObject* obj) nogil:
 */
  __pyx_r = PetscObjectDestroy((&__pyx_v_tmp));
  goto __pyx_L0;

  /* "PETSc/petscobj.pxi":42
 *     return PetscObjectReference(obj[0])
 * 
 * cdef inline int PetscCLEAR(PetscObject* obj) nogil:             # <<<<<<<<<<<<<<
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/petscobj.pxi":49
 *     return PetscObjectDestroy(&tmp)
 * 
 * cdef inline int PetscDEALLOC(PetscObject* obj) nogil:             # <<<<<<<<<<<<<<
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_PetscDEALLOC(PetscObject *__pyx_v_obj) {
  PetscObject __pyx_v_tmp;
  int __pyx_r;
  int __pyx_t_1;

  /* "PETSc/petscobj.pxi":50
 * 
 * cdef inline int PetscDEALLOC(PetscObject* obj) nogil:
 *     if obj    == NULL: return 0             # <<<<<<<<<<<<<<
 *     if obj[0] == NULL: return 0
 *     cdef PetscObject tmp
 */
  __pyx_t_1 = ((__pyx_v_obj == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":51
 * cdef inline int PetscDEALLOC(PetscObject* obj) nogil:
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0             # <<<<<<<<<<<<<<
 *     cdef PetscObject tmp
 *     tmp = obj[0]; obj[0] = NULL
 */
  __pyx_t_1 = (((__pyx_v_obj[0]) == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":53
 *     if obj[0] == NULL: return 0
 *     cdef PetscObject tmp
 *     tmp = obj[0]; obj[0] = NULL             # <<<<<<<<<<<<<<
 *     if not (<int>PetscInitializeCalled): return 0
 *     if     (<int>PetscFinalizeCalled):   return 0
 */
  __pyx_v_tmp = (__pyx_v_obj[0]);
  (__pyx_v_obj[0]) = NULL;

  /* "PETSc/petscobj.pxi":54
 *     cdef PetscObject tmp
 *     tmp = obj[0]; obj[0] = NULL
 *     if not (<int>PetscInitializeCalled): return 0             # <<<<<<<<<<<<<<
 *     if     (<int>PetscFinalizeCalled):   return 0
 *     return PetscObjectDestroy(&tmp)
 */
  __pyx_t_1 = ((!(((int)PetscInitializeCalled) != 0)) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":55
 *     tmp = obj[0]; obj[0] = NULL
 *     if not (<int>PetscInitializeCalled): return 0
 *     if     (<int>PetscFinalizeCalled):   return 0             # <<<<<<<<<<<<<<
 *     return PetscObjectDestroy(&tmp)
 * 
 */
  __pyx_t_1 = (((int)PetscFinalizeCalled) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":56
 *     if not (<int>PetscInitializeCalled): return 0
 *     if     (<int>PetscFinalizeCalled):   return 0
 *     return PetscObjectDestroy(&tmp)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int PetscINCSTATE(PetscObject *obj) nogil:
 */
  __pyx_r = PetscObjectDestroy((&__pyx_v_tmp));
  goto __pyx_L0;

  /* "PETSc/petscobj.pxi":49
 *     return PetscObjectDestroy(&tmp)
 * 
 * cdef inline int PetscDEALLOC(PetscObject* obj) nogil:             # <<<<<<<<<<<<<<
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/petscobj.pxi":58
 *     return PetscObjectDestroy(&tmp)
 * 
 * cdef inline int PetscINCSTATE(PetscObject *obj) nogil:             # <<<<<<<<<<<<<<
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_PetscINCSTATE(PetscObject *__pyx_v_obj) {
  int __pyx_r;
  int __pyx_t_1;

  /* "PETSc/petscobj.pxi":59
 * 
 * cdef inline int PetscINCSTATE(PetscObject *obj) nogil:
 *     if obj    == NULL: return 0             # <<<<<<<<<<<<<<
 *     if obj[0] == NULL: return 0
 *     return PetscObjectStateIncrease(obj[0])
 */
  __pyx_t_1 = ((__pyx_v_obj == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":60
 * cdef inline int PetscINCSTATE(PetscObject *obj) nogil:
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0             # <<<<<<<<<<<<<<
 *     return PetscObjectStateIncrease(obj[0])
 * 
 */
  __pyx_t_1 = (((__pyx_v_obj[0]) == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":61
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0
 *     return PetscObjectStateIncrease(obj[0])             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_r = PetscObjectStateIncrease((__pyx_v_obj[0]));
  goto __pyx_L0;

  /* "PETSc/petscobj.pxi":58
 *     return PetscObjectDestroy(&tmp)
 * 
 * cdef inline int PetscINCSTATE(PetscObject *obj) nogil:             # <<<<<<<<<<<<<<
 *     if obj    == NULL: return 0
 *     if obj[0] == NULL: return 0
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/petscobj.pxi":78
 *         int (*python_destroy)(void*)
 * 
 * cdef inline void Py_DecRef(PyObject *ob) with gil:             # <<<<<<<<<<<<<<
 *     _Py_DecRef(ob)
 * 
 */

static CYTHON_INLINE void __pyx_f_8petsc4py_5PETSc_Py_DecRef(PyObject *__pyx_v_ob) {
  __Pyx_RefNannyDeclarations
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("Py_DecRef", 0);

  /* "PETSc/petscobj.pxi":79
 * 
 * cdef inline void Py_DecRef(PyObject *ob) with gil:
 *     _Py_DecRef(ob)             # <<<<<<<<<<<<<<
 * 
 * cdef int PetscDelPyDict(void* ptr) nogil:
 */
  Py_DECREF(__pyx_v_ob);

  /* "PETSc/petscobj.pxi":78
 *         int (*python_destroy)(void*)
 * 
 * cdef inline void Py_DecRef(PyObject *ob) with gil:             # <<<<<<<<<<<<<<
 *     _Py_DecRef(ob)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "PETSc/petscobj.pxi":81
 *     _Py_DecRef(ob)
 * 
 * cdef int PetscDelPyDict(void* ptr) nogil:             # <<<<<<<<<<<<<<
 *     if ptr != NULL and Py_IsInitialized():
 *         Py_DecRef(<PyObject*>ptr)
 */

static int __pyx_f_8petsc4py_5PETSc_PetscDelPyDict(void *__pyx_v_ptr) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "PETSc/petscobj.pxi":82
 * 
 * cdef int PetscDelPyDict(void* ptr) nogil:
 *     if ptr != NULL and Py_IsInitialized():             # <<<<<<<<<<<<<<
 *         Py_DecRef(<PyObject*>ptr)
 *     return 0
 */
  __pyx_t_2 = ((__pyx_v_ptr != NULL) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (Py_IsInitialized() != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PETSc/petscobj.pxi":83
 * cdef int PetscDelPyDict(void* ptr) nogil:
 *     if ptr != NULL and Py_IsInitialized():
 *         Py_DecRef(<PyObject*>ptr)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_f_8petsc4py_5PETSc_Py_DecRef(((PyObject *)__pyx_v_ptr));

    /* "PETSc/petscobj.pxi":82
 * 
 * cdef int PetscDelPyDict(void* ptr) nogil:
 *     if ptr != NULL and Py_IsInitialized():             # <<<<<<<<<<<<<<
 *         Py_DecRef(<PyObject*>ptr)
 *     return 0
 */
  }

  /* "PETSc/petscobj.pxi":84
 *     if ptr != NULL and Py_IsInitialized():
 *         Py_DecRef(<PyObject*>ptr)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef object PetscGetPyDict(PetscObject obj, bint create):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscobj.pxi":81
 *     _Py_DecRef(ob)
 * 
 * cdef int PetscDelPyDict(void* ptr) nogil:             # <<<<<<<<<<<<<<
 *     if ptr != NULL and Py_IsInitialized():
 *         Py_DecRef(<PyObject*>ptr)
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/petscobj.pxi":86
 *     return 0
 * 
 * cdef object PetscGetPyDict(PetscObject obj, bint create):             # <<<<<<<<<<<<<<
 *     if obj.python_context != NULL:
 *         return <object>obj.python_context
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PetscGetPyDict(PetscObject __pyx_v_obj, int __pyx_v_create) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2;
  __Pyx_RefNannySetupContext("PetscGetPyDict", 0);

  /* "PETSc/petscobj.pxi":87
 * 
 * cdef object PetscGetPyDict(PetscObject obj, bint create):
 *     if obj.python_context != NULL:             # <<<<<<<<<<<<<<
 *         return <object>obj.python_context
 *     if create:
 */
  __pyx_t_1 = ((__pyx_v_obj->python_context != NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscobj.pxi":88
 * cdef object PetscGetPyDict(PetscObject obj, bint create):
 *     if obj.python_context != NULL:
 *         return <object>obj.python_context             # <<<<<<<<<<<<<<
 *     if create:
 *         obj.python_destroy = PetscDelPyDict
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_obj->python_context));
    __pyx_r = ((PyObject *)__pyx_v_obj->python_context);
    goto __pyx_L0;

    /* "PETSc/petscobj.pxi":87
 * 
 * cdef object PetscGetPyDict(PetscObject obj, bint create):
 *     if obj.python_context != NULL:             # <<<<<<<<<<<<<<
 *         return <object>obj.python_context
 *     if create:
 */
  }

  /* "PETSc/petscobj.pxi":89
 *     if obj.python_context != NULL:
 *         return <object>obj.python_context
 *     if create:             # <<<<<<<<<<<<<<
 *         obj.python_destroy = PetscDelPyDict
 *         obj.python_context = <void*>PyDict_New()
 */
  __pyx_t_1 = (__pyx_v_create != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscobj.pxi":90
 *         return <object>obj.python_context
 *     if create:
 *         obj.python_destroy = PetscDelPyDict             # <<<<<<<<<<<<<<
 *         obj.python_context = <void*>PyDict_New()
 *         return <object>obj.python_context
 */
    __pyx_v_obj->python_destroy = __pyx_f_8petsc4py_5PETSc_PetscDelPyDict;

    /* "PETSc/petscobj.pxi":91
 *     if create:
 *         obj.python_destroy = PetscDelPyDict
 *         obj.python_context = <void*>PyDict_New()             # <<<<<<<<<<<<<<
 *         return <object>obj.python_context
 *     return None
 */
    __pyx_t_2 = PyDict_New(); if (unlikely(__pyx_t_2 == NULL)) __PYX_ERR(16, 91, __pyx_L1_error)
    __pyx_v_obj->python_context = ((void *)__pyx_t_2);

    /* "PETSc/petscobj.pxi":92
 *         obj.python_destroy = PetscDelPyDict
 *         obj.python_context = <void*>PyDict_New()
 *         return <object>obj.python_context             # <<<<<<<<<<<<<<
 *     return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_obj->python_context));
    __pyx_r = ((PyObject *)__pyx_v_obj->python_context);
    goto __pyx_L0;

    /* "PETSc/petscobj.pxi":89
 *     if obj.python_context != NULL:
 *         return <object>obj.python_context
 *     if create:             # <<<<<<<<<<<<<<
 *         obj.python_destroy = PetscDelPyDict
 *         obj.python_context = <void*>PyDict_New()
 */
  }

  /* "PETSc/petscobj.pxi":93
 *         obj.python_context = <void*>PyDict_New()
 *         return <object>obj.python_context
 *     return None             # <<<<<<<<<<<<<<
 * 
 * cdef object PetscGetPyObj(PetscObject o, char name[]):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "PETSc/petscobj.pxi":86
 *     return 0
 * 
 * cdef object PetscGetPyDict(PetscObject obj, bint create):             # <<<<<<<<<<<<<<
 *     if obj.python_context != NULL:
 *         return <object>obj.python_context
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PetscGetPyDict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscobj.pxi":95
 *     return None
 * 
 * cdef object PetscGetPyObj(PetscObject o, char name[]):             # <<<<<<<<<<<<<<
 *     cdef object dct = PetscGetPyDict(o, False)
 *     if dct is None: return None
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PetscGetPyObj(PetscObject __pyx_v_o, char *__pyx_v_name) {
  PyObject *__pyx_v_dct = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_d;
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4;
  __Pyx_RefNannySetupContext("PetscGetPyObj", 0);

  /* "PETSc/petscobj.pxi":96
 * 
 * cdef object PetscGetPyObj(PetscObject o, char name[]):
 *     cdef object dct = PetscGetPyDict(o, False)             # <<<<<<<<<<<<<<
 *     if dct is None: return None
 *     cdef object key = bytes2str(name)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_PetscGetPyDict(__pyx_v_o, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_dct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscobj.pxi":97
 * cdef object PetscGetPyObj(PetscObject o, char name[]):
 *     cdef object dct = PetscGetPyDict(o, False)
 *     if dct is None: return None             # <<<<<<<<<<<<<<
 *     cdef object key = bytes2str(name)
 *     cdef PyObject *d = <PyObject*>dct
 */
  __pyx_t_2 = (__pyx_v_dct == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":98
 *     cdef object dct = PetscGetPyDict(o, False)
 *     if dct is None: return None
 *     cdef object key = bytes2str(name)             # <<<<<<<<<<<<<<
 *     cdef PyObject *d = <PyObject*>dct
 *     cdef PyObject *k = <PyObject*>key
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_key = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscobj.pxi":99
 *     if dct is None: return None
 *     cdef object key = bytes2str(name)
 *     cdef PyObject *d = <PyObject*>dct             # <<<<<<<<<<<<<<
 *     cdef PyObject *k = <PyObject*>key
 *     cdef PyObject *v = NULL
 */
  __pyx_v_d = ((PyObject *)__pyx_v_dct);

  /* "PETSc/petscobj.pxi":100
 *     cdef object key = bytes2str(name)
 *     cdef PyObject *d = <PyObject*>dct
 *     cdef PyObject *k = <PyObject*>key             # <<<<<<<<<<<<<<
 *     cdef PyObject *v = NULL
 *     v = PyDict_GetItem(d, k)
 */
  __pyx_v_k = ((PyObject *)__pyx_v_key);

  /* "PETSc/petscobj.pxi":101
 *     cdef PyObject *d = <PyObject*>dct
 *     cdef PyObject *k = <PyObject*>key
 *     cdef PyObject *v = NULL             # <<<<<<<<<<<<<<
 *     v = PyDict_GetItem(d, k)
 *     if v != NULL: return <object>v
 */
  __pyx_v_v = NULL;

  /* "PETSc/petscobj.pxi":102
 *     cdef PyObject *k = <PyObject*>key
 *     cdef PyObject *v = NULL
 *     v = PyDict_GetItem(d, k)             # <<<<<<<<<<<<<<
 *     if v != NULL: return <object>v
 *     return None
 */
  __pyx_t_4 = PyDict_GetItem(__pyx_v_d, __pyx_v_k); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 102, __pyx_L1_error)
  __pyx_v_v = __pyx_t_4;

  /* "PETSc/petscobj.pxi":103
 *     cdef PyObject *v = NULL
 *     v = PyDict_GetItem(d, k)
 *     if v != NULL: return <object>v             # <<<<<<<<<<<<<<
 *     return None
 * 
 */
  __pyx_t_3 = ((__pyx_v_v != NULL) != 0);
  if (__pyx_t_3) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_v));
    __pyx_r = ((PyObject *)__pyx_v_v);
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":104
 *     v = PyDict_GetItem(d, k)
 *     if v != NULL: return <object>v
 *     return None             # <<<<<<<<<<<<<<
 * 
 * cdef object PetscSetPyObj(PetscObject o, char name[], object p):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "PETSc/petscobj.pxi":95
 *     return None
 * 
 * cdef object PetscGetPyObj(PetscObject o, char name[]):             # <<<<<<<<<<<<<<
 *     cdef object dct = PetscGetPyDict(o, False)
 *     if dct is None: return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PetscGetPyObj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dct);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscobj.pxi":106
 *     return None
 * 
 * cdef object PetscSetPyObj(PetscObject o, char name[], object p):             # <<<<<<<<<<<<<<
 *     cdef object dct
 *     if p is not None:
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PetscSetPyObj(PetscObject __pyx_v_o, char *__pyx_v_name, PyObject *__pyx_v_p) {
  PyObject *__pyx_v_dct = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_d;
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("PetscSetPyObj", 0);

  /* "PETSc/petscobj.pxi":108
 * cdef object PetscSetPyObj(PetscObject o, char name[], object p):
 *     cdef object dct
 *     if p is not None:             # <<<<<<<<<<<<<<
 *         dct = PetscGetPyDict(o, True)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscobj.pxi":109
 *     cdef object dct
 *     if p is not None:
 *         dct = PetscGetPyDict(o, True)             # <<<<<<<<<<<<<<
 *     else:
 *         dct = PetscGetPyDict(o, False)
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_PetscGetPyDict(__pyx_v_o, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_dct = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PETSc/petscobj.pxi":108
 * cdef object PetscSetPyObj(PetscObject o, char name[], object p):
 *     cdef object dct
 *     if p is not None:             # <<<<<<<<<<<<<<
 *         dct = PetscGetPyDict(o, True)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscobj.pxi":111
 *         dct = PetscGetPyDict(o, True)
 *     else:
 *         dct = PetscGetPyDict(o, False)             # <<<<<<<<<<<<<<
 *         if dct is None: return None
 *     cdef str key = bytes2str(name)
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_PetscGetPyDict(__pyx_v_o, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_dct = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PETSc/petscobj.pxi":112
 *     else:
 *         dct = PetscGetPyDict(o, False)
 *         if dct is None: return None             # <<<<<<<<<<<<<<
 *     cdef str key = bytes2str(name)
 *     cdef PyObject *d = <PyObject*>dct
 */
    __pyx_t_2 = (__pyx_v_dct == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      goto __pyx_L0;
    }
  }
  __pyx_L3:;

  /* "PETSc/petscobj.pxi":113
 *         dct = PetscGetPyDict(o, False)
 *         if dct is None: return None
 *     cdef str key = bytes2str(name)             # <<<<<<<<<<<<<<
 *     cdef PyObject *d = <PyObject*>dct
 *     cdef PyObject *k = <PyObject*>key
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(16, 113, __pyx_L1_error)
  __pyx_v_key = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscobj.pxi":114
 *         if dct is None: return None
 *     cdef str key = bytes2str(name)
 *     cdef PyObject *d = <PyObject*>dct             # <<<<<<<<<<<<<<
 *     cdef PyObject *k = <PyObject*>key
 *     cdef PyObject *v = <PyObject*>p
 */
  __pyx_v_d = ((PyObject *)__pyx_v_dct);

  /* "PETSc/petscobj.pxi":115
 *     cdef str key = bytes2str(name)
 *     cdef PyObject *d = <PyObject*>dct
 *     cdef PyObject *k = <PyObject*>key             # <<<<<<<<<<<<<<
 *     cdef PyObject *v = <PyObject*>p
 *     PyDict_SetItem(d, k, v)
 */
  __pyx_v_k = ((PyObject *)__pyx_v_key);

  /* "PETSc/petscobj.pxi":116
 *     cdef PyObject *d = <PyObject*>dct
 *     cdef PyObject *k = <PyObject*>key
 *     cdef PyObject *v = <PyObject*>p             # <<<<<<<<<<<<<<
 *     PyDict_SetItem(d, k, v)
 *     if v == <PyObject*>None:
 */
  __pyx_v_v = ((PyObject *)__pyx_v_p);

  /* "PETSc/petscobj.pxi":117
 *     cdef PyObject *k = <PyObject*>key
 *     cdef PyObject *v = <PyObject*>p
 *     PyDict_SetItem(d, k, v)             # <<<<<<<<<<<<<<
 *     if v == <PyObject*>None:
 *         PyDict_DelItem(d, k)
 */
  __pyx_t_4 = PyDict_SetItem(__pyx_v_d, __pyx_v_k, __pyx_v_v); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(16, 117, __pyx_L1_error)

  /* "PETSc/petscobj.pxi":118
 *     cdef PyObject *v = <PyObject*>p
 *     PyDict_SetItem(d, k, v)
 *     if v == <PyObject*>None:             # <<<<<<<<<<<<<<
 *         PyDict_DelItem(d, k)
 *     return None
 */
  __pyx_t_1 = ((__pyx_v_v == ((PyObject *)Py_None)) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscobj.pxi":119
 *     PyDict_SetItem(d, k, v)
 *     if v == <PyObject*>None:
 *         PyDict_DelItem(d, k)             # <<<<<<<<<<<<<<
 *     return None
 * 
 */
    __pyx_t_4 = PyDict_DelItem(__pyx_v_d, __pyx_v_k); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(16, 119, __pyx_L1_error)

    /* "PETSc/petscobj.pxi":118
 *     cdef PyObject *v = <PyObject*>p
 *     PyDict_SetItem(d, k, v)
 *     if v == <PyObject*>None:             # <<<<<<<<<<<<<<
 *         PyDict_DelItem(d, k)
 *     return None
 */
  }

  /* "PETSc/petscobj.pxi":120
 *     if v == <PyObject*>None:
 *         PyDict_DelItem(d, k)
 *     return None             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "PETSc/petscobj.pxi":106
 *     return None
 * 
 * cdef object PetscSetPyObj(PetscObject o, char name[], object p):             # <<<<<<<<<<<<<<
 *     cdef object dct
 *     if p is not None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.PetscSetPyObj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dct);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscobj.pxi":127
 *     object PyLong_FromVoidPtr(void*)
 * 
 * cdef inline long Object_toFortran(PetscObject o) nogil:             # <<<<<<<<<<<<<<
 *     return <long> o
 * 
 */

static CYTHON_INLINE long __pyx_f_8petsc4py_5PETSc_Object_toFortran(PetscObject __pyx_v_o) {
  long __pyx_r;

  /* "PETSc/petscobj.pxi":128
 * 
 * cdef inline long Object_toFortran(PetscObject o) nogil:
 *     return <long> o             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_r = ((long)__pyx_v_o);
  goto __pyx_L0;

  /* "PETSc/petscobj.pxi":127
 *     object PyLong_FromVoidPtr(void*)
 * 
 * cdef inline long Object_toFortran(PetscObject o) nogil:             # <<<<<<<<<<<<<<
 *     return <long> o
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/petscobj.pxi":132
 * # --------------------------------------------------------------------
 * 
 * cdef inline type subtype_DM(PetscDM dm):             # <<<<<<<<<<<<<<
 *     cdef PetscObject obj = <PetscObject> dm
 *     if obj == NULL: return DM
 */

static CYTHON_INLINE PyTypeObject *__pyx_f_8petsc4py_5PETSc_subtype_DM(DM __pyx_v_dm) {
  PetscObject __pyx_v_obj;
  PetscBool __pyx_v_match;
  PyTypeObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("subtype_DM", 0);

  /* "PETSc/petscobj.pxi":133
 * 
 * cdef inline type subtype_DM(PetscDM dm):
 *     cdef PetscObject obj = <PetscObject> dm             # <<<<<<<<<<<<<<
 *     if obj == NULL: return DM
 *     # ---
 */
  __pyx_v_obj = ((PetscObject)__pyx_v_dm);

  /* "PETSc/petscobj.pxi":134
 * cdef inline type subtype_DM(PetscDM dm):
 *     cdef PetscObject obj = <PetscObject> dm
 *     if obj == NULL: return DM             # <<<<<<<<<<<<<<
 *     # ---
 *     cdef PetscBool match = PETSC_FALSE
 */
  __pyx_t_1 = ((__pyx_v_obj == NULL) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DM));
    __pyx_r = __pyx_ptype_8petsc4py_5PETSc_DM;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":136
 *     if obj == NULL: return DM
 *     # ---
 *     cdef PetscBool match = PETSC_FALSE             # <<<<<<<<<<<<<<
 *     CHKERR( PetscObjectTypeCompare(obj, b"da", &match) )
 *     if match == PETSC_TRUE: return DMDA
 */
  __pyx_v_match = PETSC_FALSE;

  /* "PETSc/petscobj.pxi":137
 *     # ---
 *     cdef PetscBool match = PETSC_FALSE
 *     CHKERR( PetscObjectTypeCompare(obj, b"da", &match) )             # <<<<<<<<<<<<<<
 *     if match == PETSC_TRUE: return DMDA
 *     CHKERR( PetscObjectTypeCompare(obj, b"plex", &match) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectTypeCompare(__pyx_v_obj, ((char *)"da"), (&__pyx_v_match))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(16, 137, __pyx_L1_error)

  /* "PETSc/petscobj.pxi":138
 *     cdef PetscBool match = PETSC_FALSE
 *     CHKERR( PetscObjectTypeCompare(obj, b"da", &match) )
 *     if match == PETSC_TRUE: return DMDA             # <<<<<<<<<<<<<<
 *     CHKERR( PetscObjectTypeCompare(obj, b"plex", &match) )
 *     if match == PETSC_TRUE: return DMPlex
 */
  __pyx_t_1 = ((__pyx_v_match == PETSC_TRUE) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMDA));
    __pyx_r = __pyx_ptype_8petsc4py_5PETSc_DMDA;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":139
 *     CHKERR( PetscObjectTypeCompare(obj, b"da", &match) )
 *     if match == PETSC_TRUE: return DMDA
 *     CHKERR( PetscObjectTypeCompare(obj, b"plex", &match) )             # <<<<<<<<<<<<<<
 *     if match == PETSC_TRUE: return DMPlex
 *     CHKERR( PetscObjectTypeCompare(obj, b"composite", &match) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectTypeCompare(__pyx_v_obj, ((char *)"plex"), (&__pyx_v_match))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(16, 139, __pyx_L1_error)

  /* "PETSc/petscobj.pxi":140
 *     if match == PETSC_TRUE: return DMDA
 *     CHKERR( PetscObjectTypeCompare(obj, b"plex", &match) )
 *     if match == PETSC_TRUE: return DMPlex             # <<<<<<<<<<<<<<
 *     CHKERR( PetscObjectTypeCompare(obj, b"composite", &match) )
 *     if match == PETSC_TRUE: return DMComposite
 */
  __pyx_t_1 = ((__pyx_v_match == PETSC_TRUE) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMPlex));
    __pyx_r = __pyx_ptype_8petsc4py_5PETSc_DMPlex;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":141
 *     CHKERR( PetscObjectTypeCompare(obj, b"plex", &match) )
 *     if match == PETSC_TRUE: return DMPlex
 *     CHKERR( PetscObjectTypeCompare(obj, b"composite", &match) )             # <<<<<<<<<<<<<<
 *     if match == PETSC_TRUE: return DMComposite
 *     CHKERR( PetscObjectTypeCompare(obj, b"shell", &match) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectTypeCompare(__pyx_v_obj, ((char *)"composite"), (&__pyx_v_match))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(16, 141, __pyx_L1_error)

  /* "PETSc/petscobj.pxi":142
 *     if match == PETSC_TRUE: return DMPlex
 *     CHKERR( PetscObjectTypeCompare(obj, b"composite", &match) )
 *     if match == PETSC_TRUE: return DMComposite             # <<<<<<<<<<<<<<
 *     CHKERR( PetscObjectTypeCompare(obj, b"shell", &match) )
 *     if match == PETSC_TRUE: return DMShell
 */
  __pyx_t_1 = ((__pyx_v_match == PETSC_TRUE) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMComposite));
    __pyx_r = __pyx_ptype_8petsc4py_5PETSc_DMComposite;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":143
 *     CHKERR( PetscObjectTypeCompare(obj, b"composite", &match) )
 *     if match == PETSC_TRUE: return DMComposite
 *     CHKERR( PetscObjectTypeCompare(obj, b"shell", &match) )             # <<<<<<<<<<<<<<
 *     if match == PETSC_TRUE: return DMShell
 *     # ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectTypeCompare(__pyx_v_obj, ((char *)"shell"), (&__pyx_v_match))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(16, 143, __pyx_L1_error)

  /* "PETSc/petscobj.pxi":144
 *     if match == PETSC_TRUE: return DMComposite
 *     CHKERR( PetscObjectTypeCompare(obj, b"shell", &match) )
 *     if match == PETSC_TRUE: return DMShell             # <<<<<<<<<<<<<<
 *     # ---
 *     return DM
 */
  __pyx_t_1 = ((__pyx_v_match == PETSC_TRUE) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMShell));
    __pyx_r = __pyx_ptype_8petsc4py_5PETSc_DMShell;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":146
 *     if match == PETSC_TRUE: return DMShell
 *     # ---
 *     return DM             # <<<<<<<<<<<<<<
 * 
 * cdef inline type subtype_Object(PetscObject obj):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DM));
  __pyx_r = __pyx_ptype_8petsc4py_5PETSc_DM;
  goto __pyx_L0;

  /* "PETSc/petscobj.pxi":132
 * # --------------------------------------------------------------------
 * 
 * cdef inline type subtype_DM(PetscDM dm):             # <<<<<<<<<<<<<<
 *     cdef PetscObject obj = <PetscObject> dm
 *     if obj == NULL: return DM
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.subtype_DM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscobj.pxi":148
 *     return DM
 * 
 * cdef inline type subtype_Object(PetscObject obj):             # <<<<<<<<<<<<<<
 *     cdef type klass = Object
 *     if obj == NULL: return klass
 */

static CYTHON_INLINE PyTypeObject *__pyx_f_8petsc4py_5PETSc_subtype_Object(PetscObject __pyx_v_obj) {
  PyTypeObject *__pyx_v_klass = 0;
  PetscClassId __pyx_v_classid;
  PyTypeObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("subtype_Object", 0);

  /* "PETSc/petscobj.pxi":149
 * 
 * cdef inline type subtype_Object(PetscObject obj):
 *     cdef type klass = Object             # <<<<<<<<<<<<<<
 *     if obj == NULL: return klass
 *     cdef PetscClassId classid = 0
 */
  __Pyx_INCREF(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Object));
  __pyx_v_klass = __pyx_ptype_8petsc4py_5PETSc_Object;

  /* "PETSc/petscobj.pxi":150
 * cdef inline type subtype_Object(PetscObject obj):
 *     cdef type klass = Object
 *     if obj == NULL: return klass             # <<<<<<<<<<<<<<
 *     cdef PetscClassId classid = 0
 *     CHKERR( PetscObjectGetClassId(obj,&classid) )
 */
  __pyx_t_1 = ((__pyx_v_obj == NULL) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_klass));
    __pyx_r = __pyx_v_klass;
    goto __pyx_L0;
  }

  /* "PETSc/petscobj.pxi":151
 *     cdef type klass = Object
 *     if obj == NULL: return klass
 *     cdef PetscClassId classid = 0             # <<<<<<<<<<<<<<
 *     CHKERR( PetscObjectGetClassId(obj,&classid) )
 *     if classid == PETSC_DM_CLASSID:
 */
  __pyx_v_classid = 0;

  /* "PETSc/petscobj.pxi":152
 *     if obj == NULL: return klass
 *     cdef PetscClassId classid = 0
 *     CHKERR( PetscObjectGetClassId(obj,&classid) )             # <<<<<<<<<<<<<<
 *     if classid == PETSC_DM_CLASSID:
 *         klass = subtype_DM(<PetscDM>obj)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetClassId(__pyx_v_obj, (&__pyx_v_classid))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(16, 152, __pyx_L1_error)

  /* "PETSc/petscobj.pxi":153
 *     cdef PetscClassId classid = 0
 *     CHKERR( PetscObjectGetClassId(obj,&classid) )
 *     if classid == PETSC_DM_CLASSID:             # <<<<<<<<<<<<<<
 *         klass = subtype_DM(<PetscDM>obj)
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_classid == DM_CLASSID) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscobj.pxi":154
 *     CHKERR( PetscObjectGetClassId(obj,&classid) )
 *     if classid == PETSC_DM_CLASSID:
 *         klass = subtype_DM(<PetscDM>obj)             # <<<<<<<<<<<<<<
 *     else:
 *         klass = PyPetscType_Lookup(classid)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(((DM)__pyx_v_obj))); if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_klass, ((PyTypeObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/petscobj.pxi":153
 *     cdef PetscClassId classid = 0
 *     CHKERR( PetscObjectGetClassId(obj,&classid) )
 *     if classid == PETSC_DM_CLASSID:             # <<<<<<<<<<<<<<
 *         klass = subtype_DM(<PetscDM>obj)
 *     else:
 */
    goto __pyx_L4;
  }

  /* "PETSc/petscobj.pxi":156
 *         klass = subtype_DM(<PetscDM>obj)
 *     else:
 *         klass = PyPetscType_Lookup(classid)             # <<<<<<<<<<<<<<
 *     return klass
 * 
 */
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_PyPetscType_Lookup(__pyx_v_classid)); if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_klass, ((PyTypeObject*)__pyx_t_3));
    __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "PETSc/petscobj.pxi":157
 *     else:
 *         klass = PyPetscType_Lookup(classid)
 *     return klass             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_klass));
  __pyx_r = __pyx_v_klass;
  goto __pyx_L0;

  /* "PETSc/petscobj.pxi":148
 *     return DM
 * 
 * cdef inline type subtype_Object(PetscObject obj):             # <<<<<<<<<<<<<<
 *     cdef type klass = Object
 *     if obj == NULL: return klass
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.subtype_Object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_klass);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvwr.pxi":119
 * # ---
 * 
 * cdef inline PetscFileMode filemode(object mode) except <PetscFileMode>(-1):             # <<<<<<<<<<<<<<
 *     if mode is None:
 *         return PETSC_FILE_MODE_READ
 */

static CYTHON_INLINE PetscFileMode __pyx_f_8petsc4py_5PETSc_filemode(PyObject *__pyx_v_mode) {
  PetscFileMode __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscFileMode __pyx_t_3;
  __Pyx_RefNannySetupContext("filemode", 0);

  /* "PETSc/petscvwr.pxi":120
 * 
 * cdef inline PetscFileMode filemode(object mode) except <PetscFileMode>(-1):
 *     if mode is None:             # <<<<<<<<<<<<<<
 *         return PETSC_FILE_MODE_READ
 *     if isinstance(mode, str):
 */
  __pyx_t_1 = (__pyx_v_mode == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscvwr.pxi":121
 * cdef inline PetscFileMode filemode(object mode) except <PetscFileMode>(-1):
 *     if mode is None:
 *         return PETSC_FILE_MODE_READ             # <<<<<<<<<<<<<<
 *     if isinstance(mode, str):
 *         if   mode == 'r'  : return PETSC_FILE_MODE_READ
 */
    __pyx_r = FILE_MODE_READ;
    goto __pyx_L0;

    /* "PETSc/petscvwr.pxi":120
 * 
 * cdef inline PetscFileMode filemode(object mode) except <PetscFileMode>(-1):
 *     if mode is None:             # <<<<<<<<<<<<<<
 *         return PETSC_FILE_MODE_READ
 *     if isinstance(mode, str):
 */
  }

  /* "PETSc/petscvwr.pxi":122
 *     if mode is None:
 *         return PETSC_FILE_MODE_READ
 *     if isinstance(mode, str):             # <<<<<<<<<<<<<<
 *         if   mode == 'r'  : return PETSC_FILE_MODE_READ
 *         elif mode == 'w'  : return PETSC_FILE_MODE_WRITE
 */
  __pyx_t_2 = PyString_Check(__pyx_v_mode); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscvwr.pxi":123
 *         return PETSC_FILE_MODE_READ
 *     if isinstance(mode, str):
 *         if   mode == 'r'  : return PETSC_FILE_MODE_READ             # <<<<<<<<<<<<<<
 *         elif mode == 'w'  : return PETSC_FILE_MODE_WRITE
 *         elif mode == 'a'  : return PETSC_FILE_MODE_APPEND
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_r, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(17, 123, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_r = FILE_MODE_READ;
      goto __pyx_L0;
    }

    /* "PETSc/petscvwr.pxi":124
 *     if isinstance(mode, str):
 *         if   mode == 'r'  : return PETSC_FILE_MODE_READ
 *         elif mode == 'w'  : return PETSC_FILE_MODE_WRITE             # <<<<<<<<<<<<<<
 *         elif mode == 'a'  : return PETSC_FILE_MODE_APPEND
 *         elif mode == 'r+' : return PETSC_FILE_MODE_UPDATE
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_w, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(17, 124, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_r = FILE_MODE_WRITE;
      goto __pyx_L0;
    }

    /* "PETSc/petscvwr.pxi":125
 *         if   mode == 'r'  : return PETSC_FILE_MODE_READ
 *         elif mode == 'w'  : return PETSC_FILE_MODE_WRITE
 *         elif mode == 'a'  : return PETSC_FILE_MODE_APPEND             # <<<<<<<<<<<<<<
 *         elif mode == 'r+' : return PETSC_FILE_MODE_UPDATE
 *         elif mode == 'w+' : return PETSC_FILE_MODE_UPDATE
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_a, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(17, 125, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_r = FILE_MODE_APPEND;
      goto __pyx_L0;
    }

    /* "PETSc/petscvwr.pxi":126
 *         elif mode == 'w'  : return PETSC_FILE_MODE_WRITE
 *         elif mode == 'a'  : return PETSC_FILE_MODE_APPEND
 *         elif mode == 'r+' : return PETSC_FILE_MODE_UPDATE             # <<<<<<<<<<<<<<
 *         elif mode == 'w+' : return PETSC_FILE_MODE_UPDATE
 *         elif mode == 'a+' : return PETSC_FILE_MODE_APPEND_UPDATE
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_r_2, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(17, 126, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_r = FILE_MODE_UPDATE;
      goto __pyx_L0;
    }

    /* "PETSc/petscvwr.pxi":127
 *         elif mode == 'a'  : return PETSC_FILE_MODE_APPEND
 *         elif mode == 'r+' : return PETSC_FILE_MODE_UPDATE
 *         elif mode == 'w+' : return PETSC_FILE_MODE_UPDATE             # <<<<<<<<<<<<<<
 *         elif mode == 'a+' : return PETSC_FILE_MODE_APPEND_UPDATE
 *         elif mode == 'u'  : return PETSC_FILE_MODE_UPDATE
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_w_2, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(17, 127, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_r = FILE_MODE_UPDATE;
      goto __pyx_L0;
    }

    /* "PETSc/petscvwr.pxi":128
 *         elif mode == 'r+' : return PETSC_FILE_MODE_UPDATE
 *         elif mode == 'w+' : return PETSC_FILE_MODE_UPDATE
 *         elif mode == 'a+' : return PETSC_FILE_MODE_APPEND_UPDATE             # <<<<<<<<<<<<<<
 *         elif mode == 'u'  : return PETSC_FILE_MODE_UPDATE
 *         elif mode == 'au' : return PETSC_FILE_MODE_APPEND_UPDATE
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_a_2, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(17, 128, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_r = FILE_MODE_APPEND_UPDATE;
      goto __pyx_L0;
    }

    /* "PETSc/petscvwr.pxi":129
 *         elif mode == 'w+' : return PETSC_FILE_MODE_UPDATE
 *         elif mode == 'a+' : return PETSC_FILE_MODE_APPEND_UPDATE
 *         elif mode == 'u'  : return PETSC_FILE_MODE_UPDATE             # <<<<<<<<<<<<<<
 *         elif mode == 'au' : return PETSC_FILE_MODE_APPEND_UPDATE
 *         elif mode == 'ua' : return PETSC_FILE_MODE_APPEND_UPDATE
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_u, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(17, 129, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_r = FILE_MODE_UPDATE;
      goto __pyx_L0;
    }

    /* "PETSc/petscvwr.pxi":130
 *         elif mode == 'a+' : return PETSC_FILE_MODE_APPEND_UPDATE
 *         elif mode == 'u'  : return PETSC_FILE_MODE_UPDATE
 *         elif mode == 'au' : return PETSC_FILE_MODE_APPEND_UPDATE             # <<<<<<<<<<<<<<
 *         elif mode == 'ua' : return PETSC_FILE_MODE_APPEND_UPDATE
 *     return mode
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_au, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(17, 130, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_r = FILE_MODE_APPEND_UPDATE;
      goto __pyx_L0;
    }

    /* "PETSc/petscvwr.pxi":131
 *         elif mode == 'u'  : return PETSC_FILE_MODE_UPDATE
 *         elif mode == 'au' : return PETSC_FILE_MODE_APPEND_UPDATE
 *         elif mode == 'ua' : return PETSC_FILE_MODE_APPEND_UPDATE             # <<<<<<<<<<<<<<
 *     return mode
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_ua, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(17, 131, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_r = FILE_MODE_APPEND_UPDATE;
      goto __pyx_L0;
    }

    /* "PETSc/petscvwr.pxi":122
 *     if mode is None:
 *         return PETSC_FILE_MODE_READ
 *     if isinstance(mode, str):             # <<<<<<<<<<<<<<
 *         if   mode == 'r'  : return PETSC_FILE_MODE_READ
 *         elif mode == 'w'  : return PETSC_FILE_MODE_WRITE
 */
  }

  /* "PETSc/petscvwr.pxi":132
 *         elif mode == 'au' : return PETSC_FILE_MODE_APPEND_UPDATE
 *         elif mode == 'ua' : return PETSC_FILE_MODE_APPEND_UPDATE
 *     return mode             # <<<<<<<<<<<<<<
 */
  __pyx_t_3 = ((PetscFileMode)__Pyx_PyInt_As_PetscFileMode(__pyx_v_mode)); if (unlikely(PyErr_Occurred())) __PYX_ERR(17, 132, __pyx_L1_error)
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "PETSc/petscvwr.pxi":119
 * # ---
 * 
 * cdef inline PetscFileMode filemode(object mode) except <PetscFileMode>(-1):             # <<<<<<<<<<<<<<
 *     if mode is None:
 *         return PETSC_FILE_MODE_READ
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.filemode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = ((PetscFileMode)-1L);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":91
 * # --------------------------------------------------------------------
 * 
 * cdef inline IS ref_IS(PetscIS iset):             # <<<<<<<<<<<<<<
 *     cdef IS ob = <IS> IS()
 *     ob.iset = iset
 */

static CYTHON_INLINE struct PyPetscISObject *__pyx_f_8petsc4py_5PETSc_ref_IS(IS __pyx_v_iset) {
  struct PyPetscISObject *__pyx_v_ob = 0;
  struct PyPetscISObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ref_IS", 0);

  /* "PETSc/petscis.pxi":92
 * 
 * cdef inline IS ref_IS(PetscIS iset):
 *     cdef IS ob = <IS> IS()             # <<<<<<<<<<<<<<
 *     ob.iset = iset
 *     PetscINCREF(ob.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ob = ((struct PyPetscISObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscis.pxi":93
 * cdef inline IS ref_IS(PetscIS iset):
 *     cdef IS ob = <IS> IS()
 *     ob.iset = iset             # <<<<<<<<<<<<<<
 *     PetscINCREF(ob.obj)
 *     return ob
 */
  __pyx_v_ob->iset = __pyx_v_iset;

  /* "PETSc/petscis.pxi":94
 *     cdef IS ob = <IS> IS()
 *     ob.iset = iset
 *     PetscINCREF(ob.obj)             # <<<<<<<<<<<<<<
 *     return ob
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ob->__pyx_base.obj);

  /* "PETSc/petscis.pxi":95
 *     ob.iset = iset
 *     PetscINCREF(ob.obj)
 *     return ob             # <<<<<<<<<<<<<<
 * 
 * cdef inline LGMap ref_LGMap(PetscLGMap lgm):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ob));
  __pyx_r = __pyx_v_ob;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":91
 * # --------------------------------------------------------------------
 * 
 * cdef inline IS ref_IS(PetscIS iset):             # <<<<<<<<<<<<<<
 *     cdef IS ob = <IS> IS()
 *     ob.iset = iset
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.ref_IS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":97
 *     return ob
 * 
 * cdef inline LGMap ref_LGMap(PetscLGMap lgm):             # <<<<<<<<<<<<<<
 *     cdef LGMap ob = <LGMap> LGMap()
 *     ob.lgm = lgm
 */

static CYTHON_INLINE struct PyPetscLGMapObject *__pyx_f_8petsc4py_5PETSc_ref_LGMap(ISLocalToGlobalMapping __pyx_v_lgm) {
  struct PyPetscLGMapObject *__pyx_v_ob = 0;
  struct PyPetscLGMapObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ref_LGMap", 0);

  /* "PETSc/petscis.pxi":98
 * 
 * cdef inline LGMap ref_LGMap(PetscLGMap lgm):
 *     cdef LGMap ob = <LGMap> LGMap()             # <<<<<<<<<<<<<<
 *     ob.lgm = lgm
 *     PetscINCREF(ob.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_LGMap), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ob = ((struct PyPetscLGMapObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscis.pxi":99
 * cdef inline LGMap ref_LGMap(PetscLGMap lgm):
 *     cdef LGMap ob = <LGMap> LGMap()
 *     ob.lgm = lgm             # <<<<<<<<<<<<<<
 *     PetscINCREF(ob.obj)
 *     return ob
 */
  __pyx_v_ob->lgm = __pyx_v_lgm;

  /* "PETSc/petscis.pxi":100
 *     cdef LGMap ob = <LGMap> LGMap()
 *     ob.lgm = lgm
 *     PetscINCREF(ob.obj)             # <<<<<<<<<<<<<<
 *     return ob
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ob->__pyx_base.obj);

  /* "PETSc/petscis.pxi":101
 *     ob.lgm = lgm
 *     PetscINCREF(ob.obj)
 *     return ob             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ob));
  __pyx_r = __pyx_v_ob;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":97
 *     return ob
 * 
 * cdef inline LGMap ref_LGMap(PetscLGMap lgm):             # <<<<<<<<<<<<<<
 *     cdef LGMap ob = <LGMap> LGMap()
 *     ob.lgm = lgm
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.ref_LGMap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":120
 *     cdef bint hasarray
 * 
 *     def __cinit__(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef PetscIS i = iset.iset
 *         CHKERR( PetscINCREF(<PetscObject*>&i) )
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iset,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);
        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_iset)) != 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, "__cinit__") < 0)) __PYX_ERR(4, 120, __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_iset = ((struct PyPetscISObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 120, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iset), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iset", 0))) __PYX_ERR(4, 120, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10_IS_buffer___cinit__(((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self), __pyx_v_iset);

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

static int __pyx_pf_8petsc4py_5PETSc_10_IS_buffer___cinit__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset) {
  IS __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  IS __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/petscis.pxi":121
 * 
 *     def __cinit__(self, IS iset not None):
 *         cdef PetscIS i = iset.iset             # <<<<<<<<<<<<<<
 *         CHKERR( PetscINCREF(<PetscObject*>&i) )
 *         self.iset = i
 */
  __pyx_t_1 = __pyx_v_iset->iset;
  __pyx_v_i = __pyx_t_1;

  /* "PETSc/petscis.pxi":122
 *     def __cinit__(self, IS iset not None):
 *         cdef PetscIS i = iset.iset
 *         CHKERR( PetscINCREF(<PetscObject*>&i) )             # <<<<<<<<<<<<<<
 *         self.iset = i
 *         self.size = 0
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_PetscINCREF(((PetscObject *)(&__pyx_v_i)))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(4, 122, __pyx_L1_error)

  /* "PETSc/petscis.pxi":123
 *         cdef PetscIS i = iset.iset
 *         CHKERR( PetscINCREF(<PetscObject*>&i) )
 *         self.iset = i             # <<<<<<<<<<<<<<
 *         self.size = 0
 *         self.data = NULL
 */
  __pyx_v_self->iset = __pyx_v_i;

  /* "PETSc/petscis.pxi":124
 *         CHKERR( PetscINCREF(<PetscObject*>&i) )
 *         self.iset = i
 *         self.size = 0             # <<<<<<<<<<<<<<
 *         self.data = NULL
 *         self.hasarray = 0
 */
  __pyx_v_self->size = 0;

  /* "PETSc/petscis.pxi":125
 *         self.iset = i
 *         self.size = 0
 *         self.data = NULL             # <<<<<<<<<<<<<<
 *         self.hasarray = 0
 * 
 */
  __pyx_v_self->data = NULL;

  /* "PETSc/petscis.pxi":126
 *         self.size = 0
 *         self.data = NULL
 *         self.hasarray = 0             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->hasarray = 0;

  /* "PETSc/petscis.pxi":120
 *     cdef bint hasarray
 * 
 *     def __cinit__(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef PetscIS i = iset.iset
 *         CHKERR( PetscINCREF(<PetscObject*>&i) )
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":128
 *         self.hasarray = 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.hasarray and self.iset != NULL:
 *             CHKERR( ISRestoreIndices(self.iset, &self.data) )
 */

/* Python wrapper */
static void __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_2__dealloc__(((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self));

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

static void __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_2__dealloc__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "PETSc/petscis.pxi":129
 * 
 *     def __dealloc__(self):
 *         if self.hasarray and self.iset != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( ISRestoreIndices(self.iset, &self.data) )
 *         CHKERR( ISDestroy(&self.iset) )
 */
  __pyx_t_2 = (__pyx_v_self->hasarray != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_self->iset != NULL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PETSc/petscis.pxi":130
 *     def __dealloc__(self):
 *         if self.hasarray and self.iset != NULL:
 *             CHKERR( ISRestoreIndices(self.iset, &self.data) )             # <<<<<<<<<<<<<<
 *         CHKERR( ISDestroy(&self.iset) )
 * 
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISRestoreIndices(__pyx_v_self->iset, (&__pyx_v_self->data))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(4, 130, __pyx_L1_error)

    /* "PETSc/petscis.pxi":129
 * 
 *     def __dealloc__(self):
 *         if self.hasarray and self.iset != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( ISRestoreIndices(self.iset, &self.data) )
 *         CHKERR( ISDestroy(&self.iset) )
 */
  }

  /* "PETSc/petscis.pxi":131
 *         if self.hasarray and self.iset != NULL:
 *             CHKERR( ISRestoreIndices(self.iset, &self.data) )
 *         CHKERR( ISDestroy(&self.iset) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISDestroy((&__pyx_v_self->iset))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(4, 131, __pyx_L1_error)

  /* "PETSc/petscis.pxi":128
 *         self.hasarray = 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.hasarray and self.iset != NULL:
 *             CHKERR( ISRestoreIndices(self.iset, &self.data) )
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("petsc4py.PETSc._IS_buffer.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PETSc/petscis.pxi":135
 *     #
 * 
 *     cdef int acquire(self) except -1:             # <<<<<<<<<<<<<<
 *         if not self.hasarray and self.iset != NULL:
 *             CHKERR( ISGetLocalSize(self.iset, &self.size) )
 */

static int __pyx_f_8petsc4py_5PETSc_10_IS_buffer_acquire(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("acquire", 0);

  /* "PETSc/petscis.pxi":136
 * 
 *     cdef int acquire(self) except -1:
 *         if not self.hasarray and self.iset != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( ISGetLocalSize(self.iset, &self.size) )
 *             CHKERR( ISGetIndices(self.iset, &self.data) )
 */
  __pyx_t_2 = ((!(__pyx_v_self->hasarray != 0)) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_self->iset != NULL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PETSc/petscis.pxi":137
 *     cdef int acquire(self) except -1:
 *         if not self.hasarray and self.iset != NULL:
 *             CHKERR( ISGetLocalSize(self.iset, &self.size) )             # <<<<<<<<<<<<<<
 *             CHKERR( ISGetIndices(self.iset, &self.data) )
 *             self.hasarray = 1
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetLocalSize(__pyx_v_self->iset, (&__pyx_v_self->size))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(4, 137, __pyx_L1_error)

    /* "PETSc/petscis.pxi":138
 *         if not self.hasarray and self.iset != NULL:
 *             CHKERR( ISGetLocalSize(self.iset, &self.size) )
 *             CHKERR( ISGetIndices(self.iset, &self.data) )             # <<<<<<<<<<<<<<
 *             self.hasarray = 1
 *         return 0
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetIndices(__pyx_v_self->iset, (&__pyx_v_self->data))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(4, 138, __pyx_L1_error)

    /* "PETSc/petscis.pxi":139
 *             CHKERR( ISGetLocalSize(self.iset, &self.size) )
 *             CHKERR( ISGetIndices(self.iset, &self.data) )
 *             self.hasarray = 1             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_v_self->hasarray = 1;

    /* "PETSc/petscis.pxi":136
 * 
 *     cdef int acquire(self) except -1:
 *         if not self.hasarray and self.iset != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( ISGetLocalSize(self.iset, &self.size) )
 *             CHKERR( ISGetIndices(self.iset, &self.data) )
 */
  }

  /* "PETSc/petscis.pxi":140
 *             CHKERR( ISGetIndices(self.iset, &self.data) )
 *             self.hasarray = 1
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int release(self) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":135
 *     #
 * 
 *     cdef int acquire(self) except -1:             # <<<<<<<<<<<<<<
 *         if not self.hasarray and self.iset != NULL:
 *             CHKERR( ISGetLocalSize(self.iset, &self.size) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.acquire", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":142
 *         return 0
 * 
 *     cdef int release(self) except -1:             # <<<<<<<<<<<<<<
 *         if self.hasarray and self.iset != NULL:
 *             self.size = 0
 */

static int __pyx_f_8petsc4py_5PETSc_10_IS_buffer_release(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("release", 0);

  /* "PETSc/petscis.pxi":143
 * 
 *     cdef int release(self) except -1:
 *         if self.hasarray and self.iset != NULL:             # <<<<<<<<<<<<<<
 *             self.size = 0
 *             CHKERR( ISRestoreIndices(self.iset, &self.data) )
 */
  __pyx_t_2 = (__pyx_v_self->hasarray != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_self->iset != NULL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PETSc/petscis.pxi":144
 *     cdef int release(self) except -1:
 *         if self.hasarray and self.iset != NULL:
 *             self.size = 0             # <<<<<<<<<<<<<<
 *             CHKERR( ISRestoreIndices(self.iset, &self.data) )
 *             self.hasarray = 0
 */
    __pyx_v_self->size = 0;

    /* "PETSc/petscis.pxi":145
 *         if self.hasarray and self.iset != NULL:
 *             self.size = 0
 *             CHKERR( ISRestoreIndices(self.iset, &self.data) )             # <<<<<<<<<<<<<<
 *             self.hasarray = 0
 *             self.data = NULL
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISRestoreIndices(__pyx_v_self->iset, (&__pyx_v_self->data))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(4, 145, __pyx_L1_error)

    /* "PETSc/petscis.pxi":146
 *             self.size = 0
 *             CHKERR( ISRestoreIndices(self.iset, &self.data) )
 *             self.hasarray = 0             # <<<<<<<<<<<<<<
 *             self.data = NULL
 *         return 0
 */
    __pyx_v_self->hasarray = 0;

    /* "PETSc/petscis.pxi":147
 *             CHKERR( ISRestoreIndices(self.iset, &self.data) )
 *             self.hasarray = 0
 *             self.data = NULL             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_v_self->data = NULL;

    /* "PETSc/petscis.pxi":143
 * 
 *     cdef int release(self) except -1:
 *         if self.hasarray and self.iset != NULL:             # <<<<<<<<<<<<<<
 *             self.size = 0
 *             CHKERR( ISRestoreIndices(self.iset, &self.data) )
 */
  }

  /* "PETSc/petscis.pxi":148
 *             self.hasarray = 0
 *             self.data = NULL
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # buffer interface (PEP 3118)
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":142
 *         return 0
 * 
 *     cdef int release(self) except -1:             # <<<<<<<<<<<<<<
 *         if self.hasarray and self.iset != NULL:
 *             self.size = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.release", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":152
 *     # buffer interface (PEP 3118)
 * 
 *     cdef int acquirebuffer(self, Py_buffer *view, int flags) except -1:             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         PyPetscBuffer_FillInfo(view, <void*>self.data, self.size,
 */

static int __pyx_f_8petsc4py_5PETSc_10_IS_buffer_acquirebuffer(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("acquirebuffer", 0);

  /* "PETSc/petscis.pxi":153
 * 
 *     cdef int acquirebuffer(self, Py_buffer *view, int flags) except -1:
 *         self.acquire()             # <<<<<<<<<<<<<<
 *         PyPetscBuffer_FillInfo(view, <void*>self.data, self.size,
 *                                c'i', 1, flags)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self->__pyx_vtab)->acquire(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(4, 153, __pyx_L1_error)

  /* "PETSc/petscis.pxi":154
 *     cdef int acquirebuffer(self, Py_buffer *view, int flags) except -1:
 *         self.acquire()
 *         PyPetscBuffer_FillInfo(view, <void*>self.data, self.size,             # <<<<<<<<<<<<<<
 *                                c'i', 1, flags)
 *         view.obj = self
 */
  __pyx_t_1 = PyPetscBuffer_FillInfo(__pyx_v_view, ((void *)__pyx_v_self->data), __pyx_v_self->size, 'i', 1, __pyx_v_flags); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(4, 154, __pyx_L1_error)

  /* "PETSc/petscis.pxi":156
 *         PyPetscBuffer_FillInfo(view, <void*>self.data, self.size,
 *                                c'i', 1, flags)
 *         view.obj = self             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_view->obj);
  __Pyx_DECREF(__pyx_v_view->obj);
  __pyx_v_view->obj = ((PyObject *)__pyx_v_self);

  /* "PETSc/petscis.pxi":157
 *                                c'i', 1, flags)
 *         view.obj = self
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int releasebuffer(self, Py_buffer *view) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":152
 *     # buffer interface (PEP 3118)
 * 
 *     cdef int acquirebuffer(self, Py_buffer *view, int flags) except -1:             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         PyPetscBuffer_FillInfo(view, <void*>self.data, self.size,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.acquirebuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":159
 *         return 0
 * 
 *     cdef int releasebuffer(self, Py_buffer *view) except -1:             # <<<<<<<<<<<<<<
 *         PyPetscBuffer_Release(view)
 *         self.release()
 */

static int __pyx_f_8petsc4py_5PETSc_10_IS_buffer_releasebuffer(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, Py_buffer *__pyx_v_view) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("releasebuffer", 0);

  /* "PETSc/petscis.pxi":160
 * 
 *     cdef int releasebuffer(self, Py_buffer *view) except -1:
 *         PyPetscBuffer_Release(view)             # <<<<<<<<<<<<<<
 *         self.release()
 *         return 0
 */
  PyPetscBuffer_Release(__pyx_v_view);

  /* "PETSc/petscis.pxi":161
 *     cdef int releasebuffer(self, Py_buffer *view) except -1:
 *         PyPetscBuffer_Release(view)
 *         self.release()             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self->__pyx_vtab)->release(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(4, 161, __pyx_L1_error)

  /* "PETSc/petscis.pxi":162
 *         PyPetscBuffer_Release(view)
 *         self.release()
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":159
 *         return 0
 * 
 *     cdef int releasebuffer(self, Py_buffer *view) except -1:             # <<<<<<<<<<<<<<
 *         PyPetscBuffer_Release(view)
 *         self.release()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.releasebuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":164
 *         return 0
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):             # <<<<<<<<<<<<<<
 *         self.acquirebuffer(view, flags)
 * 
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_5__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_5__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_4__getbuffer__(((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self), ((Py_buffer *)__pyx_v_view), ((int)__pyx_v_flags));

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

static int __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_4__getbuffer__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_view != NULL) {
    __pyx_v_view->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_view->obj);
  }

  /* "PETSc/petscis.pxi":165
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):
 *         self.acquirebuffer(view, flags)             # <<<<<<<<<<<<<<
 * 
 *     def __releasebuffer__(self, Py_buffer *view):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self->__pyx_vtab)->acquirebuffer(__pyx_v_self, __pyx_v_view, __pyx_v_flags); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(4, 165, __pyx_L1_error)

  /* "PETSc/petscis.pxi":164
 *         return 0
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):             # <<<<<<<<<<<<<<
 *         self.acquirebuffer(view, flags)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_view != NULL && __pyx_v_view->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_view->obj);
    __Pyx_DECREF(__pyx_v_view->obj); __pyx_v_view->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_view != NULL && __pyx_v_view->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_view->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":167
 *         self.acquirebuffer(view, flags)
 * 
 *     def __releasebuffer__(self, Py_buffer *view):             # <<<<<<<<<<<<<<
 *         self.releasebuffer(view)
 * 
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_7__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view); /*proto*/
static CYTHON_UNUSED void __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_7__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_6__releasebuffer__(((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self), ((Py_buffer *)__pyx_v_view));

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

static void __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_6__releasebuffer__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, Py_buffer *__pyx_v_view) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "PETSc/petscis.pxi":168
 * 
 *     def __releasebuffer__(self, Py_buffer *view):
 *         self.releasebuffer(view)             # <<<<<<<<<<<<<<
 * 
 *     # 'with' statement (PEP 343)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self->__pyx_vtab)->releasebuffer(__pyx_v_self, __pyx_v_view); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(4, 168, __pyx_L1_error)

  /* "PETSc/petscis.pxi":167
 *         self.acquirebuffer(view, flags)
 * 
 *     def __releasebuffer__(self, Py_buffer *view):             # <<<<<<<<<<<<<<
 *         self.releasebuffer(view)
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("petsc4py.PETSc._IS_buffer.__releasebuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PETSc/petscis.pxi":172
 *     # 'with' statement (PEP 343)
 * 
 *     cdef object enter(self):             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         return asarray(self)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_10_IS_buffer_enter(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("enter", 0);

  /* "PETSc/petscis.pxi":173
 * 
 *     cdef object enter(self):
 *         self.acquire()             # <<<<<<<<<<<<<<
 *         return asarray(self)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self->__pyx_vtab)->acquire(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(4, 173, __pyx_L1_error)

  /* "PETSc/petscis.pxi":174
 *     cdef object enter(self):
 *         self.acquire()
 *         return asarray(self)             # <<<<<<<<<<<<<<
 * 
 *     cdef object exit(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_asarray(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":172
 *     # 'with' statement (PEP 343)
 * 
 *     cdef object enter(self):             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         return asarray(self)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.enter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":176
 *         return asarray(self)
 * 
 *     cdef object exit(self):             # <<<<<<<<<<<<<<
 *         self.release()
 *         return None
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_10_IS_buffer_exit(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("exit", 0);

  /* "PETSc/petscis.pxi":177
 * 
 *     cdef object exit(self):
 *         self.release()             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self->__pyx_vtab)->release(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(4, 177, __pyx_L1_error)

  /* "PETSc/petscis.pxi":178
 *     cdef object exit(self):
 *         self.release()
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":176
 *         return asarray(self)
 * 
 *     cdef object exit(self):             # <<<<<<<<<<<<<<
 *         self.release()
 *         return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.exit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":180
 *         return None
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self.enter()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_10_IS_buffer_9__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_10_IS_buffer_8__enter__[] = "_IS_buffer.__enter__(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_10_IS_buffer_9__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_8__enter__(((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_10_IS_buffer_8__enter__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "PETSc/petscis.pxi":181
 * 
 *     def __enter__(self):
 *         return self.enter()             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *exc):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self->__pyx_vtab)->enter(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":180
 *         return None
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self.enter()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":183
 *         return self.enter()
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         return self.exit()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_10_IS_buffer_11__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_10_IS_buffer_10__exit__[] = "_IS_buffer.__exit__(self, *exc)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_10_IS_buffer_11__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_exc = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_10__exit__(((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self), __pyx_v_exc);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_10_IS_buffer_10__exit__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "PETSc/petscis.pxi":184
 * 
 *     def __exit__(self, *exc):
 *         return self.exit()             # <<<<<<<<<<<<<<
 * 
 *     # buffer interface (legacy)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self->__pyx_vtab)->exit(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":183
 *         return self.enter()
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         return self.exit()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":188
 *     # buffer interface (legacy)
 * 
 *     cdef Py_ssize_t getbuffer(self, void **p) except -1:             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         if p != NULL:
 */

static Py_ssize_t __pyx_f_8petsc4py_5PETSc_10_IS_buffer_getbuffer(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, void **__pyx_v_p) {
  PetscInt __pyx_v_n;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscInt __pyx_t_3;
  __Pyx_RefNannySetupContext("getbuffer", 0);

  /* "PETSc/petscis.pxi":189
 * 
 *     cdef Py_ssize_t getbuffer(self, void **p) except -1:
 *         cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *         if p != NULL:
 *             self.acquire()
 */
  __pyx_v_n = 0;

  /* "PETSc/petscis.pxi":190
 *     cdef Py_ssize_t getbuffer(self, void **p) except -1:
 *         cdef PetscInt n = 0
 *         if p != NULL:             # <<<<<<<<<<<<<<
 *             self.acquire()
 *             p[0] = <void*>self.data
 */
  __pyx_t_1 = ((__pyx_v_p != NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscis.pxi":191
 *         cdef PetscInt n = 0
 *         if p != NULL:
 *             self.acquire()             # <<<<<<<<<<<<<<
 *             p[0] = <void*>self.data
 *             n = self.size
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self->__pyx_vtab)->acquire(__pyx_v_self); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(4, 191, __pyx_L1_error)

    /* "PETSc/petscis.pxi":192
 *         if p != NULL:
 *             self.acquire()
 *             p[0] = <void*>self.data             # <<<<<<<<<<<<<<
 *             n = self.size
 *         elif self.iset != NULL:
 */
    (__pyx_v_p[0]) = ((void *)__pyx_v_self->data);

    /* "PETSc/petscis.pxi":193
 *             self.acquire()
 *             p[0] = <void*>self.data
 *             n = self.size             # <<<<<<<<<<<<<<
 *         elif self.iset != NULL:
 *             CHKERR( ISGetLocalSize(self.iset, &n) )
 */
    __pyx_t_3 = __pyx_v_self->size;
    __pyx_v_n = __pyx_t_3;

    /* "PETSc/petscis.pxi":190
 *     cdef Py_ssize_t getbuffer(self, void **p) except -1:
 *         cdef PetscInt n = 0
 *         if p != NULL:             # <<<<<<<<<<<<<<
 *             self.acquire()
 *             p[0] = <void*>self.data
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscis.pxi":194
 *             p[0] = <void*>self.data
 *             n = self.size
 *         elif self.iset != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( ISGetLocalSize(self.iset, &n) )
 *         return <Py_ssize_t>(<size_t>n*sizeof(PetscInt))
 */
  __pyx_t_1 = ((__pyx_v_self->iset != NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscis.pxi":195
 *             n = self.size
 *         elif self.iset != NULL:
 *             CHKERR( ISGetLocalSize(self.iset, &n) )             # <<<<<<<<<<<<<<
 *         return <Py_ssize_t>(<size_t>n*sizeof(PetscInt))
 * 
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetLocalSize(__pyx_v_self->iset, (&__pyx_v_n))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(4, 195, __pyx_L1_error)

    /* "PETSc/petscis.pxi":194
 *             p[0] = <void*>self.data
 *             n = self.size
 *         elif self.iset != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( ISGetLocalSize(self.iset, &n) )
 *         return <Py_ssize_t>(<size_t>n*sizeof(PetscInt))
 */
  }
  __pyx_L3:;

  /* "PETSc/petscis.pxi":196
 *         elif self.iset != NULL:
 *             CHKERR( ISGetLocalSize(self.iset, &n) )
 *         return <Py_ssize_t>(<size_t>n*sizeof(PetscInt))             # <<<<<<<<<<<<<<
 * 
 *     def __getsegcount__(self, Py_ssize_t *lenp):
 */
  __pyx_r = ((Py_ssize_t)(((size_t)__pyx_v_n) * (sizeof(PetscInt))));
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":188
 *     # buffer interface (legacy)
 * 
 *     cdef Py_ssize_t getbuffer(self, void **p) except -1:             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         if p != NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.getbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1L;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscis.pxi":198
 *         return <Py_ssize_t>(<size_t>n*sizeof(PetscInt))
 * 
 *     def __getsegcount__(self, Py_ssize_t *lenp):             # <<<<<<<<<<<<<<
 *         if lenp != NULL:
 *             lenp[0] = self.getbuffer(NULL)
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_13__getsegcount__(PyObject *__pyx_v_self, Py_ssize_t *__pyx_v_lenp); /*proto*/
static Py_ssize_t __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_13__getsegcount__(PyObject *__pyx_v_self, Py_ssize_t *__pyx_v_lenp) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getsegcount__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_12__getsegcount__(((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self), ((Py_ssize_t *)__pyx_v_lenp));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_12__getsegcount__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, Py_ssize_t *__pyx_v_lenp) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  __Pyx_RefNannySetupContext("__getsegcount__", 0);

  /* "PETSc/petscis.pxi":199
 * 
 *     def __getsegcount__(self, Py_ssize_t *lenp):
 *         if lenp != NULL:             # <<<<<<<<<<<<<<
 *             lenp[0] = self.getbuffer(NULL)
 *         return 1
 */
  __pyx_t_1 = ((__pyx_v_lenp != NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscis.pxi":200
 *     def __getsegcount__(self, Py_ssize_t *lenp):
 *         if lenp != NULL:
 *             lenp[0] = self.getbuffer(NULL)             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self->__pyx_vtab)->getbuffer(__pyx_v_self, NULL); if (unlikely(__pyx_t_2 == -1L)) __PYX_ERR(4, 200, __pyx_L1_error)
    (__pyx_v_lenp[0]) = __pyx_t_2;

    /* "PETSc/petscis.pxi":199
 * 
 *     def __getsegcount__(self, Py_ssize_t *lenp):
 *         if lenp != NULL:             # <<<<<<<<<<<<<<
 *             lenp[0] = self.getbuffer(NULL)
 *         return 1
 */
  }

  /* "PETSc/petscis.pxi":201
 *         if lenp != NULL:
 *             lenp[0] = self.getbuffer(NULL)
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     def __getreadbuffer__(self, Py_ssize_t idx, void **p):
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":198
 *         return <Py_ssize_t>(<size_t>n*sizeof(PetscInt))
 * 
 *     def __getsegcount__(self, Py_ssize_t *lenp):             # <<<<<<<<<<<<<<
 *         if lenp != NULL:
 *             lenp[0] = self.getbuffer(NULL)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.__getsegcount__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "PETSc/petscis.pxi":203
 *         return 1
 * 
 *     def __getreadbuffer__(self, Py_ssize_t idx, void **p):             # <<<<<<<<<<<<<<
 *         if idx != 0: raise SystemError(
 *             "accessing non-existent buffer segment")
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_15__getreadbuffer__(PyObject *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p); /*proto*/
static Py_ssize_t __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_15__getreadbuffer__(PyObject *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getreadbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_14__getreadbuffer__(((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self), ((Py_ssize_t)__pyx_v_idx), ((void **)__pyx_v_p));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_14__getreadbuffer__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  __Pyx_RefNannySetupContext("__getreadbuffer__", 0);

  /* "PETSc/petscis.pxi":204
 * 
 *     def __getreadbuffer__(self, Py_ssize_t idx, void **p):
 *         if idx != 0: raise SystemError(             # <<<<<<<<<<<<<<
 *             "accessing non-existent buffer segment")
 *         return self.getbuffer(p)
 */
  __pyx_t_1 = ((__pyx_v_idx != 0) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_SystemError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 204, __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(4, 204, __pyx_L1_error)
  }

  /* "PETSc/petscis.pxi":206
 *         if idx != 0: raise SystemError(
 *             "accessing non-existent buffer segment")
 *         return self.getbuffer(p)             # <<<<<<<<<<<<<<
 * 
 *     # NumPy array interface (legacy)
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self->__pyx_vtab)->getbuffer(__pyx_v_self, __pyx_v_p); if (unlikely(__pyx_t_3 == -1L)) __PYX_ERR(4, 206, __pyx_L1_error)
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":203
 *         return 1
 * 
 *     def __getreadbuffer__(self, Py_ssize_t idx, void **p):             # <<<<<<<<<<<<<<
 *         if idx != 0: raise SystemError(
 *             "accessing non-existent buffer segment")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.__getreadbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "PETSc/petscis.pxi":211
 * 
 *     property __array_interface__:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef PetscInt n = 0
 *             if self.iset != NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_10_IS_buffer_19__array_interface___1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_10_IS_buffer_19__array_interface___1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10_IS_buffer_19__array_interface_____get__(((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_10_IS_buffer_19__array_interface_____get__(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_self) {
  PetscInt __pyx_v_n;
  PyObject *__pyx_v_size = 0;
  PyArray_Descr *__pyx_v_descr = 0;
  PyObject *__pyx_v_typestr = 0;
  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;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/petscis.pxi":212
 *     property __array_interface__:
 *         def __get__(self):
 *             cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *             if self.iset != NULL:
 *                 CHKERR( ISGetLocalSize(self.iset, &n) )
 */
  __pyx_v_n = 0;

  /* "PETSc/petscis.pxi":213
 *         def __get__(self):
 *             cdef PetscInt n = 0
 *             if self.iset != NULL:             # <<<<<<<<<<<<<<
 *                 CHKERR( ISGetLocalSize(self.iset, &n) )
 *             cdef object size = toInt(n)
 */
  __pyx_t_1 = ((__pyx_v_self->iset != NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscis.pxi":214
 *             cdef PetscInt n = 0
 *             if self.iset != NULL:
 *                 CHKERR( ISGetLocalSize(self.iset, &n) )             # <<<<<<<<<<<<<<
 *             cdef object size = toInt(n)
 *             cdef dtype descr = PyArray_DescrFromType(NPY_PETSC_INT)
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetLocalSize(__pyx_v_self->iset, (&__pyx_v_n))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(4, 214, __pyx_L1_error)

    /* "PETSc/petscis.pxi":213
 *         def __get__(self):
 *             cdef PetscInt n = 0
 *             if self.iset != NULL:             # <<<<<<<<<<<<<<
 *                 CHKERR( ISGetLocalSize(self.iset, &n) )
 *             cdef object size = toInt(n)
 */
  }

  /* "PETSc/petscis.pxi":215
 *             if self.iset != NULL:
 *                 CHKERR( ISGetLocalSize(self.iset, &n) )
 *             cdef object size = toInt(n)             # <<<<<<<<<<<<<<
 *             cdef dtype descr = PyArray_DescrFromType(NPY_PETSC_INT)
 *             cdef str typestr = "=%c%d" % (descr.kind, descr.itemsize)
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_size = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/petscis.pxi":216
 *                 CHKERR( ISGetLocalSize(self.iset, &n) )
 *             cdef object size = toInt(n)
 *             cdef dtype descr = PyArray_DescrFromType(NPY_PETSC_INT)             # <<<<<<<<<<<<<<
 *             cdef str typestr = "=%c%d" % (descr.kind, descr.itemsize)
 *             return dict(version=3,
 */
  __pyx_t_3 = ((PyObject *)PyArray_DescrFromType(NPY_PETSC_INT)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscis.pxi":217
 *             cdef object size = toInt(n)
 *             cdef dtype descr = PyArray_DescrFromType(NPY_PETSC_INT)
 *             cdef str typestr = "=%c%d" % (descr.kind, descr.itemsize)             # <<<<<<<<<<<<<<
 *             return dict(version=3,
 *                         data=self,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_descr), __pyx_n_s_kind); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_descr), __pyx_n_s_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 217, __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_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_c_d, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_4))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(4, 217, __pyx_L1_error)
  __pyx_v_typestr = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/petscis.pxi":218
 *             cdef dtype descr = PyArray_DescrFromType(NPY_PETSC_INT)
 *             cdef str typestr = "=%c%d" % (descr.kind, descr.itemsize)
 *             return dict(version=3,             # <<<<<<<<<<<<<<
 *                         data=self,
 *                         shape=(size,),
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_version, __pyx_int_3) < 0) __PYX_ERR(4, 218, __pyx_L1_error)

  /* "PETSc/petscis.pxi":219
 *             cdef str typestr = "=%c%d" % (descr.kind, descr.itemsize)
 *             return dict(version=3,
 *                         data=self,             # <<<<<<<<<<<<<<
 *                         shape=(size,),
 *                         typestr=typestr)
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_data, ((PyObject *)__pyx_v_self)) < 0) __PYX_ERR(4, 218, __pyx_L1_error)

  /* "PETSc/petscis.pxi":220
 *             return dict(version=3,
 *                         data=self,
 *                         shape=(size,),             # <<<<<<<<<<<<<<
 *                         typestr=typestr)
 * 
 */
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_size);
  __Pyx_GIVEREF(__pyx_v_size);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_size);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_shape, __pyx_t_5) < 0) __PYX_ERR(4, 218, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/petscis.pxi":221
 *                         data=self,
 *                         shape=(size,),
 *                         typestr=typestr)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_typestr, __pyx_v_typestr) < 0) __PYX_ERR(4, 218, __pyx_L1_error)
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/petscis.pxi":211
 * 
 *     property __array_interface__:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef PetscInt n = 0
 *             if self.iset != NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc._IS_buffer.__array_interface__.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_size);
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_XDECREF(__pyx_v_typestr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":166
 * # --------------------------------------------------------------------
 * 
 * cdef inline Vec ref_Vec(PetscVec vec):             # <<<<<<<<<<<<<<
 *     cdef Vec ob = <Vec> Vec()
 *     ob.vec = vec
 */

static CYTHON_INLINE struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_ref_Vec(Vec __pyx_v_vec) {
  struct PyPetscVecObject *__pyx_v_ob = 0;
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ref_Vec", 0);

  /* "PETSc/petscvec.pxi":167
 * 
 * cdef inline Vec ref_Vec(PetscVec vec):
 *     cdef Vec ob = <Vec> Vec()             # <<<<<<<<<<<<<<
 *     ob.vec = vec
 *     PetscINCREF(ob.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ob = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscvec.pxi":168
 * cdef inline Vec ref_Vec(PetscVec vec):
 *     cdef Vec ob = <Vec> Vec()
 *     ob.vec = vec             # <<<<<<<<<<<<<<
 *     PetscINCREF(ob.obj)
 *     return ob
 */
  __pyx_v_ob->vec = __pyx_v_vec;

  /* "PETSc/petscvec.pxi":169
 *     cdef Vec ob = <Vec> Vec()
 *     ob.vec = vec
 *     PetscINCREF(ob.obj)             # <<<<<<<<<<<<<<
 *     return ob
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ob->__pyx_base.obj);

  /* "PETSc/petscvec.pxi":170
 *     ob.vec = vec
 *     PetscINCREF(ob.obj)
 *     return ob             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ob));
  __pyx_r = __pyx_v_ob;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":166
 * # --------------------------------------------------------------------
 * 
 * cdef inline Vec ref_Vec(PetscVec vec):             # <<<<<<<<<<<<<<
 *     cdef Vec ob = <Vec> Vec()
 *     ob.vec = vec
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.ref_Vec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":176
 * # unary operations
 * 
 * cdef Vec vec_pos(Vec self):             # <<<<<<<<<<<<<<
 *     cdef Vec vec = type(self)()
 *     CHKERR( VecDuplicate(self.vec, &vec.vec) )
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_pos(struct PyPetscVecObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("vec_pos", 0);

  /* "PETSc/petscvec.pxi":177
 * 
 * cdef Vec vec_pos(Vec self):
 *     cdef Vec vec = type(self)()             # <<<<<<<<<<<<<<
 *     CHKERR( VecDuplicate(self.vec, &vec.vec) )
 *     CHKERR( VecCopy(self.vec, vec.vec) )
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __pyx_t_2 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 177, __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(5, 177, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(5, 177, __pyx_L1_error)
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscvec.pxi":178
 * cdef Vec vec_pos(Vec self):
 *     cdef Vec vec = type(self)()
 *     CHKERR( VecDuplicate(self.vec, &vec.vec) )             # <<<<<<<<<<<<<<
 *     CHKERR( VecCopy(self.vec, vec.vec) )
 *     return vec
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecDuplicate(__pyx_v_self->vec, (&__pyx_v_vec->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 178, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":179
 *     cdef Vec vec = type(self)()
 *     CHKERR( VecDuplicate(self.vec, &vec.vec) )
 *     CHKERR( VecCopy(self.vec, vec.vec) )             # <<<<<<<<<<<<<<
 *     return vec
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCopy(__pyx_v_self->vec, __pyx_v_vec->vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 179, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":180
 *     CHKERR( VecDuplicate(self.vec, &vec.vec) )
 *     CHKERR( VecCopy(self.vec, vec.vec) )
 *     return vec             # <<<<<<<<<<<<<<
 * 
 * cdef Vec vec_neg(Vec self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = __pyx_v_vec;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":176
 * # unary operations
 * 
 * cdef Vec vec_pos(Vec self):             # <<<<<<<<<<<<<<
 *     cdef Vec vec = type(self)()
 *     CHKERR( VecDuplicate(self.vec, &vec.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":182
 *     return vec
 * 
 * cdef Vec vec_neg(Vec self):             # <<<<<<<<<<<<<<
 *     cdef Vec vec = <Vec> vec_pos(self)
 *     CHKERR( VecScale(vec.vec, -1) )
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_neg(struct PyPetscVecObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("vec_neg", 0);

  /* "PETSc/petscvec.pxi":183
 * 
 * cdef Vec vec_neg(Vec self):
 *     cdef Vec vec = <Vec> vec_pos(self)             # <<<<<<<<<<<<<<
 *     CHKERR( VecScale(vec.vec, -1) )
 *     return vec
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_pos(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscvec.pxi":184
 * cdef Vec vec_neg(Vec self):
 *     cdef Vec vec = <Vec> vec_pos(self)
 *     CHKERR( VecScale(vec.vec, -1) )             # <<<<<<<<<<<<<<
 *     return vec
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScale(__pyx_v_vec->vec, -1.0)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(5, 184, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":185
 *     cdef Vec vec = <Vec> vec_pos(self)
 *     CHKERR( VecScale(vec.vec, -1) )
 *     return vec             # <<<<<<<<<<<<<<
 * 
 * cdef Vec vec_abs(Vec self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = __pyx_v_vec;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":182
 *     return vec
 * 
 * cdef Vec vec_neg(Vec self):             # <<<<<<<<<<<<<<
 *     cdef Vec vec = <Vec> vec_pos(self)
 *     CHKERR( VecScale(vec.vec, -1) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_neg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":187
 *     return vec
 * 
 * cdef Vec vec_abs(Vec self):             # <<<<<<<<<<<<<<
 *     cdef Vec vec = <Vec> vec_pos(self)
 *     CHKERR( VecAbs(vec.vec) )
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_abs(struct PyPetscVecObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("vec_abs", 0);

  /* "PETSc/petscvec.pxi":188
 * 
 * cdef Vec vec_abs(Vec self):
 *     cdef Vec vec = <Vec> vec_pos(self)             # <<<<<<<<<<<<<<
 *     CHKERR( VecAbs(vec.vec) )
 *     return vec
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_pos(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscvec.pxi":189
 * cdef Vec vec_abs(Vec self):
 *     cdef Vec vec = <Vec> vec_pos(self)
 *     CHKERR( VecAbs(vec.vec) )             # <<<<<<<<<<<<<<
 *     return vec
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAbs(__pyx_v_vec->vec)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(5, 189, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":190
 *     cdef Vec vec = <Vec> vec_pos(self)
 *     CHKERR( VecAbs(vec.vec) )
 *     return vec             # <<<<<<<<<<<<<<
 * 
 * # inplace binary operations
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = __pyx_v_vec;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":187
 *     return vec
 * 
 * cdef Vec vec_abs(Vec self):             # <<<<<<<<<<<<<<
 *     cdef Vec vec = <Vec> vec_pos(self)
 *     CHKERR( VecAbs(vec.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_abs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":194
 * # inplace binary operations
 * 
 * cdef Vec vec_iadd(Vec self, other):             # <<<<<<<<<<<<<<
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_iadd(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PetscScalar __pyx_v_alpha;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  struct PyPetscVecObject *__pyx_r = NULL;
  __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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PetscScalar __pyx_t_9;
  __Pyx_RefNannySetupContext("vec_iadd", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "PETSc/petscvec.pxi":195
 * 
 * cdef Vec vec_iadd(Vec self, other):
 *     cdef PetscScalar alpha = 1             # <<<<<<<<<<<<<<
 *     cdef Vec vec
 *     if isinstance(other, Vec):
 */
  __pyx_v_alpha = 1.0;

  /* "PETSc/petscvec.pxi":197
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 *     if isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *         alpha = 1; vec = other
 *         CHKERR( VecAXPY(self.vec, alpha, vec.vec) )
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscvec.pxi":198
 *     cdef Vec vec
 *     if isinstance(other, Vec):
 *         alpha = 1; vec = other             # <<<<<<<<<<<<<<
 *         CHKERR( VecAXPY(self.vec, alpha, vec.vec) )
 *     elif isinstance(other, tuple) or isinstance(other, list):
 */
    __pyx_v_alpha = 1.0;
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(5, 198, __pyx_L1_error)
    __pyx_t_3 = __pyx_v_other;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/petscvec.pxi":199
 *     if isinstance(other, Vec):
 *         alpha = 1; vec = other
 *         CHKERR( VecAXPY(self.vec, alpha, vec.vec) )             # <<<<<<<<<<<<<<
 *     elif isinstance(other, tuple) or isinstance(other, list):
 *         other, vec = other
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAXPY(__pyx_v_self->vec, __pyx_v_alpha, __pyx_v_vec->vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 199, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":197
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 *     if isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *         alpha = 1; vec = other
 *         CHKERR( VecAXPY(self.vec, alpha, vec.vec) )
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscvec.pxi":200
 *         alpha = 1; vec = other
 *         CHKERR( VecAXPY(self.vec, alpha, vec.vec) )
 *     elif isinstance(other, tuple) or isinstance(other, list):             # <<<<<<<<<<<<<<
 *         other, vec = other
 *         alpha = asScalar(other)
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_other); 
  __pyx_t_5 = (__pyx_t_1 != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_2 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = PyList_Check(__pyx_v_other); 
  __pyx_t_1 = (__pyx_t_5 != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PETSc/petscvec.pxi":201
 *         CHKERR( VecAXPY(self.vec, alpha, vec.vec) )
 *     elif isinstance(other, tuple) or isinstance(other, list):
 *         other, vec = other             # <<<<<<<<<<<<<<
 *         alpha = asScalar(other)
 *         CHKERR( VecAXPY(self.vec, alpha, vec.vec) )
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_other))) || (PyList_CheckExact(__pyx_v_other))) {
      PyObject* sequence = __pyx_v_other;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(5, 201, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(5, 201, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(5, 201, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(5, 201, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "PETSc/petscvec.pxi":202
 *     elif isinstance(other, tuple) or isinstance(other, list):
 *         other, vec = other
 *         alpha = asScalar(other)             # <<<<<<<<<<<<<<
 *         CHKERR( VecAXPY(self.vec, alpha, vec.vec) )
 *     else:
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_other); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 202, __pyx_L1_error)
    __pyx_v_alpha = __pyx_t_9;

    /* "PETSc/petscvec.pxi":203
 *         other, vec = other
 *         alpha = asScalar(other)
 *         CHKERR( VecAXPY(self.vec, alpha, vec.vec) )             # <<<<<<<<<<<<<<
 *     else:
 *         alpha = asScalar(other)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAXPY(__pyx_v_self->vec, __pyx_v_alpha, __pyx_v_vec->vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 203, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":200
 *         alpha = 1; vec = other
 *         CHKERR( VecAXPY(self.vec, alpha, vec.vec) )
 *     elif isinstance(other, tuple) or isinstance(other, list):             # <<<<<<<<<<<<<<
 *         other, vec = other
 *         alpha = asScalar(other)
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscvec.pxi":205
 *         CHKERR( VecAXPY(self.vec, alpha, vec.vec) )
 *     else:
 *         alpha = asScalar(other)             # <<<<<<<<<<<<<<
 *         CHKERR( VecShift(self.vec, alpha) )
 *     return self
 */
  /*else*/ {
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_other); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 205, __pyx_L1_error)
    __pyx_v_alpha = __pyx_t_9;

    /* "PETSc/petscvec.pxi":206
 *     else:
 *         alpha = asScalar(other)
 *         CHKERR( VecShift(self.vec, alpha) )             # <<<<<<<<<<<<<<
 *     return self
 * 
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecShift(__pyx_v_self->vec, __pyx_v_alpha)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 206, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/petscvec.pxi":207
 *         alpha = asScalar(other)
 *         CHKERR( VecShift(self.vec, alpha) )
 *     return self             # <<<<<<<<<<<<<<
 * 
 * cdef Vec vec_isub(Vec self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":194
 * # inplace binary operations
 * 
 * cdef Vec vec_iadd(Vec self, other):             # <<<<<<<<<<<<<<
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_iadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":209
 *     return self
 * 
 * cdef Vec vec_isub(Vec self, other):             # <<<<<<<<<<<<<<
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_isub(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PetscScalar __pyx_v_alpha;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  struct PyPetscVecObject *__pyx_r = NULL;
  __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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PetscScalar __pyx_t_9;
  __Pyx_RefNannySetupContext("vec_isub", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "PETSc/petscvec.pxi":210
 * 
 * cdef Vec vec_isub(Vec self, other):
 *     cdef PetscScalar alpha = 1             # <<<<<<<<<<<<<<
 *     cdef Vec vec
 *     if isinstance(other, Vec):
 */
  __pyx_v_alpha = 1.0;

  /* "PETSc/petscvec.pxi":212
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 *     if isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *         alpha = 1; vec = other
 *         CHKERR( VecAXPY(self.vec, -alpha, vec.vec) )
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscvec.pxi":213
 *     cdef Vec vec
 *     if isinstance(other, Vec):
 *         alpha = 1; vec = other             # <<<<<<<<<<<<<<
 *         CHKERR( VecAXPY(self.vec, -alpha, vec.vec) )
 *     elif isinstance(other, tuple) or isinstance(other, list):
 */
    __pyx_v_alpha = 1.0;
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(5, 213, __pyx_L1_error)
    __pyx_t_3 = __pyx_v_other;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/petscvec.pxi":214
 *     if isinstance(other, Vec):
 *         alpha = 1; vec = other
 *         CHKERR( VecAXPY(self.vec, -alpha, vec.vec) )             # <<<<<<<<<<<<<<
 *     elif isinstance(other, tuple) or isinstance(other, list):
 *         other, vec = other
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAXPY(__pyx_v_self->vec, (-__pyx_v_alpha), __pyx_v_vec->vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 214, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":212
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 *     if isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *         alpha = 1; vec = other
 *         CHKERR( VecAXPY(self.vec, -alpha, vec.vec) )
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscvec.pxi":215
 *         alpha = 1; vec = other
 *         CHKERR( VecAXPY(self.vec, -alpha, vec.vec) )
 *     elif isinstance(other, tuple) or isinstance(other, list):             # <<<<<<<<<<<<<<
 *         other, vec = other
 *         alpha = asScalar(other)
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_other); 
  __pyx_t_5 = (__pyx_t_1 != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_2 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = PyList_Check(__pyx_v_other); 
  __pyx_t_1 = (__pyx_t_5 != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PETSc/petscvec.pxi":216
 *         CHKERR( VecAXPY(self.vec, -alpha, vec.vec) )
 *     elif isinstance(other, tuple) or isinstance(other, list):
 *         other, vec = other             # <<<<<<<<<<<<<<
 *         alpha = asScalar(other)
 *         CHKERR( VecAXPY(self.vec, -alpha, vec.vec) )
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_other))) || (PyList_CheckExact(__pyx_v_other))) {
      PyObject* sequence = __pyx_v_other;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(5, 216, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 216, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 216, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 216, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(5, 216, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(5, 216, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(5, 216, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "PETSc/petscvec.pxi":217
 *     elif isinstance(other, tuple) or isinstance(other, list):
 *         other, vec = other
 *         alpha = asScalar(other)             # <<<<<<<<<<<<<<
 *         CHKERR( VecAXPY(self.vec, -alpha, vec.vec) )
 *     else:
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_other); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 217, __pyx_L1_error)
    __pyx_v_alpha = __pyx_t_9;

    /* "PETSc/petscvec.pxi":218
 *         other, vec = other
 *         alpha = asScalar(other)
 *         CHKERR( VecAXPY(self.vec, -alpha, vec.vec) )             # <<<<<<<<<<<<<<
 *     else:
 *         alpha = asScalar(other)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAXPY(__pyx_v_self->vec, (-__pyx_v_alpha), __pyx_v_vec->vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 218, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":215
 *         alpha = 1; vec = other
 *         CHKERR( VecAXPY(self.vec, -alpha, vec.vec) )
 *     elif isinstance(other, tuple) or isinstance(other, list):             # <<<<<<<<<<<<<<
 *         other, vec = other
 *         alpha = asScalar(other)
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscvec.pxi":220
 *         CHKERR( VecAXPY(self.vec, -alpha, vec.vec) )
 *     else:
 *         alpha = asScalar(other)             # <<<<<<<<<<<<<<
 *         CHKERR( VecShift(self.vec, -alpha) )
 *     return self
 */
  /*else*/ {
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_other); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 220, __pyx_L1_error)
    __pyx_v_alpha = __pyx_t_9;

    /* "PETSc/petscvec.pxi":221
 *     else:
 *         alpha = asScalar(other)
 *         CHKERR( VecShift(self.vec, -alpha) )             # <<<<<<<<<<<<<<
 *     return self
 * 
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecShift(__pyx_v_self->vec, (-__pyx_v_alpha))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 221, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/petscvec.pxi":222
 *         alpha = asScalar(other)
 *         CHKERR( VecShift(self.vec, -alpha) )
 *     return self             # <<<<<<<<<<<<<<
 * 
 * cdef Vec vec_imul(Vec self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":209
 *     return self
 * 
 * cdef Vec vec_isub(Vec self, other):             # <<<<<<<<<<<<<<
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_isub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":224
 *     return self
 * 
 * cdef Vec vec_imul(Vec self, other):             # <<<<<<<<<<<<<<
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_imul(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PetscScalar __pyx_v_alpha;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PetscScalar __pyx_t_5;
  __Pyx_RefNannySetupContext("vec_imul", 0);

  /* "PETSc/petscvec.pxi":225
 * 
 * cdef Vec vec_imul(Vec self, other):
 *     cdef PetscScalar alpha = 1             # <<<<<<<<<<<<<<
 *     cdef Vec vec
 *     if isinstance(other, Vec):
 */
  __pyx_v_alpha = 1.0;

  /* "PETSc/petscvec.pxi":227
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 *     if isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *         vec = other
 *         CHKERR( VecPointwiseMult(self.vec, self.vec, vec.vec) )
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscvec.pxi":228
 *     cdef Vec vec
 *     if isinstance(other, Vec):
 *         vec = other             # <<<<<<<<<<<<<<
 *         CHKERR( VecPointwiseMult(self.vec, self.vec, vec.vec) )
 *     else:
 */
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(5, 228, __pyx_L1_error)
    __pyx_t_3 = __pyx_v_other;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/petscvec.pxi":229
 *     if isinstance(other, Vec):
 *         vec = other
 *         CHKERR( VecPointwiseMult(self.vec, self.vec, vec.vec) )             # <<<<<<<<<<<<<<
 *     else:
 *         alpha = asScalar(other)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecPointwiseMult(__pyx_v_self->vec, __pyx_v_self->vec, __pyx_v_vec->vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 229, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":227
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 *     if isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *         vec = other
 *         CHKERR( VecPointwiseMult(self.vec, self.vec, vec.vec) )
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscvec.pxi":231
 *         CHKERR( VecPointwiseMult(self.vec, self.vec, vec.vec) )
 *     else:
 *         alpha = asScalar(other)             # <<<<<<<<<<<<<<
 *         CHKERR( VecScale(self.vec, alpha) )
 *     return self
 */
  /*else*/ {
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_other); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 231, __pyx_L1_error)
    __pyx_v_alpha = __pyx_t_5;

    /* "PETSc/petscvec.pxi":232
 *     else:
 *         alpha = asScalar(other)
 *         CHKERR( VecScale(self.vec, alpha) )             # <<<<<<<<<<<<<<
 *     return self
 * 
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScale(__pyx_v_self->vec, __pyx_v_alpha)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 232, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/petscvec.pxi":233
 *         alpha = asScalar(other)
 *         CHKERR( VecScale(self.vec, alpha) )
 *     return self             # <<<<<<<<<<<<<<
 * 
 * cdef Vec vec_idiv(Vec self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":224
 *     return self
 * 
 * cdef Vec vec_imul(Vec self, other):             # <<<<<<<<<<<<<<
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_imul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":235
 *     return self
 * 
 * cdef Vec vec_idiv(Vec self, other):             # <<<<<<<<<<<<<<
 *     cdef PetscScalar one = 1
 *     cdef PetscScalar alpha = 1
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_idiv(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PetscScalar __pyx_v_one;
  PetscScalar __pyx_v_alpha;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PetscScalar __pyx_t_5;
  __Pyx_RefNannySetupContext("vec_idiv", 0);

  /* "PETSc/petscvec.pxi":236
 * 
 * cdef Vec vec_idiv(Vec self, other):
 *     cdef PetscScalar one = 1             # <<<<<<<<<<<<<<
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 */
  __pyx_v_one = 1.0;

  /* "PETSc/petscvec.pxi":237
 * cdef Vec vec_idiv(Vec self, other):
 *     cdef PetscScalar one = 1
 *     cdef PetscScalar alpha = 1             # <<<<<<<<<<<<<<
 *     cdef Vec vec
 *     if isinstance(other, Vec):
 */
  __pyx_v_alpha = 1.0;

  /* "PETSc/petscvec.pxi":239
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 *     if isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *         vec = other
 *         CHKERR( VecPointwiseDivide(self.vec, self.vec, vec.vec) )
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscvec.pxi":240
 *     cdef Vec vec
 *     if isinstance(other, Vec):
 *         vec = other             # <<<<<<<<<<<<<<
 *         CHKERR( VecPointwiseDivide(self.vec, self.vec, vec.vec) )
 *     else:
 */
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(5, 240, __pyx_L1_error)
    __pyx_t_3 = __pyx_v_other;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/petscvec.pxi":241
 *     if isinstance(other, Vec):
 *         vec = other
 *         CHKERR( VecPointwiseDivide(self.vec, self.vec, vec.vec) )             # <<<<<<<<<<<<<<
 *     else:
 *         alpha = asScalar(other)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecPointwiseDivide(__pyx_v_self->vec, __pyx_v_self->vec, __pyx_v_vec->vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 241, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":239
 *     cdef PetscScalar alpha = 1
 *     cdef Vec vec
 *     if isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *         vec = other
 *         CHKERR( VecPointwiseDivide(self.vec, self.vec, vec.vec) )
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscvec.pxi":243
 *         CHKERR( VecPointwiseDivide(self.vec, self.vec, vec.vec) )
 *     else:
 *         alpha = asScalar(other)             # <<<<<<<<<<<<<<
 *         CHKERR( VecScale(self.vec, one/alpha) )
 *     return self
 */
  /*else*/ {
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_other); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 243, __pyx_L1_error)
    __pyx_v_alpha = __pyx_t_5;

    /* "PETSc/petscvec.pxi":244
 *     else:
 *         alpha = asScalar(other)
 *         CHKERR( VecScale(self.vec, one/alpha) )             # <<<<<<<<<<<<<<
 *     return self
 * 
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScale(__pyx_v_self->vec, (__pyx_v_one / __pyx_v_alpha))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 244, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/petscvec.pxi":245
 *         alpha = asScalar(other)
 *         CHKERR( VecScale(self.vec, one/alpha) )
 *     return self             # <<<<<<<<<<<<<<
 * 
 * # binary operations
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":235
 *     return self
 * 
 * cdef Vec vec_idiv(Vec self, other):             # <<<<<<<<<<<<<<
 *     cdef PetscScalar one = 1
 *     cdef PetscScalar alpha = 1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_idiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":249
 * # binary operations
 * 
 * cdef Vec vec_add(Vec self, other):             # <<<<<<<<<<<<<<
 *     return vec_iadd(vec_pos(self), other)
 * 
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_add(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("vec_add", 0);

  /* "PETSc/petscvec.pxi":250
 * 
 * cdef Vec vec_add(Vec self, other):
 *     return vec_iadd(vec_pos(self), other)             # <<<<<<<<<<<<<<
 * 
 * cdef Vec vec_sub(Vec self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_pos(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_iadd(((struct PyPetscVecObject *)__pyx_t_1), __pyx_v_other)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":249
 * # binary operations
 * 
 * cdef Vec vec_add(Vec self, other):             # <<<<<<<<<<<<<<
 *     return vec_iadd(vec_pos(self), other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":252
 *     return vec_iadd(vec_pos(self), other)
 * 
 * cdef Vec vec_sub(Vec self, other):             # <<<<<<<<<<<<<<
 *     return vec_isub(vec_pos(self), other)
 * 
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_sub(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("vec_sub", 0);

  /* "PETSc/petscvec.pxi":253
 * 
 * cdef Vec vec_sub(Vec self, other):
 *     return vec_isub(vec_pos(self), other)             # <<<<<<<<<<<<<<
 * 
 * cdef Vec vec_mul(Vec self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_pos(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_isub(((struct PyPetscVecObject *)__pyx_t_1), __pyx_v_other)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":252
 *     return vec_iadd(vec_pos(self), other)
 * 
 * cdef Vec vec_sub(Vec self, other):             # <<<<<<<<<<<<<<
 *     return vec_isub(vec_pos(self), other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_sub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":255
 *     return vec_isub(vec_pos(self), other)
 * 
 * cdef Vec vec_mul(Vec self, other):             # <<<<<<<<<<<<<<
 *     return vec_imul(vec_pos(self), other)
 * 
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_mul(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("vec_mul", 0);

  /* "PETSc/petscvec.pxi":256
 * 
 * cdef Vec vec_mul(Vec self, other):
 *     return vec_imul(vec_pos(self), other)             # <<<<<<<<<<<<<<
 * 
 * cdef Vec vec_div(Vec self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_pos(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_imul(((struct PyPetscVecObject *)__pyx_t_1), __pyx_v_other)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":255
 *     return vec_isub(vec_pos(self), other)
 * 
 * cdef Vec vec_mul(Vec self, other):             # <<<<<<<<<<<<<<
 *     return vec_imul(vec_pos(self), other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_mul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":258
 *     return vec_imul(vec_pos(self), other)
 * 
 * cdef Vec vec_div(Vec self, other):             # <<<<<<<<<<<<<<
 *     return vec_idiv(vec_pos(self), other)
 * 
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_div(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("vec_div", 0);

  /* "PETSc/petscvec.pxi":259
 * 
 * cdef Vec vec_div(Vec self, other):
 *     return vec_idiv(vec_pos(self), other)             # <<<<<<<<<<<<<<
 * 
 * # reflected binary operations
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_pos(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_idiv(((struct PyPetscVecObject *)__pyx_t_1), __pyx_v_other)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":258
 *     return vec_imul(vec_pos(self), other)
 * 
 * cdef Vec vec_div(Vec self, other):             # <<<<<<<<<<<<<<
 *     return vec_idiv(vec_pos(self), other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_div", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":263
 * # reflected binary operations
 * 
 * cdef Vec vec_radd(Vec self, other):             # <<<<<<<<<<<<<<
 *     return vec_add(self, other)
 * 
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_radd(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("vec_radd", 0);

  /* "PETSc/petscvec.pxi":264
 * 
 * cdef Vec vec_radd(Vec self, other):
 *     return vec_add(self, other)             # <<<<<<<<<<<<<<
 * 
 * cdef Vec vec_rsub(Vec self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_add(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":263
 * # reflected binary operations
 * 
 * cdef Vec vec_radd(Vec self, other):             # <<<<<<<<<<<<<<
 *     return vec_add(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_radd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":266
 *     return vec_add(self, other)
 * 
 * cdef Vec vec_rsub(Vec self, other):             # <<<<<<<<<<<<<<
 *     cdef Vec vec = <Vec> vec_sub(self, other)
 *     CHKERR( VecScale(vec.vec, -1) )
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_rsub(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("vec_rsub", 0);

  /* "PETSc/petscvec.pxi":267
 * 
 * cdef Vec vec_rsub(Vec self, other):
 *     cdef Vec vec = <Vec> vec_sub(self, other)             # <<<<<<<<<<<<<<
 *     CHKERR( VecScale(vec.vec, -1) )
 *     return vec
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_sub(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscvec.pxi":268
 * cdef Vec vec_rsub(Vec self, other):
 *     cdef Vec vec = <Vec> vec_sub(self, other)
 *     CHKERR( VecScale(vec.vec, -1) )             # <<<<<<<<<<<<<<
 *     return vec
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScale(__pyx_v_vec->vec, -1.0)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(5, 268, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":269
 *     cdef Vec vec = <Vec> vec_sub(self, other)
 *     CHKERR( VecScale(vec.vec, -1) )
 *     return vec             # <<<<<<<<<<<<<<
 * 
 * cdef Vec vec_rmul(Vec self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = __pyx_v_vec;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":266
 *     return vec_add(self, other)
 * 
 * cdef Vec vec_rsub(Vec self, other):             # <<<<<<<<<<<<<<
 *     cdef Vec vec = <Vec> vec_sub(self, other)
 *     CHKERR( VecScale(vec.vec, -1) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_rsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":271
 *     return vec
 * 
 * cdef Vec vec_rmul(Vec self, other):             # <<<<<<<<<<<<<<
 *     return vec_mul(self, other)
 * 
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_rmul(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("vec_rmul", 0);

  /* "PETSc/petscvec.pxi":272
 * 
 * cdef Vec vec_rmul(Vec self, other):
 *     return vec_mul(self, other)             # <<<<<<<<<<<<<<
 * 
 * cdef Vec vec_rdiv(Vec self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_mul(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":271
 *     return vec
 * 
 * cdef Vec vec_rmul(Vec self, other):             # <<<<<<<<<<<<<<
 *     return vec_mul(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_rmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":274
 *     return vec_mul(self, other)
 * 
 * cdef Vec vec_rdiv(Vec self, other):             # <<<<<<<<<<<<<<
 *     cdef Vec vec = <Vec> vec_div(self, other)
 *     CHKERR( VecReciprocal(vec.vec) )
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_vec_rdiv(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  struct PyPetscVecObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("vec_rdiv", 0);

  /* "PETSc/petscvec.pxi":275
 * 
 * cdef Vec vec_rdiv(Vec self, other):
 *     cdef Vec vec = <Vec> vec_div(self, other)             # <<<<<<<<<<<<<<
 *     CHKERR( VecReciprocal(vec.vec) )
 *     return vec
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_div(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscvec.pxi":276
 * cdef Vec vec_rdiv(Vec self, other):
 *     cdef Vec vec = <Vec> vec_div(self, other)
 *     CHKERR( VecReciprocal(vec.vec) )             # <<<<<<<<<<<<<<
 *     return vec
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecReciprocal(__pyx_v_vec->vec)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(5, 276, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":277
 *     cdef Vec vec = <Vec> vec_div(self, other)
 *     CHKERR( VecReciprocal(vec.vec) )
 *     return vec             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = __pyx_v_vec;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":274
 *     return vec_mul(self, other)
 * 
 * cdef Vec vec_rdiv(Vec self, other):             # <<<<<<<<<<<<<<
 *     cdef Vec vec = <Vec> vec_div(self, other)
 *     CHKERR( VecReciprocal(vec.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_rdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":281
 * # --------------------------------------------------------------------
 * 
 * cdef inline int Vec_Sizes(object size, object bsize,             # <<<<<<<<<<<<<<
 *                           PetscInt *b, PetscInt *n, PetscInt *N) except -1:
 *     Sys_Sizes(size, bsize, b, n, N)
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Vec_Sizes(PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PetscInt *__pyx_v_b, PetscInt *__pyx_v_n, PetscInt *__pyx_v_N) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("Vec_Sizes", 0);

  /* "PETSc/petscvec.pxi":283
 * cdef inline int Vec_Sizes(object size, object bsize,
 *                           PetscInt *b, PetscInt *n, PetscInt *N) except -1:
 *     Sys_Sizes(size, bsize, b, n, N)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Sys_Sizes(__pyx_v_size, __pyx_v_bsize, __pyx_v_b, __pyx_v_n, __pyx_v_N); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(5, 283, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":284
 *                           PetscInt *b, PetscInt *n, PetscInt *N) except -1:
 *     Sys_Sizes(size, bsize, b, n, N)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":281
 * # --------------------------------------------------------------------
 * 
 * cdef inline int Vec_Sizes(object size, object bsize,             # <<<<<<<<<<<<<<
 *                           PetscInt *b, PetscInt *n, PetscInt *N) except -1:
 *     Sys_Sizes(size, bsize, b, n, N)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec_Sizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":291
 *                              const_PetscScalar[],PetscInsertMode)
 * 
 * cdef inline int vecsetvalues(PetscVec V,             # <<<<<<<<<<<<<<
 *                              object oi, object ov, object oim,
 *                              int blocked, int local) except -1:
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_vecsetvalues(Vec __pyx_v_V, PyObject *__pyx_v_oi, PyObject *__pyx_v_ov, PyObject *__pyx_v_oim, int __pyx_v_blocked, int __pyx_v_local) {
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_ni;
  PetscInt __pyx_v_nv;
  PetscInt *__pyx_v_i;
  PetscScalar *__pyx_v_v;
  CYTHON_UNUSED PyObject *__pyx_v_tmp1 = 0;
  CYTHON_UNUSED PyObject *__pyx_v_tmp2 = 0;
  InsertMode __pyx_v_addv;
  __pyx_t_8petsc4py_5PETSc_VecSetValuesFcn *__pyx_v_setvalues;
  int __pyx_r;
  __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;
  InsertMode __pyx_t_7;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("vecsetvalues", 0);

  /* "PETSc/petscvec.pxi":295
 *                              int blocked, int local) except -1:
 *     # block size
 *     cdef PetscInt bs=1             # <<<<<<<<<<<<<<
 *     if blocked:
 *         CHKERR( VecGetBlockSize(V, &bs) )
 */
  __pyx_v_bs = 1;

  /* "PETSc/petscvec.pxi":296
 *     # block size
 *     cdef PetscInt bs=1
 *     if blocked:             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetBlockSize(V, &bs) )
 *         if bs < 1: bs = 1
 */
  __pyx_t_1 = (__pyx_v_blocked != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscvec.pxi":297
 *     cdef PetscInt bs=1
 *     if blocked:
 *         CHKERR( VecGetBlockSize(V, &bs) )             # <<<<<<<<<<<<<<
 *         if bs < 1: bs = 1
 *     # indices and values
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetBlockSize(__pyx_v_V, (&__pyx_v_bs))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 297, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":298
 *     if blocked:
 *         CHKERR( VecGetBlockSize(V, &bs) )
 *         if bs < 1: bs = 1             # <<<<<<<<<<<<<<
 *     # indices and values
 *     cdef PetscInt ni=0, nv=0
 */
    __pyx_t_1 = ((__pyx_v_bs < 1) != 0);
    if (__pyx_t_1) {
      __pyx_v_bs = 1;
    }

    /* "PETSc/petscvec.pxi":296
 *     # block size
 *     cdef PetscInt bs=1
 *     if blocked:             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetBlockSize(V, &bs) )
 *         if bs < 1: bs = 1
 */
  }

  /* "PETSc/petscvec.pxi":300
 *         if bs < 1: bs = 1
 *     # indices and values
 *     cdef PetscInt ni=0, nv=0             # <<<<<<<<<<<<<<
 *     cdef PetscInt    *i=NULL
 *     cdef PetscScalar *v=NULL
 */
  __pyx_v_ni = 0;
  __pyx_v_nv = 0;

  /* "PETSc/petscvec.pxi":301
 *     # indices and values
 *     cdef PetscInt ni=0, nv=0
 *     cdef PetscInt    *i=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscScalar *v=NULL
 *     cdef object tmp1 = iarray_i(oi, &ni, &i)
 */
  __pyx_v_i = NULL;

  /* "PETSc/petscvec.pxi":302
 *     cdef PetscInt ni=0, nv=0
 *     cdef PetscInt    *i=NULL
 *     cdef PetscScalar *v=NULL             # <<<<<<<<<<<<<<
 *     cdef object tmp1 = iarray_i(oi, &ni, &i)
 *     cdef object tmp2 = iarray_s(ov, &nv, &v)
 */
  __pyx_v_v = NULL;

  /* "PETSc/petscvec.pxi":303
 *     cdef PetscInt    *i=NULL
 *     cdef PetscScalar *v=NULL
 *     cdef object tmp1 = iarray_i(oi, &ni, &i)             # <<<<<<<<<<<<<<
 *     cdef object tmp2 = iarray_s(ov, &nv, &v)
 *     if ni*bs != nv: raise ValueError(
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_oi, (&__pyx_v_ni), (&__pyx_v_i))); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_tmp1 = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/petscvec.pxi":304
 *     cdef PetscScalar *v=NULL
 *     cdef object tmp1 = iarray_i(oi, &ni, &i)
 *     cdef object tmp2 = iarray_s(ov, &nv, &v)             # <<<<<<<<<<<<<<
 *     if ni*bs != nv: raise ValueError(
 *         "incompatible array sizes: ni=%d, nv=%d, bs=%d" %
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_s(__pyx_v_ov, (&__pyx_v_nv), (&__pyx_v_v))); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_tmp2 = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/petscvec.pxi":305
 *     cdef object tmp1 = iarray_i(oi, &ni, &i)
 *     cdef object tmp2 = iarray_s(ov, &nv, &v)
 *     if ni*bs != nv: raise ValueError(             # <<<<<<<<<<<<<<
 *         "incompatible array sizes: ni=%d, nv=%d, bs=%d" %
 *         (toInt(ni), toInt(nv), toInt(bs)) )
 */
  __pyx_t_1 = (((__pyx_v_ni * __pyx_v_bs) != __pyx_v_nv) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscvec.pxi":307
 *     if ni*bs != nv: raise ValueError(
 *         "incompatible array sizes: ni=%d, nv=%d, bs=%d" %
 *         (toInt(ni), toInt(nv), toInt(bs)) )             # <<<<<<<<<<<<<<
 *     # insert mode
 *     cdef PetscInsertMode addv = insertmode(oim)
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ni); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nv); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_bs); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;

    /* "PETSc/petscvec.pxi":306
 *     cdef object tmp2 = iarray_s(ov, &nv, &v)
 *     if ni*bs != nv: raise ValueError(
 *         "incompatible array sizes: ni=%d, nv=%d, bs=%d" %             # <<<<<<<<<<<<<<
 *         (toInt(ni), toInt(nv), toInt(bs)) )
 *     # insert mode
 */
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_incompatible_array_sizes_ni_d_nv, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PETSc/petscvec.pxi":305
 *     cdef object tmp1 = iarray_i(oi, &ni, &i)
 *     cdef object tmp2 = iarray_s(ov, &nv, &v)
 *     if ni*bs != nv: raise ValueError(             # <<<<<<<<<<<<<<
 *         "incompatible array sizes: ni=%d, nv=%d, bs=%d" %
 *         (toInt(ni), toInt(nv), toInt(bs)) )
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 305, __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 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(5, 305, __pyx_L1_error)
  }

  /* "PETSc/petscvec.pxi":309
 *         (toInt(ni), toInt(nv), toInt(bs)) )
 *     # insert mode
 *     cdef PetscInsertMode addv = insertmode(oim)             # <<<<<<<<<<<<<<
 *     # VecSetValuesXXX function
 *     cdef VecSetValuesFcn *setvalues = NULL
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_oim); if (unlikely(__pyx_t_7 == ((InsertMode)-1L))) __PYX_ERR(5, 309, __pyx_L1_error)
  __pyx_v_addv = __pyx_t_7;

  /* "PETSc/petscvec.pxi":311
 *     cdef PetscInsertMode addv = insertmode(oim)
 *     # VecSetValuesXXX function
 *     cdef VecSetValuesFcn *setvalues = NULL             # <<<<<<<<<<<<<<
 *     if blocked and local: setvalues = VecSetValuesBlockedLocal
 *     elif blocked:         setvalues = VecSetValuesBlocked
 */
  __pyx_v_setvalues = NULL;

  /* "PETSc/petscvec.pxi":312
 *     # VecSetValuesXXX function
 *     cdef VecSetValuesFcn *setvalues = NULL
 *     if blocked and local: setvalues = VecSetValuesBlockedLocal             # <<<<<<<<<<<<<<
 *     elif blocked:         setvalues = VecSetValuesBlocked
 *     elif local:           setvalues = VecSetValuesLocal
 */
  __pyx_t_8 = (__pyx_v_blocked != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_1 = __pyx_t_8;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_8 = (__pyx_v_local != 0);
  __pyx_t_1 = __pyx_t_8;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {
    __pyx_v_setvalues = VecSetValuesBlockedLocal;
    goto __pyx_L6;
  }

  /* "PETSc/petscvec.pxi":313
 *     cdef VecSetValuesFcn *setvalues = NULL
 *     if blocked and local: setvalues = VecSetValuesBlockedLocal
 *     elif blocked:         setvalues = VecSetValuesBlocked             # <<<<<<<<<<<<<<
 *     elif local:           setvalues = VecSetValuesLocal
 *     else:                 setvalues = VecSetValues
 */
  __pyx_t_1 = (__pyx_v_blocked != 0);
  if (__pyx_t_1) {
    __pyx_v_setvalues = VecSetValuesBlocked;
    goto __pyx_L6;
  }

  /* "PETSc/petscvec.pxi":314
 *     if blocked and local: setvalues = VecSetValuesBlockedLocal
 *     elif blocked:         setvalues = VecSetValuesBlocked
 *     elif local:           setvalues = VecSetValuesLocal             # <<<<<<<<<<<<<<
 *     else:                 setvalues = VecSetValues
 *     # actual call
 */
  __pyx_t_1 = (__pyx_v_local != 0);
  if (__pyx_t_1) {
    __pyx_v_setvalues = VecSetValuesLocal;
    goto __pyx_L6;
  }

  /* "PETSc/petscvec.pxi":315
 *     elif blocked:         setvalues = VecSetValuesBlocked
 *     elif local:           setvalues = VecSetValuesLocal
 *     else:                 setvalues = VecSetValues             # <<<<<<<<<<<<<<
 *     # actual call
 *     CHKERR( setvalues(V, ni, i, v, addv) )
 */
  /*else*/ {
    __pyx_v_setvalues = VecSetValues;
  }
  __pyx_L6:;

  /* "PETSc/petscvec.pxi":317
 *     else:                 setvalues = VecSetValues
 *     # actual call
 *     CHKERR( setvalues(V, ni, i, v, addv) )             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_v_setvalues(__pyx_v_V, __pyx_v_ni, __pyx_v_i, __pyx_v_v, __pyx_v_addv)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 317, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":318
 *     # actual call
 *     CHKERR( setvalues(V, ni, i, v, addv) )
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef object vecgetvalues(PetscVec vec, object oindices, object values):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":291
 *                              const_PetscScalar[],PetscInsertMode)
 * 
 * cdef inline int vecsetvalues(PetscVec V,             # <<<<<<<<<<<<<<
 *                              object oi, object ov, object oim,
 *                              int blocked, int local) except -1:
 */

  /* 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_AddTraceback("petsc4py.PETSc.vecsetvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp1);
  __Pyx_XDECREF(__pyx_v_tmp2);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":320
 *     return 0
 * 
 * cdef object vecgetvalues(PetscVec vec, object oindices, object values):             # <<<<<<<<<<<<<<
 *     cdef PetscInt ni=0, nv=0
 *     cdef PetscInt    *i=NULL
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_vecgetvalues(Vec __pyx_v_vec, PyObject *__pyx_v_oindices, PyObject *__pyx_v_values) {
  PetscInt __pyx_v_ni;
  PetscInt __pyx_v_nv;
  PetscInt *__pyx_v_i;
  PetscScalar *__pyx_v_v;
  PyObject *__pyx_v_indices = 0;
  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;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("vecgetvalues", 0);
  __Pyx_INCREF(__pyx_v_values);

  /* "PETSc/petscvec.pxi":321
 * 
 * cdef object vecgetvalues(PetscVec vec, object oindices, object values):
 *     cdef PetscInt ni=0, nv=0             # <<<<<<<<<<<<<<
 *     cdef PetscInt    *i=NULL
 *     cdef PetscScalar *v=NULL
 */
  __pyx_v_ni = 0;
  __pyx_v_nv = 0;

  /* "PETSc/petscvec.pxi":322
 * cdef object vecgetvalues(PetscVec vec, object oindices, object values):
 *     cdef PetscInt ni=0, nv=0
 *     cdef PetscInt    *i=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscScalar *v=NULL
 *     cdef object indices = iarray_i(oindices, &ni, &i)
 */
  __pyx_v_i = NULL;

  /* "PETSc/petscvec.pxi":323
 *     cdef PetscInt ni=0, nv=0
 *     cdef PetscInt    *i=NULL
 *     cdef PetscScalar *v=NULL             # <<<<<<<<<<<<<<
 *     cdef object indices = iarray_i(oindices, &ni, &i)
 *     if values is None:
 */
  __pyx_v_v = NULL;

  /* "PETSc/petscvec.pxi":324
 *     cdef PetscInt    *i=NULL
 *     cdef PetscScalar *v=NULL
 *     cdef object indices = iarray_i(oindices, &ni, &i)             # <<<<<<<<<<<<<<
 *     if values is None:
 *         values = empty_s(ni)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_oindices, (&__pyx_v_ni), (&__pyx_v_i))); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_indices = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscvec.pxi":325
 *     cdef PetscScalar *v=NULL
 *     cdef object indices = iarray_i(oindices, &ni, &i)
 *     if values is None:             # <<<<<<<<<<<<<<
 *         values = empty_s(ni)
 *         values.shape = indices.shape
 */
  __pyx_t_2 = (__pyx_v_values == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscvec.pxi":326
 *     cdef object indices = iarray_i(oindices, &ni, &i)
 *     if values is None:
 *         values = empty_s(ni)             # <<<<<<<<<<<<<<
 *         values.shape = indices.shape
 *     values = oarray_s(values, &nv, &v)
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_s(__pyx_v_ni)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "PETSc/petscvec.pxi":327
 *     if values is None:
 *         values = empty_s(ni)
 *         values.shape = indices.shape             # <<<<<<<<<<<<<<
 *     values = oarray_s(values, &nv, &v)
 *     if (ni != nv): raise ValueError(
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_indices, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_values, __pyx_n_s_shape, __pyx_t_1) < 0) __PYX_ERR(5, 327, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PETSc/petscvec.pxi":325
 *     cdef PetscScalar *v=NULL
 *     cdef object indices = iarray_i(oindices, &ni, &i)
 *     if values is None:             # <<<<<<<<<<<<<<
 *         values = empty_s(ni)
 *         values.shape = indices.shape
 */
  }

  /* "PETSc/petscvec.pxi":328
 *         values = empty_s(ni)
 *         values.shape = indices.shape
 *     values = oarray_s(values, &nv, &v)             # <<<<<<<<<<<<<<
 *     if (ni != nv): raise ValueError(
 *         ("incompatible array sizes: "
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_s(__pyx_v_values, (&__pyx_v_nv), (&__pyx_v_v))); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscvec.pxi":329
 *         values.shape = indices.shape
 *     values = oarray_s(values, &nv, &v)
 *     if (ni != nv): raise ValueError(             # <<<<<<<<<<<<<<
 *         ("incompatible array sizes: "
 *          "ni=%d, nv=%d") % (toInt(ni), toInt(nv)))
 */
  __pyx_t_3 = ((__pyx_v_ni != __pyx_v_nv) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscvec.pxi":331
 *     if (ni != nv): raise ValueError(
 *         ("incompatible array sizes: "
 *          "ni=%d, nv=%d") % (toInt(ni), toInt(nv)))             # <<<<<<<<<<<<<<
 *     CHKERR( VecGetValues(vec, ni, i, v) )
 *     return values
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ni); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nv); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 331, __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_t_1 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_incompatible_array_sizes_ni_d_nv_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/petscvec.pxi":329
 *         values.shape = indices.shape
 *     values = oarray_s(values, &nv, &v)
 *     if (ni != nv): raise ValueError(             # <<<<<<<<<<<<<<
 *         ("incompatible array sizes: "
 *          "ni=%d, nv=%d") % (toInt(ni), toInt(nv)))
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 329, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(5, 329, __pyx_L1_error)
  }

  /* "PETSc/petscvec.pxi":332
 *         ("incompatible array sizes: "
 *          "ni=%d, nv=%d") % (toInt(ni), toInt(nv)))
 *     CHKERR( VecGetValues(vec, ni, i, v) )             # <<<<<<<<<<<<<<
 *     return values
 * 
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetValues(__pyx_v_vec, __pyx_v_ni, __pyx_v_i, __pyx_v_v)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(5, 332, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":333
 *          "ni=%d, nv=%d") % (toInt(ni), toInt(nv)))
 *     CHKERR( VecGetValues(vec, ni, i, v) )
 *     return values             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_values);
  __pyx_r = __pyx_v_values;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":320
 *     return 0
 * 
 * cdef object vecgetvalues(PetscVec vec, object oindices, object values):             # <<<<<<<<<<<<<<
 *     cdef PetscInt ni=0, nv=0
 *     cdef PetscInt    *i=NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.vecgetvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":337
 * # --------------------------------------------------------------------
 * 
 * cdef inline _Vec_buffer vec_getbuffer_r(Vec self):             # <<<<<<<<<<<<<<
 *     cdef _Vec_buffer buf = _Vec_buffer(self)
 *     buf.readonly = 1
 */

static CYTHON_INLINE struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_f_8petsc4py_5PETSc_vec_getbuffer_r(struct PyPetscVecObject *__pyx_v_self) {
  struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_buf = 0;
  struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("vec_getbuffer_r", 0);

  /* "PETSc/petscvec.pxi":338
 * 
 * cdef inline _Vec_buffer vec_getbuffer_r(Vec self):
 *     cdef _Vec_buffer buf = _Vec_buffer(self)             # <<<<<<<<<<<<<<
 *     buf.readonly = 1
 *     return buf
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc__Vec_buffer), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscvec.pxi":339
 * cdef inline _Vec_buffer vec_getbuffer_r(Vec self):
 *     cdef _Vec_buffer buf = _Vec_buffer(self)
 *     buf.readonly = 1             # <<<<<<<<<<<<<<
 *     return buf
 * 
 */
  __pyx_v_buf->readonly = 1;

  /* "PETSc/petscvec.pxi":340
 *     cdef _Vec_buffer buf = _Vec_buffer(self)
 *     buf.readonly = 1
 *     return buf             # <<<<<<<<<<<<<<
 * 
 * cdef inline _Vec_buffer vec_getbuffer_w(Vec self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_buf));
  __pyx_r = __pyx_v_buf;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":337
 * # --------------------------------------------------------------------
 * 
 * cdef inline _Vec_buffer vec_getbuffer_r(Vec self):             # <<<<<<<<<<<<<<
 *     cdef _Vec_buffer buf = _Vec_buffer(self)
 *     buf.readonly = 1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_getbuffer_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":342
 *     return buf
 * 
 * cdef inline _Vec_buffer vec_getbuffer_w(Vec self):             # <<<<<<<<<<<<<<
 *     cdef _Vec_buffer buf = _Vec_buffer(self)
 *     buf.readonly = 0
 */

static CYTHON_INLINE struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_f_8petsc4py_5PETSc_vec_getbuffer_w(struct PyPetscVecObject *__pyx_v_self) {
  struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_buf = 0;
  struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("vec_getbuffer_w", 0);

  /* "PETSc/petscvec.pxi":343
 * 
 * cdef inline _Vec_buffer vec_getbuffer_w(Vec self):
 *     cdef _Vec_buffer buf = _Vec_buffer(self)             # <<<<<<<<<<<<<<
 *     buf.readonly = 0
 *     return buf
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc__Vec_buffer), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscvec.pxi":344
 * cdef inline _Vec_buffer vec_getbuffer_w(Vec self):
 *     cdef _Vec_buffer buf = _Vec_buffer(self)
 *     buf.readonly = 0             # <<<<<<<<<<<<<<
 *     return buf
 * 
 */
  __pyx_v_buf->readonly = 0;

  /* "PETSc/petscvec.pxi":345
 *     cdef _Vec_buffer buf = _Vec_buffer(self)
 *     buf.readonly = 0
 *     return buf             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray vec_getarray_r(Vec self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_buf));
  __pyx_r = __pyx_v_buf;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":342
 *     return buf
 * 
 * cdef inline _Vec_buffer vec_getbuffer_w(Vec self):             # <<<<<<<<<<<<<<
 *     cdef _Vec_buffer buf = _Vec_buffer(self)
 *     buf.readonly = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_getbuffer_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":347
 *     return buf
 * 
 * cdef inline ndarray vec_getarray_r(Vec self):             # <<<<<<<<<<<<<<
 *     return asarray(vec_getbuffer_r(self))
 * 
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_vec_getarray_r(struct PyPetscVecObject *__pyx_v_self) {
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("vec_getarray_r", 0);

  /* "PETSc/petscvec.pxi":348
 * 
 * cdef inline ndarray vec_getarray_r(Vec self):
 *     return asarray(vec_getbuffer_r(self))             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray vec_getarray_w(Vec self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_getbuffer_r(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_asarray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":347
 *     return buf
 * 
 * cdef inline ndarray vec_getarray_r(Vec self):             # <<<<<<<<<<<<<<
 *     return asarray(vec_getbuffer_r(self))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_getarray_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":350
 *     return asarray(vec_getbuffer_r(self))
 * 
 * cdef inline ndarray vec_getarray_w(Vec self):             # <<<<<<<<<<<<<<
 *     return asarray(vec_getbuffer_w(self))
 * 
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_8petsc4py_5PETSc_vec_getarray_w(struct PyPetscVecObject *__pyx_v_self) {
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("vec_getarray_w", 0);

  /* "PETSc/petscvec.pxi":351
 * 
 * cdef inline ndarray vec_getarray_w(Vec self):
 *     return asarray(vec_getbuffer_w(self))             # <<<<<<<<<<<<<<
 * 
 * cdef inline int vec_setarray(Vec self, object o) except -1:
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_getbuffer_w(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_asarray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":350
 *     return asarray(vec_getbuffer_r(self))
 * 
 * cdef inline ndarray vec_getarray_w(Vec self):             # <<<<<<<<<<<<<<
 *     return asarray(vec_getbuffer_w(self))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_getarray_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":353
 *     return asarray(vec_getbuffer_w(self))
 * 
 * cdef inline int vec_setarray(Vec self, object o) except -1:             # <<<<<<<<<<<<<<
 *     cdef PetscInt na=0, nv=0, i=0
 *     cdef PetscScalar *va=NULL, *vv=NULL
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_vec_setarray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_o) {
  PetscInt __pyx_v_na;
  PetscInt __pyx_v_nv;
  PetscInt __pyx_v_i;
  PetscScalar *__pyx_v_va;
  PetscScalar *__pyx_v_vv;
  PyArrayObject *__pyx_v_ary = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PetscInt __pyx_t_7;
  int __pyx_t_8;
  char const *__pyx_t_9;
  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;
  __Pyx_RefNannySetupContext("vec_setarray", 0);

  /* "PETSc/petscvec.pxi":354
 * 
 * cdef inline int vec_setarray(Vec self, object o) except -1:
 *     cdef PetscInt na=0, nv=0, i=0             # <<<<<<<<<<<<<<
 *     cdef PetscScalar *va=NULL, *vv=NULL
 *     cdef ndarray ary = iarray_s(o, &na, &va)
 */
  __pyx_v_na = 0;
  __pyx_v_nv = 0;
  __pyx_v_i = 0;

  /* "PETSc/petscvec.pxi":355
 * cdef inline int vec_setarray(Vec self, object o) except -1:
 *     cdef PetscInt na=0, nv=0, i=0
 *     cdef PetscScalar *va=NULL, *vv=NULL             # <<<<<<<<<<<<<<
 *     cdef ndarray ary = iarray_s(o, &na, &va)
 *     CHKERR( VecGetLocalSize(self.vec, &nv) )
 */
  __pyx_v_va = NULL;
  __pyx_v_vv = NULL;

  /* "PETSc/petscvec.pxi":356
 *     cdef PetscInt na=0, nv=0, i=0
 *     cdef PetscScalar *va=NULL, *vv=NULL
 *     cdef ndarray ary = iarray_s(o, &na, &va)             # <<<<<<<<<<<<<<
 *     CHKERR( VecGetLocalSize(self.vec, &nv) )
 *     if (na != nv) and PyArray_NDIM(ary) > 0: raise ValueError(
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_s(__pyx_v_o, (&__pyx_v_na), (&__pyx_v_va))); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ary = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscvec.pxi":357
 *     cdef PetscScalar *va=NULL, *vv=NULL
 *     cdef ndarray ary = iarray_s(o, &na, &va)
 *     CHKERR( VecGetLocalSize(self.vec, &nv) )             # <<<<<<<<<<<<<<
 *     if (na != nv) and PyArray_NDIM(ary) > 0: raise ValueError(
 *         "array size %d incompatible with vector local size %d" %
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetLocalSize(__pyx_v_self->vec, (&__pyx_v_nv))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 357, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":358
 *     cdef ndarray ary = iarray_s(o, &na, &va)
 *     CHKERR( VecGetLocalSize(self.vec, &nv) )
 *     if (na != nv) and PyArray_NDIM(ary) > 0: raise ValueError(             # <<<<<<<<<<<<<<
 *         "array size %d incompatible with vector local size %d" %
 *         (toInt(na), toInt(nv)) )
 */
  __pyx_t_4 = ((__pyx_v_na != __pyx_v_nv) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((PyArray_NDIM(__pyx_v_ary) > 0) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "PETSc/petscvec.pxi":360
 *     if (na != nv) and PyArray_NDIM(ary) > 0: raise ValueError(
 *         "array size %d incompatible with vector local size %d" %
 *         (toInt(na), toInt(nv)) )             # <<<<<<<<<<<<<<
 *     CHKERR( VecGetArray(self.vec, &vv) )
 *     try:
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_na); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nv); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;

    /* "PETSc/petscvec.pxi":359
 *     CHKERR( VecGetLocalSize(self.vec, &nv) )
 *     if (na != nv) and PyArray_NDIM(ary) > 0: raise ValueError(
 *         "array size %d incompatible with vector local size %d" %             # <<<<<<<<<<<<<<
 *         (toInt(na), toInt(nv)) )
 *     CHKERR( VecGetArray(self.vec, &vv) )
 */
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_array_size_d_incompatible_with_v, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 359, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PETSc/petscvec.pxi":358
 *     cdef ndarray ary = iarray_s(o, &na, &va)
 *     CHKERR( VecGetLocalSize(self.vec, &nv) )
 *     if (na != nv) and PyArray_NDIM(ary) > 0: raise ValueError(             # <<<<<<<<<<<<<<
 *         "array size %d incompatible with vector local size %d" %
 *         (toInt(na), toInt(nv)) )
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 358, __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 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(5, 358, __pyx_L1_error)
  }

  /* "PETSc/petscvec.pxi":361
 *         "array size %d incompatible with vector local size %d" %
 *         (toInt(na), toInt(nv)) )
 *     CHKERR( VecGetArray(self.vec, &vv) )             # <<<<<<<<<<<<<<
 *     try:
 *         if PyArray_NDIM(ary) == 0:
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetArray(__pyx_v_self->vec, (&__pyx_v_vv))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 361, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":362
 *         (toInt(na), toInt(nv)) )
 *     CHKERR( VecGetArray(self.vec, &vv) )
 *     try:             # <<<<<<<<<<<<<<
 *         if PyArray_NDIM(ary) == 0:
 *             for i from 0 <= i < nv:
 */
  /*try:*/ {

    /* "PETSc/petscvec.pxi":363
 *     CHKERR( VecGetArray(self.vec, &vv) )
 *     try:
 *         if PyArray_NDIM(ary) == 0:             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < nv:
 *                 vv[i] = va[0]
 */
    __pyx_t_3 = ((PyArray_NDIM(__pyx_v_ary) == 0) != 0);
    if (__pyx_t_3) {

      /* "PETSc/petscvec.pxi":364
 *     try:
 *         if PyArray_NDIM(ary) == 0:
 *             for i from 0 <= i < nv:             # <<<<<<<<<<<<<<
 *                 vv[i] = va[0]
 *         else:
 */
      __pyx_t_7 = __pyx_v_nv;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

        /* "PETSc/petscvec.pxi":365
 *         if PyArray_NDIM(ary) == 0:
 *             for i from 0 <= i < nv:
 *                 vv[i] = va[0]             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( PetscMemcpy(vv, va, <size_t>nv*sizeof(PetscScalar)) )
 */
        (__pyx_v_vv[__pyx_v_i]) = (__pyx_v_va[0]);
      }

      /* "PETSc/petscvec.pxi":363
 *     CHKERR( VecGetArray(self.vec, &vv) )
 *     try:
 *         if PyArray_NDIM(ary) == 0:             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < nv:
 *                 vv[i] = va[0]
 */
      goto __pyx_L9;
    }

    /* "PETSc/petscvec.pxi":367
 *                 vv[i] = va[0]
 *         else:
 *             CHKERR( PetscMemcpy(vv, va, <size_t>nv*sizeof(PetscScalar)) )             # <<<<<<<<<<<<<<
 *     finally:
 *         CHKERR( VecRestoreArray(self.vec, &vv) )
 */
    /*else*/ {
      __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscMemcpy(__pyx_v_vv, __pyx_v_va, (((size_t)__pyx_v_nv) * (sizeof(PetscScalar))))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 367, __pyx_L7_error)
    }
    __pyx_L9:;
  }

  /* "PETSc/petscvec.pxi":369
 *             CHKERR( PetscMemcpy(vv, va, <size_t>nv*sizeof(PetscScalar)) )
 *     finally:
 *         CHKERR( VecRestoreArray(self.vec, &vv) )             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecRestoreArray(__pyx_v_self->vec, (&__pyx_v_vv))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 369, __pyx_L1_error)
      goto __pyx_L8;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L7_error:;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_2 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __pyx_t_16 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecRestoreArray(__pyx_v_self->vec, (&__pyx_v_vv))); if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(5, 369, __pyx_L13_error)
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L13_error:;
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L8:;
  }

  /* "PETSc/petscvec.pxi":370
 *     finally:
 *         CHKERR( VecRestoreArray(self.vec, &vv) )
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef object vec_getitem(Vec self, object i):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":353
 *     return asarray(vec_getbuffer_w(self))
 * 
 * cdef inline int vec_setarray(Vec self, object o) except -1:             # <<<<<<<<<<<<<<
 *     cdef PetscInt na=0, nv=0, i=0
 *     cdef PetscScalar *va=NULL, *vv=NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_setarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ary);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":372
 *     return 0
 * 
 * cdef object vec_getitem(Vec self, object i):             # <<<<<<<<<<<<<<
 *     cdef PetscInt N=0
 *     if i is Ellipsis:
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_vec_getitem(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_i) {
  PetscInt __pyx_v_N;
  PyObject *__pyx_v_start = NULL;
  PyObject *__pyx_v_stop = NULL;
  PyObject *__pyx_v_stride = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  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;
  PyObject *(*__pyx_t_9)(PyObject *);
  __Pyx_RefNannySetupContext("vec_getitem", 0);
  __Pyx_INCREF(__pyx_v_i);

  /* "PETSc/petscvec.pxi":373
 * 
 * cdef object vec_getitem(Vec self, object i):
 *     cdef PetscInt N=0             # <<<<<<<<<<<<<<
 *     if i is Ellipsis:
 *         return asarray(self)
 */
  __pyx_v_N = 0;

  /* "PETSc/petscvec.pxi":374
 * cdef object vec_getitem(Vec self, object i):
 *     cdef PetscInt N=0
 *     if i is Ellipsis:             # <<<<<<<<<<<<<<
 *         return asarray(self)
 *     if isinstance(i, slice):
 */
  __pyx_t_1 = (__pyx_v_i == __pyx_builtin_Ellipsis);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscvec.pxi":375
 *     cdef PetscInt N=0
 *     if i is Ellipsis:
 *         return asarray(self)             # <<<<<<<<<<<<<<
 *     if isinstance(i, slice):
 *         CHKERR( VecGetSize(self.vec, &N) )
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_asarray(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/petscvec.pxi":374
 * cdef object vec_getitem(Vec self, object i):
 *     cdef PetscInt N=0
 *     if i is Ellipsis:             # <<<<<<<<<<<<<<
 *         return asarray(self)
 *     if isinstance(i, slice):
 */
  }

  /* "PETSc/petscvec.pxi":376
 *     if i is Ellipsis:
 *         return asarray(self)
 *     if isinstance(i, slice):             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetSize(self.vec, &N) )
 *         start, stop, stride = i.indices(toInt(N))
 */
  __pyx_t_2 = PySlice_Check(__pyx_v_i); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscvec.pxi":377
 *         return asarray(self)
 *     if isinstance(i, slice):
 *         CHKERR( VecGetSize(self.vec, &N) )             # <<<<<<<<<<<<<<
 *         start, stop, stride = i.indices(toInt(N))
 *         i = arange(start, stop, stride)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetSize(__pyx_v_self->vec, (&__pyx_v_N))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(5, 377, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":378
 *     if isinstance(i, slice):
 *         CHKERR( VecGetSize(self.vec, &N) )
 *         start, stop, stride = i.indices(toInt(N))             # <<<<<<<<<<<<<<
 *         i = arange(start, stop, stride)
 *     return vecgetvalues(self.vec, i, None)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_i, __pyx_n_s_indices); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 378, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 378, __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_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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_CPYTHON
      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(5, 378, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_7), 3) < 0) __PYX_ERR(5, 378, __pyx_L1_error)
      __pyx_t_9 = 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_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(5, 378, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __pyx_v_start = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_stop = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_v_stride = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "PETSc/petscvec.pxi":379
 *         CHKERR( VecGetSize(self.vec, &N) )
 *         start, stop, stride = i.indices(toInt(N))
 *         i = arange(start, stop, stride)             # <<<<<<<<<<<<<<
 *     return vecgetvalues(self.vec, i, None)
 * 
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_arange(__pyx_v_start, __pyx_v_stop, __pyx_v_stride)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/petscvec.pxi":376
 *     if i is Ellipsis:
 *         return asarray(self)
 *     if isinstance(i, slice):             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetSize(self.vec, &N) )
 *         start, stop, stride = i.indices(toInt(N))
 */
  }

  /* "PETSc/petscvec.pxi":380
 *         start, stop, stride = i.indices(toInt(N))
 *         i = arange(start, stop, stride)
 *     return vecgetvalues(self.vec, i, None)             # <<<<<<<<<<<<<<
 * 
 * cdef int vec_setitem(Vec self, object i, object v) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_vecgetvalues(__pyx_v_self->vec, __pyx_v_i, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":372
 *     return 0
 * 
 * cdef object vec_getitem(Vec self, object i):             # <<<<<<<<<<<<<<
 *     cdef PetscInt N=0
 *     if i is Ellipsis:
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("petsc4py.PETSc.vec_getitem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_stop);
  __Pyx_XDECREF(__pyx_v_stride);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":382
 *     return vecgetvalues(self.vec, i, None)
 * 
 * cdef int vec_setitem(Vec self, object i, object v) except -1:             # <<<<<<<<<<<<<<
 *     cdef PetscInt N=0
 *     if i is Ellipsis:
 */

static int __pyx_f_8petsc4py_5PETSc_vec_setitem(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_v) {
  PetscInt __pyx_v_N;
  PyObject *__pyx_v_start = NULL;
  PyObject *__pyx_v_stop = NULL;
  PyObject *__pyx_v_stride = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  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 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  __Pyx_RefNannySetupContext("vec_setitem", 0);
  __Pyx_INCREF(__pyx_v_i);

  /* "PETSc/petscvec.pxi":383
 * 
 * cdef int vec_setitem(Vec self, object i, object v) except -1:
 *     cdef PetscInt N=0             # <<<<<<<<<<<<<<
 *     if i is Ellipsis:
 *         return vec_setarray(self, v)
 */
  __pyx_v_N = 0;

  /* "PETSc/petscvec.pxi":384
 * cdef int vec_setitem(Vec self, object i, object v) except -1:
 *     cdef PetscInt N=0
 *     if i is Ellipsis:             # <<<<<<<<<<<<<<
 *         return vec_setarray(self, v)
 *     if isinstance(i, slice):
 */
  __pyx_t_1 = (__pyx_v_i == __pyx_builtin_Ellipsis);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscvec.pxi":385
 *     cdef PetscInt N=0
 *     if i is Ellipsis:
 *         return vec_setarray(self, v)             # <<<<<<<<<<<<<<
 *     if isinstance(i, slice):
 *         CHKERR( VecGetSize(self.vec, &N) )
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_vec_setarray(__pyx_v_self, __pyx_v_v); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(5, 385, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "PETSc/petscvec.pxi":384
 * cdef int vec_setitem(Vec self, object i, object v) except -1:
 *     cdef PetscInt N=0
 *     if i is Ellipsis:             # <<<<<<<<<<<<<<
 *         return vec_setarray(self, v)
 *     if isinstance(i, slice):
 */
  }

  /* "PETSc/petscvec.pxi":386
 *     if i is Ellipsis:
 *         return vec_setarray(self, v)
 *     if isinstance(i, slice):             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetSize(self.vec, &N) )
 *         start, stop, stride = i.indices(toInt(N))
 */
  __pyx_t_2 = PySlice_Check(__pyx_v_i); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscvec.pxi":387
 *         return vec_setarray(self, v)
 *     if isinstance(i, slice):
 *         CHKERR( VecGetSize(self.vec, &N) )             # <<<<<<<<<<<<<<
 *         start, stop, stride = i.indices(toInt(N))
 *         i = arange(start, stop, stride)
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetSize(__pyx_v_self->vec, (&__pyx_v_N))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(5, 387, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":388
 *     if isinstance(i, slice):
 *         CHKERR( VecGetSize(self.vec, &N) )
 *         start, stop, stride = i.indices(toInt(N))             # <<<<<<<<<<<<<<
 *         i = arange(start, stop, stride)
 *     vecsetvalues(self.vec, i, v, None, 0, 0)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_i, __pyx_n_s_indices); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 388, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 388, __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_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 388, __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;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(5, 388, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_7), 3) < 0) __PYX_ERR(5, 388, __pyx_L1_error)
      __pyx_t_9 = 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_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(5, 388, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __pyx_v_start = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_stop = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_v_stride = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "PETSc/petscvec.pxi":389
 *         CHKERR( VecGetSize(self.vec, &N) )
 *         start, stop, stride = i.indices(toInt(N))
 *         i = arange(start, stop, stride)             # <<<<<<<<<<<<<<
 *     vecsetvalues(self.vec, i, v, None, 0, 0)
 *     return 0
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_arange(__pyx_v_start, __pyx_v_stop, __pyx_v_stride)); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/petscvec.pxi":386
 *     if i is Ellipsis:
 *         return vec_setarray(self, v)
 *     if isinstance(i, slice):             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetSize(self.vec, &N) )
 *         start, stop, stride = i.indices(toInt(N))
 */
  }

  /* "PETSc/petscvec.pxi":390
 *         start, stop, stride = i.indices(toInt(N))
 *         i = arange(start, stop, stride)
 *     vecsetvalues(self.vec, i, v, None, 0, 0)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_vecsetvalues(__pyx_v_self->vec, __pyx_v_i, __pyx_v_v, Py_None, 0, 0); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(5, 390, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":391
 *         i = arange(start, stop, stride)
 *     vecsetvalues(self.vec, i, v, None, 0, 0)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":382
 *     return vecgetvalues(self.vec, i, None)
 * 
 * cdef int vec_setitem(Vec self, object i, object v) except -1:             # <<<<<<<<<<<<<<
 *     cdef PetscInt N=0
 *     if i is Ellipsis:
 */

  /* function exit code */
  __pyx_L1_error:;
  __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("petsc4py.PETSc.vec_setitem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_stop);
  __Pyx_XDECREF(__pyx_v_stride);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":403
 * # --------------------------------------------------------------------
 * 
 * cdef int Vec_AcquireArray(PetscVec v, PetscScalar *a[], int ro) nogil except -1:             # <<<<<<<<<<<<<<
 *     if ro: CHKERR( VecGetArrayRead(v, <const_PetscScalar**>a) )
 *     else:  CHKERR( VecGetArray(v, a) )
 */

static int __pyx_f_8petsc4py_5PETSc_Vec_AcquireArray(Vec __pyx_v_v, PetscScalar **__pyx_v_a, int __pyx_v_ro) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "PETSc/petscvec.pxi":404
 * 
 * cdef int Vec_AcquireArray(PetscVec v, PetscScalar *a[], int ro) nogil except -1:
 *     if ro: CHKERR( VecGetArrayRead(v, <const_PetscScalar**>a) )             # <<<<<<<<<<<<<<
 *     else:  CHKERR( VecGetArray(v, a) )
 *     return 0
 */
  __pyx_t_1 = (__pyx_v_ro != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetArrayRead(__pyx_v_v, ((const PetscScalar **)__pyx_v_a))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 404, __pyx_L1_error)
    goto __pyx_L3;
  }

  /* "PETSc/petscvec.pxi":405
 * cdef int Vec_AcquireArray(PetscVec v, PetscScalar *a[], int ro) nogil except -1:
 *     if ro: CHKERR( VecGetArrayRead(v, <const_PetscScalar**>a) )
 *     else:  CHKERR( VecGetArray(v, a) )             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  /*else*/ {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetArray(__pyx_v_v, __pyx_v_a)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 405, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/petscvec.pxi":406
 *     if ro: CHKERR( VecGetArrayRead(v, <const_PetscScalar**>a) )
 *     else:  CHKERR( VecGetArray(v, a) )
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int Vec_ReleaseArray(PetscVec v, PetscScalar *a[], int ro) nogil except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":403
 * # --------------------------------------------------------------------
 * 
 * cdef int Vec_AcquireArray(PetscVec v, PetscScalar *a[], int ro) nogil except -1:             # <<<<<<<<<<<<<<
 *     if ro: CHKERR( VecGetArrayRead(v, <const_PetscScalar**>a) )
 *     else:  CHKERR( VecGetArray(v, a) )
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("petsc4py.PETSc.Vec_AcquireArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":408
 *     return 0
 * 
 * cdef int Vec_ReleaseArray(PetscVec v, PetscScalar *a[], int ro) nogil except -1:             # <<<<<<<<<<<<<<
 *     if ro: CHKERR( VecRestoreArrayRead(v, <const_PetscScalar**>a) )
 *     else:  CHKERR( VecRestoreArray(v, a) )
 */

static int __pyx_f_8petsc4py_5PETSc_Vec_ReleaseArray(Vec __pyx_v_v, PetscScalar **__pyx_v_a, int __pyx_v_ro) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "PETSc/petscvec.pxi":409
 * 
 * cdef int Vec_ReleaseArray(PetscVec v, PetscScalar *a[], int ro) nogil except -1:
 *     if ro: CHKERR( VecRestoreArrayRead(v, <const_PetscScalar**>a) )             # <<<<<<<<<<<<<<
 *     else:  CHKERR( VecRestoreArray(v, a) )
 *     return 0
 */
  __pyx_t_1 = (__pyx_v_ro != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecRestoreArrayRead(__pyx_v_v, ((const PetscScalar **)__pyx_v_a))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 409, __pyx_L1_error)
    goto __pyx_L3;
  }

  /* "PETSc/petscvec.pxi":410
 * cdef int Vec_ReleaseArray(PetscVec v, PetscScalar *a[], int ro) nogil except -1:
 *     if ro: CHKERR( VecRestoreArrayRead(v, <const_PetscScalar**>a) )
 *     else:  CHKERR( VecRestoreArray(v, a) )             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  /*else*/ {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecRestoreArray(__pyx_v_v, __pyx_v_a)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 410, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/petscvec.pxi":411
 *     if ro: CHKERR( VecRestoreArrayRead(v, <const_PetscScalar**>a) )
 *     else:  CHKERR( VecRestoreArray(v, a) )
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef class _Vec_buffer:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":408
 *     return 0
 * 
 * cdef int Vec_ReleaseArray(PetscVec v, PetscScalar *a[], int ro) nogil except -1:             # <<<<<<<<<<<<<<
 *     if ro: CHKERR( VecRestoreArrayRead(v, <const_PetscScalar**>a) )
 *     else:  CHKERR( VecRestoreArray(v, a) )
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("petsc4py.PETSc.Vec_ReleaseArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":421
 *     cdef bint hasarray
 * 
 *     def __cinit__(self, Vec vec not None, bint readonly=0):             # <<<<<<<<<<<<<<
 *         cdef PetscVec v = vec.vec
 *         CHKERR( PetscINCREF(<PetscObject*>&v) )
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  int __pyx_v_readonly;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,&__pyx_n_s_readonly,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vec)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_readonly);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(5, 421, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_vec = ((struct PyPetscVecObject *)values[0]);
    if (values[1]) {
      __pyx_v_readonly = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_readonly == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 421, __pyx_L3_error)
    } else {
      __pyx_v_readonly = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 421, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(5, 421, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer___cinit__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self), __pyx_v_vec, __pyx_v_readonly);

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

static int __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer___cinit__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec, int __pyx_v_readonly) {
  Vec __pyx_v_v;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Vec __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/petscvec.pxi":422
 * 
 *     def __cinit__(self, Vec vec not None, bint readonly=0):
 *         cdef PetscVec v = vec.vec             # <<<<<<<<<<<<<<
 *         CHKERR( PetscINCREF(<PetscObject*>&v) )
 *         self.vec = v
 */
  __pyx_t_1 = __pyx_v_vec->vec;
  __pyx_v_v = __pyx_t_1;

  /* "PETSc/petscvec.pxi":423
 *     def __cinit__(self, Vec vec not None, bint readonly=0):
 *         cdef PetscVec v = vec.vec
 *         CHKERR( PetscINCREF(<PetscObject*>&v) )             # <<<<<<<<<<<<<<
 *         self.vec = v
 *         self.size = 0
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_PetscINCREF(((PetscObject *)(&__pyx_v_v)))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 423, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":424
 *         cdef PetscVec v = vec.vec
 *         CHKERR( PetscINCREF(<PetscObject*>&v) )
 *         self.vec = v             # <<<<<<<<<<<<<<
 *         self.size = 0
 *         self.data = NULL
 */
  __pyx_v_self->vec = __pyx_v_v;

  /* "PETSc/petscvec.pxi":425
 *         CHKERR( PetscINCREF(<PetscObject*>&v) )
 *         self.vec = v
 *         self.size = 0             # <<<<<<<<<<<<<<
 *         self.data = NULL
 *         self.readonly = 1 if readonly else 0
 */
  __pyx_v_self->size = 0;

  /* "PETSc/petscvec.pxi":426
 *         self.vec = v
 *         self.size = 0
 *         self.data = NULL             # <<<<<<<<<<<<<<
 *         self.readonly = 1 if readonly else 0
 *         self.hasarray = 0
 */
  __pyx_v_self->data = NULL;

  /* "PETSc/petscvec.pxi":427
 *         self.size = 0
 *         self.data = NULL
 *         self.readonly = 1 if readonly else 0             # <<<<<<<<<<<<<<
 *         self.hasarray = 0
 * 
 */
  if ((__pyx_v_readonly != 0)) {
    __pyx_t_3 = 1;
  } else {
    __pyx_t_3 = 0;
  }
  __pyx_v_self->readonly = __pyx_t_3;

  /* "PETSc/petscvec.pxi":428
 *         self.data = NULL
 *         self.readonly = 1 if readonly else 0
 *         self.hasarray = 0             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->hasarray = 0;

  /* "PETSc/petscvec.pxi":421
 *     cdef bint hasarray
 * 
 *     def __cinit__(self, Vec vec not None, bint readonly=0):             # <<<<<<<<<<<<<<
 *         cdef PetscVec v = vec.vec
 *         CHKERR( PetscINCREF(<PetscObject*>&v) )
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":430
 *         self.hasarray = 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.hasarray and self.vec != NULL:
 *             Vec_ReleaseArray(self.vec, &self.data, self.readonly)
 */

/* Python wrapper */
static void __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_2__dealloc__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self));

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

static void __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_2__dealloc__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "PETSc/petscvec.pxi":431
 * 
 *     def __dealloc__(self):
 *         if self.hasarray and self.vec != NULL:             # <<<<<<<<<<<<<<
 *             Vec_ReleaseArray(self.vec, &self.data, self.readonly)
 *         CHKERR( VecDestroy(&self.vec) )
 */
  __pyx_t_2 = (__pyx_v_self->hasarray != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_self->vec != NULL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PETSc/petscvec.pxi":432
 *     def __dealloc__(self):
 *         if self.hasarray and self.vec != NULL:
 *             Vec_ReleaseArray(self.vec, &self.data, self.readonly)             # <<<<<<<<<<<<<<
 *         CHKERR( VecDestroy(&self.vec) )
 * 
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_Vec_ReleaseArray(__pyx_v_self->vec, (&__pyx_v_self->data), __pyx_v_self->readonly); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(5, 432, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":431
 * 
 *     def __dealloc__(self):
 *         if self.hasarray and self.vec != NULL:             # <<<<<<<<<<<<<<
 *             Vec_ReleaseArray(self.vec, &self.data, self.readonly)
 *         CHKERR( VecDestroy(&self.vec) )
 */
  }

  /* "PETSc/petscvec.pxi":433
 *         if self.hasarray and self.vec != NULL:
 *             Vec_ReleaseArray(self.vec, &self.data, self.readonly)
 *         CHKERR( VecDestroy(&self.vec) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecDestroy((&__pyx_v_self->vec))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(5, 433, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":430
 *         self.hasarray = 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.hasarray and self.vec != NULL:
 *             Vec_ReleaseArray(self.vec, &self.data, self.readonly)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("petsc4py.PETSc._Vec_buffer.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PETSc/petscvec.pxi":437
 *     #
 * 
 *     cdef int acquire(self) nogil except -1:             # <<<<<<<<<<<<<<
 *         if not self.hasarray and self.vec != NULL:
 *             CHKERR( VecGetLocalSize(self.vec, &self.size) )
 */

static int __pyx_f_8petsc4py_5PETSc_11_Vec_buffer_acquire(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "PETSc/petscvec.pxi":438
 * 
 *     cdef int acquire(self) nogil except -1:
 *         if not self.hasarray and self.vec != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( VecGetLocalSize(self.vec, &self.size) )
 *             Vec_AcquireArray(self.vec, &self.data, self.readonly)
 */
  __pyx_t_2 = ((!(__pyx_v_self->hasarray != 0)) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_self->vec != NULL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PETSc/petscvec.pxi":439
 *     cdef int acquire(self) nogil except -1:
 *         if not self.hasarray and self.vec != NULL:
 *             CHKERR( VecGetLocalSize(self.vec, &self.size) )             # <<<<<<<<<<<<<<
 *             Vec_AcquireArray(self.vec, &self.data, self.readonly)
 *             self.hasarray = 1
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetLocalSize(__pyx_v_self->vec, (&__pyx_v_self->size))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(5, 439, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":440
 *         if not self.hasarray and self.vec != NULL:
 *             CHKERR( VecGetLocalSize(self.vec, &self.size) )
 *             Vec_AcquireArray(self.vec, &self.data, self.readonly)             # <<<<<<<<<<<<<<
 *             self.hasarray = 1
 *         return 0
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_Vec_AcquireArray(__pyx_v_self->vec, (&__pyx_v_self->data), __pyx_v_self->readonly); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(5, 440, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":441
 *             CHKERR( VecGetLocalSize(self.vec, &self.size) )
 *             Vec_AcquireArray(self.vec, &self.data, self.readonly)
 *             self.hasarray = 1             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_v_self->hasarray = 1;

    /* "PETSc/petscvec.pxi":438
 * 
 *     cdef int acquire(self) nogil except -1:
 *         if not self.hasarray and self.vec != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( VecGetLocalSize(self.vec, &self.size) )
 *             Vec_AcquireArray(self.vec, &self.data, self.readonly)
 */
  }

  /* "PETSc/petscvec.pxi":442
 *             Vec_AcquireArray(self.vec, &self.data, self.readonly)
 *             self.hasarray = 1
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int release(self) nogil except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":437
 *     #
 * 
 *     cdef int acquire(self) nogil except -1:             # <<<<<<<<<<<<<<
 *         if not self.hasarray and self.vec != NULL:
 *             CHKERR( VecGetLocalSize(self.vec, &self.size) )
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.acquire", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":444
 *         return 0
 * 
 *     cdef int release(self) nogil except -1:             # <<<<<<<<<<<<<<
 *         if self.hasarray and self.vec != NULL:
 *             self.size = 0
 */

static int __pyx_f_8petsc4py_5PETSc_11_Vec_buffer_release(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "PETSc/petscvec.pxi":445
 * 
 *     cdef int release(self) nogil except -1:
 *         if self.hasarray and self.vec != NULL:             # <<<<<<<<<<<<<<
 *             self.size = 0
 *             Vec_ReleaseArray(self.vec, &self.data, self.readonly)
 */
  __pyx_t_2 = (__pyx_v_self->hasarray != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_self->vec != NULL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PETSc/petscvec.pxi":446
 *     cdef int release(self) nogil except -1:
 *         if self.hasarray and self.vec != NULL:
 *             self.size = 0             # <<<<<<<<<<<<<<
 *             Vec_ReleaseArray(self.vec, &self.data, self.readonly)
 *             self.hasarray = 0
 */
    __pyx_v_self->size = 0;

    /* "PETSc/petscvec.pxi":447
 *         if self.hasarray and self.vec != NULL:
 *             self.size = 0
 *             Vec_ReleaseArray(self.vec, &self.data, self.readonly)             # <<<<<<<<<<<<<<
 *             self.hasarray = 0
 *         return 0
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_Vec_ReleaseArray(__pyx_v_self->vec, (&__pyx_v_self->data), __pyx_v_self->readonly); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(5, 447, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":448
 *             self.size = 0
 *             Vec_ReleaseArray(self.vec, &self.data, self.readonly)
 *             self.hasarray = 0             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_v_self->hasarray = 0;

    /* "PETSc/petscvec.pxi":445
 * 
 *     cdef int release(self) nogil except -1:
 *         if self.hasarray and self.vec != NULL:             # <<<<<<<<<<<<<<
 *             self.size = 0
 *             Vec_ReleaseArray(self.vec, &self.data, self.readonly)
 */
  }

  /* "PETSc/petscvec.pxi":449
 *             Vec_ReleaseArray(self.vec, &self.data, self.readonly)
 *             self.hasarray = 0
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # buffer interface (PEP 3118)
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":444
 *         return 0
 * 
 *     cdef int release(self) nogil except -1:             # <<<<<<<<<<<<<<
 *         if self.hasarray and self.vec != NULL:
 *             self.size = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.release", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":453
 *     # buffer interface (PEP 3118)
 * 
 *     cdef int acquirebuffer(self, Py_buffer *view, int flags) except -1:             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         PyPetscBuffer_FillInfo(view, <void*>self.data, self.size,
 */

static int __pyx_f_8petsc4py_5PETSc_11_Vec_buffer_acquirebuffer(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("acquirebuffer", 0);

  /* "PETSc/petscvec.pxi":454
 * 
 *     cdef int acquirebuffer(self, Py_buffer *view, int flags) except -1:
 *         self.acquire()             # <<<<<<<<<<<<<<
 *         PyPetscBuffer_FillInfo(view, <void*>self.data, self.size,
 *                                c's', self.readonly, flags)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->__pyx_vtab)->acquire(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(5, 454, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":455
 *     cdef int acquirebuffer(self, Py_buffer *view, int flags) except -1:
 *         self.acquire()
 *         PyPetscBuffer_FillInfo(view, <void*>self.data, self.size,             # <<<<<<<<<<<<<<
 *                                c's', self.readonly, flags)
 *         view.obj = self
 */
  __pyx_t_1 = PyPetscBuffer_FillInfo(__pyx_v_view, ((void *)__pyx_v_self->data), __pyx_v_self->size, 's', __pyx_v_self->readonly, __pyx_v_flags); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(5, 455, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":457
 *         PyPetscBuffer_FillInfo(view, <void*>self.data, self.size,
 *                                c's', self.readonly, flags)
 *         view.obj = self             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_view->obj);
  __Pyx_DECREF(__pyx_v_view->obj);
  __pyx_v_view->obj = ((PyObject *)__pyx_v_self);

  /* "PETSc/petscvec.pxi":458
 *                                c's', self.readonly, flags)
 *         view.obj = self
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int releasebuffer(self, Py_buffer *view) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":453
 *     # buffer interface (PEP 3118)
 * 
 *     cdef int acquirebuffer(self, Py_buffer *view, int flags) except -1:             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         PyPetscBuffer_FillInfo(view, <void*>self.data, self.size,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.acquirebuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":460
 *         return 0
 * 
 *     cdef int releasebuffer(self, Py_buffer *view) except -1:             # <<<<<<<<<<<<<<
 *         PyPetscBuffer_Release(view)
 *         self.release()
 */

static int __pyx_f_8petsc4py_5PETSc_11_Vec_buffer_releasebuffer(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_buffer *__pyx_v_view) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("releasebuffer", 0);

  /* "PETSc/petscvec.pxi":461
 * 
 *     cdef int releasebuffer(self, Py_buffer *view) except -1:
 *         PyPetscBuffer_Release(view)             # <<<<<<<<<<<<<<
 *         self.release()
 *         return 0
 */
  PyPetscBuffer_Release(__pyx_v_view);

  /* "PETSc/petscvec.pxi":462
 *     cdef int releasebuffer(self, Py_buffer *view) except -1:
 *         PyPetscBuffer_Release(view)
 *         self.release()             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->__pyx_vtab)->release(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(5, 462, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":463
 *         PyPetscBuffer_Release(view)
 *         self.release()
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":460
 *         return 0
 * 
 *     cdef int releasebuffer(self, Py_buffer *view) except -1:             # <<<<<<<<<<<<<<
 *         PyPetscBuffer_Release(view)
 *         self.release()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.releasebuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":465
 *         return 0
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):             # <<<<<<<<<<<<<<
 *         self.acquirebuffer(view, flags)
 * 
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_5__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_5__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_4__getbuffer__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self), ((Py_buffer *)__pyx_v_view), ((int)__pyx_v_flags));

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

static int __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_4__getbuffer__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_view != NULL) {
    __pyx_v_view->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_view->obj);
  }

  /* "PETSc/petscvec.pxi":466
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):
 *         self.acquirebuffer(view, flags)             # <<<<<<<<<<<<<<
 * 
 *     def __releasebuffer__(self, Py_buffer *view):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->__pyx_vtab)->acquirebuffer(__pyx_v_self, __pyx_v_view, __pyx_v_flags); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(5, 466, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":465
 *         return 0
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):             # <<<<<<<<<<<<<<
 *         self.acquirebuffer(view, flags)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_view != NULL && __pyx_v_view->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_view->obj);
    __Pyx_DECREF(__pyx_v_view->obj); __pyx_v_view->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_view != NULL && __pyx_v_view->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_view->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":468
 *         self.acquirebuffer(view, flags)
 * 
 *     def __releasebuffer__(self, Py_buffer *view):             # <<<<<<<<<<<<<<
 *         self.releasebuffer(view)
 * 
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_7__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view); /*proto*/
static CYTHON_UNUSED void __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_7__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_6__releasebuffer__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self), ((Py_buffer *)__pyx_v_view));

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

static void __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_6__releasebuffer__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_buffer *__pyx_v_view) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "PETSc/petscvec.pxi":469
 * 
 *     def __releasebuffer__(self, Py_buffer *view):
 *         self.releasebuffer(view)             # <<<<<<<<<<<<<<
 * 
 *     # 'with' statement (PEP 343)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->__pyx_vtab)->releasebuffer(__pyx_v_self, __pyx_v_view); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(5, 469, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":468
 *         self.acquirebuffer(view, flags)
 * 
 *     def __releasebuffer__(self, Py_buffer *view):             # <<<<<<<<<<<<<<
 *         self.releasebuffer(view)
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("petsc4py.PETSc._Vec_buffer.__releasebuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PETSc/petscvec.pxi":473
 *     # 'with' statement (PEP 343)
 * 
 *     cdef object enter(self):             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         return asarray(self)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_11_Vec_buffer_enter(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("enter", 0);

  /* "PETSc/petscvec.pxi":474
 * 
 *     cdef object enter(self):
 *         self.acquire()             # <<<<<<<<<<<<<<
 *         return asarray(self)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->__pyx_vtab)->acquire(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(5, 474, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":475
 *     cdef object enter(self):
 *         self.acquire()
 *         return asarray(self)             # <<<<<<<<<<<<<<
 * 
 *     cdef object exit(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_asarray(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":473
 *     # 'with' statement (PEP 343)
 * 
 *     cdef object enter(self):             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         return asarray(self)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.enter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":477
 *         return asarray(self)
 * 
 *     cdef object exit(self):             # <<<<<<<<<<<<<<
 *         self.release()
 *         return None
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_11_Vec_buffer_exit(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("exit", 0);

  /* "PETSc/petscvec.pxi":478
 * 
 *     cdef object exit(self):
 *         self.release()             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->__pyx_vtab)->release(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(5, 478, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":479
 *     cdef object exit(self):
 *         self.release()
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":477
 *         return asarray(self)
 * 
 *     cdef object exit(self):             # <<<<<<<<<<<<<<
 *         self.release()
 *         return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.exit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":481
 *         return None
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self.enter()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_9__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11_Vec_buffer_8__enter__[] = "_Vec_buffer.__enter__(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_9__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_8__enter__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_8__enter__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "PETSc/petscvec.pxi":482
 * 
 *     def __enter__(self):
 *         return self.enter()             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *exc):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->__pyx_vtab)->enter(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":481
 *         return None
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self.enter()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":484
 *         return self.enter()
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         return self.exit()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_11__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11_Vec_buffer_10__exit__[] = "_Vec_buffer.__exit__(self, *exc)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_11__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_exc = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_10__exit__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self), __pyx_v_exc);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_10__exit__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "PETSc/petscvec.pxi":485
 * 
 *     def __exit__(self, *exc):
 *         return self.exit()             # <<<<<<<<<<<<<<
 * 
 *     # buffer interface (legacy)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->__pyx_vtab)->exit(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":484
 *         return self.enter()
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         return self.exit()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":489
 *     # buffer interface (legacy)
 * 
 *     cdef Py_ssize_t getbuffer(self, void **p) except -1:             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         if p != NULL:
 */

static Py_ssize_t __pyx_f_8petsc4py_5PETSc_11_Vec_buffer_getbuffer(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, void **__pyx_v_p) {
  PetscInt __pyx_v_n;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscInt __pyx_t_3;
  __Pyx_RefNannySetupContext("getbuffer", 0);

  /* "PETSc/petscvec.pxi":490
 * 
 *     cdef Py_ssize_t getbuffer(self, void **p) except -1:
 *         cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *         if p != NULL:
 *             self.acquire()
 */
  __pyx_v_n = 0;

  /* "PETSc/petscvec.pxi":491
 *     cdef Py_ssize_t getbuffer(self, void **p) except -1:
 *         cdef PetscInt n = 0
 *         if p != NULL:             # <<<<<<<<<<<<<<
 *             self.acquire()
 *             p[0] = <void*>self.data
 */
  __pyx_t_1 = ((__pyx_v_p != NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscvec.pxi":492
 *         cdef PetscInt n = 0
 *         if p != NULL:
 *             self.acquire()             # <<<<<<<<<<<<<<
 *             p[0] = <void*>self.data
 *             n = self.size
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->__pyx_vtab)->acquire(__pyx_v_self); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 492, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":493
 *         if p != NULL:
 *             self.acquire()
 *             p[0] = <void*>self.data             # <<<<<<<<<<<<<<
 *             n = self.size
 *         elif self.vec != NULL:
 */
    (__pyx_v_p[0]) = ((void *)__pyx_v_self->data);

    /* "PETSc/petscvec.pxi":494
 *             self.acquire()
 *             p[0] = <void*>self.data
 *             n = self.size             # <<<<<<<<<<<<<<
 *         elif self.vec != NULL:
 *             CHKERR( VecGetLocalSize(self.vec, &n) )
 */
    __pyx_t_3 = __pyx_v_self->size;
    __pyx_v_n = __pyx_t_3;

    /* "PETSc/petscvec.pxi":491
 *     cdef Py_ssize_t getbuffer(self, void **p) except -1:
 *         cdef PetscInt n = 0
 *         if p != NULL:             # <<<<<<<<<<<<<<
 *             self.acquire()
 *             p[0] = <void*>self.data
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscvec.pxi":495
 *             p[0] = <void*>self.data
 *             n = self.size
 *         elif self.vec != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( VecGetLocalSize(self.vec, &n) )
 *         return <Py_ssize_t>(<size_t>n*sizeof(PetscScalar))
 */
  __pyx_t_1 = ((__pyx_v_self->vec != NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscvec.pxi":496
 *             n = self.size
 *         elif self.vec != NULL:
 *             CHKERR( VecGetLocalSize(self.vec, &n) )             # <<<<<<<<<<<<<<
 *         return <Py_ssize_t>(<size_t>n*sizeof(PetscScalar))
 * 
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetLocalSize(__pyx_v_self->vec, (&__pyx_v_n))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 496, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":495
 *             p[0] = <void*>self.data
 *             n = self.size
 *         elif self.vec != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( VecGetLocalSize(self.vec, &n) )
 *         return <Py_ssize_t>(<size_t>n*sizeof(PetscScalar))
 */
  }
  __pyx_L3:;

  /* "PETSc/petscvec.pxi":497
 *         elif self.vec != NULL:
 *             CHKERR( VecGetLocalSize(self.vec, &n) )
 *         return <Py_ssize_t>(<size_t>n*sizeof(PetscScalar))             # <<<<<<<<<<<<<<
 * 
 *     def __getsegcount__(self, Py_ssize_t *lenp):
 */
  __pyx_r = ((Py_ssize_t)(((size_t)__pyx_v_n) * (sizeof(PetscScalar))));
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":489
 *     # buffer interface (legacy)
 * 
 *     cdef Py_ssize_t getbuffer(self, void **p) except -1:             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         if p != NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.getbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1L;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":499
 *         return <Py_ssize_t>(<size_t>n*sizeof(PetscScalar))
 * 
 *     def __getsegcount__(self, Py_ssize_t *lenp):             # <<<<<<<<<<<<<<
 *         if lenp != NULL:
 *             lenp[0] = self.getbuffer(NULL)
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_13__getsegcount__(PyObject *__pyx_v_self, Py_ssize_t *__pyx_v_lenp); /*proto*/
static Py_ssize_t __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_13__getsegcount__(PyObject *__pyx_v_self, Py_ssize_t *__pyx_v_lenp) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getsegcount__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_12__getsegcount__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self), ((Py_ssize_t *)__pyx_v_lenp));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_12__getsegcount__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_ssize_t *__pyx_v_lenp) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  __Pyx_RefNannySetupContext("__getsegcount__", 0);

  /* "PETSc/petscvec.pxi":500
 * 
 *     def __getsegcount__(self, Py_ssize_t *lenp):
 *         if lenp != NULL:             # <<<<<<<<<<<<<<
 *             lenp[0] = self.getbuffer(NULL)
 *         return 1
 */
  __pyx_t_1 = ((__pyx_v_lenp != NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscvec.pxi":501
 *     def __getsegcount__(self, Py_ssize_t *lenp):
 *         if lenp != NULL:
 *             lenp[0] = self.getbuffer(NULL)             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->__pyx_vtab)->getbuffer(__pyx_v_self, NULL); if (unlikely(__pyx_t_2 == -1L)) __PYX_ERR(5, 501, __pyx_L1_error)
    (__pyx_v_lenp[0]) = __pyx_t_2;

    /* "PETSc/petscvec.pxi":500
 * 
 *     def __getsegcount__(self, Py_ssize_t *lenp):
 *         if lenp != NULL:             # <<<<<<<<<<<<<<
 *             lenp[0] = self.getbuffer(NULL)
 *         return 1
 */
  }

  /* "PETSc/petscvec.pxi":502
 *         if lenp != NULL:
 *             lenp[0] = self.getbuffer(NULL)
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     def __getreadbuffer__(self, Py_ssize_t idx, void **p):
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":499
 *         return <Py_ssize_t>(<size_t>n*sizeof(PetscScalar))
 * 
 *     def __getsegcount__(self, Py_ssize_t *lenp):             # <<<<<<<<<<<<<<
 *         if lenp != NULL:
 *             lenp[0] = self.getbuffer(NULL)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.__getsegcount__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "PETSc/petscvec.pxi":504
 *         return 1
 * 
 *     def __getreadbuffer__(self, Py_ssize_t idx, void **p):             # <<<<<<<<<<<<<<
 *         if idx != 0: raise SystemError(
 *             "accessing non-existent buffer segment")
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_15__getreadbuffer__(PyObject *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p); /*proto*/
static Py_ssize_t __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_15__getreadbuffer__(PyObject *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getreadbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_14__getreadbuffer__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self), ((Py_ssize_t)__pyx_v_idx), ((void **)__pyx_v_p));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_14__getreadbuffer__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  __Pyx_RefNannySetupContext("__getreadbuffer__", 0);

  /* "PETSc/petscvec.pxi":505
 * 
 *     def __getreadbuffer__(self, Py_ssize_t idx, void **p):
 *         if idx != 0: raise SystemError(             # <<<<<<<<<<<<<<
 *             "accessing non-existent buffer segment")
 *         return self.getbuffer(p)
 */
  __pyx_t_1 = ((__pyx_v_idx != 0) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_SystemError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 505, __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(5, 505, __pyx_L1_error)
  }

  /* "PETSc/petscvec.pxi":507
 *         if idx != 0: raise SystemError(
 *             "accessing non-existent buffer segment")
 *         return self.getbuffer(p)             # <<<<<<<<<<<<<<
 * 
 *     def __getwritebuffer__(self, Py_ssize_t idx, void **p):
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->__pyx_vtab)->getbuffer(__pyx_v_self, __pyx_v_p); if (unlikely(__pyx_t_3 == -1L)) __PYX_ERR(5, 507, __pyx_L1_error)
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":504
 *         return 1
 * 
 *     def __getreadbuffer__(self, Py_ssize_t idx, void **p):             # <<<<<<<<<<<<<<
 *         if idx != 0: raise SystemError(
 *             "accessing non-existent buffer segment")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.__getreadbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "PETSc/petscvec.pxi":509
 *         return self.getbuffer(p)
 * 
 *     def __getwritebuffer__(self, Py_ssize_t idx, void **p):             # <<<<<<<<<<<<<<
 *         if idx != 0: raise SystemError(
 *             "accessing non-existent buffer segment")
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_17__getwritebuffer__(PyObject *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p); /*proto*/
static Py_ssize_t __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_17__getwritebuffer__(PyObject *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getwritebuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_16__getwritebuffer__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self), ((Py_ssize_t)__pyx_v_idx), ((void **)__pyx_v_p));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static Py_ssize_t __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_16__getwritebuffer__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  __Pyx_RefNannySetupContext("__getwritebuffer__", 0);

  /* "PETSc/petscvec.pxi":510
 * 
 *     def __getwritebuffer__(self, Py_ssize_t idx, void **p):
 *         if idx != 0: raise SystemError(             # <<<<<<<<<<<<<<
 *             "accessing non-existent buffer segment")
 *         if self.readonly: raise TypeError(
 */
  __pyx_t_1 = ((__pyx_v_idx != 0) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_SystemError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 510, __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(5, 510, __pyx_L1_error)
  }

  /* "PETSc/petscvec.pxi":512
 *         if idx != 0: raise SystemError(
 *             "accessing non-existent buffer segment")
 *         if self.readonly: raise TypeError(             # <<<<<<<<<<<<<<
 *             "Object is not writable.")
 *         return self.getbuffer(p)
 */
  __pyx_t_1 = (__pyx_v_self->readonly != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 512, __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(5, 512, __pyx_L1_error)
  }

  /* "PETSc/petscvec.pxi":514
 *         if self.readonly: raise TypeError(
 *             "Object is not writable.")
 *         return self.getbuffer(p)             # <<<<<<<<<<<<<<
 * 
 *     # NumPy array interface (legacy)
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->__pyx_vtab)->getbuffer(__pyx_v_self, __pyx_v_p); if (unlikely(__pyx_t_3 == -1L)) __PYX_ERR(5, 514, __pyx_L1_error)
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":509
 *         return self.getbuffer(p)
 * 
 *     def __getwritebuffer__(self, Py_ssize_t idx, void **p):             # <<<<<<<<<<<<<<
 *         if idx != 0: raise SystemError(
 *             "accessing non-existent buffer segment")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.__getwritebuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "PETSc/petscvec.pxi":519
 * 
 *     property __array_interface__:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef PetscInt n = 0
 *             if self.vec != NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_19__array_interface___1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_19__array_interface___1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_19__array_interface_____get__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_11_Vec_buffer_19__array_interface_____get__(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_self) {
  PetscInt __pyx_v_n;
  PyObject *__pyx_v_size = 0;
  PyArray_Descr *__pyx_v_descr = 0;
  PyObject *__pyx_v_typestr = 0;
  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;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/petscvec.pxi":520
 *     property __array_interface__:
 *         def __get__(self):
 *             cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *             if self.vec != NULL:
 *                 CHKERR( VecGetLocalSize(self.vec, &n) )
 */
  __pyx_v_n = 0;

  /* "PETSc/petscvec.pxi":521
 *         def __get__(self):
 *             cdef PetscInt n = 0
 *             if self.vec != NULL:             # <<<<<<<<<<<<<<
 *                 CHKERR( VecGetLocalSize(self.vec, &n) )
 *             cdef object size = toInt(n)
 */
  __pyx_t_1 = ((__pyx_v_self->vec != NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscvec.pxi":522
 *             cdef PetscInt n = 0
 *             if self.vec != NULL:
 *                 CHKERR( VecGetLocalSize(self.vec, &n) )             # <<<<<<<<<<<<<<
 *             cdef object size = toInt(n)
 *             cdef dtype descr = PyArray_DescrFromType(NPY_PETSC_SCALAR)
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetLocalSize(__pyx_v_self->vec, (&__pyx_v_n))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 522, __pyx_L1_error)

    /* "PETSc/petscvec.pxi":521
 *         def __get__(self):
 *             cdef PetscInt n = 0
 *             if self.vec != NULL:             # <<<<<<<<<<<<<<
 *                 CHKERR( VecGetLocalSize(self.vec, &n) )
 *             cdef object size = toInt(n)
 */
  }

  /* "PETSc/petscvec.pxi":523
 *             if self.vec != NULL:
 *                 CHKERR( VecGetLocalSize(self.vec, &n) )
 *             cdef object size = toInt(n)             # <<<<<<<<<<<<<<
 *             cdef dtype descr = PyArray_DescrFromType(NPY_PETSC_SCALAR)
 *             cdef str typestr = "=%c%d" % (descr.kind, descr.itemsize)
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_size = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/petscvec.pxi":524
 *                 CHKERR( VecGetLocalSize(self.vec, &n) )
 *             cdef object size = toInt(n)
 *             cdef dtype descr = PyArray_DescrFromType(NPY_PETSC_SCALAR)             # <<<<<<<<<<<<<<
 *             cdef str typestr = "=%c%d" % (descr.kind, descr.itemsize)
 *             return dict(version=3,
 */
  __pyx_t_3 = ((PyObject *)PyArray_DescrFromType(NPY_PETSC_SCALAR)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscvec.pxi":525
 *             cdef object size = toInt(n)
 *             cdef dtype descr = PyArray_DescrFromType(NPY_PETSC_SCALAR)
 *             cdef str typestr = "=%c%d" % (descr.kind, descr.itemsize)             # <<<<<<<<<<<<<<
 *             return dict(version=3,
 *                         data=self,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_descr), __pyx_n_s_kind); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_descr), __pyx_n_s_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 525, __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_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_c_d, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_4))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(5, 525, __pyx_L1_error)
  __pyx_v_typestr = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/petscvec.pxi":526
 *             cdef dtype descr = PyArray_DescrFromType(NPY_PETSC_SCALAR)
 *             cdef str typestr = "=%c%d" % (descr.kind, descr.itemsize)
 *             return dict(version=3,             # <<<<<<<<<<<<<<
 *                         data=self,
 *                         shape=(size,),
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_version, __pyx_int_3) < 0) __PYX_ERR(5, 526, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":527
 *             cdef str typestr = "=%c%d" % (descr.kind, descr.itemsize)
 *             return dict(version=3,
 *                         data=self,             # <<<<<<<<<<<<<<
 *                         shape=(size,),
 *                         typestr=typestr)
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_data, ((PyObject *)__pyx_v_self)) < 0) __PYX_ERR(5, 526, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":528
 *             return dict(version=3,
 *                         data=self,
 *                         shape=(size,),             # <<<<<<<<<<<<<<
 *                         typestr=typestr)
 * 
 */
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_size);
  __Pyx_GIVEREF(__pyx_v_size);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_size);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_shape, __pyx_t_5) < 0) __PYX_ERR(5, 526, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/petscvec.pxi":529
 *                         data=self,
 *                         shape=(size,),
 *                         typestr=typestr)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_typestr, __pyx_v_typestr) < 0) __PYX_ERR(5, 526, __pyx_L1_error)
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":519
 * 
 *     property __array_interface__:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef PetscInt n = 0
 *             if self.vec != NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_buffer.__array_interface__.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_size);
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_XDECREF(__pyx_v_typestr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":540
 *     cdef Vec lvec
 * 
 *     def __init__(self, Vec gvec not None):             # <<<<<<<<<<<<<<
 *         self.gvec = gvec
 *         self.lvec = Vec()
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_14_Vec_LocalForm_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_14_Vec_LocalForm_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_gvec = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gvec,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);
        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_gvec)) != 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(5, 540, __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_gvec = ((struct PyPetscVecObject *)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(5, 540, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_LocalForm.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gvec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "gvec", 0))) __PYX_ERR(5, 540, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_14_Vec_LocalForm___init__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *)__pyx_v_self), __pyx_v_gvec);

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

static int __pyx_pf_8petsc4py_5PETSc_14_Vec_LocalForm___init__(struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *__pyx_v_self, struct PyPetscVecObject *__pyx_v_gvec) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "PETSc/petscvec.pxi":541
 * 
 *     def __init__(self, Vec gvec not None):
 *         self.gvec = gvec             # <<<<<<<<<<<<<<
 *         self.lvec = Vec()
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_gvec));
  __Pyx_GOTREF(__pyx_v_self->gvec);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->gvec));
  __pyx_v_self->gvec = __pyx_v_gvec;

  /* "PETSc/petscvec.pxi":542
 *     def __init__(self, Vec gvec not None):
 *         self.gvec = gvec
 *         self.lvec = Vec()             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->lvec);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->lvec));
  __pyx_v_self->lvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscvec.pxi":540
 *     cdef Vec lvec
 * 
 *     def __init__(self, Vec gvec not None):             # <<<<<<<<<<<<<<
 *         self.gvec = gvec
 *         self.lvec = Vec()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_LocalForm.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":544
 *         self.lvec = Vec()
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         cdef PetscVec gvec = self.gvec.vec
 *         CHKERR( VecGhostGetLocalForm(gvec, &self.lvec.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_14_Vec_LocalForm_3__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_14_Vec_LocalForm_2__enter__[] = "_Vec_LocalForm.__enter__(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_14_Vec_LocalForm_3__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_14_Vec_LocalForm_2__enter__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_14_Vec_LocalForm_2__enter__(struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *__pyx_v_self) {
  Vec __pyx_v_gvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Vec __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "PETSc/petscvec.pxi":545
 * 
 *     def __enter__(self):
 *         cdef PetscVec gvec = self.gvec.vec             # <<<<<<<<<<<<<<
 *         CHKERR( VecGhostGetLocalForm(gvec, &self.lvec.vec) )
 *         return self.lvec
 */
  __pyx_t_1 = __pyx_v_self->gvec->vec;
  __pyx_v_gvec = __pyx_t_1;

  /* "PETSc/petscvec.pxi":546
 *     def __enter__(self):
 *         cdef PetscVec gvec = self.gvec.vec
 *         CHKERR( VecGhostGetLocalForm(gvec, &self.lvec.vec) )             # <<<<<<<<<<<<<<
 *         return self.lvec
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGhostGetLocalForm(__pyx_v_gvec, (&__pyx_v_self->lvec->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 546, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":547
 *         cdef PetscVec gvec = self.gvec.vec
 *         CHKERR( VecGhostGetLocalForm(gvec, &self.lvec.vec) )
 *         return self.lvec             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *exc):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->lvec));
  __pyx_r = ((PyObject *)__pyx_v_self->lvec);
  goto __pyx_L0;

  /* "PETSc/petscvec.pxi":544
 *         self.lvec = Vec()
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         cdef PetscVec gvec = self.gvec.vec
 *         CHKERR( VecGhostGetLocalForm(gvec, &self.lvec.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_LocalForm.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscvec.pxi":549
 *         return self.lvec
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         cdef PetscVec gvec = self.gvec.vec
 *         CHKERR( VecGhostRestoreLocalForm(gvec, &self.lvec.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_14_Vec_LocalForm_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_14_Vec_LocalForm_4__exit__[] = "_Vec_LocalForm.__exit__(self, *exc)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_14_Vec_LocalForm_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_exc = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_14_Vec_LocalForm_4__exit__(((struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *)__pyx_v_self), __pyx_v_exc);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_14_Vec_LocalForm_4__exit__(struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  Vec __pyx_v_gvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Vec __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "PETSc/petscvec.pxi":550
 * 
 *     def __exit__(self, *exc):
 *         cdef PetscVec gvec = self.gvec.vec             # <<<<<<<<<<<<<<
 *         CHKERR( VecGhostRestoreLocalForm(gvec, &self.lvec.vec) )
 *         self.lvec.vec = NULL
 */
  __pyx_t_1 = __pyx_v_self->gvec->vec;
  __pyx_v_gvec = __pyx_t_1;

  /* "PETSc/petscvec.pxi":551
 *     def __exit__(self, *exc):
 *         cdef PetscVec gvec = self.gvec.vec
 *         CHKERR( VecGhostRestoreLocalForm(gvec, &self.lvec.vec) )             # <<<<<<<<<<<<<<
 *         self.lvec.vec = NULL
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGhostRestoreLocalForm(__pyx_v_gvec, (&__pyx_v_self->lvec->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 551, __pyx_L1_error)

  /* "PETSc/petscvec.pxi":552
 *         cdef PetscVec gvec = self.gvec.vec
 *         CHKERR( VecGhostRestoreLocalForm(gvec, &self.lvec.vec) )
 *         self.lvec.vec = NULL             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_v_self->lvec->vec = NULL;

  /* "PETSc/petscvec.pxi":549
 *         return self.lvec
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         cdef PetscVec gvec = self.gvec.vec
 *         CHKERR( VecGhostRestoreLocalForm(gvec, &self.lvec.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Vec_LocalForm.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":412
 *     int MatGetNearNullSpace(PetscMat,PetscNullSpace*)
 * 
 * cdef inline NullSpace ref_NullSpace(PetscNullSpace nsp):             # <<<<<<<<<<<<<<
 *     cdef NullSpace ob = <NullSpace> NullSpace()
 *     ob.nsp = nsp
 */

static CYTHON_INLINE struct PyPetscNullSpaceObject *__pyx_f_8petsc4py_5PETSc_ref_NullSpace(MatNullSpace __pyx_v_nsp) {
  struct PyPetscNullSpaceObject *__pyx_v_ob = 0;
  struct PyPetscNullSpaceObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ref_NullSpace", 0);

  /* "PETSc/petscmat.pxi":413
 * 
 * cdef inline NullSpace ref_NullSpace(PetscNullSpace nsp):
 *     cdef NullSpace ob = <NullSpace> NullSpace()             # <<<<<<<<<<<<<<
 *     ob.nsp = nsp
 *     PetscINCREF(ob.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_NullSpace), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ob = ((struct PyPetscNullSpaceObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscmat.pxi":414
 * cdef inline NullSpace ref_NullSpace(PetscNullSpace nsp):
 *     cdef NullSpace ob = <NullSpace> NullSpace()
 *     ob.nsp = nsp             # <<<<<<<<<<<<<<
 *     PetscINCREF(ob.obj)
 *     return ob
 */
  __pyx_v_ob->nsp = __pyx_v_nsp;

  /* "PETSc/petscmat.pxi":415
 *     cdef NullSpace ob = <NullSpace> NullSpace()
 *     ob.nsp = nsp
 *     PetscINCREF(ob.obj)             # <<<<<<<<<<<<<<
 *     return ob
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ob->__pyx_base.obj);

  /* "PETSc/petscmat.pxi":416
 *     ob.nsp = nsp
 *     PetscINCREF(ob.obj)
 *     return ob             # <<<<<<<<<<<<<<
 * 
 * cdef int NullSpace_Function(
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ob));
  __pyx_r = __pyx_v_ob;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":412
 *     int MatGetNearNullSpace(PetscMat,PetscNullSpace*)
 * 
 * cdef inline NullSpace ref_NullSpace(PetscNullSpace nsp):             # <<<<<<<<<<<<<<
 *     cdef NullSpace ob = <NullSpace> NullSpace()
 *     ob.nsp = nsp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.ref_NullSpace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":418
 *     return ob
 * 
 * cdef int NullSpace_Function(             # <<<<<<<<<<<<<<
 *     PetscNullSpace n,
 *     PetscVec       v,
 */

static int __pyx_f_8petsc4py_5PETSc_NullSpace_Function(MatNullSpace __pyx_v_n, Vec __pyx_v_v, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscNullSpaceObject *__pyx_v_nsp = 0;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_v_function = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("NullSpace_Function", 0);

  /* "PETSc/petscmat.pxi":423
 *     void *         ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef NullSpace nsp = ref_NullSpace(n)             # <<<<<<<<<<<<<<
 *     cdef Vec vec = ref_Vec(v)
 *     (function, args, kargs) = nsp.get_attr('__function__')
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_NullSpace(__pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_nsp = ((struct PyPetscNullSpaceObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscmat.pxi":424
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef NullSpace nsp = ref_NullSpace(n)
 *     cdef Vec vec = ref_Vec(v)             # <<<<<<<<<<<<<<
 *     (function, args, kargs) = nsp.get_attr('__function__')
 *     function(nsp, vec, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_v)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscmat.pxi":425
 *     cdef NullSpace nsp = ref_NullSpace(n)
 *     cdef Vec vec = ref_Vec(v)
 *     (function, args, kargs) = nsp.get_attr('__function__')             # <<<<<<<<<<<<<<
 *     function(nsp, vec, *args, **kargs)
 *     return 0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_NullSpace *)__pyx_v_nsp->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_nsp), ((char *)"__function__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 425, __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_CPYTHON
    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(6, 425, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 425, __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(6, 425, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(6, 425, __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(6, 425, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_function = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petscmat.pxi":426
 *     cdef Vec vec = ref_Vec(v)
 *     (function, args, kargs) = nsp.get_attr('__function__')
 *     function(nsp, vec, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_nsp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_nsp));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_nsp));
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vec));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_vec));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(6, 426, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_function, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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;

  /* "PETSc/petscmat.pxi":427
 *     (function, args, kargs) = nsp.get_attr('__function__')
 *     function(nsp, vec, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":418
 *     return ob
 * 
 * cdef int NullSpace_Function(             # <<<<<<<<<<<<<<
 *     PetscNullSpace n,
 *     PetscVec       v,
 */

  /* 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("petsc4py.PETSc.NullSpace_Function", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_nsp);
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":431
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline Mat ref_Mat(PetscMat mat):             # <<<<<<<<<<<<<<
 *     cdef Mat ob = <Mat> Mat()
 *     ob.mat = mat
 */

static CYTHON_INLINE struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_ref_Mat(Mat __pyx_v_mat) {
  struct PyPetscMatObject *__pyx_v_ob = 0;
  struct PyPetscMatObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ref_Mat", 0);

  /* "PETSc/petscmat.pxi":432
 * 
 * cdef inline Mat ref_Mat(PetscMat mat):
 *     cdef Mat ob = <Mat> Mat()             # <<<<<<<<<<<<<<
 *     ob.mat = mat
 *     PetscINCREF(ob.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ob = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscmat.pxi":433
 * cdef inline Mat ref_Mat(PetscMat mat):
 *     cdef Mat ob = <Mat> Mat()
 *     ob.mat = mat             # <<<<<<<<<<<<<<
 *     PetscINCREF(ob.obj)
 *     return ob
 */
  __pyx_v_ob->mat = __pyx_v_mat;

  /* "PETSc/petscmat.pxi":434
 *     cdef Mat ob = <Mat> Mat()
 *     ob.mat = mat
 *     PetscINCREF(ob.obj)             # <<<<<<<<<<<<<<
 *     return ob
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ob->__pyx_base.obj);

  /* "PETSc/petscmat.pxi":435
 *     ob.mat = mat
 *     PetscINCREF(ob.obj)
 *     return ob             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ob));
  __pyx_r = __pyx_v_ob;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":431
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline Mat ref_Mat(PetscMat mat):             # <<<<<<<<<<<<<<
 *     cdef Mat ob = <Mat> Mat()
 *     ob.mat = mat
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.ref_Mat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":441
 * # unary operations
 * 
 * cdef Mat mat_pos(Mat self):             # <<<<<<<<<<<<<<
 *     cdef Mat mat = type(self)()
 *     CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &mat.mat) )
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_pos(struct PyPetscMatObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  struct PyPetscMatObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("mat_pos", 0);

  /* "PETSc/petscmat.pxi":442
 * 
 * cdef Mat mat_pos(Mat self):
 *     cdef Mat mat = type(self)()             # <<<<<<<<<<<<<<
 *     CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &mat.mat) )
 *     return mat
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __pyx_t_2 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 442, __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(6, 442, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(6, 442, __pyx_L1_error)
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscmat.pxi":443
 * cdef Mat mat_pos(Mat self):
 *     cdef Mat mat = type(self)()
 *     CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &mat.mat) )             # <<<<<<<<<<<<<<
 *     return mat
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDuplicate(__pyx_v_self->mat, MAT_COPY_VALUES, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(6, 443, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":444
 *     cdef Mat mat = type(self)()
 *     CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &mat.mat) )
 *     return mat             # <<<<<<<<<<<<<<
 * 
 * cdef Mat mat_neg(Mat self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = __pyx_v_mat;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":441
 * # unary operations
 * 
 * cdef Mat mat_pos(Mat self):             # <<<<<<<<<<<<<<
 *     cdef Mat mat = type(self)()
 *     CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &mat.mat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":446
 *     return mat
 * 
 * cdef Mat mat_neg(Mat self):             # <<<<<<<<<<<<<<
 *     cdef Mat mat = <Mat> mat_pos(self)
 *     CHKERR( MatScale(mat.mat, -1) )
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_neg(struct PyPetscMatObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  struct PyPetscMatObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("mat_neg", 0);

  /* "PETSc/petscmat.pxi":447
 * 
 * cdef Mat mat_neg(Mat self):
 *     cdef Mat mat = <Mat> mat_pos(self)             # <<<<<<<<<<<<<<
 *     CHKERR( MatScale(mat.mat, -1) )
 *     return mat
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_pos(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscmat.pxi":448
 * cdef Mat mat_neg(Mat self):
 *     cdef Mat mat = <Mat> mat_pos(self)
 *     CHKERR( MatScale(mat.mat, -1) )             # <<<<<<<<<<<<<<
 *     return mat
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatScale(__pyx_v_mat->mat, -1.0)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(6, 448, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":449
 *     cdef Mat mat = <Mat> mat_pos(self)
 *     CHKERR( MatScale(mat.mat, -1) )
 *     return mat             # <<<<<<<<<<<<<<
 * 
 * # inplace binary operations
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = __pyx_v_mat;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":446
 *     return mat
 * 
 * cdef Mat mat_neg(Mat self):             # <<<<<<<<<<<<<<
 *     cdef Mat mat = <Mat> mat_pos(self)
 *     CHKERR( MatScale(mat.mat, -1) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_neg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":453
 * # inplace binary operations
 * 
 * cdef Mat mat_iadd(Mat self, other):             # <<<<<<<<<<<<<<
 *     if isinstance(other, Mat):
 *         self.axpy(1, other)
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_iadd(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_alpha = NULL;
  PyObject *__pyx_v_mat = NULL;
  struct PyPetscMatObject *__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;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("mat_iadd", 0);

  /* "PETSc/petscmat.pxi":454
 * 
 * cdef Mat mat_iadd(Mat self, other):
 *     if isinstance(other, Mat):             # <<<<<<<<<<<<<<
 *         self.axpy(1, other)
 *     elif isinstance(other, (tuple, list)):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Mat); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":455
 * cdef Mat mat_iadd(Mat self, other):
 *     if isinstance(other, Mat):
 *         self.axpy(1, other)             # <<<<<<<<<<<<<<
 *     elif isinstance(other, (tuple, list)):
 *         alpha, mat = other
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_axpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_int_1);
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_other);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 455, __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;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/petscmat.pxi":454
 * 
 * cdef Mat mat_iadd(Mat self, other):
 *     if isinstance(other, Mat):             # <<<<<<<<<<<<<<
 *         self.axpy(1, other)
 *     elif isinstance(other, (tuple, list)):
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscmat.pxi":456
 *     if isinstance(other, Mat):
 *         self.axpy(1, other)
 *     elif isinstance(other, (tuple, list)):             # <<<<<<<<<<<<<<
 *         alpha, mat = other
 *         self.axpy(alpha, mat)
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_other); 
  __pyx_t_8 = (__pyx_t_1 != 0);
  if (!__pyx_t_8) {
  } else {
    __pyx_t_2 = __pyx_t_8;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_8 = PyList_Check(__pyx_v_other); 
  __pyx_t_1 = (__pyx_t_8 != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L4_bool_binop_done:;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscmat.pxi":457
 *         self.axpy(1, other)
 *     elif isinstance(other, (tuple, list)):
 *         alpha, mat = other             # <<<<<<<<<<<<<<
 *         self.axpy(alpha, mat)
 *     elif isinstance(other, Vec):
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_other))) || (PyList_CheckExact(__pyx_v_other))) {
      PyObject* sequence = __pyx_v_other;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(6, 457, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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(6, 457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_7), 2) < 0) __PYX_ERR(6, 457, __pyx_L1_error)
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 457, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_alpha = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_mat = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PETSc/petscmat.pxi":458
 *     elif isinstance(other, (tuple, list)):
 *         alpha, mat = other
 *         self.axpy(alpha, mat)             # <<<<<<<<<<<<<<
 *     elif isinstance(other, Vec):
 *         self.setDiagonal(other, PETSC_ADD_VALUES)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_axpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(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);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(__pyx_v_alpha);
    __Pyx_GIVEREF(__pyx_v_alpha);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_alpha);
    __Pyx_INCREF(__pyx_v_mat);
    __Pyx_GIVEREF(__pyx_v_mat);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_mat);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 458, __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_4); __pyx_t_4 = 0;

    /* "PETSc/petscmat.pxi":456
 *     if isinstance(other, Mat):
 *         self.axpy(1, other)
 *     elif isinstance(other, (tuple, list)):             # <<<<<<<<<<<<<<
 *         alpha, mat = other
 *         self.axpy(alpha, mat)
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscmat.pxi":459
 *         alpha, mat = other
 *         self.axpy(alpha, mat)
 *     elif isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *         self.setDiagonal(other, PETSC_ADD_VALUES)
 *     else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":460
 *         self.axpy(alpha, mat)
 *     elif isinstance(other, Vec):
 *         self.setDiagonal(other, PETSC_ADD_VALUES)             # <<<<<<<<<<<<<<
 *     else:
 *         self.shift(other)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setDiagonal); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyInt_From_InsertMode(ADD_VALUES); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(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);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_10 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 460, __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(__pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_6, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_6, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 460, __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_4); __pyx_t_4 = 0;

    /* "PETSc/petscmat.pxi":459
 *         alpha, mat = other
 *         self.axpy(alpha, mat)
 *     elif isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *         self.setDiagonal(other, PETSC_ADD_VALUES)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscmat.pxi":462
 *         self.setDiagonal(other, PETSC_ADD_VALUES)
 *     else:
 *         self.shift(other)             # <<<<<<<<<<<<<<
 *     return self
 * 
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shift); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_other); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 462, __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_INCREF(__pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_other);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 462, __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_4); __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "PETSc/petscmat.pxi":463
 *     else:
 *         self.shift(other)
 *     return self             # <<<<<<<<<<<<<<
 * 
 * cdef Mat mat_isub(Mat self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":453
 * # inplace binary operations
 * 
 * cdef Mat mat_iadd(Mat self, other):             # <<<<<<<<<<<<<<
 *     if isinstance(other, Mat):
 *         self.axpy(1, other)
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_iadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alpha);
  __Pyx_XDECREF(__pyx_v_mat);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":465
 *     return self
 * 
 * cdef Mat mat_isub(Mat self, other):             # <<<<<<<<<<<<<<
 *     if isinstance(other, Mat):
 *         self.axpy(-1, other)
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_isub(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_alpha = NULL;
  PyObject *__pyx_v_mat = NULL;
  PyObject *__pyx_v_diag = NULL;
  struct PyPetscMatObject *__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;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("mat_isub", 0);

  /* "PETSc/petscmat.pxi":466
 * 
 * cdef Mat mat_isub(Mat self, other):
 *     if isinstance(other, Mat):             # <<<<<<<<<<<<<<
 *         self.axpy(-1, other)
 *     elif isinstance(other, (tuple, list)):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Mat); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":467
 * cdef Mat mat_isub(Mat self, other):
 *     if isinstance(other, Mat):
 *         self.axpy(-1, other)             # <<<<<<<<<<<<<<
 *     elif isinstance(other, (tuple, list)):
 *         alpha, mat = other
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_axpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_GIVEREF(__pyx_int_neg_1);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_int_neg_1);
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_other);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 467, __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;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/petscmat.pxi":466
 * 
 * cdef Mat mat_isub(Mat self, other):
 *     if isinstance(other, Mat):             # <<<<<<<<<<<<<<
 *         self.axpy(-1, other)
 *     elif isinstance(other, (tuple, list)):
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscmat.pxi":468
 *     if isinstance(other, Mat):
 *         self.axpy(-1, other)
 *     elif isinstance(other, (tuple, list)):             # <<<<<<<<<<<<<<
 *         alpha, mat = other
 *         self.axpy(-alpha, mat)
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_other); 
  __pyx_t_8 = (__pyx_t_1 != 0);
  if (!__pyx_t_8) {
  } else {
    __pyx_t_2 = __pyx_t_8;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_8 = PyList_Check(__pyx_v_other); 
  __pyx_t_1 = (__pyx_t_8 != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L4_bool_binop_done:;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscmat.pxi":469
 *         self.axpy(-1, other)
 *     elif isinstance(other, (tuple, list)):
 *         alpha, mat = other             # <<<<<<<<<<<<<<
 *         self.axpy(-alpha, mat)
 *     elif isinstance(other, Vec):
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_other))) || (PyList_CheckExact(__pyx_v_other))) {
      PyObject* sequence = __pyx_v_other;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(6, 469, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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(6, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_7), 2) < 0) __PYX_ERR(6, 469, __pyx_L1_error)
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 469, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_alpha = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_mat = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PETSc/petscmat.pxi":470
 *     elif isinstance(other, (tuple, list)):
 *         alpha, mat = other
 *         self.axpy(-alpha, mat)             # <<<<<<<<<<<<<<
 *     elif isinstance(other, Vec):
 *         diag = other.copy()
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_axpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyNumber_Negative(__pyx_v_alpha); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_10 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_6, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_mat);
    __Pyx_GIVEREF(__pyx_v_mat);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_6, __pyx_v_mat);
    __pyx_t_7 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 470, __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_4); __pyx_t_4 = 0;

    /* "PETSc/petscmat.pxi":468
 *     if isinstance(other, Mat):
 *         self.axpy(-1, other)
 *     elif isinstance(other, (tuple, list)):             # <<<<<<<<<<<<<<
 *         alpha, mat = other
 *         self.axpy(-alpha, mat)
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscmat.pxi":471
 *         alpha, mat = other
 *         self.axpy(-alpha, mat)
 *     elif isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *         diag = other.copy()
 *         diag.scale(-1)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":472
 *         self.axpy(-alpha, mat)
 *     elif isinstance(other, Vec):
 *         diag = other.copy()             # <<<<<<<<<<<<<<
 *         diag.scale(-1)
 *         self.setDiagonal(diag, PETSC_ADD_VALUES)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_10) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 472, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 472, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_diag = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "PETSc/petscmat.pxi":473
 *     elif isinstance(other, Vec):
 *         diag = other.copy()
 *         diag.scale(-1)             # <<<<<<<<<<<<<<
 *         self.setDiagonal(diag, PETSC_ADD_VALUES)
 *         diag.destroy()
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_diag, __pyx_n_s_scale); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/petscmat.pxi":474
 *         diag = other.copy()
 *         diag.scale(-1)
 *         self.setDiagonal(diag, PETSC_ADD_VALUES)             # <<<<<<<<<<<<<<
 *         diag.destroy()
 *     else:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setDiagonal); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyInt_From_InsertMode(ADD_VALUES); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(__pyx_v_diag);
    __Pyx_GIVEREF(__pyx_v_diag);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_diag);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 474, __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_3); __pyx_t_3 = 0;

    /* "PETSc/petscmat.pxi":475
 *         diag.scale(-1)
 *         self.setDiagonal(diag, PETSC_ADD_VALUES)
 *         diag.destroy()             # <<<<<<<<<<<<<<
 *     else:
 *         self.shift(other)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_diag, __pyx_n_s_destroy); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 475, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 475, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/petscmat.pxi":471
 *         alpha, mat = other
 *         self.axpy(-alpha, mat)
 *     elif isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *         diag = other.copy()
 *         diag.scale(-1)
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscmat.pxi":477
 *         diag.destroy()
 *     else:
 *         self.shift(other)             # <<<<<<<<<<<<<<
 *     return self
 * 
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shift); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 477, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 477, __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 = NULL;
      __Pyx_INCREF(__pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_other);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "PETSc/petscmat.pxi":478
 *     else:
 *         self.shift(other)
 *     return self             # <<<<<<<<<<<<<<
 * 
 * cdef Mat mat_imul(Mat self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":465
 *     return self
 * 
 * cdef Mat mat_isub(Mat self, other):             # <<<<<<<<<<<<<<
 *     if isinstance(other, Mat):
 *         self.axpy(-1, other)
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_isub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alpha);
  __Pyx_XDECREF(__pyx_v_mat);
  __Pyx_XDECREF(__pyx_v_diag);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":480
 *     return self
 * 
 * cdef Mat mat_imul(Mat self, other):             # <<<<<<<<<<<<<<
 *     if (isinstance(other, tuple) or
 *         isinstance(other, list)):
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_imul(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_L = NULL;
  PyObject *__pyx_v_R = NULL;
  struct PyPetscMatObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("mat_imul", 0);

  /* "PETSc/petscmat.pxi":481
 * 
 * cdef Mat mat_imul(Mat self, other):
 *     if (isinstance(other, tuple) or             # <<<<<<<<<<<<<<
 *         isinstance(other, list)):
 *         L, R = other
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "PETSc/petscmat.pxi":482
 * cdef Mat mat_imul(Mat self, other):
 *     if (isinstance(other, tuple) or
 *         isinstance(other, list)):             # <<<<<<<<<<<<<<
 *         L, R = other
 *         self.diagonalScale(L, R)
 */
  __pyx_t_3 = PyList_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "PETSc/petscmat.pxi":481
 * 
 * cdef Mat mat_imul(Mat self, other):
 *     if (isinstance(other, tuple) or             # <<<<<<<<<<<<<<
 *         isinstance(other, list)):
 *         L, R = other
 */
  if (__pyx_t_1) {

    /* "PETSc/petscmat.pxi":483
 *     if (isinstance(other, tuple) or
 *         isinstance(other, list)):
 *         L, R = other             # <<<<<<<<<<<<<<
 *         self.diagonalScale(L, R)
 *     else:
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_other))) || (PyList_CheckExact(__pyx_v_other))) {
      PyObject* sequence = __pyx_v_other;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(6, 483, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_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(6, 483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(6, 483, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 483, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_L = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_R = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PETSc/petscmat.pxi":484
 *         isinstance(other, list)):
 *         L, R = other
 *         self.diagonalScale(L, R)             # <<<<<<<<<<<<<<
 *     else:
 *         self.scale(other)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_diagonalScale); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 484, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(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);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 484, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_v_L);
    __Pyx_GIVEREF(__pyx_v_L);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_L);
    __Pyx_INCREF(__pyx_v_R);
    __Pyx_GIVEREF(__pyx_v_R);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_R);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 484, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/petscmat.pxi":481
 * 
 * cdef Mat mat_imul(Mat self, other):
 *     if (isinstance(other, tuple) or             # <<<<<<<<<<<<<<
 *         isinstance(other, list)):
 *         L, R = other
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscmat.pxi":486
 *         self.diagonalScale(L, R)
 *     else:
 *         self.scale(other)             # <<<<<<<<<<<<<<
 *     return self
 * 
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_scale); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); __pyx_t_9 = NULL;
      __Pyx_INCREF(__pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_other);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 486, __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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "PETSc/petscmat.pxi":487
 *     else:
 *         self.scale(other)
 *     return self             # <<<<<<<<<<<<<<
 * 
 * cdef Mat mat_idiv(Mat self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":480
 *     return self
 * 
 * cdef Mat mat_imul(Mat self, other):             # <<<<<<<<<<<<<<
 *     if (isinstance(other, tuple) or
 *         isinstance(other, list)):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_imul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_R);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":489
 *     return self
 * 
 * cdef Mat mat_idiv(Mat self, other):             # <<<<<<<<<<<<<<
 *     if isinstance(other, (tuple, list)):
 *         L, R = other
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_idiv(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_L = NULL;
  PyObject *__pyx_v_R = NULL;
  struct PyPetscMatObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("mat_idiv", 0);

  /* "PETSc/petscmat.pxi":490
 * 
 * cdef Mat mat_idiv(Mat self, other):
 *     if isinstance(other, (tuple, list)):             # <<<<<<<<<<<<<<
 *         L, R = other
 *         if isinstance(L, Vec):
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_other); 
  __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 = PyList_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":491
 * cdef Mat mat_idiv(Mat self, other):
 *     if isinstance(other, (tuple, list)):
 *         L, R = other             # <<<<<<<<<<<<<<
 *         if isinstance(L, Vec):
 *             L = L.copy()
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_other))) || (PyList_CheckExact(__pyx_v_other))) {
      PyObject* sequence = __pyx_v_other;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(6, 491, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_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(6, 491, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 491, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 491, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(6, 491, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 491, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_L = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_R = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PETSc/petscmat.pxi":492
 *     if isinstance(other, (tuple, list)):
 *         L, R = other
 *         if isinstance(L, Vec):             # <<<<<<<<<<<<<<
 *             L = L.copy()
 *             L.reciprocal()
 */
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_L, __pyx_ptype_8petsc4py_5PETSc_Vec); 
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "PETSc/petscmat.pxi":493
 *         L, R = other
 *         if isinstance(L, Vec):
 *             L = L.copy()             # <<<<<<<<<<<<<<
 *             L.reciprocal()
 *         if isinstance(R, Vec):
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_L, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 493, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(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_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 493, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 493, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "PETSc/petscmat.pxi":494
 *         if isinstance(L, Vec):
 *             L = L.copy()
 *             L.reciprocal()             # <<<<<<<<<<<<<<
 *         if isinstance(R, Vec):
 *             R = R.copy()
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_L, __pyx_n_s_reciprocal); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(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_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 494, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 494, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "PETSc/petscmat.pxi":492
 *     if isinstance(other, (tuple, list)):
 *         L, R = other
 *         if isinstance(L, Vec):             # <<<<<<<<<<<<<<
 *             L = L.copy()
 *             L.reciprocal()
 */
    }

    /* "PETSc/petscmat.pxi":495
 *             L = L.copy()
 *             L.reciprocal()
 *         if isinstance(R, Vec):             # <<<<<<<<<<<<<<
 *             R = R.copy()
 *             R.reciprocal()
 */
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_R, __pyx_ptype_8petsc4py_5PETSc_Vec); 
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "PETSc/petscmat.pxi":496
 *             L.reciprocal()
 *         if isinstance(R, Vec):
 *             R = R.copy()             # <<<<<<<<<<<<<<
 *             R.reciprocal()
 *         self.diagonalScale(L, R)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_R, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(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_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 496, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 496, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_R, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "PETSc/petscmat.pxi":497
 *         if isinstance(R, Vec):
 *             R = R.copy()
 *             R.reciprocal()             # <<<<<<<<<<<<<<
 *         self.diagonalScale(L, R)
 *     else:
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_R, __pyx_n_s_reciprocal); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 497, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(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_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 497, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 497, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "PETSc/petscmat.pxi":495
 *             L = L.copy()
 *             L.reciprocal()
 *         if isinstance(R, Vec):             # <<<<<<<<<<<<<<
 *             R = R.copy()
 *             R.reciprocal()
 */
    }

    /* "PETSc/petscmat.pxi":498
 *             R = R.copy()
 *             R.reciprocal()
 *         self.diagonalScale(L, R)             # <<<<<<<<<<<<<<
 *     else:
 *         self.scale(other)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_diagonalScale); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(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);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_v_L);
    __Pyx_GIVEREF(__pyx_v_L);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_L);
    __Pyx_INCREF(__pyx_v_R);
    __Pyx_GIVEREF(__pyx_v_R);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_R);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/petscmat.pxi":490
 * 
 * cdef Mat mat_idiv(Mat self, other):
 *     if isinstance(other, (tuple, list)):             # <<<<<<<<<<<<<<
 *         L, R = other
 *         if isinstance(L, Vec):
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscmat.pxi":500
 *         self.diagonalScale(L, R)
 *     else:
 *         self.scale(other)             # <<<<<<<<<<<<<<
 *     return self
 * 
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_scale); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 500, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 500, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); __pyx_t_9 = NULL;
      __Pyx_INCREF(__pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_other);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 500, __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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "PETSc/petscmat.pxi":501
 *     else:
 *         self.scale(other)
 *     return self             # <<<<<<<<<<<<<<
 * 
 * # binary operations
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":489
 *     return self
 * 
 * cdef Mat mat_idiv(Mat self, other):             # <<<<<<<<<<<<<<
 *     if isinstance(other, (tuple, list)):
 *         L, R = other
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_idiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_R);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":505
 * # binary operations
 * 
 * cdef Mat mat_add(Mat self, other):             # <<<<<<<<<<<<<<
 *     return mat_iadd(mat_pos(self), other)
 * 
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_add(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscMatObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("mat_add", 0);

  /* "PETSc/petscmat.pxi":506
 * 
 * cdef Mat mat_add(Mat self, other):
 *     return mat_iadd(mat_pos(self), other)             # <<<<<<<<<<<<<<
 * 
 * cdef Mat mat_sub(Mat self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_pos(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_iadd(((struct PyPetscMatObject *)__pyx_t_1), __pyx_v_other)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":505
 * # binary operations
 * 
 * cdef Mat mat_add(Mat self, other):             # <<<<<<<<<<<<<<
 *     return mat_iadd(mat_pos(self), other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":508
 *     return mat_iadd(mat_pos(self), other)
 * 
 * cdef Mat mat_sub(Mat self, other):             # <<<<<<<<<<<<<<
 *     return mat_isub(mat_pos(self), other)
 * 
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_sub(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscMatObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("mat_sub", 0);

  /* "PETSc/petscmat.pxi":509
 * 
 * cdef Mat mat_sub(Mat self, other):
 *     return mat_isub(mat_pos(self), other)             # <<<<<<<<<<<<<<
 * 
 * cdef Mat mat_mul(Mat self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_pos(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_isub(((struct PyPetscMatObject *)__pyx_t_1), __pyx_v_other)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":508
 *     return mat_iadd(mat_pos(self), other)
 * 
 * cdef Mat mat_sub(Mat self, other):             # <<<<<<<<<<<<<<
 *     return mat_isub(mat_pos(self), other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_sub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":511
 *     return mat_isub(mat_pos(self), other)
 * 
 * cdef Mat mat_mul(Mat self, other):             # <<<<<<<<<<<<<<
 *     if isinstance(other, Mat):
 *         return self.matMult(other)
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_mul(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscMatObject *__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;
  __Pyx_RefNannySetupContext("mat_mul", 0);

  /* "PETSc/petscmat.pxi":512
 * 
 * cdef Mat mat_mul(Mat self, other):
 *     if isinstance(other, Mat):             # <<<<<<<<<<<<<<
 *         return self.matMult(other)
 *     else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Mat); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":513
 * cdef Mat mat_mul(Mat self, other):
 *     if isinstance(other, Mat):
 *         return self.matMult(other)             # <<<<<<<<<<<<<<
 *     else:
 *         return mat_imul(mat_pos(self), other)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_matMult); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 513, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 513, __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_other);
      __Pyx_GIVEREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_other);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 513, __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;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(6, 513, __pyx_L1_error)
    __pyx_r = ((struct PyPetscMatObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/petscmat.pxi":512
 * 
 * cdef Mat mat_mul(Mat self, other):
 *     if isinstance(other, Mat):             # <<<<<<<<<<<<<<
 *         return self.matMult(other)
 *     else:
 */
  }

  /* "PETSc/petscmat.pxi":515
 *         return self.matMult(other)
 *     else:
 *         return mat_imul(mat_pos(self), other)             # <<<<<<<<<<<<<<
 * 
 * cdef Vec mat_mul_vec(Mat self, Vec other):
 */
  /*else*/ {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_pos(__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_imul(((struct PyPetscMatObject *)__pyx_t_3), __pyx_v_other)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = ((struct PyPetscMatObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscmat.pxi":511
 *     return mat_isub(mat_pos(self), other)
 * 
 * cdef Mat mat_mul(Mat self, other):             # <<<<<<<<<<<<<<
 *     if isinstance(other, Mat):
 *         return self.matMult(other)
 */

  /* 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_AddTraceback("petsc4py.PETSc.mat_mul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":517
 *         return mat_imul(mat_pos(self), other)
 * 
 * cdef Vec mat_mul_vec(Mat self, Vec other):             # <<<<<<<<<<<<<<
 *     cdef Vec result = self.createVecLeft()
 *     self.mult(other, result)
 */

static struct PyPetscVecObject *__pyx_f_8petsc4py_5PETSc_mat_mul_vec(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_other) {
  struct PyPetscVecObject *__pyx_v_result = 0;
  struct PyPetscVecObject *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("mat_mul_vec", 0);

  /* "PETSc/petscmat.pxi":518
 * 
 * cdef Vec mat_mul_vec(Mat self, Vec other):
 *     cdef Vec result = self.createVecLeft()             # <<<<<<<<<<<<<<
 *     self.mult(other, result)
 *     return result
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_createVecLeft); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(6, 518, __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(6, 518, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(6, 518, __pyx_L1_error)
  __pyx_v_result = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscmat.pxi":519
 * cdef Vec mat_mul_vec(Mat self, Vec other):
 *     cdef Vec result = self.createVecLeft()
 *     self.mult(other, result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_mult); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_other));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_other));
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, ((PyObject *)__pyx_v_other));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, ((PyObject *)__pyx_v_result));
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petscmat.pxi":520
 *     cdef Vec result = self.createVecLeft()
 *     self.mult(other, result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef Mat mat_div(Mat self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":517
 *         return mat_imul(mat_pos(self), other)
 * 
 * cdef Vec mat_mul_vec(Mat self, Vec other):             # <<<<<<<<<<<<<<
 *     cdef Vec result = self.createVecLeft()
 *     self.mult(other, result)
 */

  /* 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_5);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_mul_vec", __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;
}

/* "PETSc/petscmat.pxi":522
 *     return result
 * 
 * cdef Mat mat_div(Mat self, other):             # <<<<<<<<<<<<<<
 *     return mat_idiv(mat_pos(self), other)
 * 
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_div(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscMatObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("mat_div", 0);

  /* "PETSc/petscmat.pxi":523
 * 
 * cdef Mat mat_div(Mat self, other):
 *     return mat_idiv(mat_pos(self), other)             # <<<<<<<<<<<<<<
 * 
 * # reflected binary operations
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_pos(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_idiv(((struct PyPetscMatObject *)__pyx_t_1), __pyx_v_other)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":522
 *     return result
 * 
 * cdef Mat mat_div(Mat self, other):             # <<<<<<<<<<<<<<
 *     return mat_idiv(mat_pos(self), other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_div", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":527
 * # reflected binary operations
 * 
 * cdef Mat mat_radd(Mat self, other):             # <<<<<<<<<<<<<<
 *     return mat_add(self, other)
 * 
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_radd(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscMatObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("mat_radd", 0);

  /* "PETSc/petscmat.pxi":528
 * 
 * cdef Mat mat_radd(Mat self, other):
 *     return mat_add(self, other)             # <<<<<<<<<<<<<<
 * 
 * cdef Mat mat_rsub(Mat self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_add(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":527
 * # reflected binary operations
 * 
 * cdef Mat mat_radd(Mat self, other):             # <<<<<<<<<<<<<<
 *     return mat_add(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_radd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":530
 *     return mat_add(self, other)
 * 
 * cdef Mat mat_rsub(Mat self, other):             # <<<<<<<<<<<<<<
 *     cdef Mat mat = <Mat> mat_sub(self, other)
 *     mat.scale(-1)
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_rsub(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  struct PyPetscMatObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("mat_rsub", 0);

  /* "PETSc/petscmat.pxi":531
 * 
 * cdef Mat mat_rsub(Mat self, other):
 *     cdef Mat mat = <Mat> mat_sub(self, other)             # <<<<<<<<<<<<<<
 *     mat.scale(-1)
 *     return mat
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_sub(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscmat.pxi":532
 * cdef Mat mat_rsub(Mat self, other):
 *     cdef Mat mat = <Mat> mat_sub(self, other)
 *     mat.scale(-1)             # <<<<<<<<<<<<<<
 *     return mat
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_mat), __pyx_n_s_scale); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petscmat.pxi":533
 *     cdef Mat mat = <Mat> mat_sub(self, other)
 *     mat.scale(-1)
 *     return mat             # <<<<<<<<<<<<<<
 * 
 * cdef Mat mat_rmul(Mat self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = __pyx_v_mat;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":530
 *     return mat_add(self, other)
 * 
 * cdef Mat mat_rsub(Mat self, other):             # <<<<<<<<<<<<<<
 *     cdef Mat mat = <Mat> mat_sub(self, other)
 *     mat.scale(-1)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_rsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":535
 *     return mat
 * 
 * cdef Mat mat_rmul(Mat self, other):             # <<<<<<<<<<<<<<
 *     return mat_mul(self, other)
 * 
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_rmul(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscMatObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("mat_rmul", 0);

  /* "PETSc/petscmat.pxi":536
 * 
 * cdef Mat mat_rmul(Mat self, other):
 *     return mat_mul(self, other)             # <<<<<<<<<<<<<<
 * 
 * cdef Mat mat_rdiv(Mat self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_mul(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":535
 *     return mat
 * 
 * cdef Mat mat_rmul(Mat self, other):             # <<<<<<<<<<<<<<
 *     return mat_mul(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.mat_rmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":538
 *     return mat_mul(self, other)
 * 
 * cdef Mat mat_rdiv(Mat self, other):             # <<<<<<<<<<<<<<
 *     <void>self; <void>other; # unused
 *     raise NotImplementedError
 */

static struct PyPetscMatObject *__pyx_f_8petsc4py_5PETSc_mat_rdiv(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct PyPetscMatObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mat_rdiv", 0);

  /* "PETSc/petscmat.pxi":539
 * 
 * cdef Mat mat_rdiv(Mat self, other):
 *     <void>self; <void>other; # unused             # <<<<<<<<<<<<<<
 *     raise NotImplementedError
 * 
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_other);

  /* "PETSc/petscmat.pxi":540
 * cdef Mat mat_rdiv(Mat self, other):
 *     <void>self; <void>other; # unused
 *     raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(6, 540, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":538
 *     return mat_mul(self, other)
 * 
 * cdef Mat mat_rdiv(Mat self, other):             # <<<<<<<<<<<<<<
 *     <void>self; <void>other; # unused
 *     raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.mat_rdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":544
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline PetscMatStructure matstructure(object structure) \             # <<<<<<<<<<<<<<
 *     except <PetscMatStructure>(-1):
 *     if   structure is None:  return MAT_DIFFERENT_NONZERO_PATTERN
 */

static CYTHON_INLINE MatStructure __pyx_f_8petsc4py_5PETSc_matstructure(PyObject *__pyx_v_structure) {
  MatStructure __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  MatStructure __pyx_t_3;
  __Pyx_RefNannySetupContext("matstructure", 0);

  /* "PETSc/petscmat.pxi":546
 * cdef inline PetscMatStructure matstructure(object structure) \
 *     except <PetscMatStructure>(-1):
 *     if   structure is None:  return MAT_DIFFERENT_NONZERO_PATTERN             # <<<<<<<<<<<<<<
 *     elif structure is False: return MAT_DIFFERENT_NONZERO_PATTERN
 *     elif structure is True:  return MAT_SAME_NONZERO_PATTERN
 */
  __pyx_t_1 = (__pyx_v_structure == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_r = DIFFERENT_NONZERO_PATTERN;
    goto __pyx_L0;
  }

  /* "PETSc/petscmat.pxi":547
 *     except <PetscMatStructure>(-1):
 *     if   structure is None:  return MAT_DIFFERENT_NONZERO_PATTERN
 *     elif structure is False: return MAT_DIFFERENT_NONZERO_PATTERN             # <<<<<<<<<<<<<<
 *     elif structure is True:  return MAT_SAME_NONZERO_PATTERN
 *     else:                    return structure
 */
  __pyx_t_2 = (__pyx_v_structure == Py_False);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_r = DIFFERENT_NONZERO_PATTERN;
    goto __pyx_L0;
  }

  /* "PETSc/petscmat.pxi":548
 *     if   structure is None:  return MAT_DIFFERENT_NONZERO_PATTERN
 *     elif structure is False: return MAT_DIFFERENT_NONZERO_PATTERN
 *     elif structure is True:  return MAT_SAME_NONZERO_PATTERN             # <<<<<<<<<<<<<<
 *     else:                    return structure
 * 
 */
  __pyx_t_1 = (__pyx_v_structure == Py_True);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_r = SAME_NONZERO_PATTERN;
    goto __pyx_L0;
  }

  /* "PETSc/petscmat.pxi":549
 *     elif structure is False: return MAT_DIFFERENT_NONZERO_PATTERN
 *     elif structure is True:  return MAT_SAME_NONZERO_PATTERN
 *     else:                    return structure             # <<<<<<<<<<<<<<
 * 
 * cdef inline PetscMatAssemblyType assemblytype(object assembly) \
 */
  /*else*/ {
    __pyx_t_3 = ((MatStructure)__Pyx_PyInt_As_MatStructure(__pyx_v_structure)); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 549, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;
  }

  /* "PETSc/petscmat.pxi":544
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline PetscMatStructure matstructure(object structure) \             # <<<<<<<<<<<<<<
 *     except <PetscMatStructure>(-1):
 *     if   structure is None:  return MAT_DIFFERENT_NONZERO_PATTERN
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.matstructure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = ((MatStructure)-1L);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":551
 *     else:                    return structure
 * 
 * cdef inline PetscMatAssemblyType assemblytype(object assembly) \             # <<<<<<<<<<<<<<
 *     except <PetscMatAssemblyType>(-1):
 *     if   assembly is None:  return MAT_FINAL_ASSEMBLY
 */

static CYTHON_INLINE MatAssemblyType __pyx_f_8petsc4py_5PETSc_assemblytype(PyObject *__pyx_v_assembly) {
  MatAssemblyType __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  MatAssemblyType __pyx_t_3;
  __Pyx_RefNannySetupContext("assemblytype", 0);

  /* "PETSc/petscmat.pxi":553
 * cdef inline PetscMatAssemblyType assemblytype(object assembly) \
 *     except <PetscMatAssemblyType>(-1):
 *     if   assembly is None:  return MAT_FINAL_ASSEMBLY             # <<<<<<<<<<<<<<
 *     elif assembly is False: return MAT_FINAL_ASSEMBLY
 *     elif assembly is True:  return MAT_FLUSH_ASSEMBLY
 */
  __pyx_t_1 = (__pyx_v_assembly == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_r = MAT_FINAL_ASSEMBLY;
    goto __pyx_L0;
  }

  /* "PETSc/petscmat.pxi":554
 *     except <PetscMatAssemblyType>(-1):
 *     if   assembly is None:  return MAT_FINAL_ASSEMBLY
 *     elif assembly is False: return MAT_FINAL_ASSEMBLY             # <<<<<<<<<<<<<<
 *     elif assembly is True:  return MAT_FLUSH_ASSEMBLY
 *     else:                   return assembly
 */
  __pyx_t_2 = (__pyx_v_assembly == Py_False);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_r = MAT_FINAL_ASSEMBLY;
    goto __pyx_L0;
  }

  /* "PETSc/petscmat.pxi":555
 *     if   assembly is None:  return MAT_FINAL_ASSEMBLY
 *     elif assembly is False: return MAT_FINAL_ASSEMBLY
 *     elif assembly is True:  return MAT_FLUSH_ASSEMBLY             # <<<<<<<<<<<<<<
 *     else:                   return assembly
 * 
 */
  __pyx_t_1 = (__pyx_v_assembly == Py_True);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_r = MAT_FLUSH_ASSEMBLY;
    goto __pyx_L0;
  }

  /* "PETSc/petscmat.pxi":556
 *     elif assembly is False: return MAT_FINAL_ASSEMBLY
 *     elif assembly is True:  return MAT_FLUSH_ASSEMBLY
 *     else:                   return assembly             # <<<<<<<<<<<<<<
 * 
 * cdef inline PetscMatInfoType infotype(object info) \
 */
  /*else*/ {
    __pyx_t_3 = ((MatAssemblyType)__Pyx_PyInt_As_MatAssemblyType(__pyx_v_assembly)); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 556, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;
  }

  /* "PETSc/petscmat.pxi":551
 *     else:                    return structure
 * 
 * cdef inline PetscMatAssemblyType assemblytype(object assembly) \             # <<<<<<<<<<<<<<
 *     except <PetscMatAssemblyType>(-1):
 *     if   assembly is None:  return MAT_FINAL_ASSEMBLY
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.assemblytype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = ((MatAssemblyType)-1L);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":558
 *     else:                   return assembly
 * 
 * cdef inline PetscMatInfoType infotype(object info) \             # <<<<<<<<<<<<<<
 *     except <PetscMatInfoType>(-1):
 *     if   info is None: return MAT_GLOBAL_SUM
 */

static CYTHON_INLINE MatInfoType __pyx_f_8petsc4py_5PETSc_infotype(PyObject *__pyx_v_info) {
  MatInfoType __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  MatInfoType __pyx_t_3;
  __Pyx_RefNannySetupContext("infotype", 0);

  /* "PETSc/petscmat.pxi":560
 * cdef inline PetscMatInfoType infotype(object info) \
 *     except <PetscMatInfoType>(-1):
 *     if   info is None: return MAT_GLOBAL_SUM             # <<<<<<<<<<<<<<
 *     else:              return info
 * 
 */
  __pyx_t_1 = (__pyx_v_info == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_r = MAT_GLOBAL_SUM;
    goto __pyx_L0;
  }

  /* "PETSc/petscmat.pxi":561
 *     except <PetscMatInfoType>(-1):
 *     if   info is None: return MAT_GLOBAL_SUM
 *     else:              return info             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  /*else*/ {
    __pyx_t_3 = ((MatInfoType)__Pyx_PyInt_As_MatInfoType(__pyx_v_info)); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 561, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;
  }

  /* "PETSc/petscmat.pxi":558
 *     else:                   return assembly
 * 
 * cdef inline PetscMatInfoType infotype(object info) \             # <<<<<<<<<<<<<<
 *     except <PetscMatInfoType>(-1):
 *     if   info is None: return MAT_GLOBAL_SUM
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.infotype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = ((MatInfoType)-1L);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":565
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline int Mat_Sizes(             # <<<<<<<<<<<<<<
 *     object size, object bsize,
 *     PetscInt *r, PetscInt *c,
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Mat_Sizes(PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PetscInt *__pyx_v_r, PetscInt *__pyx_v_c, PetscInt *__pyx_v_m, PetscInt *__pyx_v_n, PetscInt *__pyx_v_M, PetscInt *__pyx_v_N) {
  PyObject *__pyx_v_rsize = 0;
  PyObject *__pyx_v_csize = 0;
  PyObject *__pyx_v_rbsize = 0;
  PyObject *__pyx_v_cbsize = 0;
  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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("Mat_Sizes", 0);

  /* "PETSc/petscmat.pxi":573
 *     # unpack row and column sizes
 *     cdef object rsize, csize
 *     try:             # <<<<<<<<<<<<<<
 *         rsize , csize = size
 *     except (TypeError, ValueError):
 */
  {
    __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:*/ {

      /* "PETSc/petscmat.pxi":574
 *     cdef object rsize, csize
 *     try:
 *         rsize , csize = size             # <<<<<<<<<<<<<<
 *     except (TypeError, ValueError):
 *         rsize = csize = size
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_size))) || (PyList_CheckExact(__pyx_v_size))) {
        PyObject* sequence = __pyx_v_size;
        #if CYTHON_COMPILING_IN_CPYTHON
        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(6, 574, __pyx_L3_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyList_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(6, 574, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 574, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_6 = PyObject_GetIter(__pyx_v_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 574, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
        index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(6, 574, __pyx_L3_error)
        __pyx_t_7 = NULL;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(6, 574, __pyx_L3_error)
        __pyx_L12_unpacking_done:;
      }
      __pyx_v_rsize = __pyx_t_4;
      __pyx_t_4 = 0;
      __pyx_v_csize = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "PETSc/petscmat.pxi":573
 *     # unpack row and column sizes
 *     cdef object rsize, csize
 *     try:             # <<<<<<<<<<<<<<
 *         rsize , csize = size
 *     except (TypeError, ValueError):
 */
    }
    __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_L10_try_end;
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/petscmat.pxi":575
 *     try:
 *         rsize , csize = size
 *     except (TypeError, ValueError):             # <<<<<<<<<<<<<<
 *         rsize = csize = size
 *     # unpack row and column block sizes
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("petsc4py.PETSc.Mat_Sizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(6, 575, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);

      /* "PETSc/petscmat.pxi":576
 *         rsize , csize = size
 *     except (TypeError, ValueError):
 *         rsize = csize = size             # <<<<<<<<<<<<<<
 *     # unpack row and column block sizes
 *     cdef object rbsize, cbsize
 */
      __Pyx_INCREF(__pyx_v_size);
      __Pyx_XDECREF_SET(__pyx_v_rsize, __pyx_v_size);
      __Pyx_INCREF(__pyx_v_size);
      __Pyx_XDECREF_SET(__pyx_v_csize, __pyx_v_size);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "PETSc/petscmat.pxi":573
 *     # unpack row and column sizes
 *     cdef object rsize, csize
 *     try:             # <<<<<<<<<<<<<<
 *         rsize , csize = size
 *     except (TypeError, ValueError):
 */
    __Pyx_PyThreadState_assign
    __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_L4_exception_handled:;
    __Pyx_PyThreadState_assign
    __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);
    __pyx_L10_try_end:;
  }

  /* "PETSc/petscmat.pxi":579
 *     # unpack row and column block sizes
 *     cdef object rbsize, cbsize
 *     try:             # <<<<<<<<<<<<<<
 *         rbsize , cbsize = bsize
 *     except (TypeError, ValueError):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "PETSc/petscmat.pxi":580
 *     cdef object rbsize, cbsize
 *     try:
 *         rbsize , cbsize = bsize             # <<<<<<<<<<<<<<
 *     except (TypeError, ValueError):
 *         rbsize = cbsize = bsize
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_bsize))) || (PyList_CheckExact(__pyx_v_bsize))) {
        PyObject* sequence = __pyx_v_bsize;
        #if CYTHON_COMPILING_IN_CPYTHON
        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(6, 580, __pyx_L15_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 580, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 580, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_5 = PyObject_GetIter(__pyx_v_bsize); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 580, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
        index = 0; __pyx_t_6 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L23_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L23_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_5), 2) < 0) __PYX_ERR(6, 580, __pyx_L15_error)
        __pyx_t_7 = NULL;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L24_unpacking_done;
        __pyx_L23_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_7 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(6, 580, __pyx_L15_error)
        __pyx_L24_unpacking_done:;
      }
      __pyx_v_rbsize = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_v_cbsize = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "PETSc/petscmat.pxi":579
 *     # unpack row and column block sizes
 *     cdef object rbsize, cbsize
 *     try:             # <<<<<<<<<<<<<<
 *         rbsize , cbsize = bsize
 *     except (TypeError, ValueError):
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L22_try_end;
    __pyx_L15_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/petscmat.pxi":581
 *     try:
 *         rbsize , cbsize = bsize
 *     except (TypeError, ValueError):             # <<<<<<<<<<<<<<
 *         rbsize = cbsize = bsize
 *     # split row and column sizes
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("petsc4py.PETSc.Mat_Sizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(6, 581, __pyx_L17_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);

      /* "PETSc/petscmat.pxi":582
 *         rbsize , cbsize = bsize
 *     except (TypeError, ValueError):
 *         rbsize = cbsize = bsize             # <<<<<<<<<<<<<<
 *     # split row and column sizes
 *     Sys_Sizes(rsize, rbsize, r, m, M)
 */
      __Pyx_INCREF(__pyx_v_bsize);
      __Pyx_XDECREF_SET(__pyx_v_rbsize, __pyx_v_bsize);
      __Pyx_INCREF(__pyx_v_bsize);
      __Pyx_XDECREF_SET(__pyx_v_cbsize, __pyx_v_bsize);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L16_exception_handled;
    }
    goto __pyx_L17_except_error;
    __pyx_L17_except_error:;

    /* "PETSc/petscmat.pxi":579
 *     # unpack row and column block sizes
 *     cdef object rbsize, cbsize
 *     try:             # <<<<<<<<<<<<<<
 *         rbsize , cbsize = bsize
 *     except (TypeError, ValueError):
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L16_exception_handled:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L22_try_end:;
  }

  /* "PETSc/petscmat.pxi":584
 *         rbsize = cbsize = bsize
 *     # split row and column sizes
 *     Sys_Sizes(rsize, rbsize, r, m, M)             # <<<<<<<<<<<<<<
 *     Sys_Sizes(csize, cbsize, c, n, N)
 *     return 0
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_Sys_Sizes(__pyx_v_rsize, __pyx_v_rbsize, __pyx_v_r, __pyx_v_m, __pyx_v_M); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(6, 584, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":585
 *     # split row and column sizes
 *     Sys_Sizes(rsize, rbsize, r, m, M)
 *     Sys_Sizes(csize, cbsize, c, n, N)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_Sys_Sizes(__pyx_v_csize, __pyx_v_cbsize, __pyx_v_c, __pyx_v_n, __pyx_v_N); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(6, 585, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":586
 *     Sys_Sizes(rsize, rbsize, r, m, M)
 *     Sys_Sizes(csize, cbsize, c, n, N)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Mat_Create(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":565
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline int Mat_Sizes(             # <<<<<<<<<<<<<<
 *     object size, object bsize,
 *     PetscInt *r, PetscInt *c,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat_Sizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rsize);
  __Pyx_XDECREF(__pyx_v_csize);
  __Pyx_XDECREF(__pyx_v_rbsize);
  __Pyx_XDECREF(__pyx_v_cbsize);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":588
 *     return 0
 * 
 * cdef inline int Mat_Create(             # <<<<<<<<<<<<<<
 *     PetscMatType mtype,
 *     object comm,
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Mat_Create(const char* __pyx_v_mtype, PyObject *__pyx_v_comm, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, Mat *__pyx_v_A) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_rbs;
  PetscInt __pyx_v_cbs;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_M;
  PetscInt __pyx_v_N;
  Mat __pyx_v_mat;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("Mat_Create", 0);

  /* "PETSc/petscmat.pxi":596
 *     ) except -1:
 *     # communicator
 *     cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *     # sizes and block sizes
 *     cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 596, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/petscmat.pxi":598
 *     cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *     # sizes and block sizes
 *     cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0             # <<<<<<<<<<<<<<
 *     Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)
 *     if rbs == PETSC_DECIDE: rbs = 1
 */
  __pyx_v_rbs = 0;
  __pyx_v_cbs = 0;
  __pyx_v_m = 0;
  __pyx_v_n = 0;
  __pyx_v_M = 0;
  __pyx_v_N = 0;

  /* "PETSc/petscmat.pxi":599
 *     # sizes and block sizes
 *     cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 *     Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)             # <<<<<<<<<<<<<<
 *     if rbs == PETSC_DECIDE: rbs = 1
 *     if cbs == PETSC_DECIDE: cbs = rbs
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Mat_Sizes(__pyx_v_size, __pyx_v_bsize, (&__pyx_v_rbs), (&__pyx_v_cbs), (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_M), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 599, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":600
 *     cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 *     Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)
 *     if rbs == PETSC_DECIDE: rbs = 1             # <<<<<<<<<<<<<<
 *     if cbs == PETSC_DECIDE: cbs = rbs
 *     Sys_Layout(ccomm, rbs, &m, &M)
 */
  __pyx_t_3 = ((__pyx_v_rbs == PETSC_DECIDE) != 0);
  if (__pyx_t_3) {
    __pyx_v_rbs = 1;
  }

  /* "PETSc/petscmat.pxi":601
 *     Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)
 *     if rbs == PETSC_DECIDE: rbs = 1
 *     if cbs == PETSC_DECIDE: cbs = rbs             # <<<<<<<<<<<<<<
 *     Sys_Layout(ccomm, rbs, &m, &M)
 *     Sys_Layout(ccomm, cbs, &n, &N)
 */
  __pyx_t_3 = ((__pyx_v_cbs == PETSC_DECIDE) != 0);
  if (__pyx_t_3) {
    __pyx_v_cbs = __pyx_v_rbs;
  }

  /* "PETSc/petscmat.pxi":602
 *     if rbs == PETSC_DECIDE: rbs = 1
 *     if cbs == PETSC_DECIDE: cbs = rbs
 *     Sys_Layout(ccomm, rbs, &m, &M)             # <<<<<<<<<<<<<<
 *     Sys_Layout(ccomm, cbs, &n, &N)
 *     # create matrix and set sizes
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Sys_Layout(__pyx_v_ccomm, __pyx_v_rbs, (&__pyx_v_m), (&__pyx_v_M)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 602, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":603
 *     if cbs == PETSC_DECIDE: cbs = rbs
 *     Sys_Layout(ccomm, rbs, &m, &M)
 *     Sys_Layout(ccomm, cbs, &n, &N)             # <<<<<<<<<<<<<<
 *     # create matrix and set sizes
 *     cdef PetscMat mat = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Sys_Layout(__pyx_v_ccomm, __pyx_v_cbs, (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 603, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":605
 *     Sys_Layout(ccomm, cbs, &n, &N)
 *     # create matrix and set sizes
 *     cdef PetscMat mat = NULL             # <<<<<<<<<<<<<<
 *     CHKERR( MatCreate(ccomm, &mat) )
 *     CHKERR( MatSetSizes(mat, m, n, M, N) )
 */
  __pyx_v_mat = NULL;

  /* "PETSc/petscmat.pxi":606
 *     # create matrix and set sizes
 *     cdef PetscMat mat = NULL
 *     CHKERR( MatCreate(ccomm, &mat) )             # <<<<<<<<<<<<<<
 *     CHKERR( MatSetSizes(mat, m, n, M, N) )
 *     CHKERR( MatSetBlockSizes(mat, rbs, cbs) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreate(__pyx_v_ccomm, (&__pyx_v_mat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 606, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":607
 *     cdef PetscMat mat = NULL
 *     CHKERR( MatCreate(ccomm, &mat) )
 *     CHKERR( MatSetSizes(mat, m, n, M, N) )             # <<<<<<<<<<<<<<
 *     CHKERR( MatSetBlockSizes(mat, rbs, cbs) )
 *     CHKERR( MatSetType(mat, mtype) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetSizes(__pyx_v_mat, __pyx_v_m, __pyx_v_n, __pyx_v_M, __pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 607, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":608
 *     CHKERR( MatCreate(ccomm, &mat) )
 *     CHKERR( MatSetSizes(mat, m, n, M, N) )
 *     CHKERR( MatSetBlockSizes(mat, rbs, cbs) )             # <<<<<<<<<<<<<<
 *     CHKERR( MatSetType(mat, mtype) )
 *     A[0] = mat
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetBlockSizes(__pyx_v_mat, __pyx_v_rbs, __pyx_v_cbs)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 608, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":609
 *     CHKERR( MatSetSizes(mat, m, n, M, N) )
 *     CHKERR( MatSetBlockSizes(mat, rbs, cbs) )
 *     CHKERR( MatSetType(mat, mtype) )             # <<<<<<<<<<<<<<
 *     A[0] = mat
 *     return 0
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetType(__pyx_v_mat, __pyx_v_mtype)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 609, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":610
 *     CHKERR( MatSetBlockSizes(mat, rbs, cbs) )
 *     CHKERR( MatSetType(mat, mtype) )
 *     A[0] = mat             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  (__pyx_v_A[0]) = __pyx_v_mat;

  /* "PETSc/petscmat.pxi":611
 *     CHKERR( MatSetType(mat, mtype) )
 *     A[0] = mat
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Mat_AllocAIJ_NNZ( PetscMat A, object NNZ) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":588
 *     return 0
 * 
 * cdef inline int Mat_Create(             # <<<<<<<<<<<<<<
 *     PetscMatType mtype,
 *     object comm,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat_Create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":613
 *     return 0
 * 
 * cdef inline int Mat_AllocAIJ_NNZ( PetscMat A, object NNZ) except -1:             # <<<<<<<<<<<<<<
 *     #
 *     cdef PetscBool aij=PETSC_FALSE, baij=PETSC_FALSE, sbaij=PETSC_FALSE
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ_NNZ(Mat __pyx_v_A, PyObject *__pyx_v_NNZ) {
  PetscBool __pyx_v_aij;
  PetscBool __pyx_v_baij;
  PetscBool __pyx_v_sbaij;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_bs;
  PyObject *__pyx_v_od_nnz = 0;
  PyObject *__pyx_v_oo_nnz = 0;
  PetscInt __pyx_v_d_nz;
  PetscInt __pyx_v_d_n;
  PetscInt *__pyx_v_d_nnz;
  PetscInt __pyx_v_o_nz;
  PetscInt __pyx_v_o_n;
  PetscInt *__pyx_v_o_nnz;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  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 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("Mat_AllocAIJ_NNZ", 0);

  /* "PETSc/petscmat.pxi":615
 * cdef inline int Mat_AllocAIJ_NNZ( PetscMat A, object NNZ) except -1:
 *     #
 *     cdef PetscBool aij=PETSC_FALSE, baij=PETSC_FALSE, sbaij=PETSC_FALSE             # <<<<<<<<<<<<<<
 *     CHKERR( MatHasPreallocationAIJ(A, &aij, &baij, &sbaij))
 *     # local row size and block size
 */
  __pyx_v_aij = PETSC_FALSE;
  __pyx_v_baij = PETSC_FALSE;
  __pyx_v_sbaij = PETSC_FALSE;

  /* "PETSc/petscmat.pxi":616
 *     #
 *     cdef PetscBool aij=PETSC_FALSE, baij=PETSC_FALSE, sbaij=PETSC_FALSE
 *     CHKERR( MatHasPreallocationAIJ(A, &aij, &baij, &sbaij))             # <<<<<<<<<<<<<<
 *     # local row size and block size
 *     cdef PetscInt m=0, bs=1
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatHasPreallocationAIJ(__pyx_v_A, (&__pyx_v_aij), (&__pyx_v_baij), (&__pyx_v_sbaij))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 616, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":618
 *     CHKERR( MatHasPreallocationAIJ(A, &aij, &baij, &sbaij))
 *     # local row size and block size
 *     cdef PetscInt m=0, bs=1             # <<<<<<<<<<<<<<
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 *     if baij == PETSC_TRUE or sbaij == PETSC_TRUE:
 */
  __pyx_v_m = 0;
  __pyx_v_bs = 1;

  /* "PETSc/petscmat.pxi":619
 *     # local row size and block size
 *     cdef PetscInt m=0, bs=1
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )             # <<<<<<<<<<<<<<
 *     if baij == PETSC_TRUE or sbaij == PETSC_TRUE:
 *         CHKERR( MatGetBlockSize(A, &bs) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetLocalSize(__pyx_v_A, (&__pyx_v_m), NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 619, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":620
 *     cdef PetscInt m=0, bs=1
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 *     if baij == PETSC_TRUE or sbaij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetBlockSize(A, &bs) )
 *         assert bs > 0, "block size not set"
 */
  __pyx_t_3 = ((__pyx_v_baij == PETSC_TRUE) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_sbaij == PETSC_TRUE) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":621
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 *     if baij == PETSC_TRUE or sbaij == PETSC_TRUE:
 *         CHKERR( MatGetBlockSize(A, &bs) )             # <<<<<<<<<<<<<<
 *         assert bs > 0, "block size not set"
 *     # unpack NNZ argument
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetBlockSize(__pyx_v_A, (&__pyx_v_bs))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 621, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":622
 *     if baij == PETSC_TRUE or sbaij == PETSC_TRUE:
 *         CHKERR( MatGetBlockSize(A, &bs) )
 *         assert bs > 0, "block size not set"             # <<<<<<<<<<<<<<
 *     # unpack NNZ argument
 *     cdef object od_nnz, oo_nnz
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!((__pyx_v_bs > 0) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_block_size_not_set);
        __PYX_ERR(6, 622, __pyx_L1_error)
      }
    }
    #endif

    /* "PETSc/petscmat.pxi":620
 *     cdef PetscInt m=0, bs=1
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 *     if baij == PETSC_TRUE or sbaij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetBlockSize(A, &bs) )
 *         assert bs > 0, "block size not set"
 */
  }

  /* "PETSc/petscmat.pxi":625
 *     # unpack NNZ argument
 *     cdef object od_nnz, oo_nnz
 *     try:             # <<<<<<<<<<<<<<
 *         od_nnz, oo_nnz = NNZ
 *     except (TypeError, ValueError):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "PETSc/petscmat.pxi":626
 *     cdef object od_nnz, oo_nnz
 *     try:
 *         od_nnz, oo_nnz = NNZ             # <<<<<<<<<<<<<<
 *     except (TypeError, ValueError):
 *         od_nnz, oo_nnz = NNZ, None
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_NNZ))) || (PyList_CheckExact(__pyx_v_NNZ))) {
        PyObject* sequence = __pyx_v_NNZ;
        #if CYTHON_COMPILING_IN_CPYTHON
        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(6, 626, __pyx_L6_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        #else
        __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 626, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 626, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_9 = PyObject_GetIter(__pyx_v_NNZ); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 626, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
        index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(6, 626, __pyx_L6_error)
        __pyx_t_10 = NULL;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L15_unpacking_done;
        __pyx_L14_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(6, 626, __pyx_L6_error)
        __pyx_L15_unpacking_done:;
      }
      __pyx_v_od_nnz = __pyx_t_7;
      __pyx_t_7 = 0;
      __pyx_v_oo_nnz = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "PETSc/petscmat.pxi":625
 *     # unpack NNZ argument
 *     cdef object od_nnz, oo_nnz
 *     try:             # <<<<<<<<<<<<<<
 *         od_nnz, oo_nnz = NNZ
 *     except (TypeError, ValueError):
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "PETSc/petscmat.pxi":627
 *     try:
 *         od_nnz, oo_nnz = NNZ
 *     except (TypeError, ValueError):             # <<<<<<<<<<<<<<
 *         od_nnz, oo_nnz = NNZ, None
 *     # diagonal and off-diagonal number of nonzeros
 */
    __pyx_t_1 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_1) {
      __Pyx_AddTraceback("petsc4py.PETSc.Mat_AllocAIJ_NNZ", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_9) < 0) __PYX_ERR(6, 627, __pyx_L8_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_9);

      /* "PETSc/petscmat.pxi":628
 *         od_nnz, oo_nnz = NNZ
 *     except (TypeError, ValueError):
 *         od_nnz, oo_nnz = NNZ, None             # <<<<<<<<<<<<<<
 *     # diagonal and off-diagonal number of nonzeros
 *     cdef PetscInt d_nz=PETSC_DECIDE, d_n=0, *d_nnz=NULL
 */
      __pyx_t_11 = __pyx_v_NNZ;
      __Pyx_INCREF(__pyx_t_11);
      __pyx_t_12 = Py_None;
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_XDECREF_SET(__pyx_v_od_nnz, __pyx_t_11);
      __pyx_t_11 = 0;
      __Pyx_XDECREF_SET(__pyx_v_oo_nnz, __pyx_t_12);
      __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L7_exception_handled;
    }
    goto __pyx_L8_except_error;
    __pyx_L8_except_error:;

    /* "PETSc/petscmat.pxi":625
 *     # unpack NNZ argument
 *     cdef object od_nnz, oo_nnz
 *     try:             # <<<<<<<<<<<<<<
 *         od_nnz, oo_nnz = NNZ
 *     except (TypeError, ValueError):
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L13_try_end:;
  }

  /* "PETSc/petscmat.pxi":630
 *         od_nnz, oo_nnz = NNZ, None
 *     # diagonal and off-diagonal number of nonzeros
 *     cdef PetscInt d_nz=PETSC_DECIDE, d_n=0, *d_nnz=NULL             # <<<<<<<<<<<<<<
 *     if od_nnz is not None:
 *         od_nnz = iarray_i(od_nnz, &d_n, &d_nnz)
 */
  __pyx_v_d_nz = PETSC_DECIDE;
  __pyx_v_d_n = 0;
  __pyx_v_d_nnz = NULL;

  /* "PETSc/petscmat.pxi":631
 *     # diagonal and off-diagonal number of nonzeros
 *     cdef PetscInt d_nz=PETSC_DECIDE, d_n=0, *d_nnz=NULL
 *     if od_nnz is not None:             # <<<<<<<<<<<<<<
 *         od_nnz = iarray_i(od_nnz, &d_n, &d_nnz)
 *         if   d_n == 0: d_nnz = NULL # just in case
 */
  __pyx_t_2 = (__pyx_v_od_nnz != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":632
 *     cdef PetscInt d_nz=PETSC_DECIDE, d_n=0, *d_nnz=NULL
 *     if od_nnz is not None:
 *         od_nnz = iarray_i(od_nnz, &d_n, &d_nnz)             # <<<<<<<<<<<<<<
 *         if   d_n == 0: d_nnz = NULL # just in case
 *         elif d_n == 1: d_nz = d_nnz[0]; d_n=0; d_nnz = NULL
 */
    __pyx_t_9 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_od_nnz, (&__pyx_v_d_n), (&__pyx_v_d_nnz))); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF_SET(__pyx_v_od_nnz, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "PETSc/petscmat.pxi":633
 *     if od_nnz is not None:
 *         od_nnz = iarray_i(od_nnz, &d_n, &d_nnz)
 *         if   d_n == 0: d_nnz = NULL # just in case             # <<<<<<<<<<<<<<
 *         elif d_n == 1: d_nz = d_nnz[0]; d_n=0; d_nnz = NULL
 *     cdef PetscInt o_nz=PETSC_DECIDE, o_n=0, *o_nnz=NULL
 */
    switch (__pyx_v_d_n) {
      case 0:
      __pyx_v_d_nnz = NULL;
      break;

      /* "PETSc/petscmat.pxi":634
 *         od_nnz = iarray_i(od_nnz, &d_n, &d_nnz)
 *         if   d_n == 0: d_nnz = NULL # just in case
 *         elif d_n == 1: d_nz = d_nnz[0]; d_n=0; d_nnz = NULL             # <<<<<<<<<<<<<<
 *     cdef PetscInt o_nz=PETSC_DECIDE, o_n=0, *o_nnz=NULL
 *     if oo_nnz is not None:
 */
      case 1:
      __pyx_v_d_nz = (__pyx_v_d_nnz[0]);
      __pyx_v_d_n = 0;
      __pyx_v_d_nnz = NULL;
      break;
      default: break;
    }

    /* "PETSc/petscmat.pxi":631
 *     # diagonal and off-diagonal number of nonzeros
 *     cdef PetscInt d_nz=PETSC_DECIDE, d_n=0, *d_nnz=NULL
 *     if od_nnz is not None:             # <<<<<<<<<<<<<<
 *         od_nnz = iarray_i(od_nnz, &d_n, &d_nnz)
 *         if   d_n == 0: d_nnz = NULL # just in case
 */
  }

  /* "PETSc/petscmat.pxi":635
 *         if   d_n == 0: d_nnz = NULL # just in case
 *         elif d_n == 1: d_nz = d_nnz[0]; d_n=0; d_nnz = NULL
 *     cdef PetscInt o_nz=PETSC_DECIDE, o_n=0, *o_nnz=NULL             # <<<<<<<<<<<<<<
 *     if oo_nnz is not None:
 *         oo_nnz = iarray_i(oo_nnz, &o_n, &o_nnz)
 */
  __pyx_v_o_nz = PETSC_DECIDE;
  __pyx_v_o_n = 0;
  __pyx_v_o_nnz = NULL;

  /* "PETSc/petscmat.pxi":636
 *         elif d_n == 1: d_nz = d_nnz[0]; d_n=0; d_nnz = NULL
 *     cdef PetscInt o_nz=PETSC_DECIDE, o_n=0, *o_nnz=NULL
 *     if oo_nnz is not None:             # <<<<<<<<<<<<<<
 *         oo_nnz = iarray_i(oo_nnz, &o_n, &o_nnz)
 *         if   o_n == 0: o_nnz = NULL # just in case
 */
  __pyx_t_3 = (__pyx_v_oo_nnz != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":637
 *     cdef PetscInt o_nz=PETSC_DECIDE, o_n=0, *o_nnz=NULL
 *     if oo_nnz is not None:
 *         oo_nnz = iarray_i(oo_nnz, &o_n, &o_nnz)             # <<<<<<<<<<<<<<
 *         if   o_n == 0: o_nnz = NULL # just in case
 *         elif o_n == 1: o_nz = o_nnz[0]; o_n=0; o_nnz = NULL
 */
    __pyx_t_9 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_oo_nnz, (&__pyx_v_o_n), (&__pyx_v_o_nnz))); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF_SET(__pyx_v_oo_nnz, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "PETSc/petscmat.pxi":638
 *     if oo_nnz is not None:
 *         oo_nnz = iarray_i(oo_nnz, &o_n, &o_nnz)
 *         if   o_n == 0: o_nnz = NULL # just in case             # <<<<<<<<<<<<<<
 *         elif o_n == 1: o_nz = o_nnz[0]; o_n=0; o_nnz = NULL
 *     if m == PETSC_DECIDE:
 */
    switch (__pyx_v_o_n) {
      case 0:
      __pyx_v_o_nnz = NULL;
      break;

      /* "PETSc/petscmat.pxi":639
 *         oo_nnz = iarray_i(oo_nnz, &o_n, &o_nnz)
 *         if   o_n == 0: o_nnz = NULL # just in case
 *         elif o_n == 1: o_nz = o_nnz[0]; o_n=0; o_nnz = NULL             # <<<<<<<<<<<<<<
 *     if m == PETSC_DECIDE:
 *         if d_n > 1 and d_n*bs > m: m = d_n*bs
 */
      case 1:
      __pyx_v_o_nz = (__pyx_v_o_nnz[0]);
      __pyx_v_o_n = 0;
      __pyx_v_o_nnz = NULL;
      break;
      default: break;
    }

    /* "PETSc/petscmat.pxi":636
 *         elif d_n == 1: d_nz = d_nnz[0]; d_n=0; d_nnz = NULL
 *     cdef PetscInt o_nz=PETSC_DECIDE, o_n=0, *o_nnz=NULL
 *     if oo_nnz is not None:             # <<<<<<<<<<<<<<
 *         oo_nnz = iarray_i(oo_nnz, &o_n, &o_nnz)
 *         if   o_n == 0: o_nnz = NULL # just in case
 */
  }

  /* "PETSc/petscmat.pxi":640
 *         if   o_n == 0: o_nnz = NULL # just in case
 *         elif o_n == 1: o_nz = o_nnz[0]; o_n=0; o_nnz = NULL
 *     if m == PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *         if d_n > 1 and d_n*bs > m: m = d_n*bs
 *         if o_n > 1 and o_n*bs > m: m = o_n*bs
 */
  __pyx_t_2 = ((__pyx_v_m == PETSC_DECIDE) != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":641
 *         elif o_n == 1: o_nz = o_nnz[0]; o_n=0; o_nnz = NULL
 *     if m == PETSC_DECIDE:
 *         if d_n > 1 and d_n*bs > m: m = d_n*bs             # <<<<<<<<<<<<<<
 *         if o_n > 1 and o_n*bs > m: m = o_n*bs
 *     # check array sizes
 */
    __pyx_t_3 = ((__pyx_v_d_n > 1) != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L22_bool_binop_done;
    }
    __pyx_t_3 = (((__pyx_v_d_n * __pyx_v_bs) > __pyx_v_m) != 0);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L22_bool_binop_done:;
    if (__pyx_t_2) {
      __pyx_v_m = (__pyx_v_d_n * __pyx_v_bs);
    }

    /* "PETSc/petscmat.pxi":642
 *     if m == PETSC_DECIDE:
 *         if d_n > 1 and d_n*bs > m: m = d_n*bs
 *         if o_n > 1 and o_n*bs > m: m = o_n*bs             # <<<<<<<<<<<<<<
 *     # check array sizes
 *     if d_n > 1 and d_n*bs != m: raise ValueError(
 */
    __pyx_t_3 = ((__pyx_v_o_n > 1) != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L25_bool_binop_done;
    }
    __pyx_t_3 = (((__pyx_v_o_n * __pyx_v_bs) > __pyx_v_m) != 0);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L25_bool_binop_done:;
    if (__pyx_t_2) {
      __pyx_v_m = (__pyx_v_o_n * __pyx_v_bs);
    }

    /* "PETSc/petscmat.pxi":640
 *         if   o_n == 0: o_nnz = NULL # just in case
 *         elif o_n == 1: o_nz = o_nnz[0]; o_n=0; o_nnz = NULL
 *     if m == PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *         if d_n > 1 and d_n*bs > m: m = d_n*bs
 *         if o_n > 1 and o_n*bs > m: m = o_n*bs
 */
  }

  /* "PETSc/petscmat.pxi":644
 *         if o_n > 1 and o_n*bs > m: m = o_n*bs
 *     # check array sizes
 *     if d_n > 1 and d_n*bs != m: raise ValueError(             # <<<<<<<<<<<<<<
 *         "size(d_nnz) is %d, expected %d" %
 *             (toInt(d_n), toInt(m//bs)) )
 */
  __pyx_t_3 = ((__pyx_v_d_n > 1) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L28_bool_binop_done;
  }
  __pyx_t_3 = (((__pyx_v_d_n * __pyx_v_bs) != __pyx_v_m) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L28_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":646
 *     if d_n > 1 and d_n*bs != m: raise ValueError(
 *         "size(d_nnz) is %d, expected %d" %
 *             (toInt(d_n), toInt(m//bs)) )             # <<<<<<<<<<<<<<
 *     if o_n > 1 and o_n*bs != m: raise ValueError(
 *         "size(o_nnz) is %d, expected %d" %
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_d_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_m / __pyx_v_bs)); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 646, __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_7);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
    __pyx_t_9 = 0;
    __pyx_t_7 = 0;

    /* "PETSc/petscmat.pxi":645
 *     # check array sizes
 *     if d_n > 1 and d_n*bs != m: raise ValueError(
 *         "size(d_nnz) is %d, expected %d" %             # <<<<<<<<<<<<<<
 *             (toInt(d_n), toInt(m//bs)) )
 *     if o_n > 1 and o_n*bs != m: raise ValueError(
 */
    __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_size_d_nnz_is_d_expected_d, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "PETSc/petscmat.pxi":644
 *         if o_n > 1 and o_n*bs > m: m = o_n*bs
 *     # check array sizes
 *     if d_n > 1 and d_n*bs != m: raise ValueError(             # <<<<<<<<<<<<<<
 *         "size(d_nnz) is %d, expected %d" %
 *             (toInt(d_n), toInt(m//bs)) )
 */
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 644, __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 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(6, 644, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":647
 *         "size(d_nnz) is %d, expected %d" %
 *             (toInt(d_n), toInt(m//bs)) )
 *     if o_n > 1 and o_n*bs != m: raise ValueError(             # <<<<<<<<<<<<<<
 *         "size(o_nnz) is %d, expected %d" %
 *             (toInt(o_n), toInt(m//bs)) )
 */
  __pyx_t_3 = ((__pyx_v_o_n > 1) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L31_bool_binop_done;
  }
  __pyx_t_3 = (((__pyx_v_o_n * __pyx_v_bs) != __pyx_v_m) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L31_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":649
 *     if o_n > 1 and o_n*bs != m: raise ValueError(
 *         "size(o_nnz) is %d, expected %d" %
 *             (toInt(o_n), toInt(m//bs)) )             # <<<<<<<<<<<<<<
 *     # preallocate
 *     if aij == PETSC_TRUE:
 */
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_o_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_m / __pyx_v_bs)); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 649, __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_t_7 = 0;
    __pyx_t_8 = 0;

    /* "PETSc/petscmat.pxi":648
 *             (toInt(d_n), toInt(m//bs)) )
 *     if o_n > 1 and o_n*bs != m: raise ValueError(
 *         "size(o_nnz) is %d, expected %d" %             # <<<<<<<<<<<<<<
 *             (toInt(o_n), toInt(m//bs)) )
 *     # preallocate
 */
    __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_size_o_nnz_is_d_expected_d, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "PETSc/petscmat.pxi":647
 *         "size(d_nnz) is %d, expected %d" %
 *             (toInt(d_n), toInt(m//bs)) )
 *     if o_n > 1 and o_n*bs != m: raise ValueError(             # <<<<<<<<<<<<<<
 *         "size(o_nnz) is %d, expected %d" %
 *             (toInt(o_n), toInt(m//bs)) )
 */
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 647, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 647, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(6, 647, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":651
 *             (toInt(o_n), toInt(m//bs)) )
 *     # preallocate
 *     if aij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSeqAIJSetPreallocation(A, d_nz, d_nnz) )
 *         CHKERR( MatMPIAIJSetPreallocation(A, d_nz, d_nnz, o_nz, o_nnz) )
 */
  __pyx_t_2 = ((__pyx_v_aij == PETSC_TRUE) != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":652
 *     # preallocate
 *     if aij == PETSC_TRUE:
 *         CHKERR( MatSeqAIJSetPreallocation(A, d_nz, d_nnz) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatMPIAIJSetPreallocation(A, d_nz, d_nnz, o_nz, o_nnz) )
 *     if baij == PETSC_TRUE:
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSeqAIJSetPreallocation(__pyx_v_A, __pyx_v_d_nz, __pyx_v_d_nnz)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 652, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":653
 *     if aij == PETSC_TRUE:
 *         CHKERR( MatSeqAIJSetPreallocation(A, d_nz, d_nnz) )
 *         CHKERR( MatMPIAIJSetPreallocation(A, d_nz, d_nnz, o_nz, o_nnz) )             # <<<<<<<<<<<<<<
 *     if baij == PETSC_TRUE:
 *         CHKERR( MatSeqBAIJSetPreallocation(A, bs, d_nz, d_nnz) )
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMPIAIJSetPreallocation(__pyx_v_A, __pyx_v_d_nz, __pyx_v_d_nnz, __pyx_v_o_nz, __pyx_v_o_nnz)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 653, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":651
 *             (toInt(o_n), toInt(m//bs)) )
 *     # preallocate
 *     if aij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSeqAIJSetPreallocation(A, d_nz, d_nnz) )
 *         CHKERR( MatMPIAIJSetPreallocation(A, d_nz, d_nnz, o_nz, o_nnz) )
 */
  }

  /* "PETSc/petscmat.pxi":654
 *         CHKERR( MatSeqAIJSetPreallocation(A, d_nz, d_nnz) )
 *         CHKERR( MatMPIAIJSetPreallocation(A, d_nz, d_nnz, o_nz, o_nnz) )
 *     if baij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSeqBAIJSetPreallocation(A, bs, d_nz, d_nnz) )
 *         CHKERR( MatMPIBAIJSetPreallocation(A, bs, d_nz, d_nnz, o_nz, o_nnz) )
 */
  __pyx_t_2 = ((__pyx_v_baij == PETSC_TRUE) != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":655
 *         CHKERR( MatMPIAIJSetPreallocation(A, d_nz, d_nnz, o_nz, o_nnz) )
 *     if baij == PETSC_TRUE:
 *         CHKERR( MatSeqBAIJSetPreallocation(A, bs, d_nz, d_nnz) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatMPIBAIJSetPreallocation(A, bs, d_nz, d_nnz, o_nz, o_nnz) )
 *     if sbaij == PETSC_TRUE:
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSeqBAIJSetPreallocation(__pyx_v_A, __pyx_v_bs, __pyx_v_d_nz, __pyx_v_d_nnz)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 655, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":656
 *     if baij == PETSC_TRUE:
 *         CHKERR( MatSeqBAIJSetPreallocation(A, bs, d_nz, d_nnz) )
 *         CHKERR( MatMPIBAIJSetPreallocation(A, bs, d_nz, d_nnz, o_nz, o_nnz) )             # <<<<<<<<<<<<<<
 *     if sbaij == PETSC_TRUE:
 *         CHKERR( MatSeqSBAIJSetPreallocation(A, bs, d_nz, d_nnz) )
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMPIBAIJSetPreallocation(__pyx_v_A, __pyx_v_bs, __pyx_v_d_nz, __pyx_v_d_nnz, __pyx_v_o_nz, __pyx_v_o_nnz)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 656, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":654
 *         CHKERR( MatSeqAIJSetPreallocation(A, d_nz, d_nnz) )
 *         CHKERR( MatMPIAIJSetPreallocation(A, d_nz, d_nnz, o_nz, o_nnz) )
 *     if baij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSeqBAIJSetPreallocation(A, bs, d_nz, d_nnz) )
 *         CHKERR( MatMPIBAIJSetPreallocation(A, bs, d_nz, d_nnz, o_nz, o_nnz) )
 */
  }

  /* "PETSc/petscmat.pxi":657
 *         CHKERR( MatSeqBAIJSetPreallocation(A, bs, d_nz, d_nnz) )
 *         CHKERR( MatMPIBAIJSetPreallocation(A, bs, d_nz, d_nnz, o_nz, o_nnz) )
 *     if sbaij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSeqSBAIJSetPreallocation(A, bs, d_nz, d_nnz) )
 *         CHKERR( MatMPISBAIJSetPreallocation(A, bs, d_nz, d_nnz, o_nz, o_nnz) )
 */
  __pyx_t_2 = ((__pyx_v_sbaij == PETSC_TRUE) != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":658
 *         CHKERR( MatMPIBAIJSetPreallocation(A, bs, d_nz, d_nnz, o_nz, o_nnz) )
 *     if sbaij == PETSC_TRUE:
 *         CHKERR( MatSeqSBAIJSetPreallocation(A, bs, d_nz, d_nnz) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatMPISBAIJSetPreallocation(A, bs, d_nz, d_nnz, o_nz, o_nnz) )
 *     return 0
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSeqSBAIJSetPreallocation(__pyx_v_A, __pyx_v_bs, __pyx_v_d_nz, __pyx_v_d_nnz)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 658, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":659
 *     if sbaij == PETSC_TRUE:
 *         CHKERR( MatSeqSBAIJSetPreallocation(A, bs, d_nz, d_nnz) )
 *         CHKERR( MatMPISBAIJSetPreallocation(A, bs, d_nz, d_nnz, o_nz, o_nnz) )             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMPISBAIJSetPreallocation(__pyx_v_A, __pyx_v_bs, __pyx_v_d_nz, __pyx_v_d_nnz, __pyx_v_o_nz, __pyx_v_o_nnz)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 659, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":657
 *         CHKERR( MatSeqBAIJSetPreallocation(A, bs, d_nz, d_nnz) )
 *         CHKERR( MatMPIBAIJSetPreallocation(A, bs, d_nz, d_nnz, o_nz, o_nnz) )
 *     if sbaij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSeqSBAIJSetPreallocation(A, bs, d_nz, d_nnz) )
 *         CHKERR( MatMPISBAIJSetPreallocation(A, bs, d_nz, d_nnz, o_nz, o_nnz) )
 */
  }

  /* "PETSc/petscmat.pxi":660
 *         CHKERR( MatSeqSBAIJSetPreallocation(A, bs, d_nz, d_nnz) )
 *         CHKERR( MatMPISBAIJSetPreallocation(A, bs, d_nz, d_nnz, o_nz, o_nnz) )
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Mat_AllocAIJ_CSR(PetscMat A, object CSR) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":613
 *     return 0
 * 
 * cdef inline int Mat_AllocAIJ_NNZ( PetscMat A, object NNZ) except -1:             # <<<<<<<<<<<<<<
 *     #
 *     cdef PetscBool aij=PETSC_FALSE, baij=PETSC_FALSE, sbaij=PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat_AllocAIJ_NNZ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_od_nnz);
  __Pyx_XDECREF(__pyx_v_oo_nnz);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":662
 *     return 0
 * 
 * cdef inline int Mat_AllocAIJ_CSR(PetscMat A, object CSR) except -1:             # <<<<<<<<<<<<<<
 *     #
 *     cdef PetscBool aij=PETSC_FALSE, baij=PETSC_FALSE, sbaij=PETSC_FALSE
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ_CSR(Mat __pyx_v_A, PyObject *__pyx_v_CSR) {
  PetscBool __pyx_v_aij;
  PetscBool __pyx_v_baij;
  PetscBool __pyx_v_sbaij;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_bs;
  PyObject *__pyx_v_oi = 0;
  PyObject *__pyx_v_oj = 0;
  PyObject *__pyx_v_ov = 0;
  PetscInt __pyx_v_ni;
  PetscInt *__pyx_v_i;
  PetscInt __pyx_v_nj;
  PetscInt *__pyx_v_j;
  PetscInt __pyx_v_nv;
  PetscScalar *__pyx_v_v;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  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 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("Mat_AllocAIJ_CSR", 0);

  /* "PETSc/petscmat.pxi":664
 * cdef inline int Mat_AllocAIJ_CSR(PetscMat A, object CSR) except -1:
 *     #
 *     cdef PetscBool aij=PETSC_FALSE, baij=PETSC_FALSE, sbaij=PETSC_FALSE             # <<<<<<<<<<<<<<
 *     CHKERR( MatHasPreallocationAIJ(A, &aij, &baij, &sbaij))
 *     # local row size and block size
 */
  __pyx_v_aij = PETSC_FALSE;
  __pyx_v_baij = PETSC_FALSE;
  __pyx_v_sbaij = PETSC_FALSE;

  /* "PETSc/petscmat.pxi":665
 *     #
 *     cdef PetscBool aij=PETSC_FALSE, baij=PETSC_FALSE, sbaij=PETSC_FALSE
 *     CHKERR( MatHasPreallocationAIJ(A, &aij, &baij, &sbaij))             # <<<<<<<<<<<<<<
 *     # local row size and block size
 *     cdef PetscInt m=0, bs = 1
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatHasPreallocationAIJ(__pyx_v_A, (&__pyx_v_aij), (&__pyx_v_baij), (&__pyx_v_sbaij))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 665, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":667
 *     CHKERR( MatHasPreallocationAIJ(A, &aij, &baij, &sbaij))
 *     # local row size and block size
 *     cdef PetscInt m=0, bs = 1             # <<<<<<<<<<<<<<
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 *     if baij == PETSC_TRUE or sbaij == PETSC_TRUE:
 */
  __pyx_v_m = 0;
  __pyx_v_bs = 1;

  /* "PETSc/petscmat.pxi":668
 *     # local row size and block size
 *     cdef PetscInt m=0, bs = 1
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )             # <<<<<<<<<<<<<<
 *     if baij == PETSC_TRUE or sbaij == PETSC_TRUE:
 *         CHKERR( MatGetBlockSize(A, &bs) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetLocalSize(__pyx_v_A, (&__pyx_v_m), NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 668, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":669
 *     cdef PetscInt m=0, bs = 1
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 *     if baij == PETSC_TRUE or sbaij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetBlockSize(A, &bs) )
 *         assert bs > 0, "block size not set"
 */
  __pyx_t_3 = ((__pyx_v_baij == PETSC_TRUE) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_sbaij == PETSC_TRUE) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":670
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 *     if baij == PETSC_TRUE or sbaij == PETSC_TRUE:
 *         CHKERR( MatGetBlockSize(A, &bs) )             # <<<<<<<<<<<<<<
 *         assert bs > 0, "block size not set"
 *     # unpack CSR argument
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetBlockSize(__pyx_v_A, (&__pyx_v_bs))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 670, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":671
 *     if baij == PETSC_TRUE or sbaij == PETSC_TRUE:
 *         CHKERR( MatGetBlockSize(A, &bs) )
 *         assert bs > 0, "block size not set"             # <<<<<<<<<<<<<<
 *     # unpack CSR argument
 *     cdef object oi, oj, ov
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!((__pyx_v_bs > 0) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_block_size_not_set);
        __PYX_ERR(6, 671, __pyx_L1_error)
      }
    }
    #endif

    /* "PETSc/petscmat.pxi":669
 *     cdef PetscInt m=0, bs = 1
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 *     if baij == PETSC_TRUE or sbaij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetBlockSize(A, &bs) )
 *         assert bs > 0, "block size not set"
 */
  }

  /* "PETSc/petscmat.pxi":674
 *     # unpack CSR argument
 *     cdef object oi, oj, ov
 *     try:             # <<<<<<<<<<<<<<
 *         oi, oj, ov = CSR
 *     except (TypeError, ValueError):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "PETSc/petscmat.pxi":675
 *     cdef object oi, oj, ov
 *     try:
 *         oi, oj, ov = CSR             # <<<<<<<<<<<<<<
 *     except (TypeError, ValueError):
 *         oi, oj = CSR; ov = None
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_CSR))) || (PyList_CheckExact(__pyx_v_CSR))) {
        PyObject* sequence = __pyx_v_CSR;
        #if CYTHON_COMPILING_IN_CPYTHON
        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(6, 675, __pyx_L6_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 675, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 675, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 675, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_v_CSR); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 675, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
        index = 0; __pyx_t_7 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) __PYX_ERR(6, 675, __pyx_L6_error)
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L15_unpacking_done;
        __pyx_L14_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(6, 675, __pyx_L6_error)
        __pyx_L15_unpacking_done:;
      }
      __pyx_v_oi = __pyx_t_7;
      __pyx_t_7 = 0;
      __pyx_v_oj = __pyx_t_8;
      __pyx_t_8 = 0;
      __pyx_v_ov = __pyx_t_9;
      __pyx_t_9 = 0;

      /* "PETSc/petscmat.pxi":674
 *     # unpack CSR argument
 *     cdef object oi, oj, ov
 *     try:             # <<<<<<<<<<<<<<
 *         oi, oj, ov = CSR
 *     except (TypeError, ValueError):
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "PETSc/petscmat.pxi":676
 *     try:
 *         oi, oj, ov = CSR
 *     except (TypeError, ValueError):             # <<<<<<<<<<<<<<
 *         oi, oj = CSR; ov = None
 *     # rows, cols, and values
 */
    __pyx_t_1 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_1) {
      __Pyx_AddTraceback("petsc4py.PETSc.Mat_AllocAIJ_CSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7) < 0) __PYX_ERR(6, 676, __pyx_L8_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_7);

      /* "PETSc/petscmat.pxi":677
 *         oi, oj, ov = CSR
 *     except (TypeError, ValueError):
 *         oi, oj = CSR; ov = None             # <<<<<<<<<<<<<<
 *     # rows, cols, and values
 *     cdef PetscInt ni=0, *i=NULL
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_CSR))) || (PyList_CheckExact(__pyx_v_CSR))) {
        PyObject* sequence = __pyx_v_CSR;
        #if CYTHON_COMPILING_IN_CPYTHON
        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(6, 677, __pyx_L8_except_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_12);
        #else
        __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 677, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(6, 677, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_13 = PyObject_GetIter(__pyx_v_CSR); if (unlikely(!__pyx_t_13)) __PYX_ERR(6, 677, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_11 = Py_TYPE(__pyx_t_13)->tp_iternext;
        index = 0; __pyx_t_10 = __pyx_t_11(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L18_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        index = 1; __pyx_t_12 = __pyx_t_11(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L18_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_13), 2) < 0) __PYX_ERR(6, 677, __pyx_L8_except_error)
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L19_unpacking_done;
        __pyx_L18_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(6, 677, __pyx_L8_except_error)
        __pyx_L19_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_oi, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_oj, __pyx_t_12);
      __pyx_t_12 = 0;
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_ov, Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_exception_handled;
    }
    goto __pyx_L8_except_error;
    __pyx_L8_except_error:;

    /* "PETSc/petscmat.pxi":674
 *     # unpack CSR argument
 *     cdef object oi, oj, ov
 *     try:             # <<<<<<<<<<<<<<
 *         oi, oj, ov = CSR
 *     except (TypeError, ValueError):
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L13_try_end:;
  }

  /* "PETSc/petscmat.pxi":679
 *         oi, oj = CSR; ov = None
 *     # rows, cols, and values
 *     cdef PetscInt ni=0, *i=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscInt nj=0, *j=NULL
 *     cdef PetscInt nv=0
 */
  __pyx_v_ni = 0;
  __pyx_v_i = NULL;

  /* "PETSc/petscmat.pxi":680
 *     # rows, cols, and values
 *     cdef PetscInt ni=0, *i=NULL
 *     cdef PetscInt nj=0, *j=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscInt nv=0
 *     cdef PetscScalar *v=NULL
 */
  __pyx_v_nj = 0;
  __pyx_v_j = NULL;

  /* "PETSc/petscmat.pxi":681
 *     cdef PetscInt ni=0, *i=NULL
 *     cdef PetscInt nj=0, *j=NULL
 *     cdef PetscInt nv=0             # <<<<<<<<<<<<<<
 *     cdef PetscScalar *v=NULL
 *     oi = iarray_i(oi, &ni, &i)
 */
  __pyx_v_nv = 0;

  /* "PETSc/petscmat.pxi":682
 *     cdef PetscInt nj=0, *j=NULL
 *     cdef PetscInt nv=0
 *     cdef PetscScalar *v=NULL             # <<<<<<<<<<<<<<
 *     oi = iarray_i(oi, &ni, &i)
 *     oj = iarray_i(oj, &nj, &j)
 */
  __pyx_v_v = NULL;

  /* "PETSc/petscmat.pxi":683
 *     cdef PetscInt nv=0
 *     cdef PetscScalar *v=NULL
 *     oi = iarray_i(oi, &ni, &i)             # <<<<<<<<<<<<<<
 *     oj = iarray_i(oj, &nj, &j)
 *     if ov is not None:
 */
  __pyx_t_7 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_oi, (&__pyx_v_ni), (&__pyx_v_i))); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF_SET(__pyx_v_oi, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "PETSc/petscmat.pxi":684
 *     cdef PetscScalar *v=NULL
 *     oi = iarray_i(oi, &ni, &i)
 *     oj = iarray_i(oj, &nj, &j)             # <<<<<<<<<<<<<<
 *     if ov is not None:
 *         ov = iarray_s(ov, &nv, &v)
 */
  __pyx_t_7 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_oj, (&__pyx_v_nj), (&__pyx_v_j))); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF_SET(__pyx_v_oj, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "PETSc/petscmat.pxi":685
 *     oi = iarray_i(oi, &ni, &i)
 *     oj = iarray_i(oj, &nj, &j)
 *     if ov is not None:             # <<<<<<<<<<<<<<
 *         ov = iarray_s(ov, &nv, &v)
 *     if m == PETSC_DECIDE: m = (ni-1)*bs
 */
  __pyx_t_2 = (__pyx_v_ov != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":686
 *     oj = iarray_i(oj, &nj, &j)
 *     if ov is not None:
 *         ov = iarray_s(ov, &nv, &v)             # <<<<<<<<<<<<<<
 *     if m == PETSC_DECIDE: m = (ni-1)*bs
 *     # check array sizes
 */
    __pyx_t_7 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_s(__pyx_v_ov, (&__pyx_v_nv), (&__pyx_v_v))); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 686, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF_SET(__pyx_v_ov, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "PETSc/petscmat.pxi":685
 *     oi = iarray_i(oi, &ni, &i)
 *     oj = iarray_i(oj, &nj, &j)
 *     if ov is not None:             # <<<<<<<<<<<<<<
 *         ov = iarray_s(ov, &nv, &v)
 *     if m == PETSC_DECIDE: m = (ni-1)*bs
 */
  }

  /* "PETSc/petscmat.pxi":687
 *     if ov is not None:
 *         ov = iarray_s(ov, &nv, &v)
 *     if m == PETSC_DECIDE: m = (ni-1)*bs             # <<<<<<<<<<<<<<
 *     # check array sizes
 *     if ((ni-1)*bs != m):
 */
  __pyx_t_3 = ((__pyx_v_m == PETSC_DECIDE) != 0);
  if (__pyx_t_3) {
    __pyx_v_m = ((__pyx_v_ni - 1) * __pyx_v_bs);
  }

  /* "PETSc/petscmat.pxi":689
 *     if m == PETSC_DECIDE: m = (ni-1)*bs
 *     # check array sizes
 *     if ((ni-1)*bs != m):             # <<<<<<<<<<<<<<
 *         raise ValueError("size(I) is %d, expected %d" %
 *                          (toInt(ni), toInt(m//bs+1)) )
 */
  __pyx_t_3 = ((((__pyx_v_ni - 1) * __pyx_v_bs) != __pyx_v_m) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":691
 *     if ((ni-1)*bs != m):
 *         raise ValueError("size(I) is %d, expected %d" %
 *                          (toInt(ni), toInt(m//bs+1)) )             # <<<<<<<<<<<<<<
 *     if (i[0] != 0):
 *         raise ValueError("I[0] is %d, expected %d" %
 */
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ni); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 691, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_toInt(((__pyx_v_m / __pyx_v_bs) + 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 691, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 691, __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_t_7 = 0;
    __pyx_t_8 = 0;

    /* "PETSc/petscmat.pxi":690
 *     # check array sizes
 *     if ((ni-1)*bs != m):
 *         raise ValueError("size(I) is %d, expected %d" %             # <<<<<<<<<<<<<<
 *                          (toInt(ni), toInt(m//bs+1)) )
 *     if (i[0] != 0):
 */
    __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_size_I_is_d_expected_d, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 690, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(6, 690, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":689
 *     if m == PETSC_DECIDE: m = (ni-1)*bs
 *     # check array sizes
 *     if ((ni-1)*bs != m):             # <<<<<<<<<<<<<<
 *         raise ValueError("size(I) is %d, expected %d" %
 *                          (toInt(ni), toInt(m//bs+1)) )
 */
  }

  /* "PETSc/petscmat.pxi":692
 *         raise ValueError("size(I) is %d, expected %d" %
 *                          (toInt(ni), toInt(m//bs+1)) )
 *     if (i[0] != 0):             # <<<<<<<<<<<<<<
 *         raise ValueError("I[0] is %d, expected %d" %
 *                          (toInt(i[0]), toInt(0)) )
 */
  __pyx_t_3 = (((__pyx_v_i[0]) != 0) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":694
 *     if (i[0] != 0):
 *         raise ValueError("I[0] is %d, expected %d" %
 *                          (toInt(i[0]), toInt(0)) )             # <<<<<<<<<<<<<<
 *     if (i[ni-1] != nj):
 *         raise ValueError("size(J) is %d, expected %d" %
 */
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_i[0])); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_toInt(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 694, __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_9);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;

    /* "PETSc/petscmat.pxi":693
 *                          (toInt(ni), toInt(m//bs+1)) )
 *     if (i[0] != 0):
 *         raise ValueError("I[0] is %d, expected %d" %             # <<<<<<<<<<<<<<
 *                          (toInt(i[0]), toInt(0)) )
 *     if (i[ni-1] != nj):
 */
    __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_I_0_is_d_expected_d, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 693, __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(6, 693, __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 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 693, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_Raise(__pyx_t_9, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __PYX_ERR(6, 693, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":692
 *         raise ValueError("size(I) is %d, expected %d" %
 *                          (toInt(ni), toInt(m//bs+1)) )
 *     if (i[0] != 0):             # <<<<<<<<<<<<<<
 *         raise ValueError("I[0] is %d, expected %d" %
 *                          (toInt(i[0]), toInt(0)) )
 */
  }

  /* "PETSc/petscmat.pxi":695
 *         raise ValueError("I[0] is %d, expected %d" %
 *                          (toInt(i[0]), toInt(0)) )
 *     if (i[ni-1] != nj):             # <<<<<<<<<<<<<<
 *         raise ValueError("size(J) is %d, expected %d" %
 *                          (toInt(nj), toInt(i[ni-1])) )
 */
  __pyx_t_3 = (((__pyx_v_i[(__pyx_v_ni - 1)]) != __pyx_v_nj) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":697
 *     if (i[ni-1] != nj):
 *         raise ValueError("size(J) is %d, expected %d" %
 *                          (toInt(nj), toInt(i[ni-1])) )             # <<<<<<<<<<<<<<
 *     if v != NULL and (nj*bs*bs != nv):
 *         raise ValueError("size(V) is %d, expected %d" %
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nj); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 697, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_i[(__pyx_v_ni - 1)])); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 697, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 697, __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_7);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
    __pyx_t_9 = 0;
    __pyx_t_7 = 0;

    /* "PETSc/petscmat.pxi":696
 *                          (toInt(i[0]), toInt(0)) )
 *     if (i[ni-1] != nj):
 *         raise ValueError("size(J) is %d, expected %d" %             # <<<<<<<<<<<<<<
 *                          (toInt(nj), toInt(i[ni-1])) )
 *     if v != NULL and (nj*bs*bs != nv):
 */
    __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_size_J_is_d_expected_d, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 696, __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 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(6, 696, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":695
 *         raise ValueError("I[0] is %d, expected %d" %
 *                          (toInt(i[0]), toInt(0)) )
 *     if (i[ni-1] != nj):             # <<<<<<<<<<<<<<
 *         raise ValueError("size(J) is %d, expected %d" %
 *                          (toInt(nj), toInt(i[ni-1])) )
 */
  }

  /* "PETSc/petscmat.pxi":698
 *         raise ValueError("size(J) is %d, expected %d" %
 *                          (toInt(nj), toInt(i[ni-1])) )
 *     if v != NULL and (nj*bs*bs != nv):             # <<<<<<<<<<<<<<
 *         raise ValueError("size(V) is %d, expected %d" %
 *                          (toInt(nv), toInt(nj*bs*bs)) )
 */
  __pyx_t_2 = ((__pyx_v_v != NULL) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L26_bool_binop_done;
  }
  __pyx_t_2 = ((((__pyx_v_nj * __pyx_v_bs) * __pyx_v_bs) != __pyx_v_nv) != 0);
  __pyx_t_3 = __pyx_t_2;
  __pyx_L26_bool_binop_done:;
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":700
 *     if v != NULL and (nj*bs*bs != nv):
 *         raise ValueError("size(V) is %d, expected %d" %
 *                          (toInt(nv), toInt(nj*bs*bs)) )             # <<<<<<<<<<<<<<
 *     # preallocate
 *     if aij == PETSC_TRUE:
 */
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nv); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_toInt(((__pyx_v_nj * __pyx_v_bs) * __pyx_v_bs)); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 700, __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_t_7 = 0;
    __pyx_t_8 = 0;

    /* "PETSc/petscmat.pxi":699
 *                          (toInt(nj), toInt(i[ni-1])) )
 *     if v != NULL and (nj*bs*bs != nv):
 *         raise ValueError("size(V) is %d, expected %d" %             # <<<<<<<<<<<<<<
 *                          (toInt(nv), toInt(nj*bs*bs)) )
 *     # preallocate
 */
    __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_size_V_is_d_expected_d, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 699, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(6, 699, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":698
 *         raise ValueError("size(J) is %d, expected %d" %
 *                          (toInt(nj), toInt(i[ni-1])) )
 *     if v != NULL and (nj*bs*bs != nv):             # <<<<<<<<<<<<<<
 *         raise ValueError("size(V) is %d, expected %d" %
 *                          (toInt(nv), toInt(nj*bs*bs)) )
 */
  }

  /* "PETSc/petscmat.pxi":702
 *                          (toInt(nv), toInt(nj*bs*bs)) )
 *     # preallocate
 *     if aij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSeqAIJSetPreallocationCSR(A, i, j, v) )
 *         CHKERR( MatMPIAIJSetPreallocationCSR(A, i, j, v) )
 */
  __pyx_t_3 = ((__pyx_v_aij == PETSC_TRUE) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":703
 *     # preallocate
 *     if aij == PETSC_TRUE:
 *         CHKERR( MatSeqAIJSetPreallocationCSR(A, i, j, v) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatMPIAIJSetPreallocationCSR(A, i, j, v) )
 *     if baij == PETSC_TRUE:
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSeqAIJSetPreallocationCSR(__pyx_v_A, __pyx_v_i, __pyx_v_j, __pyx_v_v)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 703, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":704
 *     if aij == PETSC_TRUE:
 *         CHKERR( MatSeqAIJSetPreallocationCSR(A, i, j, v) )
 *         CHKERR( MatMPIAIJSetPreallocationCSR(A, i, j, v) )             # <<<<<<<<<<<<<<
 *     if baij == PETSC_TRUE:
 *         CHKERR( MatSeqBAIJSetPreallocationCSR(A, bs, i, j, v) )
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMPIAIJSetPreallocationCSR(__pyx_v_A, __pyx_v_i, __pyx_v_j, __pyx_v_v)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 704, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":702
 *                          (toInt(nv), toInt(nj*bs*bs)) )
 *     # preallocate
 *     if aij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSeqAIJSetPreallocationCSR(A, i, j, v) )
 *         CHKERR( MatMPIAIJSetPreallocationCSR(A, i, j, v) )
 */
  }

  /* "PETSc/petscmat.pxi":705
 *         CHKERR( MatSeqAIJSetPreallocationCSR(A, i, j, v) )
 *         CHKERR( MatMPIAIJSetPreallocationCSR(A, i, j, v) )
 *     if baij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSeqBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *         CHKERR( MatMPIBAIJSetPreallocationCSR(A, bs, i, j, v) )
 */
  __pyx_t_3 = ((__pyx_v_baij == PETSC_TRUE) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":706
 *         CHKERR( MatMPIAIJSetPreallocationCSR(A, i, j, v) )
 *     if baij == PETSC_TRUE:
 *         CHKERR( MatSeqBAIJSetPreallocationCSR(A, bs, i, j, v) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatMPIBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *     if sbaij == PETSC_TRUE:
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSeqBAIJSetPreallocationCSR(__pyx_v_A, __pyx_v_bs, __pyx_v_i, __pyx_v_j, __pyx_v_v)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 706, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":707
 *     if baij == PETSC_TRUE:
 *         CHKERR( MatSeqBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *         CHKERR( MatMPIBAIJSetPreallocationCSR(A, bs, i, j, v) )             # <<<<<<<<<<<<<<
 *     if sbaij == PETSC_TRUE:
 *         CHKERR( MatSeqSBAIJSetPreallocationCSR(A, bs, i, j, v) )
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMPIBAIJSetPreallocationCSR(__pyx_v_A, __pyx_v_bs, __pyx_v_i, __pyx_v_j, __pyx_v_v)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 707, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":705
 *         CHKERR( MatSeqAIJSetPreallocationCSR(A, i, j, v) )
 *         CHKERR( MatMPIAIJSetPreallocationCSR(A, i, j, v) )
 *     if baij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSeqBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *         CHKERR( MatMPIBAIJSetPreallocationCSR(A, bs, i, j, v) )
 */
  }

  /* "PETSc/petscmat.pxi":708
 *         CHKERR( MatSeqBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *         CHKERR( MatMPIBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *     if sbaij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSeqSBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *         CHKERR( MatMPISBAIJSetPreallocationCSR(A, bs, i, j, v) )
 */
  __pyx_t_3 = ((__pyx_v_sbaij == PETSC_TRUE) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":709
 *         CHKERR( MatMPIBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *     if sbaij == PETSC_TRUE:
 *         CHKERR( MatSeqSBAIJSetPreallocationCSR(A, bs, i, j, v) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatMPISBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *     return 0
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSeqSBAIJSetPreallocationCSR(__pyx_v_A, __pyx_v_bs, __pyx_v_i, __pyx_v_j, __pyx_v_v)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 709, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":710
 *     if sbaij == PETSC_TRUE:
 *         CHKERR( MatSeqSBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *         CHKERR( MatMPISBAIJSetPreallocationCSR(A, bs, i, j, v) )             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMPISBAIJSetPreallocationCSR(__pyx_v_A, __pyx_v_bs, __pyx_v_i, __pyx_v_j, __pyx_v_v)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 710, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":708
 *         CHKERR( MatSeqBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *         CHKERR( MatMPIBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *     if sbaij == PETSC_TRUE:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSeqSBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *         CHKERR( MatMPISBAIJSetPreallocationCSR(A, bs, i, j, v) )
 */
  }

  /* "PETSc/petscmat.pxi":711
 *         CHKERR( MatSeqSBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *         CHKERR( MatMPISBAIJSetPreallocationCSR(A, bs, i, j, v) )
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Mat_AllocAIJ(PetscMat A,object NNZ, object CSR) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":662
 *     return 0
 * 
 * cdef inline int Mat_AllocAIJ_CSR(PetscMat A, object CSR) except -1:             # <<<<<<<<<<<<<<
 *     #
 *     cdef PetscBool aij=PETSC_FALSE, baij=PETSC_FALSE, sbaij=PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat_AllocAIJ_CSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_oi);
  __Pyx_XDECREF(__pyx_v_oj);
  __Pyx_XDECREF(__pyx_v_ov);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":713
 *     return 0
 * 
 * cdef inline int Mat_AllocAIJ(PetscMat A,object NNZ, object CSR) except -1:             # <<<<<<<<<<<<<<
 *     if CSR is not None:
 *         return Mat_AllocAIJ_CSR(A, CSR)
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ(Mat __pyx_v_A, PyObject *__pyx_v_NNZ, PyObject *__pyx_v_CSR) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("Mat_AllocAIJ", 0);

  /* "PETSc/petscmat.pxi":714
 * 
 * cdef inline int Mat_AllocAIJ(PetscMat A,object NNZ, object CSR) except -1:
 *     if CSR is not None:             # <<<<<<<<<<<<<<
 *         return Mat_AllocAIJ_CSR(A, CSR)
 *     if NNZ is not None:
 */
  __pyx_t_1 = (__pyx_v_CSR != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":715
 * cdef inline int Mat_AllocAIJ(PetscMat A,object NNZ, object CSR) except -1:
 *     if CSR is not None:
 *         return Mat_AllocAIJ_CSR(A, CSR)             # <<<<<<<<<<<<<<
 *     if NNZ is not None:
 *         return Mat_AllocAIJ_NNZ(A, NNZ)
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ_CSR(__pyx_v_A, __pyx_v_CSR); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(6, 715, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "PETSc/petscmat.pxi":714
 * 
 * cdef inline int Mat_AllocAIJ(PetscMat A,object NNZ, object CSR) except -1:
 *     if CSR is not None:             # <<<<<<<<<<<<<<
 *         return Mat_AllocAIJ_CSR(A, CSR)
 *     if NNZ is not None:
 */
  }

  /* "PETSc/petscmat.pxi":716
 *     if CSR is not None:
 *         return Mat_AllocAIJ_CSR(A, CSR)
 *     if NNZ is not None:             # <<<<<<<<<<<<<<
 *         return Mat_AllocAIJ_NNZ(A, NNZ)
 *     return 0
 */
  __pyx_t_2 = (__pyx_v_NNZ != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscmat.pxi":717
 *         return Mat_AllocAIJ_CSR(A, CSR)
 *     if NNZ is not None:
 *         return Mat_AllocAIJ_NNZ(A, NNZ)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ_NNZ(__pyx_v_A, __pyx_v_NNZ); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(6, 717, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "PETSc/petscmat.pxi":716
 *     if CSR is not None:
 *         return Mat_AllocAIJ_CSR(A, CSR)
 *     if NNZ is not None:             # <<<<<<<<<<<<<<
 *         return Mat_AllocAIJ_NNZ(A, NNZ)
 *     return 0
 */
  }

  /* "PETSc/petscmat.pxi":718
 *     if NNZ is not None:
 *         return Mat_AllocAIJ_NNZ(A, NNZ)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline object Mat_AllocDense(PetscMat A, object array):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":713
 *     return 0
 * 
 * cdef inline int Mat_AllocAIJ(PetscMat A,object NNZ, object CSR) except -1:             # <<<<<<<<<<<<<<
 *     if CSR is not None:
 *         return Mat_AllocAIJ_CSR(A, CSR)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat_AllocAIJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":720
 *     return 0
 * 
 * cdef inline object Mat_AllocDense(PetscMat A, object array):             # <<<<<<<<<<<<<<
 *     cdef PetscInt m=0, N=0
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_Mat_AllocDense(Mat __pyx_v_A, PyObject *__pyx_v_array) {
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_N;
  PetscInt __pyx_v_size;
  PetscScalar *__pyx_v_data;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  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 = NULL;
  __Pyx_RefNannySetupContext("Mat_AllocDense", 0);
  __Pyx_INCREF(__pyx_v_array);

  /* "PETSc/petscmat.pxi":721
 * 
 * cdef inline object Mat_AllocDense(PetscMat A, object array):
 *     cdef PetscInt m=0, N=0             # <<<<<<<<<<<<<<
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 *     CHKERR( MatGetSize(A, NULL, &N) )
 */
  __pyx_v_m = 0;
  __pyx_v_N = 0;

  /* "PETSc/petscmat.pxi":722
 * cdef inline object Mat_AllocDense(PetscMat A, object array):
 *     cdef PetscInt m=0, N=0
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )             # <<<<<<<<<<<<<<
 *     CHKERR( MatGetSize(A, NULL, &N) )
 *     cdef PetscInt size=0
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetLocalSize(__pyx_v_A, (&__pyx_v_m), NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 722, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":723
 *     cdef PetscInt m=0, N=0
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 *     CHKERR( MatGetSize(A, NULL, &N) )             # <<<<<<<<<<<<<<
 *     cdef PetscInt size=0
 *     cdef PetscScalar *data=NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetSize(__pyx_v_A, NULL, (&__pyx_v_N))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 723, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":724
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 *     CHKERR( MatGetSize(A, NULL, &N) )
 *     cdef PetscInt size=0             # <<<<<<<<<<<<<<
 *     cdef PetscScalar *data=NULL
 *     if array is not None:
 */
  __pyx_v_size = 0;

  /* "PETSc/petscmat.pxi":725
 *     CHKERR( MatGetSize(A, NULL, &N) )
 *     cdef PetscInt size=0
 *     cdef PetscScalar *data=NULL             # <<<<<<<<<<<<<<
 *     if array is not None:
 *         array = ofarray_s(array, &size, &data)
 */
  __pyx_v_data = NULL;

  /* "PETSc/petscmat.pxi":726
 *     cdef PetscInt size=0
 *     cdef PetscScalar *data=NULL
 *     if array is not None:             # <<<<<<<<<<<<<<
 *         array = ofarray_s(array, &size, &data)
 *         if m*N != size: raise ValueError(
 */
  __pyx_t_2 = (__pyx_v_array != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":727
 *     cdef PetscScalar *data=NULL
 *     if array is not None:
 *         array = ofarray_s(array, &size, &data)             # <<<<<<<<<<<<<<
 *         if m*N != size: raise ValueError(
 *             "size(array) is %d, expected %dx%d=%d" %
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ofarray_s(__pyx_v_array, (&__pyx_v_size), (&__pyx_v_data))); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_array, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/petscmat.pxi":728
 *     if array is not None:
 *         array = ofarray_s(array, &size, &data)
 *         if m*N != size: raise ValueError(             # <<<<<<<<<<<<<<
 *             "size(array) is %d, expected %dx%d=%d" %
 *             (toInt(size), toInt(m), toInt(N), toInt(m*N)) )
 */
    __pyx_t_3 = (((__pyx_v_m * __pyx_v_N) != __pyx_v_size) != 0);
    if (__pyx_t_3) {

      /* "PETSc/petscmat.pxi":730
 *         if m*N != size: raise ValueError(
 *             "size(array) is %d, expected %dx%d=%d" %
 *             (toInt(size), toInt(m), toInt(N), toInt(m*N)) )             # <<<<<<<<<<<<<<
 *     CHKERR( MatSeqDenseSetPreallocation(A, data) )
 *     CHKERR( MatMPIDenseSetPreallocation(A, data) )
 */
      __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_m); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_m * __pyx_v_N)); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 730, __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_5);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_7);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;

      /* "PETSc/petscmat.pxi":729
 *         array = ofarray_s(array, &size, &data)
 *         if m*N != size: raise ValueError(
 *             "size(array) is %d, expected %dx%d=%d" %             # <<<<<<<<<<<<<<
 *             (toInt(size), toInt(m), toInt(N), toInt(m*N)) )
 *     CHKERR( MatSeqDenseSetPreallocation(A, data) )
 */
      __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_size_array_is_d_expected_dx_d_d, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 729, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "PETSc/petscmat.pxi":728
 *     if array is not None:
 *         array = ofarray_s(array, &size, &data)
 *         if m*N != size: raise ValueError(             # <<<<<<<<<<<<<<
 *             "size(array) is %d, expected %dx%d=%d" %
 *             (toInt(size), toInt(m), toInt(N), toInt(m*N)) )
 */
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 728, __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 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 728, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_7, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(6, 728, __pyx_L1_error)
    }

    /* "PETSc/petscmat.pxi":726
 *     cdef PetscInt size=0
 *     cdef PetscScalar *data=NULL
 *     if array is not None:             # <<<<<<<<<<<<<<
 *         array = ofarray_s(array, &size, &data)
 *         if m*N != size: raise ValueError(
 */
  }

  /* "PETSc/petscmat.pxi":731
 *             "size(array) is %d, expected %dx%d=%d" %
 *             (toInt(size), toInt(m), toInt(N), toInt(m*N)) )
 *     CHKERR( MatSeqDenseSetPreallocation(A, data) )             # <<<<<<<<<<<<<<
 *     CHKERR( MatMPIDenseSetPreallocation(A, data) )
 *     return array
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSeqDenseSetPreallocation(__pyx_v_A, __pyx_v_data)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 731, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":732
 *             (toInt(size), toInt(m), toInt(N), toInt(m*N)) )
 *     CHKERR( MatSeqDenseSetPreallocation(A, data) )
 *     CHKERR( MatMPIDenseSetPreallocation(A, data) )             # <<<<<<<<<<<<<<
 *     return array
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMPIDenseSetPreallocation(__pyx_v_A, __pyx_v_data)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 732, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":733
 *     CHKERR( MatSeqDenseSetPreallocation(A, data) )
 *     CHKERR( MatMPIDenseSetPreallocation(A, data) )
 *     return array             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_array);
  __pyx_r = __pyx_v_array;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":720
 *     return 0
 * 
 * cdef inline object Mat_AllocDense(PetscMat A, object array):             # <<<<<<<<<<<<<<
 *     cdef PetscInt m=0, N=0
 *     CHKERR( MatGetLocalSize(A, &m, NULL) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __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("petsc4py.PETSc.Mat_AllocDense", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":741
 *                              const_PetscScalar[],PetscInsertMode)
 * 
 * cdef inline MatSetValuesFcn* matsetvalues_fcn(int blocked, int local):             # <<<<<<<<<<<<<<
 *     cdef MatSetValuesFcn *setvalues = NULL
 *     if blocked and local: setvalues = MatSetValuesBlockedLocal
 */

static CYTHON_INLINE __pyx_t_8petsc4py_5PETSc_MatSetValuesFcn *__pyx_f_8petsc4py_5PETSc_matsetvalues_fcn(int __pyx_v_blocked, int __pyx_v_local) {
  __pyx_t_8petsc4py_5PETSc_MatSetValuesFcn *__pyx_v_setvalues;
  __pyx_t_8petsc4py_5PETSc_MatSetValuesFcn *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("matsetvalues_fcn", 0);

  /* "PETSc/petscmat.pxi":742
 * 
 * cdef inline MatSetValuesFcn* matsetvalues_fcn(int blocked, int local):
 *     cdef MatSetValuesFcn *setvalues = NULL             # <<<<<<<<<<<<<<
 *     if blocked and local: setvalues = MatSetValuesBlockedLocal
 *     elif blocked:         setvalues = MatSetValuesBlocked
 */
  __pyx_v_setvalues = NULL;

  /* "PETSc/petscmat.pxi":743
 * cdef inline MatSetValuesFcn* matsetvalues_fcn(int blocked, int local):
 *     cdef MatSetValuesFcn *setvalues = NULL
 *     if blocked and local: setvalues = MatSetValuesBlockedLocal             # <<<<<<<<<<<<<<
 *     elif blocked:         setvalues = MatSetValuesBlocked
 *     elif local:           setvalues = MatSetValuesLocal
 */
  __pyx_t_2 = (__pyx_v_blocked != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_local != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {
    __pyx_v_setvalues = MatSetValuesBlockedLocal;
    goto __pyx_L3;
  }

  /* "PETSc/petscmat.pxi":744
 *     cdef MatSetValuesFcn *setvalues = NULL
 *     if blocked and local: setvalues = MatSetValuesBlockedLocal
 *     elif blocked:         setvalues = MatSetValuesBlocked             # <<<<<<<<<<<<<<
 *     elif local:           setvalues = MatSetValuesLocal
 *     else:                 setvalues = MatSetValues
 */
  __pyx_t_1 = (__pyx_v_blocked != 0);
  if (__pyx_t_1) {
    __pyx_v_setvalues = MatSetValuesBlocked;
    goto __pyx_L3;
  }

  /* "PETSc/petscmat.pxi":745
 *     if blocked and local: setvalues = MatSetValuesBlockedLocal
 *     elif blocked:         setvalues = MatSetValuesBlocked
 *     elif local:           setvalues = MatSetValuesLocal             # <<<<<<<<<<<<<<
 *     else:                 setvalues = MatSetValues
 *     return setvalues
 */
  __pyx_t_1 = (__pyx_v_local != 0);
  if (__pyx_t_1) {
    __pyx_v_setvalues = MatSetValuesLocal;
    goto __pyx_L3;
  }

  /* "PETSc/petscmat.pxi":746
 *     elif blocked:         setvalues = MatSetValuesBlocked
 *     elif local:           setvalues = MatSetValuesLocal
 *     else:                 setvalues = MatSetValues             # <<<<<<<<<<<<<<
 *     return setvalues
 * 
 */
  /*else*/ {
    __pyx_v_setvalues = MatSetValues;
  }
  __pyx_L3:;

  /* "PETSc/petscmat.pxi":747
 *     elif local:           setvalues = MatSetValuesLocal
 *     else:                 setvalues = MatSetValues
 *     return setvalues             # <<<<<<<<<<<<<<
 * 
 * cdef inline int matsetvalues(PetscMat A,
 */
  __pyx_r = __pyx_v_setvalues;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":741
 *                              const_PetscScalar[],PetscInsertMode)
 * 
 * cdef inline MatSetValuesFcn* matsetvalues_fcn(int blocked, int local):             # <<<<<<<<<<<<<<
 *     cdef MatSetValuesFcn *setvalues = NULL
 *     if blocked and local: setvalues = MatSetValuesBlockedLocal
 */

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

/* "PETSc/petscmat.pxi":749
 *     return setvalues
 * 
 * cdef inline int matsetvalues(PetscMat A,             # <<<<<<<<<<<<<<
 *                              object oi, object oj, object ov,
 *                              object oaddv, int blocked, int local) except -1:
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_matsetvalues(Mat __pyx_v_A, PyObject *__pyx_v_oi, PyObject *__pyx_v_oj, PyObject *__pyx_v_ov, PyObject *__pyx_v_oaddv, int __pyx_v_blocked, int __pyx_v_local) {
  PetscInt __pyx_v_rbs;
  PetscInt __pyx_v_cbs;
  PetscInt __pyx_v_ni;
  PetscInt *__pyx_v_i;
  PetscInt __pyx_v_nj;
  PetscInt *__pyx_v_j;
  PetscInt __pyx_v_nv;
  PetscScalar *__pyx_v_v;
  __pyx_t_8petsc4py_5PETSc_MatSetValuesFcn *__pyx_v_setvalues;
  InsertMode __pyx_v_addv;
  int __pyx_r;
  __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;
  InsertMode __pyx_t_7;
  __Pyx_RefNannySetupContext("matsetvalues", 0);
  __Pyx_INCREF(__pyx_v_oi);
  __Pyx_INCREF(__pyx_v_oj);
  __Pyx_INCREF(__pyx_v_ov);

  /* "PETSc/petscmat.pxi":753
 *                              object oaddv, int blocked, int local) except -1:
 *     # block size
 *     cdef PetscInt rbs=1, cbs=1             # <<<<<<<<<<<<<<
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )
 *     if rbs < 1: rbs = 1
 */
  __pyx_v_rbs = 1;
  __pyx_v_cbs = 1;

  /* "PETSc/petscmat.pxi":754
 *     # block size
 *     cdef PetscInt rbs=1, cbs=1
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )             # <<<<<<<<<<<<<<
 *     if rbs < 1: rbs = 1
 *     if cbs < 1: cbs = 1
 */
  __pyx_t_1 = (__pyx_v_blocked != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetBlockSizes(__pyx_v_A, (&__pyx_v_rbs), (&__pyx_v_cbs))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 754, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":755
 *     cdef PetscInt rbs=1, cbs=1
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )
 *     if rbs < 1: rbs = 1             # <<<<<<<<<<<<<<
 *     if cbs < 1: cbs = 1
 *     # rows, cols, and values
 */
  __pyx_t_1 = ((__pyx_v_rbs < 1) != 0);
  if (__pyx_t_1) {
    __pyx_v_rbs = 1;
  }

  /* "PETSc/petscmat.pxi":756
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )
 *     if rbs < 1: rbs = 1
 *     if cbs < 1: cbs = 1             # <<<<<<<<<<<<<<
 *     # rows, cols, and values
 *     cdef PetscInt ni=0, *i=NULL
 */
  __pyx_t_1 = ((__pyx_v_cbs < 1) != 0);
  if (__pyx_t_1) {
    __pyx_v_cbs = 1;
  }

  /* "PETSc/petscmat.pxi":758
 *     if cbs < 1: cbs = 1
 *     # rows, cols, and values
 *     cdef PetscInt ni=0, *i=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscInt nj=0, *j=NULL
 *     cdef PetscInt nv=0
 */
  __pyx_v_ni = 0;
  __pyx_v_i = NULL;

  /* "PETSc/petscmat.pxi":759
 *     # rows, cols, and values
 *     cdef PetscInt ni=0, *i=NULL
 *     cdef PetscInt nj=0, *j=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscInt nv=0
 *     cdef PetscScalar *v=NULL
 */
  __pyx_v_nj = 0;
  __pyx_v_j = NULL;

  /* "PETSc/petscmat.pxi":760
 *     cdef PetscInt ni=0, *i=NULL
 *     cdef PetscInt nj=0, *j=NULL
 *     cdef PetscInt nv=0             # <<<<<<<<<<<<<<
 *     cdef PetscScalar *v=NULL
 *     oi = iarray_i(oi, &ni, &i)
 */
  __pyx_v_nv = 0;

  /* "PETSc/petscmat.pxi":761
 *     cdef PetscInt nj=0, *j=NULL
 *     cdef PetscInt nv=0
 *     cdef PetscScalar *v=NULL             # <<<<<<<<<<<<<<
 *     oi = iarray_i(oi, &ni, &i)
 *     oj = iarray_i(oj, &nj, &j)
 */
  __pyx_v_v = NULL;

  /* "PETSc/petscmat.pxi":762
 *     cdef PetscInt nv=0
 *     cdef PetscScalar *v=NULL
 *     oi = iarray_i(oi, &ni, &i)             # <<<<<<<<<<<<<<
 *     oj = iarray_i(oj, &nj, &j)
 *     ov = iarray_s(ov, &nv, &v)
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_oi, (&__pyx_v_ni), (&__pyx_v_i))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_oi, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscmat.pxi":763
 *     cdef PetscScalar *v=NULL
 *     oi = iarray_i(oi, &ni, &i)
 *     oj = iarray_i(oj, &nj, &j)             # <<<<<<<<<<<<<<
 *     ov = iarray_s(ov, &nv, &v)
 *     if ni*nj*rbs*cbs != nv: raise ValueError(
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_oj, (&__pyx_v_nj), (&__pyx_v_j))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_oj, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscmat.pxi":764
 *     oi = iarray_i(oi, &ni, &i)
 *     oj = iarray_i(oj, &nj, &j)
 *     ov = iarray_s(ov, &nv, &v)             # <<<<<<<<<<<<<<
 *     if ni*nj*rbs*cbs != nv: raise ValueError(
 *         "incompatible array sizes: ni=%d, nj=%d, nv=%d" %
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_s(__pyx_v_ov, (&__pyx_v_nv), (&__pyx_v_v))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_ov, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscmat.pxi":765
 *     oj = iarray_i(oj, &nj, &j)
 *     ov = iarray_s(ov, &nv, &v)
 *     if ni*nj*rbs*cbs != nv: raise ValueError(             # <<<<<<<<<<<<<<
 *         "incompatible array sizes: ni=%d, nj=%d, nv=%d" %
 *         (toInt(ni), toInt(nj), toInt(nv)) )
 */
  __pyx_t_1 = (((((__pyx_v_ni * __pyx_v_nj) * __pyx_v_rbs) * __pyx_v_cbs) != __pyx_v_nv) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscmat.pxi":767
 *     if ni*nj*rbs*cbs != nv: raise ValueError(
 *         "incompatible array sizes: ni=%d, nj=%d, nv=%d" %
 *         (toInt(ni), toInt(nj), toInt(nv)) )             # <<<<<<<<<<<<<<
 *     # MatSetValuesXXX function and insert mode
 *     cdef MatSetValuesFcn *setvalues = \
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ni); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 767, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nj); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 767, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nv); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 767, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 767, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;

    /* "PETSc/petscmat.pxi":766
 *     ov = iarray_s(ov, &nv, &v)
 *     if ni*nj*rbs*cbs != nv: raise ValueError(
 *         "incompatible array sizes: ni=%d, nj=%d, nv=%d" %             # <<<<<<<<<<<<<<
 *         (toInt(ni), toInt(nj), toInt(nv)) )
 *     # MatSetValuesXXX function and insert mode
 */
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_incompatible_array_sizes_ni_d_nj, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 766, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PETSc/petscmat.pxi":765
 *     oj = iarray_i(oj, &nj, &j)
 *     ov = iarray_s(ov, &nv, &v)
 *     if ni*nj*rbs*cbs != nv: raise ValueError(             # <<<<<<<<<<<<<<
 *         "incompatible array sizes: ni=%d, nj=%d, nv=%d" %
 *         (toInt(ni), toInt(nj), toInt(nv)) )
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 765, __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 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 765, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(6, 765, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":770
 *     # MatSetValuesXXX function and insert mode
 *     cdef MatSetValuesFcn *setvalues = \
 *          matsetvalues_fcn(blocked, local)             # <<<<<<<<<<<<<<
 *     cdef PetscInsertMode addv = insertmode(oaddv)
 *     # actual call
 */
  __pyx_v_setvalues = __pyx_f_8petsc4py_5PETSc_matsetvalues_fcn(__pyx_v_blocked, __pyx_v_local);

  /* "PETSc/petscmat.pxi":771
 *     cdef MatSetValuesFcn *setvalues = \
 *          matsetvalues_fcn(blocked, local)
 *     cdef PetscInsertMode addv = insertmode(oaddv)             # <<<<<<<<<<<<<<
 *     # actual call
 *     CHKERR( setvalues(A, ni, i, nj, j, v, addv) )
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_oaddv); if (unlikely(__pyx_t_7 == ((InsertMode)-1L))) __PYX_ERR(6, 771, __pyx_L1_error)
  __pyx_v_addv = __pyx_t_7;

  /* "PETSc/petscmat.pxi":773
 *     cdef PetscInsertMode addv = insertmode(oaddv)
 *     # actual call
 *     CHKERR( setvalues(A, ni, i, nj, j, v, addv) )             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_v_setvalues(__pyx_v_A, __pyx_v_ni, __pyx_v_i, __pyx_v_nj, __pyx_v_j, __pyx_v_v, __pyx_v_addv)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 773, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":774
 *     # actual call
 *     CHKERR( setvalues(A, ni, i, nj, j, v, addv) )
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int matsetvalues_rcv(PetscMat A,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":749
 *     return setvalues
 * 
 * cdef inline int matsetvalues(PetscMat A,             # <<<<<<<<<<<<<<
 *                              object oi, object oj, object ov,
 *                              object oaddv, int blocked, int local) except -1:
 */

  /* 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_AddTraceback("petsc4py.PETSc.matsetvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_oi);
  __Pyx_XDECREF(__pyx_v_oj);
  __Pyx_XDECREF(__pyx_v_ov);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":776
 *     return 0
 * 
 * cdef inline int matsetvalues_rcv(PetscMat A,             # <<<<<<<<<<<<<<
 *                                  object oi, object oj, object ov,
 *                                  object oaddv,
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_matsetvalues_rcv(Mat __pyx_v_A, PyObject *__pyx_v_oi, PyObject *__pyx_v_oj, PyObject *__pyx_v_ov, PyObject *__pyx_v_oaddv, int __pyx_v_blocked, int __pyx_v_local) {
  PetscInt __pyx_v_rbs;
  PetscInt __pyx_v_cbs;
  PetscInt __pyx_v_ni;
  PetscInt *__pyx_v_i;
  PetscInt __pyx_v_nj;
  PetscInt *__pyx_v_j;
  PetscInt __pyx_v_nv;
  PetscScalar *__pyx_v_v;
  PyArrayObject *__pyx_v_ai = 0;
  PyArrayObject *__pyx_v_aj = 0;
  PyArrayObject *__pyx_v_av = 0;
  Py_ssize_t __pyx_v_nm;
  Py_ssize_t __pyx_v_si;
  Py_ssize_t __pyx_v_sj;
  Py_ssize_t __pyx_v_sv;
  __pyx_t_8petsc4py_5PETSc_MatSetValuesFcn *__pyx_v_setvalues;
  InsertMode __pyx_v_addv;
  Py_ssize_t __pyx_v_k;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  InsertMode __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  __Pyx_RefNannySetupContext("matsetvalues_rcv", 0);

  /* "PETSc/petscmat.pxi":781
 *                                  int blocked, int local) except -1:
 *     # block size
 *     cdef PetscInt rbs=1, cbs=1             # <<<<<<<<<<<<<<
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )
 *     if rbs < 1: rbs = 1
 */
  __pyx_v_rbs = 1;
  __pyx_v_cbs = 1;

  /* "PETSc/petscmat.pxi":782
 *     # block size
 *     cdef PetscInt rbs=1, cbs=1
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )             # <<<<<<<<<<<<<<
 *     if rbs < 1: rbs = 1
 *     if cbs < 1: cbs = 1
 */
  __pyx_t_1 = (__pyx_v_blocked != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetBlockSizes(__pyx_v_A, (&__pyx_v_rbs), (&__pyx_v_cbs))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 782, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":783
 *     cdef PetscInt rbs=1, cbs=1
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )
 *     if rbs < 1: rbs = 1             # <<<<<<<<<<<<<<
 *     if cbs < 1: cbs = 1
 *     # rows, cols, and values
 */
  __pyx_t_1 = ((__pyx_v_rbs < 1) != 0);
  if (__pyx_t_1) {
    __pyx_v_rbs = 1;
  }

  /* "PETSc/petscmat.pxi":784
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )
 *     if rbs < 1: rbs = 1
 *     if cbs < 1: cbs = 1             # <<<<<<<<<<<<<<
 *     # rows, cols, and values
 *     cdef PetscInt ni=0, *i=NULL
 */
  __pyx_t_1 = ((__pyx_v_cbs < 1) != 0);
  if (__pyx_t_1) {
    __pyx_v_cbs = 1;
  }

  /* "PETSc/petscmat.pxi":786
 *     if cbs < 1: cbs = 1
 *     # rows, cols, and values
 *     cdef PetscInt ni=0, *i=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscInt nj=0, *j=NULL
 *     cdef PetscInt nv=0
 */
  __pyx_v_ni = 0;
  __pyx_v_i = NULL;

  /* "PETSc/petscmat.pxi":787
 *     # rows, cols, and values
 *     cdef PetscInt ni=0, *i=NULL
 *     cdef PetscInt nj=0, *j=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscInt nv=0
 *     cdef PetscScalar *v=NULL
 */
  __pyx_v_nj = 0;
  __pyx_v_j = NULL;

  /* "PETSc/petscmat.pxi":788
 *     cdef PetscInt ni=0, *i=NULL
 *     cdef PetscInt nj=0, *j=NULL
 *     cdef PetscInt nv=0             # <<<<<<<<<<<<<<
 *     cdef PetscScalar *v=NULL
 *     cdef ndarray ai = iarray_i(oi, &ni, &i)
 */
  __pyx_v_nv = 0;

  /* "PETSc/petscmat.pxi":789
 *     cdef PetscInt nj=0, *j=NULL
 *     cdef PetscInt nv=0
 *     cdef PetscScalar *v=NULL             # <<<<<<<<<<<<<<
 *     cdef ndarray ai = iarray_i(oi, &ni, &i)
 *     cdef ndarray aj = iarray_i(oj, &nj, &j)
 */
  __pyx_v_v = NULL;

  /* "PETSc/petscmat.pxi":790
 *     cdef PetscInt nv=0
 *     cdef PetscScalar *v=NULL
 *     cdef ndarray ai = iarray_i(oi, &ni, &i)             # <<<<<<<<<<<<<<
 *     cdef ndarray aj = iarray_i(oj, &nj, &j)
 *     cdef ndarray av = iarray_s(ov, &nv, &v)
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_oi, (&__pyx_v_ni), (&__pyx_v_i))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_ai = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscmat.pxi":791
 *     cdef PetscScalar *v=NULL
 *     cdef ndarray ai = iarray_i(oi, &ni, &i)
 *     cdef ndarray aj = iarray_i(oj, &nj, &j)             # <<<<<<<<<<<<<<
 *     cdef ndarray av = iarray_s(ov, &nv, &v)
 *     # check various dimensions
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_oj, (&__pyx_v_nj), (&__pyx_v_j))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_aj = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscmat.pxi":792
 *     cdef ndarray ai = iarray_i(oi, &ni, &i)
 *     cdef ndarray aj = iarray_i(oj, &nj, &j)
 *     cdef ndarray av = iarray_s(ov, &nv, &v)             # <<<<<<<<<<<<<<
 *     # check various dimensions
 *     if PyArray_NDIM(ai) != 2: raise ValueError(
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_s(__pyx_v_ov, (&__pyx_v_nv), (&__pyx_v_v))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_av = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscmat.pxi":794
 *     cdef ndarray av = iarray_s(ov, &nv, &v)
 *     # check various dimensions
 *     if PyArray_NDIM(ai) != 2: raise ValueError(             # <<<<<<<<<<<<<<
 *         ("row indices must have two dimensions: "
 *          "rows.ndim=%d") % (PyArray_NDIM(ai)) )
 */
  __pyx_t_1 = ((PyArray_NDIM(__pyx_v_ai) != 2) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscmat.pxi":796
 *     if PyArray_NDIM(ai) != 2: raise ValueError(
 *         ("row indices must have two dimensions: "
 *          "rows.ndim=%d") % (PyArray_NDIM(ai)) )             # <<<<<<<<<<<<<<
 *     elif not PyArray_ISCONTIGUOUS(ai): raise ValueError(
 *         "expecting a C-contiguous array")
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(PyArray_NDIM(__pyx_v_ai)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_row_indices_must_have_two_dimens, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/petscmat.pxi":794
 *     cdef ndarray av = iarray_s(ov, &nv, &v)
 *     # check various dimensions
 *     if PyArray_NDIM(ai) != 2: raise ValueError(             # <<<<<<<<<<<<<<
 *         ("row indices must have two dimensions: "
 *          "rows.ndim=%d") % (PyArray_NDIM(ai)) )
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 794, __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_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 794, __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(6, 794, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":797
 *         ("row indices must have two dimensions: "
 *          "rows.ndim=%d") % (PyArray_NDIM(ai)) )
 *     elif not PyArray_ISCONTIGUOUS(ai): raise ValueError(             # <<<<<<<<<<<<<<
 *         "expecting a C-contiguous array")
 *     if PyArray_NDIM(aj) != 2: raise ValueError(
 */
  __pyx_t_1 = ((!(PyArray_ISCONTIGUOUS(__pyx_v_ai) != 0)) != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 797, __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(6, 797, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":799
 *     elif not PyArray_ISCONTIGUOUS(ai): raise ValueError(
 *         "expecting a C-contiguous array")
 *     if PyArray_NDIM(aj) != 2: raise ValueError(             # <<<<<<<<<<<<<<
 *         ("column indices must have two dimensions: "
 *          "cols.ndim=%d") % (PyArray_NDIM(aj)) )
 */
  __pyx_t_1 = ((PyArray_NDIM(__pyx_v_aj) != 2) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscmat.pxi":801
 *     if PyArray_NDIM(aj) != 2: raise ValueError(
 *         ("column indices must have two dimensions: "
 *          "cols.ndim=%d") % (PyArray_NDIM(aj)) )             # <<<<<<<<<<<<<<
 *     elif not PyArray_ISCONTIGUOUS(aj): raise ValueError(
 *         "expecting a C-contiguous array")
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(PyArray_NDIM(__pyx_v_aj)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_column_indices_must_have_two_dim, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/petscmat.pxi":799
 *     elif not PyArray_ISCONTIGUOUS(ai): raise ValueError(
 *         "expecting a C-contiguous array")
 *     if PyArray_NDIM(aj) != 2: raise ValueError(             # <<<<<<<<<<<<<<
 *         ("column indices must have two dimensions: "
 *          "cols.ndim=%d") % (PyArray_NDIM(aj)) )
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 799, __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(6, 799, __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(6, 799, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":802
 *         ("column indices must have two dimensions: "
 *          "cols.ndim=%d") % (PyArray_NDIM(aj)) )
 *     elif not PyArray_ISCONTIGUOUS(aj): raise ValueError(             # <<<<<<<<<<<<<<
 *         "expecting a C-contiguous array")
 *     if PyArray_NDIM(av) < 2: raise ValueError(
 */
  __pyx_t_1 = ((!(PyArray_ISCONTIGUOUS(__pyx_v_aj) != 0)) != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 802, __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(6, 802, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":804
 *     elif not PyArray_ISCONTIGUOUS(aj): raise ValueError(
 *         "expecting a C-contiguous array")
 *     if PyArray_NDIM(av) < 2: raise ValueError(             # <<<<<<<<<<<<<<
 *         ("values must have two or more dimensions: "
 *          "vals.ndim=%d") % (PyArray_NDIM(av)) )
 */
  __pyx_t_1 = ((PyArray_NDIM(__pyx_v_av) < 2) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscmat.pxi":806
 *     if PyArray_NDIM(av) < 2: raise ValueError(
 *         ("values must have two or more dimensions: "
 *          "vals.ndim=%d") % (PyArray_NDIM(av)) )             # <<<<<<<<<<<<<<
 *     elif not PyArray_ISCONTIGUOUS(av): raise ValueError(
 *         "expecting a C-contiguous array")
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(PyArray_NDIM(__pyx_v_av)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 806, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_values_must_have_two_or_more_dim, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 806, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/petscmat.pxi":804
 *     elif not PyArray_ISCONTIGUOUS(aj): raise ValueError(
 *         "expecting a C-contiguous array")
 *     if PyArray_NDIM(av) < 2: raise ValueError(             # <<<<<<<<<<<<<<
 *         ("values must have two or more dimensions: "
 *          "vals.ndim=%d") % (PyArray_NDIM(av)) )
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 804, __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_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 804, __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(6, 804, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":807
 *         ("values must have two or more dimensions: "
 *          "vals.ndim=%d") % (PyArray_NDIM(av)) )
 *     elif not PyArray_ISCONTIGUOUS(av): raise ValueError(             # <<<<<<<<<<<<<<
 *         "expecting a C-contiguous array")
 *     # check various shapes
 */
  __pyx_t_1 = ((!(PyArray_ISCONTIGUOUS(__pyx_v_av) != 0)) != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 807, __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(6, 807, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":810
 *         "expecting a C-contiguous array")
 *     # check various shapes
 *     cdef Py_ssize_t nm = PyArray_DIM(ai, 0)             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t si = PyArray_DIM(ai, 1)
 *     cdef Py_ssize_t sj = PyArray_DIM(aj, 1)
 */
  __pyx_v_nm = PyArray_DIM(__pyx_v_ai, 0);

  /* "PETSc/petscmat.pxi":811
 *     # check various shapes
 *     cdef Py_ssize_t nm = PyArray_DIM(ai, 0)
 *     cdef Py_ssize_t si = PyArray_DIM(ai, 1)             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t sj = PyArray_DIM(aj, 1)
 *     cdef Py_ssize_t sv = PyArray_SIZE(av) // PyArray_DIM(av, 0)
 */
  __pyx_v_si = PyArray_DIM(__pyx_v_ai, 1);

  /* "PETSc/petscmat.pxi":812
 *     cdef Py_ssize_t nm = PyArray_DIM(ai, 0)
 *     cdef Py_ssize_t si = PyArray_DIM(ai, 1)
 *     cdef Py_ssize_t sj = PyArray_DIM(aj, 1)             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t sv = PyArray_SIZE(av) // PyArray_DIM(av, 0)
 *     if ((nm != PyArray_DIM(aj, 0)) or
 */
  __pyx_v_sj = PyArray_DIM(__pyx_v_aj, 1);

  /* "PETSc/petscmat.pxi":813
 *     cdef Py_ssize_t si = PyArray_DIM(ai, 1)
 *     cdef Py_ssize_t sj = PyArray_DIM(aj, 1)
 *     cdef Py_ssize_t sv = PyArray_SIZE(av) // PyArray_DIM(av, 0)             # <<<<<<<<<<<<<<
 *     if ((nm != PyArray_DIM(aj, 0)) or
 *         (nm != PyArray_DIM(av, 0)) or
 */
  __pyx_v_sv = (PyArray_SIZE(__pyx_v_av) / PyArray_DIM(__pyx_v_av, 0));

  /* "PETSc/petscmat.pxi":814
 *     cdef Py_ssize_t sj = PyArray_DIM(aj, 1)
 *     cdef Py_ssize_t sv = PyArray_SIZE(av) // PyArray_DIM(av, 0)
 *     if ((nm != PyArray_DIM(aj, 0)) or             # <<<<<<<<<<<<<<
 *         (nm != PyArray_DIM(av, 0)) or
 *         (si*rbs * sj*cbs != sv)): raise ValueError(
 */
  __pyx_t_5 = ((__pyx_v_nm != PyArray_DIM(__pyx_v_aj, 0)) != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_1 = __pyx_t_5;
    goto __pyx_L10_bool_binop_done;
  }

  /* "PETSc/petscmat.pxi":815
 *     cdef Py_ssize_t sv = PyArray_SIZE(av) // PyArray_DIM(av, 0)
 *     if ((nm != PyArray_DIM(aj, 0)) or
 *         (nm != PyArray_DIM(av, 0)) or             # <<<<<<<<<<<<<<
 *         (si*rbs * sj*cbs != sv)): raise ValueError(
 *         ("input arrays have incompatible shapes: "
 */
  __pyx_t_5 = ((__pyx_v_nm != PyArray_DIM(__pyx_v_av, 0)) != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_1 = __pyx_t_5;
    goto __pyx_L10_bool_binop_done;
  }

  /* "PETSc/petscmat.pxi":816
 *     if ((nm != PyArray_DIM(aj, 0)) or
 *         (nm != PyArray_DIM(av, 0)) or
 *         (si*rbs * sj*cbs != sv)): raise ValueError(             # <<<<<<<<<<<<<<
 *         ("input arrays have incompatible shapes: "
 *          "rows.shape=%s, cols.shape=%s, vals.shape=%s") %
 */
  __pyx_t_5 = (((((__pyx_v_si * __pyx_v_rbs) * __pyx_v_sj) * __pyx_v_cbs) != __pyx_v_sv) != 0);
  __pyx_t_1 = __pyx_t_5;
  __pyx_L10_bool_binop_done:;

  /* "PETSc/petscmat.pxi":814
 *     cdef Py_ssize_t sj = PyArray_DIM(aj, 1)
 *     cdef Py_ssize_t sv = PyArray_SIZE(av) // PyArray_DIM(av, 0)
 *     if ((nm != PyArray_DIM(aj, 0)) or             # <<<<<<<<<<<<<<
 *         (nm != PyArray_DIM(av, 0)) or
 *         (si*rbs * sj*cbs != sv)): raise ValueError(
 */
  if (__pyx_t_1) {

    /* "PETSc/petscmat.pxi":819
 *         ("input arrays have incompatible shapes: "
 *          "rows.shape=%s, cols.shape=%s, vals.shape=%s") %
 *         (ai.shape, aj.shape, av.shape))             # <<<<<<<<<<<<<<
 *     # MatSetValuesXXX function and insert mode
 *     cdef MatSetValuesFcn *setvalues = \
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ai), __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 819, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_aj), __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 819, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_av), __pyx_n_s_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 819, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 819, __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_3);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_t_6 = 0;

    /* "PETSc/petscmat.pxi":818
 *         (si*rbs * sj*cbs != sv)): raise ValueError(
 *         ("input arrays have incompatible shapes: "
 *          "rows.shape=%s, cols.shape=%s, vals.shape=%s") %             # <<<<<<<<<<<<<<
 *         (ai.shape, aj.shape, av.shape))
 *     # MatSetValuesXXX function and insert mode
 */
    __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_input_arrays_have_incompatible_s, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "PETSc/petscmat.pxi":816
 *     if ((nm != PyArray_DIM(aj, 0)) or
 *         (nm != PyArray_DIM(av, 0)) or
 *         (si*rbs * sj*cbs != sv)): raise ValueError(             # <<<<<<<<<<<<<<
 *         ("input arrays have incompatible shapes: "
 *          "rows.shape=%s, cols.shape=%s, vals.shape=%s") %
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 816, __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 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __PYX_ERR(6, 816, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":814
 *     cdef Py_ssize_t sj = PyArray_DIM(aj, 1)
 *     cdef Py_ssize_t sv = PyArray_SIZE(av) // PyArray_DIM(av, 0)
 *     if ((nm != PyArray_DIM(aj, 0)) or             # <<<<<<<<<<<<<<
 *         (nm != PyArray_DIM(av, 0)) or
 *         (si*rbs * sj*cbs != sv)): raise ValueError(
 */
  }

  /* "PETSc/petscmat.pxi":822
 *     # MatSetValuesXXX function and insert mode
 *     cdef MatSetValuesFcn *setvalues = \
 *          matsetvalues_fcn(blocked, local)             # <<<<<<<<<<<<<<
 *     cdef PetscInsertMode addv = insertmode(oaddv)
 *     # actual calls
 */
  __pyx_v_setvalues = __pyx_f_8petsc4py_5PETSc_matsetvalues_fcn(__pyx_v_blocked, __pyx_v_local);

  /* "PETSc/petscmat.pxi":823
 *     cdef MatSetValuesFcn *setvalues = \
 *          matsetvalues_fcn(blocked, local)
 *     cdef PetscInsertMode addv = insertmode(oaddv)             # <<<<<<<<<<<<<<
 *     # actual calls
 *     cdef Py_ssize_t k=0
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_oaddv); if (unlikely(__pyx_t_8 == ((InsertMode)-1L))) __PYX_ERR(6, 823, __pyx_L1_error)
  __pyx_v_addv = __pyx_t_8;

  /* "PETSc/petscmat.pxi":825
 *     cdef PetscInsertMode addv = insertmode(oaddv)
 *     # actual calls
 *     cdef Py_ssize_t k=0             # <<<<<<<<<<<<<<
 *     for k from 0 <= k < nm:
 *         CHKERR( setvalues(A,
 */
  __pyx_v_k = 0;

  /* "PETSc/petscmat.pxi":826
 *     # actual calls
 *     cdef Py_ssize_t k=0
 *     for k from 0 <= k < nm:             # <<<<<<<<<<<<<<
 *         CHKERR( setvalues(A,
 *                           <PetscInt>si, &i[k*si],
 */
  __pyx_t_9 = __pyx_v_nm;
  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_9; __pyx_v_k++) {

    /* "PETSc/petscmat.pxi":827
 *     cdef Py_ssize_t k=0
 *     for k from 0 <= k < nm:
 *         CHKERR( setvalues(A,             # <<<<<<<<<<<<<<
 *                           <PetscInt>si, &i[k*si],
 *                           <PetscInt>sj, &j[k*sj],
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_v_setvalues(__pyx_v_A, ((PetscInt)__pyx_v_si), (&(__pyx_v_i[(__pyx_v_k * __pyx_v_si)])), ((PetscInt)__pyx_v_sj), (&(__pyx_v_j[(__pyx_v_k * __pyx_v_sj)])), (&(__pyx_v_v[(__pyx_v_k * __pyx_v_sv)])), __pyx_v_addv)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 827, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":831
 *                           <PetscInt>sj, &j[k*sj],
 *                           &v[k*sv], addv) )
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int matsetvalues_ijv(PetscMat A,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":776
 *     return 0
 * 
 * cdef inline int matsetvalues_rcv(PetscMat A,             # <<<<<<<<<<<<<<
 *                                  object oi, object oj, object ov,
 *                                  object oaddv,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.matsetvalues_rcv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ai);
  __Pyx_XDECREF((PyObject *)__pyx_v_aj);
  __Pyx_XDECREF((PyObject *)__pyx_v_av);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":833
 *     return 0
 * 
 * cdef inline int matsetvalues_ijv(PetscMat A,             # <<<<<<<<<<<<<<
 *                                  object oi, object oj, object ov,
 *                                  object oaddv,
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_matsetvalues_ijv(Mat __pyx_v_A, PyObject *__pyx_v_oi, PyObject *__pyx_v_oj, PyObject *__pyx_v_ov, PyObject *__pyx_v_oaddv, PyObject *__pyx_v_om, int __pyx_v_blocked, int __pyx_v_local) {
  PetscInt __pyx_v_rbs;
  PetscInt __pyx_v_cbs;
  PetscInt __pyx_v_ni;
  PetscInt *__pyx_v_i;
  PetscInt __pyx_v_nj;
  PetscInt *__pyx_v_j;
  PetscInt __pyx_v_nv;
  PetscScalar *__pyx_v_v;
  PetscInt __pyx_v_nm;
  PetscInt *__pyx_v_m;
  PetscInt __pyx_v_rs;
  PetscInt __pyx_v_re;
  __pyx_t_8petsc4py_5PETSc_MatSetValuesFcn *__pyx_v_setvalues;
  InsertMode __pyx_v_addv;
  PetscInt __pyx_v_k;
  PetscInt __pyx_v_l;
  PetscInt __pyx_v_irow;
  PetscInt __pyx_v_ncol;
  PetscInt *__pyx_v_icol;
  PetscScalar *__pyx_v_sval;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  InsertMode __pyx_t_7;
  PetscInt __pyx_t_8;
  PetscInt __pyx_t_9;
  __Pyx_RefNannySetupContext("matsetvalues_ijv", 0);
  __Pyx_INCREF(__pyx_v_oi);
  __Pyx_INCREF(__pyx_v_oj);
  __Pyx_INCREF(__pyx_v_ov);
  __Pyx_INCREF(__pyx_v_om);

  /* "PETSc/petscmat.pxi":839
 *                                  int blocked, int local) except -1:
 *     # block size
 *     cdef PetscInt rbs=1, cbs=1             # <<<<<<<<<<<<<<
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )
 *     if rbs < 1: rbs = 1
 */
  __pyx_v_rbs = 1;
  __pyx_v_cbs = 1;

  /* "PETSc/petscmat.pxi":840
 *     # block size
 *     cdef PetscInt rbs=1, cbs=1
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )             # <<<<<<<<<<<<<<
 *     if rbs < 1: rbs = 1
 *     if cbs < 1: cbs = 1
 */
  __pyx_t_1 = (__pyx_v_blocked != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetBlockSizes(__pyx_v_A, (&__pyx_v_rbs), (&__pyx_v_cbs))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 840, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":841
 *     cdef PetscInt rbs=1, cbs=1
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )
 *     if rbs < 1: rbs = 1             # <<<<<<<<<<<<<<
 *     if cbs < 1: cbs = 1
 *     # column pointers, column indices, and values
 */
  __pyx_t_1 = ((__pyx_v_rbs < 1) != 0);
  if (__pyx_t_1) {
    __pyx_v_rbs = 1;
  }

  /* "PETSc/petscmat.pxi":842
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )
 *     if rbs < 1: rbs = 1
 *     if cbs < 1: cbs = 1             # <<<<<<<<<<<<<<
 *     # column pointers, column indices, and values
 *     cdef PetscInt ni=0, *i=NULL
 */
  __pyx_t_1 = ((__pyx_v_cbs < 1) != 0);
  if (__pyx_t_1) {
    __pyx_v_cbs = 1;
  }

  /* "PETSc/petscmat.pxi":844
 *     if cbs < 1: cbs = 1
 *     # column pointers, column indices, and values
 *     cdef PetscInt ni=0, *i=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscInt nj=0, *j=NULL
 *     cdef PetscInt nv=0
 */
  __pyx_v_ni = 0;
  __pyx_v_i = NULL;

  /* "PETSc/petscmat.pxi":845
 *     # column pointers, column indices, and values
 *     cdef PetscInt ni=0, *i=NULL
 *     cdef PetscInt nj=0, *j=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscInt nv=0
 *     cdef PetscScalar *v=NULL
 */
  __pyx_v_nj = 0;
  __pyx_v_j = NULL;

  /* "PETSc/petscmat.pxi":846
 *     cdef PetscInt ni=0, *i=NULL
 *     cdef PetscInt nj=0, *j=NULL
 *     cdef PetscInt nv=0             # <<<<<<<<<<<<<<
 *     cdef PetscScalar *v=NULL
 *     oi = iarray_i(oi, &ni, &i)
 */
  __pyx_v_nv = 0;

  /* "PETSc/petscmat.pxi":847
 *     cdef PetscInt nj=0, *j=NULL
 *     cdef PetscInt nv=0
 *     cdef PetscScalar *v=NULL             # <<<<<<<<<<<<<<
 *     oi = iarray_i(oi, &ni, &i)
 *     oj = iarray_i(oj, &nj, &j)
 */
  __pyx_v_v = NULL;

  /* "PETSc/petscmat.pxi":848
 *     cdef PetscInt nv=0
 *     cdef PetscScalar *v=NULL
 *     oi = iarray_i(oi, &ni, &i)             # <<<<<<<<<<<<<<
 *     oj = iarray_i(oj, &nj, &j)
 *     ov = iarray_s(ov, &nv, &v)
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_oi, (&__pyx_v_ni), (&__pyx_v_i))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_oi, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscmat.pxi":849
 *     cdef PetscScalar *v=NULL
 *     oi = iarray_i(oi, &ni, &i)
 *     oj = iarray_i(oj, &nj, &j)             # <<<<<<<<<<<<<<
 *     ov = iarray_s(ov, &nv, &v)
 *     # row indices
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_oj, (&__pyx_v_nj), (&__pyx_v_j))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_oj, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscmat.pxi":850
 *     oi = iarray_i(oi, &ni, &i)
 *     oj = iarray_i(oj, &nj, &j)
 *     ov = iarray_s(ov, &nv, &v)             # <<<<<<<<<<<<<<
 *     # row indices
 *     cdef PetscInt nm=0, *m=NULL
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_s(__pyx_v_ov, (&__pyx_v_nv), (&__pyx_v_v))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_ov, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscmat.pxi":852
 *     ov = iarray_s(ov, &nv, &v)
 *     # row indices
 *     cdef PetscInt nm=0, *m=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscInt rs=0, re=ni-1
 *     if om is not None:
 */
  __pyx_v_nm = 0;
  __pyx_v_m = NULL;

  /* "PETSc/petscmat.pxi":853
 *     # row indices
 *     cdef PetscInt nm=0, *m=NULL
 *     cdef PetscInt rs=0, re=ni-1             # <<<<<<<<<<<<<<
 *     if om is not None:
 *         om = iarray_i(om, &nm, &m)
 */
  __pyx_v_rs = 0;
  __pyx_v_re = (__pyx_v_ni - 1);

  /* "PETSc/petscmat.pxi":854
 *     cdef PetscInt nm=0, *m=NULL
 *     cdef PetscInt rs=0, re=ni-1
 *     if om is not None:             # <<<<<<<<<<<<<<
 *         om = iarray_i(om, &nm, &m)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_om != Py_None);
  __pyx_t_4 = (__pyx_t_1 != 0);
  if (__pyx_t_4) {

    /* "PETSc/petscmat.pxi":855
 *     cdef PetscInt rs=0, re=ni-1
 *     if om is not None:
 *         om = iarray_i(om, &nm, &m)             # <<<<<<<<<<<<<<
 *     else:
 *         if not local:
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_om, (&__pyx_v_nm), (&__pyx_v_m))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_om, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/petscmat.pxi":854
 *     cdef PetscInt nm=0, *m=NULL
 *     cdef PetscInt rs=0, re=ni-1
 *     if om is not None:             # <<<<<<<<<<<<<<
 *         om = iarray_i(om, &nm, &m)
 *     else:
 */
    goto __pyx_L6;
  }

  /* "PETSc/petscmat.pxi":857
 *         om = iarray_i(om, &nm, &m)
 *     else:
 *         if not local:             # <<<<<<<<<<<<<<
 *             CHKERR( MatGetOwnershipRange(A, &rs, &re) )
 *             rs //= rbs; re //= rbs
 */
  /*else*/ {
    __pyx_t_4 = ((!(__pyx_v_local != 0)) != 0);
    if (__pyx_t_4) {

      /* "PETSc/petscmat.pxi":858
 *     else:
 *         if not local:
 *             CHKERR( MatGetOwnershipRange(A, &rs, &re) )             # <<<<<<<<<<<<<<
 *             rs //= rbs; re //= rbs
 *         nm = re - rs
 */
      __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetOwnershipRange(__pyx_v_A, (&__pyx_v_rs), (&__pyx_v_re))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 858, __pyx_L1_error)

      /* "PETSc/petscmat.pxi":859
 *         if not local:
 *             CHKERR( MatGetOwnershipRange(A, &rs, &re) )
 *             rs //= rbs; re //= rbs             # <<<<<<<<<<<<<<
 *         nm = re - rs
 *     # check various sizes
 */
      __pyx_v_rs = (__pyx_v_rs / __pyx_v_rbs);
      __pyx_v_re = (__pyx_v_re / __pyx_v_rbs);

      /* "PETSc/petscmat.pxi":857
 *         om = iarray_i(om, &nm, &m)
 *     else:
 *         if not local:             # <<<<<<<<<<<<<<
 *             CHKERR( MatGetOwnershipRange(A, &rs, &re) )
 *             rs //= rbs; re //= rbs
 */
    }

    /* "PETSc/petscmat.pxi":860
 *             CHKERR( MatGetOwnershipRange(A, &rs, &re) )
 *             rs //= rbs; re //= rbs
 *         nm = re - rs             # <<<<<<<<<<<<<<
 *     # check various sizes
 *     if (ni-1 != nm): raise ValueError(
 */
    __pyx_v_nm = (__pyx_v_re - __pyx_v_rs);
  }
  __pyx_L6:;

  /* "PETSc/petscmat.pxi":862
 *         nm = re - rs
 *     # check various sizes
 *     if (ni-1 != nm): raise ValueError(             # <<<<<<<<<<<<<<
 *         "size(I) is %d, expected %d" %
 *         (toInt(ni), toInt(nm+1)) )
 */
  __pyx_t_4 = (((__pyx_v_ni - 1) != __pyx_v_nm) != 0);
  if (__pyx_t_4) {

    /* "PETSc/petscmat.pxi":864
 *     if (ni-1 != nm): raise ValueError(
 *         "size(I) is %d, expected %d" %
 *         (toInt(ni), toInt(nm+1)) )             # <<<<<<<<<<<<<<
 *     if (i[0] != 0):raise ValueError(
 *         "I[0] is %d, expected %d" %
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ni); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 864, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_nm + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 864, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 864, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;

    /* "PETSc/petscmat.pxi":863
 *     # check various sizes
 *     if (ni-1 != nm): raise ValueError(
 *         "size(I) is %d, expected %d" %             # <<<<<<<<<<<<<<
 *         (toInt(ni), toInt(nm+1)) )
 *     if (i[0] != 0):raise ValueError(
 */
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_size_I_is_d_expected_d, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PETSc/petscmat.pxi":862
 *         nm = re - rs
 *     # check various sizes
 *     if (ni-1 != nm): raise ValueError(             # <<<<<<<<<<<<<<
 *         "size(I) is %d, expected %d" %
 *         (toInt(ni), toInt(nm+1)) )
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 862, __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 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 862, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(6, 862, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":865
 *         "size(I) is %d, expected %d" %
 *         (toInt(ni), toInt(nm+1)) )
 *     if (i[0] != 0):raise ValueError(             # <<<<<<<<<<<<<<
 *         "I[0] is %d, expected %d" %
 *         (toInt(i[0]), 0) )
 */
  __pyx_t_4 = (((__pyx_v_i[0]) != 0) != 0);
  if (__pyx_t_4) {

    /* "PETSc/petscmat.pxi":867
 *     if (i[0] != 0):raise ValueError(
 *         "I[0] is %d, expected %d" %
 *         (toInt(i[0]), 0) )             # <<<<<<<<<<<<<<
 *     if (i[ni-1] != nj): raise ValueError(
 *         "size(J) is %d, expected %d" %
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_i[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 867, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 867, __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_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_0);
    __pyx_t_5 = 0;

    /* "PETSc/petscmat.pxi":866
 *         (toInt(ni), toInt(nm+1)) )
 *     if (i[0] != 0):raise ValueError(
 *         "I[0] is %d, expected %d" %             # <<<<<<<<<<<<<<
 *         (toInt(i[0]), 0) )
 *     if (i[ni-1] != nj): raise ValueError(
 */
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_I_0_is_d_expected_d, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 866, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PETSc/petscmat.pxi":865
 *         "size(I) is %d, expected %d" %
 *         (toInt(ni), toInt(nm+1)) )
 *     if (i[0] != 0):raise ValueError(             # <<<<<<<<<<<<<<
 *         "I[0] is %d, expected %d" %
 *         (toInt(i[0]), 0) )
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 865, __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 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 865, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(6, 865, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":868
 *         "I[0] is %d, expected %d" %
 *         (toInt(i[0]), 0) )
 *     if (i[ni-1] != nj): raise ValueError(             # <<<<<<<<<<<<<<
 *         "size(J) is %d, expected %d" %
 *         (toInt(nj), toInt(i[ni-1])) )
 */
  __pyx_t_4 = (((__pyx_v_i[(__pyx_v_ni - 1)]) != __pyx_v_nj) != 0);
  if (__pyx_t_4) {

    /* "PETSc/petscmat.pxi":870
 *     if (i[ni-1] != nj): raise ValueError(
 *         "size(J) is %d, expected %d" %
 *         (toInt(nj), toInt(i[ni-1])) )             # <<<<<<<<<<<<<<
 *     if (nj*rbs*cbs != nv): raise ValueError(
 *         "size(V) is %d, expected %d" %
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nj); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 870, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_i[(__pyx_v_ni - 1)])); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 870, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 870, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;

    /* "PETSc/petscmat.pxi":869
 *         (toInt(i[0]), 0) )
 *     if (i[ni-1] != nj): raise ValueError(
 *         "size(J) is %d, expected %d" %             # <<<<<<<<<<<<<<
 *         (toInt(nj), toInt(i[ni-1])) )
 *     if (nj*rbs*cbs != nv): raise ValueError(
 */
    __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_size_J_is_d_expected_d, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 869, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/petscmat.pxi":868
 *         "I[0] is %d, expected %d" %
 *         (toInt(i[0]), 0) )
 *     if (i[ni-1] != nj): raise ValueError(             # <<<<<<<<<<<<<<
 *         "size(J) is %d, expected %d" %
 *         (toInt(nj), toInt(i[ni-1])) )
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 868, __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(6, 868, __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(6, 868, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":871
 *         "size(J) is %d, expected %d" %
 *         (toInt(nj), toInt(i[ni-1])) )
 *     if (nj*rbs*cbs != nv): raise ValueError(             # <<<<<<<<<<<<<<
 *         "size(V) is %d, expected %d" %
 *         (toInt(nv), toInt(nj*rbs*cbs)) )
 */
  __pyx_t_4 = ((((__pyx_v_nj * __pyx_v_rbs) * __pyx_v_cbs) != __pyx_v_nv) != 0);
  if (__pyx_t_4) {

    /* "PETSc/petscmat.pxi":873
 *     if (nj*rbs*cbs != nv): raise ValueError(
 *         "size(V) is %d, expected %d" %
 *         (toInt(nv), toInt(nj*rbs*cbs)) )             # <<<<<<<<<<<<<<
 *     # MatSetValuesXXX function and insert mode
 *     cdef MatSetValuesFcn *setvalues = \
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nv); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 873, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(((__pyx_v_nj * __pyx_v_rbs) * __pyx_v_cbs)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 873, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 873, __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;

    /* "PETSc/petscmat.pxi":872
 *         (toInt(nj), toInt(i[ni-1])) )
 *     if (nj*rbs*cbs != nv): raise ValueError(
 *         "size(V) is %d, expected %d" %             # <<<<<<<<<<<<<<
 *         (toInt(nv), toInt(nj*rbs*cbs)) )
 *     # MatSetValuesXXX function and insert mode
 */
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_size_V_is_d_expected_d, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/petscmat.pxi":871
 *         "size(J) is %d, expected %d" %
 *         (toInt(nj), toInt(i[ni-1])) )
 *     if (nj*rbs*cbs != nv): raise ValueError(             # <<<<<<<<<<<<<<
 *         "size(V) is %d, expected %d" %
 *         (toInt(nv), toInt(nj*rbs*cbs)) )
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 871, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 871, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(6, 871, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":876
 *     # MatSetValuesXXX function and insert mode
 *     cdef MatSetValuesFcn *setvalues = \
 *          matsetvalues_fcn(blocked, local)             # <<<<<<<<<<<<<<
 *     cdef PetscInsertMode addv = insertmode(oaddv)
 *     # actual call
 */
  __pyx_v_setvalues = __pyx_f_8petsc4py_5PETSc_matsetvalues_fcn(__pyx_v_blocked, __pyx_v_local);

  /* "PETSc/petscmat.pxi":877
 *     cdef MatSetValuesFcn *setvalues = \
 *          matsetvalues_fcn(blocked, local)
 *     cdef PetscInsertMode addv = insertmode(oaddv)             # <<<<<<<<<<<<<<
 *     # actual call
 *     cdef PetscInt k=0, l=0
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_oaddv); if (unlikely(__pyx_t_7 == ((InsertMode)-1L))) __PYX_ERR(6, 877, __pyx_L1_error)
  __pyx_v_addv = __pyx_t_7;

  /* "PETSc/petscmat.pxi":879
 *     cdef PetscInsertMode addv = insertmode(oaddv)
 *     # actual call
 *     cdef PetscInt k=0, l=0             # <<<<<<<<<<<<<<
 *     cdef PetscInt irow=0, ncol=0, *icol=NULL
 *     cdef PetscScalar *sval=NULL
 */
  __pyx_v_k = 0;
  __pyx_v_l = 0;

  /* "PETSc/petscmat.pxi":880
 *     # actual call
 *     cdef PetscInt k=0, l=0
 *     cdef PetscInt irow=0, ncol=0, *icol=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscScalar *sval=NULL
 *     for k from 0 <= k < nm:
 */
  __pyx_v_irow = 0;
  __pyx_v_ncol = 0;
  __pyx_v_icol = NULL;

  /* "PETSc/petscmat.pxi":881
 *     cdef PetscInt k=0, l=0
 *     cdef PetscInt irow=0, ncol=0, *icol=NULL
 *     cdef PetscScalar *sval=NULL             # <<<<<<<<<<<<<<
 *     for k from 0 <= k < nm:
 *         irow = m[k] if m!=NULL else rs+k
 */
  __pyx_v_sval = NULL;

  /* "PETSc/petscmat.pxi":882
 *     cdef PetscInt irow=0, ncol=0, *icol=NULL
 *     cdef PetscScalar *sval=NULL
 *     for k from 0 <= k < nm:             # <<<<<<<<<<<<<<
 *         irow = m[k] if m!=NULL else rs+k
 *         ncol = i[k+1] - i[k]
 */
  __pyx_t_8 = __pyx_v_nm;
  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_8; __pyx_v_k++) {

    /* "PETSc/petscmat.pxi":883
 *     cdef PetscScalar *sval=NULL
 *     for k from 0 <= k < nm:
 *         irow = m[k] if m!=NULL else rs+k             # <<<<<<<<<<<<<<
 *         ncol = i[k+1] - i[k]
 *         icol = j + i[k]
 */
    if (((__pyx_v_m != NULL) != 0)) {
      __pyx_t_9 = (__pyx_v_m[__pyx_v_k]);
    } else {
      __pyx_t_9 = (__pyx_v_rs + __pyx_v_k);
    }
    __pyx_v_irow = __pyx_t_9;

    /* "PETSc/petscmat.pxi":884
 *     for k from 0 <= k < nm:
 *         irow = m[k] if m!=NULL else rs+k
 *         ncol = i[k+1] - i[k]             # <<<<<<<<<<<<<<
 *         icol = j + i[k]
 *         if blocked:
 */
    __pyx_v_ncol = ((__pyx_v_i[(__pyx_v_k + 1)]) - (__pyx_v_i[__pyx_v_k]));

    /* "PETSc/petscmat.pxi":885
 *         irow = m[k] if m!=NULL else rs+k
 *         ncol = i[k+1] - i[k]
 *         icol = j + i[k]             # <<<<<<<<<<<<<<
 *         if blocked:
 *             sval = v + i[k]*rbs*cbs
 */
    __pyx_v_icol = (__pyx_v_j + (__pyx_v_i[__pyx_v_k]));

    /* "PETSc/petscmat.pxi":886
 *         ncol = i[k+1] - i[k]
 *         icol = j + i[k]
 *         if blocked:             # <<<<<<<<<<<<<<
 *             sval = v + i[k]*rbs*cbs
 *             for l from 0 <= l < ncol:
 */
    __pyx_t_4 = (__pyx_v_blocked != 0);
    if (__pyx_t_4) {

      /* "PETSc/petscmat.pxi":887
 *         icol = j + i[k]
 *         if blocked:
 *             sval = v + i[k]*rbs*cbs             # <<<<<<<<<<<<<<
 *             for l from 0 <= l < ncol:
 *                 CHKERR( setvalues(A, 1, &irow, 1, &icol[l],
 */
      __pyx_v_sval = (__pyx_v_v + (((__pyx_v_i[__pyx_v_k]) * __pyx_v_rbs) * __pyx_v_cbs));

      /* "PETSc/petscmat.pxi":888
 *         if blocked:
 *             sval = v + i[k]*rbs*cbs
 *             for l from 0 <= l < ncol:             # <<<<<<<<<<<<<<
 *                 CHKERR( setvalues(A, 1, &irow, 1, &icol[l],
 *                                   &sval[l*rbs*cbs], addv) )
 */
      __pyx_t_9 = __pyx_v_ncol;
      for (__pyx_v_l = 0; __pyx_v_l < __pyx_t_9; __pyx_v_l++) {

        /* "PETSc/petscmat.pxi":889
 *             sval = v + i[k]*rbs*cbs
 *             for l from 0 <= l < ncol:
 *                 CHKERR( setvalues(A, 1, &irow, 1, &icol[l],             # <<<<<<<<<<<<<<
 *                                   &sval[l*rbs*cbs], addv) )
 *         else:
 */
        __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_v_setvalues(__pyx_v_A, 1, (&__pyx_v_irow), 1, (&(__pyx_v_icol[__pyx_v_l])), (&(__pyx_v_sval[((__pyx_v_l * __pyx_v_rbs) * __pyx_v_cbs)])), __pyx_v_addv)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 889, __pyx_L1_error)
      }

      /* "PETSc/petscmat.pxi":886
 *         ncol = i[k+1] - i[k]
 *         icol = j + i[k]
 *         if blocked:             # <<<<<<<<<<<<<<
 *             sval = v + i[k]*rbs*cbs
 *             for l from 0 <= l < ncol:
 */
      goto __pyx_L14;
    }

    /* "PETSc/petscmat.pxi":892
 *                                   &sval[l*rbs*cbs], addv) )
 *         else:
 *             sval = v + i[k]             # <<<<<<<<<<<<<<
 *             CHKERR( setvalues(A, 1, &irow, ncol, icol, sval, addv) )
 *     return 0
 */
    /*else*/ {
      __pyx_v_sval = (__pyx_v_v + (__pyx_v_i[__pyx_v_k]));

      /* "PETSc/petscmat.pxi":893
 *         else:
 *             sval = v + i[k]
 *             CHKERR( setvalues(A, 1, &irow, ncol, icol, sval, addv) )             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
      __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_v_setvalues(__pyx_v_A, 1, (&__pyx_v_irow), __pyx_v_ncol, __pyx_v_icol, __pyx_v_sval, __pyx_v_addv)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 893, __pyx_L1_error)
    }
    __pyx_L14:;
  }

  /* "PETSc/petscmat.pxi":894
 *             sval = v + i[k]
 *             CHKERR( setvalues(A, 1, &irow, ncol, icol, sval, addv) )
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int matsetvalues_csr(PetscMat A,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":833
 *     return 0
 * 
 * cdef inline int matsetvalues_ijv(PetscMat A,             # <<<<<<<<<<<<<<
 *                                  object oi, object oj, object ov,
 *                                  object oaddv,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.matsetvalues_ijv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_oi);
  __Pyx_XDECREF(__pyx_v_oj);
  __Pyx_XDECREF(__pyx_v_ov);
  __Pyx_XDECREF(__pyx_v_om);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":896
 *     return 0
 * 
 * cdef inline int matsetvalues_csr(PetscMat A,             # <<<<<<<<<<<<<<
 *                                  object oi, object oj, object ov,
 *                                  object oaddv,
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_matsetvalues_csr(Mat __pyx_v_A, PyObject *__pyx_v_oi, PyObject *__pyx_v_oj, PyObject *__pyx_v_ov, PyObject *__pyx_v_oaddv, int __pyx_v_blocked, int __pyx_v_local) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("matsetvalues_csr", 0);

  /* "PETSc/petscmat.pxi":900
 *                                  object oaddv,
 *                                  int blocked, int local) except -1:
 *     matsetvalues_ijv(A, oi, oj, ov, oaddv, None, blocked, local)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_ijv(__pyx_v_A, __pyx_v_oi, __pyx_v_oj, __pyx_v_ov, __pyx_v_oaddv, Py_None, __pyx_v_blocked, __pyx_v_local); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 900, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":901
 *                                  int blocked, int local) except -1:
 *     matsetvalues_ijv(A, oi, oj, ov, oaddv, None, blocked, local)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline matgetvalues(PetscMat mat,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":896
 *     return 0
 * 
 * cdef inline int matsetvalues_csr(PetscMat A,             # <<<<<<<<<<<<<<
 *                                  object oi, object oj, object ov,
 *                                  object oaddv,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.matsetvalues_csr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":903
 *     return 0
 * 
 * cdef inline matgetvalues(PetscMat mat,             # <<<<<<<<<<<<<<
 *                          object orows, object ocols, object values):
 *     cdef PetscInt ni=0, nj=0, nv=0
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_matgetvalues(Mat __pyx_v_mat, PyObject *__pyx_v_orows, PyObject *__pyx_v_ocols, PyObject *__pyx_v_values) {
  PetscInt __pyx_v_ni;
  PetscInt __pyx_v_nj;
  PetscInt __pyx_v_nv;
  PetscInt *__pyx_v_i;
  PetscInt *__pyx_v_j;
  PetscScalar *__pyx_v_v;
  PyArrayObject *__pyx_v_rows = 0;
  PyArrayObject *__pyx_v_cols = 0;
  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;
  __Pyx_RefNannySetupContext("matgetvalues", 0);
  __Pyx_INCREF(__pyx_v_values);

  /* "PETSc/petscmat.pxi":905
 * cdef inline matgetvalues(PetscMat mat,
 *                          object orows, object ocols, object values):
 *     cdef PetscInt ni=0, nj=0, nv=0             # <<<<<<<<<<<<<<
 *     cdef PetscInt *i=NULL, *j=NULL
 *     cdef PetscScalar *v=NULL
 */
  __pyx_v_ni = 0;
  __pyx_v_nj = 0;
  __pyx_v_nv = 0;

  /* "PETSc/petscmat.pxi":906
 *                          object orows, object ocols, object values):
 *     cdef PetscInt ni=0, nj=0, nv=0
 *     cdef PetscInt *i=NULL, *j=NULL             # <<<<<<<<<<<<<<
 *     cdef PetscScalar *v=NULL
 *     cdef ndarray rows = iarray_i(orows, &ni, &i)
 */
  __pyx_v_i = NULL;
  __pyx_v_j = NULL;

  /* "PETSc/petscmat.pxi":907
 *     cdef PetscInt ni=0, nj=0, nv=0
 *     cdef PetscInt *i=NULL, *j=NULL
 *     cdef PetscScalar *v=NULL             # <<<<<<<<<<<<<<
 *     cdef ndarray rows = iarray_i(orows, &ni, &i)
 *     cdef ndarray cols = iarray_i(ocols, &nj, &j)
 */
  __pyx_v_v = NULL;

  /* "PETSc/petscmat.pxi":908
 *     cdef PetscInt *i=NULL, *j=NULL
 *     cdef PetscScalar *v=NULL
 *     cdef ndarray rows = iarray_i(orows, &ni, &i)             # <<<<<<<<<<<<<<
 *     cdef ndarray cols = iarray_i(ocols, &nj, &j)
 *     if values is None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_orows, (&__pyx_v_ni), (&__pyx_v_i))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rows = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscmat.pxi":909
 *     cdef PetscScalar *v=NULL
 *     cdef ndarray rows = iarray_i(orows, &ni, &i)
 *     cdef ndarray cols = iarray_i(ocols, &nj, &j)             # <<<<<<<<<<<<<<
 *     if values is None:
 *         values = empty_s(ni*nj)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_ocols, (&__pyx_v_nj), (&__pyx_v_j))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cols = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscmat.pxi":910
 *     cdef ndarray rows = iarray_i(orows, &ni, &i)
 *     cdef ndarray cols = iarray_i(ocols, &nj, &j)
 *     if values is None:             # <<<<<<<<<<<<<<
 *         values = empty_s(ni*nj)
 *         values.shape = rows.shape + cols.shape
 */
  __pyx_t_2 = (__pyx_v_values == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":911
 *     cdef ndarray cols = iarray_i(ocols, &nj, &j)
 *     if values is None:
 *         values = empty_s(ni*nj)             # <<<<<<<<<<<<<<
 *         values.shape = rows.shape + cols.shape
 *     values = oarray_s(values, &nv, &v)
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_s((__pyx_v_ni * __pyx_v_nj))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "PETSc/petscmat.pxi":912
 *     if values is None:
 *         values = empty_s(ni*nj)
 *         values.shape = rows.shape + cols.shape             # <<<<<<<<<<<<<<
 *     values = oarray_s(values, &nv, &v)
 *     if (ni*nj != nv): raise ValueError(
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rows), __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_cols), __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_values, __pyx_n_s_shape, __pyx_t_5) < 0) __PYX_ERR(6, 912, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/petscmat.pxi":910
 *     cdef ndarray rows = iarray_i(orows, &ni, &i)
 *     cdef ndarray cols = iarray_i(ocols, &nj, &j)
 *     if values is None:             # <<<<<<<<<<<<<<
 *         values = empty_s(ni*nj)
 *         values.shape = rows.shape + cols.shape
 */
  }

  /* "PETSc/petscmat.pxi":913
 *         values = empty_s(ni*nj)
 *         values.shape = rows.shape + cols.shape
 *     values = oarray_s(values, &nv, &v)             # <<<<<<<<<<<<<<
 *     if (ni*nj != nv): raise ValueError(
 *         "incompatible array sizes: ni=%d, nj=%d, nv=%d" %
 */
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_s(__pyx_v_values, (&__pyx_v_nv), (&__pyx_v_v))); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "PETSc/petscmat.pxi":914
 *         values.shape = rows.shape + cols.shape
 *     values = oarray_s(values, &nv, &v)
 *     if (ni*nj != nv): raise ValueError(             # <<<<<<<<<<<<<<
 *         "incompatible array sizes: ni=%d, nj=%d, nv=%d" %
 *         (toInt(ni), toInt(nj), toInt(nv)))
 */
  __pyx_t_3 = (((__pyx_v_ni * __pyx_v_nj) != __pyx_v_nv) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":916
 *     if (ni*nj != nv): raise ValueError(
 *         "incompatible array sizes: ni=%d, nj=%d, nv=%d" %
 *         (toInt(ni), toInt(nj), toInt(nv)))             # <<<<<<<<<<<<<<
 *     CHKERR( MatGetValues(mat, ni, i, nj, j, v) )
 *     return values
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ni); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nj); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nv); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;

    /* "PETSc/petscmat.pxi":915
 *     values = oarray_s(values, &nv, &v)
 *     if (ni*nj != nv): raise ValueError(
 *         "incompatible array sizes: ni=%d, nj=%d, nv=%d" %             # <<<<<<<<<<<<<<
 *         (toInt(ni), toInt(nj), toInt(nv)))
 *     CHKERR( MatGetValues(mat, ni, i, nj, j, v) )
 */
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_incompatible_array_sizes_ni_d_nj, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PETSc/petscmat.pxi":914
 *         values.shape = rows.shape + cols.shape
 *     values = oarray_s(values, &nv, &v)
 *     if (ni*nj != nv): raise ValueError(             # <<<<<<<<<<<<<<
 *         "incompatible array sizes: ni=%d, nj=%d, nv=%d" %
 *         (toInt(ni), toInt(nj), toInt(nv)))
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 914, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 914, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(6, 914, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":917
 *         "incompatible array sizes: ni=%d, nj=%d, nv=%d" %
 *         (toInt(ni), toInt(nj), toInt(nv)))
 *     CHKERR( MatGetValues(mat, ni, i, nj, j, v) )             # <<<<<<<<<<<<<<
 *     return values
 * 
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetValues(__pyx_v_mat, __pyx_v_ni, __pyx_v_i, __pyx_v_nj, __pyx_v_j, __pyx_v_v)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(6, 917, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":918
 *         (toInt(ni), toInt(nj), toInt(nv)))
 *     CHKERR( MatGetValues(mat, ni, i, nj, j, v) )
 *     return values             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_values);
  __pyx_r = __pyx_v_values;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":903
 *     return 0
 * 
 * cdef inline matgetvalues(PetscMat mat,             # <<<<<<<<<<<<<<
 *                          object orows, object ocols, object values):
 *     cdef PetscInt ni=0, nj=0, nv=0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.matgetvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rows);
  __Pyx_XDECREF((PyObject *)__pyx_v_cols);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":925
 *     int MatFactorInfoDefaults(PetscBool,PetscBool,PetscMatFactorInfo*)
 * 
 * cdef inline PetscMatFactorShiftType matfactorshifttype(object st) \             # <<<<<<<<<<<<<<
 *     except <PetscMatFactorShiftType>(-1):
 *     if isinstance(st, str):
 */

static CYTHON_INLINE MatFactorShiftType __pyx_f_8petsc4py_5PETSc_matfactorshifttype(PyObject *__pyx_v_st) {
  MatFactorShiftType __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  MatFactorShiftType __pyx_t_5;
  __Pyx_RefNannySetupContext("matfactorshifttype", 0);

  /* "PETSc/petscmat.pxi":927
 * cdef inline PetscMatFactorShiftType matfactorshifttype(object st) \
 *     except <PetscMatFactorShiftType>(-1):
 *     if isinstance(st, str):             # <<<<<<<<<<<<<<
 *         if st == "none": return MAT_SHIFT_NONE
 *         if st == "nonzero": return MAT_SHIFT_NONZERO
 */
  __pyx_t_1 = PyString_Check(__pyx_v_st); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":928
 *     except <PetscMatFactorShiftType>(-1):
 *     if isinstance(st, str):
 *         if st == "none": return MAT_SHIFT_NONE             # <<<<<<<<<<<<<<
 *         if st == "nonzero": return MAT_SHIFT_NONZERO
 *         if st == "positive_definite": return MAT_SHIFT_POSITIVE_DEFINITE
 */
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_st, __pyx_n_s_none, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 928, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_r = MAT_SHIFT_NONE;
      goto __pyx_L0;
    }

    /* "PETSc/petscmat.pxi":929
 *     if isinstance(st, str):
 *         if st == "none": return MAT_SHIFT_NONE
 *         if st == "nonzero": return MAT_SHIFT_NONZERO             # <<<<<<<<<<<<<<
 *         if st == "positive_definite": return MAT_SHIFT_POSITIVE_DEFINITE
 *         if st == "inblocks": return MAT_SHIFT_INBLOCKS
 */
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_st, __pyx_n_s_nonzero, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 929, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_r = MAT_SHIFT_NONZERO;
      goto __pyx_L0;
    }

    /* "PETSc/petscmat.pxi":930
 *         if st == "none": return MAT_SHIFT_NONE
 *         if st == "nonzero": return MAT_SHIFT_NONZERO
 *         if st == "positive_definite": return MAT_SHIFT_POSITIVE_DEFINITE             # <<<<<<<<<<<<<<
 *         if st == "inblocks": return MAT_SHIFT_INBLOCKS
 *         if st == "na": return MAT_SHIFT_NONZERO
 */
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_st, __pyx_n_s_positive_definite, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 930, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_r = MAT_SHIFT_POSITIVE_DEFINITE;
      goto __pyx_L0;
    }

    /* "PETSc/petscmat.pxi":931
 *         if st == "nonzero": return MAT_SHIFT_NONZERO
 *         if st == "positive_definite": return MAT_SHIFT_POSITIVE_DEFINITE
 *         if st == "inblocks": return MAT_SHIFT_INBLOCKS             # <<<<<<<<<<<<<<
 *         if st == "na": return MAT_SHIFT_NONZERO
 *         if st == "pd": return MAT_SHIFT_POSITIVE_DEFINITE
 */
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_st, __pyx_n_s_inblocks, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 931, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_r = MAT_SHIFT_INBLOCKS;
      goto __pyx_L0;
    }

    /* "PETSc/petscmat.pxi":932
 *         if st == "positive_definite": return MAT_SHIFT_POSITIVE_DEFINITE
 *         if st == "inblocks": return MAT_SHIFT_INBLOCKS
 *         if st == "na": return MAT_SHIFT_NONZERO             # <<<<<<<<<<<<<<
 *         if st == "pd": return MAT_SHIFT_POSITIVE_DEFINITE
 *         else: raise ValueError("unknown shift type: %s" % st)
 */
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_st, __pyx_n_s_na, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 932, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_r = MAT_SHIFT_NONZERO;
      goto __pyx_L0;
    }

    /* "PETSc/petscmat.pxi":933
 *         if st == "inblocks": return MAT_SHIFT_INBLOCKS
 *         if st == "na": return MAT_SHIFT_NONZERO
 *         if st == "pd": return MAT_SHIFT_POSITIVE_DEFINITE             # <<<<<<<<<<<<<<
 *         else: raise ValueError("unknown shift type: %s" % st)
 *     return st
 */
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_st, __pyx_n_s_pd, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 933, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_r = MAT_SHIFT_POSITIVE_DEFINITE;
      goto __pyx_L0;
    }

    /* "PETSc/petscmat.pxi":934
 *         if st == "na": return MAT_SHIFT_NONZERO
 *         if st == "pd": return MAT_SHIFT_POSITIVE_DEFINITE
 *         else: raise ValueError("unknown shift type: %s" % st)             # <<<<<<<<<<<<<<
 *     return st
 * 
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unknown_shift_type_s, __pyx_v_st); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 934, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 934, __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(6, 934, __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(6, 934, __pyx_L1_error)
    }

    /* "PETSc/petscmat.pxi":927
 * cdef inline PetscMatFactorShiftType matfactorshifttype(object st) \
 *     except <PetscMatFactorShiftType>(-1):
 *     if isinstance(st, str):             # <<<<<<<<<<<<<<
 *         if st == "none": return MAT_SHIFT_NONE
 *         if st == "nonzero": return MAT_SHIFT_NONZERO
 */
  }

  /* "PETSc/petscmat.pxi":935
 *         if st == "pd": return MAT_SHIFT_POSITIVE_DEFINITE
 *         else: raise ValueError("unknown shift type: %s" % st)
 *     return st             # <<<<<<<<<<<<<<
 * 
 * cdef int matfactorinfo(PetscBool inc, PetscBool chol, object opts,
 */
  __pyx_t_5 = ((MatFactorShiftType)__Pyx_PyInt_As_MatFactorShiftType(__pyx_v_st)); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 935, __pyx_L1_error)
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":925
 *     int MatFactorInfoDefaults(PetscBool,PetscBool,PetscMatFactorInfo*)
 * 
 * cdef inline PetscMatFactorShiftType matfactorshifttype(object st) \             # <<<<<<<<<<<<<<
 *     except <PetscMatFactorShiftType>(-1):
 *     if isinstance(st, str):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.matfactorshifttype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = ((MatFactorShiftType)-1L);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":937
 *     return st
 * 
 * cdef int matfactorinfo(PetscBool inc, PetscBool chol, object opts,             # <<<<<<<<<<<<<<
 *                        PetscMatFactorInfo *info) except -1:
 *     CHKERR( MatFactorInfoDefaults(inc,chol,info) )
 */

static int __pyx_f_8petsc4py_5PETSc_matfactorinfo(PetscBool __pyx_v_inc, PetscBool __pyx_v_chol, PyObject *__pyx_v_opts, MatFactorInfo *__pyx_v_info) {
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_v_fill = 0;
  PyObject *__pyx_v_zeropivot = 0;
  PyObject *__pyx_v_levels = 0;
  PyObject *__pyx_v_diagonal_fill = 0;
  PyObject *__pyx_v_dt = 0;
  PyObject *__pyx_v_dtcol = 0;
  PyObject *__pyx_v_dtcount = 0;
  PyObject *__pyx_v_shifttype = 0;
  PyObject *__pyx_v_shiftamount = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PetscReal __pyx_t_6;
  PetscInt __pyx_t_7;
  int __pyx_t_8;
  MatFactorShiftType __pyx_t_9;
  __Pyx_RefNannySetupContext("matfactorinfo", 0);

  /* "PETSc/petscmat.pxi":939
 * cdef int matfactorinfo(PetscBool inc, PetscBool chol, object opts,
 *                        PetscMatFactorInfo *info) except -1:
 *     CHKERR( MatFactorInfoDefaults(inc,chol,info) )             # <<<<<<<<<<<<<<
 *     if opts is None: return 0
 *     cdef dict options = dict(opts)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatFactorInfoDefaults(__pyx_v_inc, __pyx_v_chol, __pyx_v_info)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(6, 939, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":940
 *                        PetscMatFactorInfo *info) except -1:
 *     CHKERR( MatFactorInfoDefaults(inc,chol,info) )
 *     if opts is None: return 0             # <<<<<<<<<<<<<<
 *     cdef dict options = dict(opts)
 *     #
 */
  __pyx_t_2 = (__pyx_v_opts == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscmat.pxi":941
 *     CHKERR( MatFactorInfoDefaults(inc,chol,info) )
 *     if opts is None: return 0
 *     cdef dict options = dict(opts)             # <<<<<<<<<<<<<<
 *     #
 *     cdef fill = options.pop('fill', None)
 */
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_opts);
  __Pyx_GIVEREF(__pyx_v_opts);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_opts);
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyDict_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_options = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "PETSc/petscmat.pxi":943
 *     cdef dict options = dict(opts)
 *     #
 *     cdef fill = options.pop('fill', None)             # <<<<<<<<<<<<<<
 *     if fill is not None:
 *         info.fill = asReal(fill)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_pop); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_fill = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petscmat.pxi":944
 *     #
 *     cdef fill = options.pop('fill', None)
 *     if fill is not None:             # <<<<<<<<<<<<<<
 *         info.fill = asReal(fill)
 *     #
 */
  __pyx_t_3 = (__pyx_v_fill != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":945
 *     cdef fill = options.pop('fill', None)
 *     if fill is not None:
 *         info.fill = asReal(fill)             # <<<<<<<<<<<<<<
 *     #
 *     cdef zeropivot = options.pop('zeropivot', None)
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_fill); if (unlikely(__pyx_t_6 == -1.0 && PyErr_Occurred())) __PYX_ERR(6, 945, __pyx_L1_error)
    __pyx_v_info->fill = __pyx_t_6;

    /* "PETSc/petscmat.pxi":944
 *     #
 *     cdef fill = options.pop('fill', None)
 *     if fill is not None:             # <<<<<<<<<<<<<<
 *         info.fill = asReal(fill)
 *     #
 */
  }

  /* "PETSc/petscmat.pxi":947
 *         info.fill = asReal(fill)
 *     #
 *     cdef zeropivot = options.pop('zeropivot', None)             # <<<<<<<<<<<<<<
 *     if zeropivot is not None:
 *         info.zeropivot = asReal(zeropivot)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_pop); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_zeropivot = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "PETSc/petscmat.pxi":948
 *     #
 *     cdef zeropivot = options.pop('zeropivot', None)
 *     if zeropivot is not None:             # <<<<<<<<<<<<<<
 *         info.zeropivot = asReal(zeropivot)
 *     #
 */
  __pyx_t_2 = (__pyx_v_zeropivot != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":949
 *     cdef zeropivot = options.pop('zeropivot', None)
 *     if zeropivot is not None:
 *         info.zeropivot = asReal(zeropivot)             # <<<<<<<<<<<<<<
 *     #
 *     cdef levels = options.pop('levels', None)
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_zeropivot); if (unlikely(__pyx_t_6 == -1.0 && PyErr_Occurred())) __PYX_ERR(6, 949, __pyx_L1_error)
    __pyx_v_info->zeropivot = __pyx_t_6;

    /* "PETSc/petscmat.pxi":948
 *     #
 *     cdef zeropivot = options.pop('zeropivot', None)
 *     if zeropivot is not None:             # <<<<<<<<<<<<<<
 *         info.zeropivot = asReal(zeropivot)
 *     #
 */
  }

  /* "PETSc/petscmat.pxi":951
 *         info.zeropivot = asReal(zeropivot)
 *     #
 *     cdef levels = options.pop('levels', None)             # <<<<<<<<<<<<<<
 *     if levels is not None:
 *         info.levels  = <PetscReal>asInt(levels)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_pop); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_levels = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petscmat.pxi":952
 *     #
 *     cdef levels = options.pop('levels', None)
 *     if levels is not None:             # <<<<<<<<<<<<<<
 *         info.levels  = <PetscReal>asInt(levels)
 *     cdef diagonal_fill = options.pop('diagonal_fill', None)
 */
  __pyx_t_3 = (__pyx_v_levels != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":953
 *     cdef levels = options.pop('levels', None)
 *     if levels is not None:
 *         info.levels  = <PetscReal>asInt(levels)             # <<<<<<<<<<<<<<
 *     cdef diagonal_fill = options.pop('diagonal_fill', None)
 *     if diagonal_fill is not None:
 */
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_levels); if (unlikely(__pyx_t_7 == -1L && PyErr_Occurred())) __PYX_ERR(6, 953, __pyx_L1_error)
    __pyx_v_info->levels = ((PetscReal)__pyx_t_7);

    /* "PETSc/petscmat.pxi":952
 *     #
 *     cdef levels = options.pop('levels', None)
 *     if levels is not None:             # <<<<<<<<<<<<<<
 *         info.levels  = <PetscReal>asInt(levels)
 *     cdef diagonal_fill = options.pop('diagonal_fill', None)
 */
  }

  /* "PETSc/petscmat.pxi":954
 *     if levels is not None:
 *         info.levels  = <PetscReal>asInt(levels)
 *     cdef diagonal_fill = options.pop('diagonal_fill', None)             # <<<<<<<<<<<<<<
 *     if diagonal_fill is not None:
 *         info.diagonal_fill = <PetscReal>(<bint>diagonal_fill)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_pop); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_diagonal_fill = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "PETSc/petscmat.pxi":955
 *         info.levels  = <PetscReal>asInt(levels)
 *     cdef diagonal_fill = options.pop('diagonal_fill', None)
 *     if diagonal_fill is not None:             # <<<<<<<<<<<<<<
 *         info.diagonal_fill = <PetscReal>(<bint>diagonal_fill)
 *     #
 */
  __pyx_t_2 = (__pyx_v_diagonal_fill != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":956
 *     cdef diagonal_fill = options.pop('diagonal_fill', None)
 *     if diagonal_fill is not None:
 *         info.diagonal_fill = <PetscReal>(<bint>diagonal_fill)             # <<<<<<<<<<<<<<
 *     #
 *     cdef dt = options.pop('dt', None)
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_diagonal_fill); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(6, 956, __pyx_L1_error)
    __pyx_v_info->diagonal_fill = ((PetscReal)__pyx_t_3);

    /* "PETSc/petscmat.pxi":955
 *         info.levels  = <PetscReal>asInt(levels)
 *     cdef diagonal_fill = options.pop('diagonal_fill', None)
 *     if diagonal_fill is not None:             # <<<<<<<<<<<<<<
 *         info.diagonal_fill = <PetscReal>(<bint>diagonal_fill)
 *     #
 */
  }

  /* "PETSc/petscmat.pxi":958
 *         info.diagonal_fill = <PetscReal>(<bint>diagonal_fill)
 *     #
 *     cdef dt = options.pop('dt', None)             # <<<<<<<<<<<<<<
 *     if dt is not None:
 *         info.dt = asReal(dt)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_pop); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_dt = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petscmat.pxi":959
 *     #
 *     cdef dt = options.pop('dt', None)
 *     if dt is not None:             # <<<<<<<<<<<<<<
 *         info.dt = asReal(dt)
 *     cdef dtcol = options.pop('dtcol', None)
 */
  __pyx_t_3 = (__pyx_v_dt != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":960
 *     cdef dt = options.pop('dt', None)
 *     if dt is not None:
 *         info.dt = asReal(dt)             # <<<<<<<<<<<<<<
 *     cdef dtcol = options.pop('dtcol', None)
 *     if dtcol is not None:
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_dt); if (unlikely(__pyx_t_6 == -1.0 && PyErr_Occurred())) __PYX_ERR(6, 960, __pyx_L1_error)
    __pyx_v_info->dt = __pyx_t_6;

    /* "PETSc/petscmat.pxi":959
 *     #
 *     cdef dt = options.pop('dt', None)
 *     if dt is not None:             # <<<<<<<<<<<<<<
 *         info.dt = asReal(dt)
 *     cdef dtcol = options.pop('dtcol', None)
 */
  }

  /* "PETSc/petscmat.pxi":961
 *     if dt is not None:
 *         info.dt = asReal(dt)
 *     cdef dtcol = options.pop('dtcol', None)             # <<<<<<<<<<<<<<
 *     if dtcol is not None:
 *         info.dtcol = asReal(dtcol)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_pop); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_dtcol = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "PETSc/petscmat.pxi":962
 *         info.dt = asReal(dt)
 *     cdef dtcol = options.pop('dtcol', None)
 *     if dtcol is not None:             # <<<<<<<<<<<<<<
 *         info.dtcol = asReal(dtcol)
 *     cdef dtcount = options.pop('dtcount', None)
 */
  __pyx_t_2 = (__pyx_v_dtcol != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscmat.pxi":963
 *     cdef dtcol = options.pop('dtcol', None)
 *     if dtcol is not None:
 *         info.dtcol = asReal(dtcol)             # <<<<<<<<<<<<<<
 *     cdef dtcount = options.pop('dtcount', None)
 *     if dtcount is not None:
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_dtcol); if (unlikely(__pyx_t_6 == -1.0 && PyErr_Occurred())) __PYX_ERR(6, 963, __pyx_L1_error)
    __pyx_v_info->dtcol = __pyx_t_6;

    /* "PETSc/petscmat.pxi":962
 *         info.dt = asReal(dt)
 *     cdef dtcol = options.pop('dtcol', None)
 *     if dtcol is not None:             # <<<<<<<<<<<<<<
 *         info.dtcol = asReal(dtcol)
 *     cdef dtcount = options.pop('dtcount', None)
 */
  }

  /* "PETSc/petscmat.pxi":964
 *     if dtcol is not None:
 *         info.dtcol = asReal(dtcol)
 *     cdef dtcount = options.pop('dtcount', None)             # <<<<<<<<<<<<<<
 *     if dtcount is not None:
 *         info.dtcount = <PetscReal>asInt(dtcount)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_pop); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_dtcount = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petscmat.pxi":965
 *         info.dtcol = asReal(dtcol)
 *     cdef dtcount = options.pop('dtcount', None)
 *     if dtcount is not None:             # <<<<<<<<<<<<<<
 *         info.dtcount = <PetscReal>asInt(dtcount)
 *     if ((dt is not None) or
 */
  __pyx_t_3 = (__pyx_v_dtcount != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":966
 *     cdef dtcount = options.pop('dtcount', None)
 *     if dtcount is not None:
 *         info.dtcount = <PetscReal>asInt(dtcount)             # <<<<<<<<<<<<<<
 *     if ((dt is not None) or
 *         (dtcol is not None) or
 */
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_dtcount); if (unlikely(__pyx_t_7 == -1L && PyErr_Occurred())) __PYX_ERR(6, 966, __pyx_L1_error)
    __pyx_v_info->dtcount = ((PetscReal)__pyx_t_7);

    /* "PETSc/petscmat.pxi":965
 *         info.dtcol = asReal(dtcol)
 *     cdef dtcount = options.pop('dtcount', None)
 *     if dtcount is not None:             # <<<<<<<<<<<<<<
 *         info.dtcount = <PetscReal>asInt(dtcount)
 *     if ((dt is not None) or
 */
  }

  /* "PETSc/petscmat.pxi":967
 *     if dtcount is not None:
 *         info.dtcount = <PetscReal>asInt(dtcount)
 *     if ((dt is not None) or             # <<<<<<<<<<<<<<
 *         (dtcol is not None) or
 *         (dtcount is not None)):
 */
  __pyx_t_3 = (__pyx_v_dt != Py_None);
  __pyx_t_8 = (__pyx_t_3 != 0);
  if (!__pyx_t_8) {
  } else {
    __pyx_t_2 = __pyx_t_8;
    goto __pyx_L12_bool_binop_done;
  }

  /* "PETSc/petscmat.pxi":968
 *         info.dtcount = <PetscReal>asInt(dtcount)
 *     if ((dt is not None) or
 *         (dtcol is not None) or             # <<<<<<<<<<<<<<
 *         (dtcount is not None)):
 *         info.usedt = <PetscReal>PETSC_TRUE
 */
  __pyx_t_8 = (__pyx_v_dtcol != Py_None);
  __pyx_t_3 = (__pyx_t_8 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L12_bool_binop_done;
  }

  /* "PETSc/petscmat.pxi":969
 *     if ((dt is not None) or
 *         (dtcol is not None) or
 *         (dtcount is not None)):             # <<<<<<<<<<<<<<
 *         info.usedt = <PetscReal>PETSC_TRUE
 *     #
 */
  __pyx_t_3 = (__pyx_v_dtcount != Py_None);
  __pyx_t_8 = (__pyx_t_3 != 0);
  __pyx_t_2 = __pyx_t_8;
  __pyx_L12_bool_binop_done:;

  /* "PETSc/petscmat.pxi":967
 *     if dtcount is not None:
 *         info.dtcount = <PetscReal>asInt(dtcount)
 *     if ((dt is not None) or             # <<<<<<<<<<<<<<
 *         (dtcol is not None) or
 *         (dtcount is not None)):
 */
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":970
 *         (dtcol is not None) or
 *         (dtcount is not None)):
 *         info.usedt = <PetscReal>PETSC_TRUE             # <<<<<<<<<<<<<<
 *     #
 *     cdef shifttype = options.pop('shifttype', None)
 */
    __pyx_v_info->usedt = ((PetscReal)PETSC_TRUE);

    /* "PETSc/petscmat.pxi":967
 *     if dtcount is not None:
 *         info.dtcount = <PetscReal>asInt(dtcount)
 *     if ((dt is not None) or             # <<<<<<<<<<<<<<
 *         (dtcol is not None) or
 *         (dtcount is not None)):
 */
  }

  /* "PETSc/petscmat.pxi":972
 *         info.usedt = <PetscReal>PETSC_TRUE
 *     #
 *     cdef shifttype = options.pop('shifttype', None)             # <<<<<<<<<<<<<<
 *     if shifttype is not None:
 *         info.shifttype = <PetscReal>matfactorshifttype(shifttype)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_pop); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_shifttype = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "PETSc/petscmat.pxi":973
 *     #
 *     cdef shifttype = options.pop('shifttype', None)
 *     if shifttype is not None:             # <<<<<<<<<<<<<<
 *         info.shifttype = <PetscReal>matfactorshifttype(shifttype)
 *     cdef shiftamount = options.pop('shiftamount', None)
 */
  __pyx_t_2 = (__pyx_v_shifttype != Py_None);
  __pyx_t_8 = (__pyx_t_2 != 0);
  if (__pyx_t_8) {

    /* "PETSc/petscmat.pxi":974
 *     cdef shifttype = options.pop('shifttype', None)
 *     if shifttype is not None:
 *         info.shifttype = <PetscReal>matfactorshifttype(shifttype)             # <<<<<<<<<<<<<<
 *     cdef shiftamount = options.pop('shiftamount', None)
 *     if shiftamount is not None:
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_matfactorshifttype(__pyx_v_shifttype); if (unlikely(__pyx_t_9 == ((MatFactorShiftType)-1L))) __PYX_ERR(6, 974, __pyx_L1_error)
    __pyx_v_info->shifttype = ((PetscReal)__pyx_t_9);

    /* "PETSc/petscmat.pxi":973
 *     #
 *     cdef shifttype = options.pop('shifttype', None)
 *     if shifttype is not None:             # <<<<<<<<<<<<<<
 *         info.shifttype = <PetscReal>matfactorshifttype(shifttype)
 *     cdef shiftamount = options.pop('shiftamount', None)
 */
  }

  /* "PETSc/petscmat.pxi":975
 *     if shifttype is not None:
 *         info.shifttype = <PetscReal>matfactorshifttype(shifttype)
 *     cdef shiftamount = options.pop('shiftamount', None)             # <<<<<<<<<<<<<<
 *     if shiftamount is not None:
 *         info.shiftamount = asReal(shiftamount)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_pop); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_shiftamount = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petscmat.pxi":976
 *         info.shifttype = <PetscReal>matfactorshifttype(shifttype)
 *     cdef shiftamount = options.pop('shiftamount', None)
 *     if shiftamount is not None:             # <<<<<<<<<<<<<<
 *         info.shiftamount = asReal(shiftamount)
 *     #
 */
  __pyx_t_8 = (__pyx_v_shiftamount != Py_None);
  __pyx_t_2 = (__pyx_t_8 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":977
 *     cdef shiftamount = options.pop('shiftamount', None)
 *     if shiftamount is not None:
 *         info.shiftamount = asReal(shiftamount)             # <<<<<<<<<<<<<<
 *     #
 *     if options:
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_shiftamount); if (unlikely(__pyx_t_6 == -1.0 && PyErr_Occurred())) __PYX_ERR(6, 977, __pyx_L1_error)
    __pyx_v_info->shiftamount = __pyx_t_6;

    /* "PETSc/petscmat.pxi":976
 *         info.shifttype = <PetscReal>matfactorshifttype(shifttype)
 *     cdef shiftamount = options.pop('shiftamount', None)
 *     if shiftamount is not None:             # <<<<<<<<<<<<<<
 *         info.shiftamount = asReal(shiftamount)
 *     #
 */
  }

  /* "PETSc/petscmat.pxi":979
 *         info.shiftamount = asReal(shiftamount)
 *     #
 *     if options:             # <<<<<<<<<<<<<<
 *         raise ValueError("unknown options: %s"
 *                          % list(options.keys()))
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_options); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 979, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "PETSc/petscmat.pxi":981
 *     if options:
 *         raise ValueError("unknown options: %s"
 *                          % list(options.keys()))             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_4 = __Pyx_PyDict_Keys(__pyx_v_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_unknown_options_s, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/petscmat.pxi":980
 *     #
 *     if options:
 *         raise ValueError("unknown options: %s"             # <<<<<<<<<<<<<<
 *                          % list(options.keys()))
 *     return 0
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 980, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(6, 980, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":979
 *         info.shiftamount = asReal(shiftamount)
 *     #
 *     if options:             # <<<<<<<<<<<<<<
 *         raise ValueError("unknown options: %s"
 *                          % list(options.keys()))
 */
  }

  /* "PETSc/petscmat.pxi":982
 *         raise ValueError("unknown options: %s"
 *                          % list(options.keys()))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":937
 *     return st
 * 
 * cdef int matfactorinfo(PetscBool inc, PetscBool chol, object opts,             # <<<<<<<<<<<<<<
 *                        PetscMatFactorInfo *info) except -1:
 *     CHKERR( MatFactorInfoDefaults(inc,chol,info) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.matfactorinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_options);
  __Pyx_XDECREF(__pyx_v_fill);
  __Pyx_XDECREF(__pyx_v_zeropivot);
  __Pyx_XDECREF(__pyx_v_levels);
  __Pyx_XDECREF(__pyx_v_diagonal_fill);
  __Pyx_XDECREF(__pyx_v_dt);
  __Pyx_XDECREF(__pyx_v_dtcol);
  __Pyx_XDECREF(__pyx_v_dtcount);
  __Pyx_XDECREF(__pyx_v_shifttype);
  __Pyx_XDECREF(__pyx_v_shiftamount);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":986
 * # -----------------------------------------------------------------------------
 * 
 * cdef object mat_getitem(Mat self, object ij):             # <<<<<<<<<<<<<<
 *     cdef PetscInt M=0, N=0
 *     rows, cols = ij
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_mat_getitem(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_ij) {
  PetscInt __pyx_v_M;
  PetscInt __pyx_v_N;
  PyObject *__pyx_v_rows = NULL;
  PyObject *__pyx_v_cols = NULL;
  PyObject *__pyx_v_start = NULL;
  PyObject *__pyx_v_stop = NULL;
  PyObject *__pyx_v_stride = 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)(PyObject *);
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("mat_getitem", 0);

  /* "PETSc/petscmat.pxi":987
 * 
 * cdef object mat_getitem(Mat self, object ij):
 *     cdef PetscInt M=0, N=0             # <<<<<<<<<<<<<<
 *     rows, cols = ij
 *     if isinstance(rows, slice):
 */
  __pyx_v_M = 0;
  __pyx_v_N = 0;

  /* "PETSc/petscmat.pxi":988
 * cdef object mat_getitem(Mat self, object ij):
 *     cdef PetscInt M=0, N=0
 *     rows, cols = ij             # <<<<<<<<<<<<<<
 *     if isinstance(rows, slice):
 *         CHKERR( MatGetSize(self.mat, &M, NULL) )
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_ij))) || (PyList_CheckExact(__pyx_v_ij))) {
    PyObject* sequence = __pyx_v_ij;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(6, 988, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_v_ij); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(6, 988, __pyx_L1_error)
    __pyx_t_4 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(6, 988, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_rows = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_cols = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscmat.pxi":989
 *     cdef PetscInt M=0, N=0
 *     rows, cols = ij
 *     if isinstance(rows, slice):             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSize(self.mat, &M, NULL) )
 *         start, stop, stride = rows.indices(toInt(M))
 */
  __pyx_t_5 = PySlice_Check(__pyx_v_rows); 
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "PETSc/petscmat.pxi":990
 *     rows, cols = ij
 *     if isinstance(rows, slice):
 *         CHKERR( MatGetSize(self.mat, &M, NULL) )             # <<<<<<<<<<<<<<
 *         start, stop, stride = rows.indices(toInt(M))
 *         rows = arange(start, stop, stride)
 */
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetSize(__pyx_v_self->mat, (&__pyx_v_M), NULL)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(6, 990, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":991
 *     if isinstance(rows, slice):
 *         CHKERR( MatGetSize(self.mat, &M, NULL) )
 *         start, stop, stride = rows.indices(toInt(M))             # <<<<<<<<<<<<<<
 *         rows = arange(start, stop, stride)
 *     if isinstance(cols, slice):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rows, __pyx_n_s_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_M); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 991, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 991, __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_3);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 991, __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;
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(6, 991, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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); 
      } 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_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_9 = __pyx_t_4(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 2; __pyx_t_3 = __pyx_t_4(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_8), 3) < 0) __PYX_ERR(6, 991, __pyx_L1_error)
      __pyx_t_4 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_4 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 991, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_start = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_stop = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_stride = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PETSc/petscmat.pxi":992
 *         CHKERR( MatGetSize(self.mat, &M, NULL) )
 *         start, stop, stride = rows.indices(toInt(M))
 *         rows = arange(start, stop, stride)             # <<<<<<<<<<<<<<
 *     if isinstance(cols, slice):
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_arange(__pyx_v_start, __pyx_v_stop, __pyx_v_stride)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 992, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_rows, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PETSc/petscmat.pxi":989
 *     cdef PetscInt M=0, N=0
 *     rows, cols = ij
 *     if isinstance(rows, slice):             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSize(self.mat, &M, NULL) )
 *         start, stop, stride = rows.indices(toInt(M))
 */
  }

  /* "PETSc/petscmat.pxi":993
 *         start, stop, stride = rows.indices(toInt(M))
 *         rows = arange(start, stop, stride)
 *     if isinstance(cols, slice):             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 *         start, stop, stride = cols.indices(toInt(N))
 */
  __pyx_t_6 = PySlice_Check(__pyx_v_cols); 
  __pyx_t_5 = (__pyx_t_6 != 0);
  if (__pyx_t_5) {

    /* "PETSc/petscmat.pxi":994
 *         rows = arange(start, stop, stride)
 *     if isinstance(cols, slice):
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )             # <<<<<<<<<<<<<<
 *         start, stop, stride = cols.indices(toInt(N))
 *         cols = arange(start, stop, stride)
 */
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetSize(__pyx_v_self->mat, NULL, (&__pyx_v_N))); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(6, 994, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":995
 *     if isinstance(cols, slice):
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 *         start, stop, stride = cols.indices(toInt(N))             # <<<<<<<<<<<<<<
 *         cols = arange(start, stop, stride)
 *     return matgetvalues(self.mat, rows, cols, None)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cols, __pyx_n_s_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(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_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 995, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 995, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 995, __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;
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(6, 995, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 995, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 995, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 995, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 995, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_8 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 2; __pyx_t_9 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_9)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_1), 3) < 0) __PYX_ERR(6, 995, __pyx_L1_error)
      __pyx_t_4 = NULL;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L10_unpacking_done;
      __pyx_L9_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 995, __pyx_L1_error)
      __pyx_L10_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_start, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_stop, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_stride, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "PETSc/petscmat.pxi":996
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 *         start, stop, stride = cols.indices(toInt(N))
 *         cols = arange(start, stop, stride)             # <<<<<<<<<<<<<<
 *     return matgetvalues(self.mat, rows, cols, None)
 * 
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_arange(__pyx_v_start, __pyx_v_stop, __pyx_v_stride)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 996, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_cols, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PETSc/petscmat.pxi":993
 *         start, stop, stride = rows.indices(toInt(M))
 *         rows = arange(start, stop, stride)
 *     if isinstance(cols, slice):             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 *         start, stop, stride = cols.indices(toInt(N))
 */
  }

  /* "PETSc/petscmat.pxi":997
 *         start, stop, stride = cols.indices(toInt(N))
 *         cols = arange(start, stop, stride)
 *     return matgetvalues(self.mat, rows, cols, None)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_matgetvalues(__pyx_v_self->mat, __pyx_v_rows, __pyx_v_cols, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":986
 * # -----------------------------------------------------------------------------
 * 
 * cdef object mat_getitem(Mat self, object ij):             # <<<<<<<<<<<<<<
 *     cdef PetscInt M=0, N=0
 *     rows, cols = ij
 */

  /* 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_AddTraceback("petsc4py.PETSc.mat_getitem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rows);
  __Pyx_XDECREF(__pyx_v_cols);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_stop);
  __Pyx_XDECREF(__pyx_v_stride);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":1000
 * 
 * 
 * cdef int mat_setitem(Mat self, object ij, object v) except -1:             # <<<<<<<<<<<<<<
 *     cdef PetscInt M=0, N=0
 *     rows, cols = ij
 */

static int __pyx_f_8petsc4py_5PETSc_mat_setitem(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_ij, PyObject *__pyx_v_v) {
  PetscInt __pyx_v_M;
  PetscInt __pyx_v_N;
  PyObject *__pyx_v_rows = NULL;
  PyObject *__pyx_v_cols = NULL;
  PyObject *__pyx_v_start = NULL;
  PyObject *__pyx_v_stop = NULL;
  PyObject *__pyx_v_stride = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("mat_setitem", 0);

  /* "PETSc/petscmat.pxi":1001
 * 
 * cdef int mat_setitem(Mat self, object ij, object v) except -1:
 *     cdef PetscInt M=0, N=0             # <<<<<<<<<<<<<<
 *     rows, cols = ij
 *     if isinstance(rows, slice):
 */
  __pyx_v_M = 0;
  __pyx_v_N = 0;

  /* "PETSc/petscmat.pxi":1002
 * cdef int mat_setitem(Mat self, object ij, object v) except -1:
 *     cdef PetscInt M=0, N=0
 *     rows, cols = ij             # <<<<<<<<<<<<<<
 *     if isinstance(rows, slice):
 *         CHKERR( MatGetSize(self.mat, &M, NULL) )
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_ij))) || (PyList_CheckExact(__pyx_v_ij))) {
    PyObject* sequence = __pyx_v_ij;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(6, 1002, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1002, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1002, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_v_ij); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1002, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(6, 1002, __pyx_L1_error)
    __pyx_t_4 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(6, 1002, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_rows = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_cols = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscmat.pxi":1003
 *     cdef PetscInt M=0, N=0
 *     rows, cols = ij
 *     if isinstance(rows, slice):             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSize(self.mat, &M, NULL) )
 *         start, stop, stride = rows.indices(toInt(M))
 */
  __pyx_t_5 = PySlice_Check(__pyx_v_rows); 
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "PETSc/petscmat.pxi":1004
 *     rows, cols = ij
 *     if isinstance(rows, slice):
 *         CHKERR( MatGetSize(self.mat, &M, NULL) )             # <<<<<<<<<<<<<<
 *         start, stop, stride = rows.indices(toInt(M))
 *         rows = arange(start, stop, stride)
 */
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetSize(__pyx_v_self->mat, (&__pyx_v_M), NULL)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(6, 1004, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":1005
 *     if isinstance(rows, slice):
 *         CHKERR( MatGetSize(self.mat, &M, NULL) )
 *         start, stop, stride = rows.indices(toInt(M))             # <<<<<<<<<<<<<<
 *         rows = arange(start, stop, stride)
 *     if isinstance(cols, slice):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rows, __pyx_n_s_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_M); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1005, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1005, __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_3);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1005, __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;
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(6, 1005, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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); 
      } 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_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1005, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1005, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1005, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1005, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_9 = __pyx_t_4(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 2; __pyx_t_3 = __pyx_t_4(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_8), 3) < 0) __PYX_ERR(6, 1005, __pyx_L1_error)
      __pyx_t_4 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_4 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 1005, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_start = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_stop = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_stride = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PETSc/petscmat.pxi":1006
 *         CHKERR( MatGetSize(self.mat, &M, NULL) )
 *         start, stop, stride = rows.indices(toInt(M))
 *         rows = arange(start, stop, stride)             # <<<<<<<<<<<<<<
 *     if isinstance(cols, slice):
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_arange(__pyx_v_start, __pyx_v_stop, __pyx_v_stride)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1006, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_rows, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PETSc/petscmat.pxi":1003
 *     cdef PetscInt M=0, N=0
 *     rows, cols = ij
 *     if isinstance(rows, slice):             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSize(self.mat, &M, NULL) )
 *         start, stop, stride = rows.indices(toInt(M))
 */
  }

  /* "PETSc/petscmat.pxi":1007
 *         start, stop, stride = rows.indices(toInt(M))
 *         rows = arange(start, stop, stride)
 *     if isinstance(cols, slice):             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 *         start, stop, stride = cols.indices(toInt(N))
 */
  __pyx_t_6 = PySlice_Check(__pyx_v_cols); 
  __pyx_t_5 = (__pyx_t_6 != 0);
  if (__pyx_t_5) {

    /* "PETSc/petscmat.pxi":1008
 *         rows = arange(start, stop, stride)
 *     if isinstance(cols, slice):
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )             # <<<<<<<<<<<<<<
 *         start, stop, stride = cols.indices(toInt(N))
 *         cols = arange(start, stop, stride)
 */
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetSize(__pyx_v_self->mat, NULL, (&__pyx_v_N))); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(6, 1008, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":1009
 *     if isinstance(cols, slice):
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 *         start, stop, stride = cols.indices(toInt(N))             # <<<<<<<<<<<<<<
 *         cols = arange(start, stop, stride)
 *     matsetvalues(self.mat, rows, cols, v, None, 0, 0)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cols, __pyx_n_s_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(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_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1009, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1009, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1009, __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;
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(6, 1009, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_8 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 2; __pyx_t_9 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_9)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_1), 3) < 0) __PYX_ERR(6, 1009, __pyx_L1_error)
      __pyx_t_4 = NULL;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L10_unpacking_done;
      __pyx_L9_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 1009, __pyx_L1_error)
      __pyx_L10_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_start, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_stop, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_stride, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "PETSc/petscmat.pxi":1010
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 *         start, stop, stride = cols.indices(toInt(N))
 *         cols = arange(start, stop, stride)             # <<<<<<<<<<<<<<
 *     matsetvalues(self.mat, rows, cols, v, None, 0, 0)
 *     return 0
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_arange(__pyx_v_start, __pyx_v_stop, __pyx_v_stride)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1010, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_cols, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PETSc/petscmat.pxi":1007
 *         start, stop, stride = rows.indices(toInt(M))
 *         rows = arange(start, stop, stride)
 *     if isinstance(cols, slice):             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 *         start, stop, stride = cols.indices(toInt(N))
 */
  }

  /* "PETSc/petscmat.pxi":1011
 *         start, stop, stride = cols.indices(toInt(N))
 *         cols = arange(start, stop, stride)
 *     matsetvalues(self.mat, rows, cols, v, None, 0, 0)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_matsetvalues(__pyx_v_self->mat, __pyx_v_rows, __pyx_v_cols, __pyx_v_v, Py_None, 0, 0); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(6, 1011, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":1012
 *         cols = arange(start, stop, stride)
 *     matsetvalues(self.mat, rows, cols, v, None, 0, 0)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":1000
 * 
 * 
 * cdef int mat_setitem(Mat self, object ij, object v) except -1:             # <<<<<<<<<<<<<<
 *     cdef PetscInt M=0, N=0
 *     rows, cols = ij
 */

  /* 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_AddTraceback("petsc4py.PETSc.mat_setitem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rows);
  __Pyx_XDECREF(__pyx_v_cols);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_stop);
  __Pyx_XDECREF(__pyx_v_stride);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":1020
 *    cdef PetscMatStencil stencil
 *    property i:
 *        def __set__(self, value):             # <<<<<<<<<<<<<<
 *            self.stencil.i = asInt(value)
 *    property j:
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_1i_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_1i_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_1i___set__(((struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_1i___set__(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/petscmat.pxi":1021
 *    property i:
 *        def __set__(self, value):
 *            self.stencil.i = asInt(value)             # <<<<<<<<<<<<<<
 *    property j:
 *        def __set__(self, value):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_value); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(6, 1021, __pyx_L1_error)
  __pyx_v_self->stencil.i = __pyx_t_1;

  /* "PETSc/petscmat.pxi":1020
 *    cdef PetscMatStencil stencil
 *    property i:
 *        def __set__(self, value):             # <<<<<<<<<<<<<<
 *            self.stencil.i = asInt(value)
 *    property j:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Mat_Stencil.i.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":1023
 *            self.stencil.i = asInt(value)
 *    property j:
 *        def __set__(self, value):             # <<<<<<<<<<<<<<
 *            self.stencil.j = asInt(value)
 *    property k:
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_1j_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_1j_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_1j___set__(((struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_1j___set__(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/petscmat.pxi":1024
 *    property j:
 *        def __set__(self, value):
 *            self.stencil.j = asInt(value)             # <<<<<<<<<<<<<<
 *    property k:
 *        def __set__(self, value):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_value); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(6, 1024, __pyx_L1_error)
  __pyx_v_self->stencil.j = __pyx_t_1;

  /* "PETSc/petscmat.pxi":1023
 *            self.stencil.i = asInt(value)
 *    property j:
 *        def __set__(self, value):             # <<<<<<<<<<<<<<
 *            self.stencil.j = asInt(value)
 *    property k:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Mat_Stencil.j.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":1026
 *            self.stencil.j = asInt(value)
 *    property k:
 *        def __set__(self, value):             # <<<<<<<<<<<<<<
 *            self.stencil.k = asInt(value)
 *    property c:
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_1k_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_1k_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_1k___set__(((struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_1k___set__(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/petscmat.pxi":1027
 *    property k:
 *        def __set__(self, value):
 *            self.stencil.k = asInt(value)             # <<<<<<<<<<<<<<
 *    property c:
 *        def __set__(self, value):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_value); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(6, 1027, __pyx_L1_error)
  __pyx_v_self->stencil.k = __pyx_t_1;

  /* "PETSc/petscmat.pxi":1026
 *            self.stencil.j = asInt(value)
 *    property k:
 *        def __set__(self, value):             # <<<<<<<<<<<<<<
 *            self.stencil.k = asInt(value)
 *    property c:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Mat_Stencil.k.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":1029
 *            self.stencil.k = asInt(value)
 *    property c:
 *        def __set__(self, value):             # <<<<<<<<<<<<<<
 *            self.stencil.c = asInt(value)
 *    property index:
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_1c_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_1c_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_1c___set__(((struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_1c___set__(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/petscmat.pxi":1030
 *    property c:
 *        def __set__(self, value):
 *            self.stencil.c = asInt(value)             # <<<<<<<<<<<<<<
 *    property index:
 *        def __set__(self, value):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_value); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(6, 1030, __pyx_L1_error)
  __pyx_v_self->stencil.c = __pyx_t_1;

  /* "PETSc/petscmat.pxi":1029
 *            self.stencil.k = asInt(value)
 *    property c:
 *        def __set__(self, value):             # <<<<<<<<<<<<<<
 *            self.stencil.c = asInt(value)
 *    property index:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Mat_Stencil.c.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":1032
 *            self.stencil.c = asInt(value)
 *    property index:
 *        def __set__(self, value):             # <<<<<<<<<<<<<<
 *            cdef PetscMatStencil *s = &self.stencil
 *            s.k = s.j = s.i = 0
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_5index_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_5index_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_5index___set__(((struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_5index___set__(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_self, PyObject *__pyx_v_value) {
  MatStencil *__pyx_v_s;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/petscmat.pxi":1033
 *    property index:
 *        def __set__(self, value):
 *            cdef PetscMatStencil *s = &self.stencil             # <<<<<<<<<<<<<<
 *            s.k = s.j = s.i = 0
 *            asDims(value, &s.i, &s.j, &s.k)
 */
  __pyx_v_s = (&__pyx_v_self->stencil);

  /* "PETSc/petscmat.pxi":1034
 *        def __set__(self, value):
 *            cdef PetscMatStencil *s = &self.stencil
 *            s.k = s.j = s.i = 0             # <<<<<<<<<<<<<<
 *            asDims(value, &s.i, &s.j, &s.k)
 *    property field:
 */
  __pyx_v_s->k = 0;
  __pyx_v_s->j = 0;
  __pyx_v_s->i = 0;

  /* "PETSc/petscmat.pxi":1035
 *            cdef PetscMatStencil *s = &self.stencil
 *            s.k = s.j = s.i = 0
 *            asDims(value, &s.i, &s.j, &s.k)             # <<<<<<<<<<<<<<
 *    property field:
 *        def __set__(self, value):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asDims(__pyx_v_value, (&__pyx_v_s->i), (&__pyx_v_s->j), (&__pyx_v_s->k)); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(6, 1035, __pyx_L1_error)

  /* "PETSc/petscmat.pxi":1032
 *            self.stencil.c = asInt(value)
 *    property index:
 *        def __set__(self, value):             # <<<<<<<<<<<<<<
 *            cdef PetscMatStencil *s = &self.stencil
 *            s.k = s.j = s.i = 0
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Mat_Stencil.index.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":1037
 *            asDims(value, &s.i, &s.j, &s.k)
 *    property field:
 *        def __set__(self, value):             # <<<<<<<<<<<<<<
 *            cdef PetscMatStencil *s = &self.stencil
 *            s.c = asInt(value)
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_5field_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_5field_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_5field___set__(((struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_12_Mat_Stencil_5field___set__(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_self, PyObject *__pyx_v_value) {
  MatStencil *__pyx_v_s;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/petscmat.pxi":1038
 *    property field:
 *        def __set__(self, value):
 *            cdef PetscMatStencil *s = &self.stencil             # <<<<<<<<<<<<<<
 *            s.c = asInt(value)
 * 
 */
  __pyx_v_s = (&__pyx_v_self->stencil);

  /* "PETSc/petscmat.pxi":1039
 *        def __set__(self, value):
 *            cdef PetscMatStencil *s = &self.stencil
 *            s.c = asInt(value)             # <<<<<<<<<<<<<<
 * 
 * cdef matsetvaluestencil(PetscMat A,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_value); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(6, 1039, __pyx_L1_error)
  __pyx_v_s->c = __pyx_t_1;

  /* "PETSc/petscmat.pxi":1037
 *            asDims(value, &s.i, &s.j, &s.k)
 *    property field:
 *        def __set__(self, value):             # <<<<<<<<<<<<<<
 *            cdef PetscMatStencil *s = &self.stencil
 *            s.c = asInt(value)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._Mat_Stencil.field.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscmat.pxi":1041
 *            s.c = asInt(value)
 * 
 * cdef matsetvaluestencil(PetscMat A,             # <<<<<<<<<<<<<<
 *                         _Mat_Stencil r, _Mat_Stencil c, object value,
 *                         PetscInsertMode im, int blocked):
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_matsetvaluestencil(Mat __pyx_v_A, struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_r, struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_c, PyObject *__pyx_v_value, InsertMode __pyx_v_im, int __pyx_v_blocked) {
  PetscInt __pyx_v_rbs;
  PetscInt __pyx_v_cbs;
  PetscInt __pyx_v_nv;
  PetscScalar *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("matsetvaluestencil", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "PETSc/petscmat.pxi":1045
 *                         PetscInsertMode im, int blocked):
 *     # block size
 *     cdef PetscInt rbs=1, cbs=1             # <<<<<<<<<<<<<<
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )
 *     if rbs < 1: rbs = 1
 */
  __pyx_v_rbs = 1;
  __pyx_v_cbs = 1;

  /* "PETSc/petscmat.pxi":1046
 *     # block size
 *     cdef PetscInt rbs=1, cbs=1
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )             # <<<<<<<<<<<<<<
 *     if rbs < 1: rbs = 1
 *     if cbs < 1: cbs = 1
 */
  __pyx_t_1 = (__pyx_v_blocked != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetBlockSizes(__pyx_v_A, (&__pyx_v_rbs), (&__pyx_v_cbs))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 1046, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":1047
 *     cdef PetscInt rbs=1, cbs=1
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )
 *     if rbs < 1: rbs = 1             # <<<<<<<<<<<<<<
 *     if cbs < 1: cbs = 1
 *     # values
 */
  __pyx_t_1 = ((__pyx_v_rbs < 1) != 0);
  if (__pyx_t_1) {
    __pyx_v_rbs = 1;
  }

  /* "PETSc/petscmat.pxi":1048
 *     if blocked: CHKERR( MatGetBlockSizes(A, &rbs, &cbs) )
 *     if rbs < 1: rbs = 1
 *     if cbs < 1: cbs = 1             # <<<<<<<<<<<<<<
 *     # values
 *     cdef PetscInt    nv = 1
 */
  __pyx_t_1 = ((__pyx_v_cbs < 1) != 0);
  if (__pyx_t_1) {
    __pyx_v_cbs = 1;
  }

  /* "PETSc/petscmat.pxi":1050
 *     if cbs < 1: cbs = 1
 *     # values
 *     cdef PetscInt    nv = 1             # <<<<<<<<<<<<<<
 *     cdef PetscScalar *v = NULL
 *     value = iarray_s(value, &nv, &v)
 */
  __pyx_v_nv = 1;

  /* "PETSc/petscmat.pxi":1051
 *     # values
 *     cdef PetscInt    nv = 1
 *     cdef PetscScalar *v = NULL             # <<<<<<<<<<<<<<
 *     value = iarray_s(value, &nv, &v)
 *     if rbs*cbs != nv: raise ValueError(
 */
  __pyx_v_v = NULL;

  /* "PETSc/petscmat.pxi":1052
 *     cdef PetscInt    nv = 1
 *     cdef PetscScalar *v = NULL
 *     value = iarray_s(value, &nv, &v)             # <<<<<<<<<<<<<<
 *     if rbs*cbs != nv: raise ValueError(
 *         "incompatible array sizes: nv=%d" % toInt(nv) )
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_s(__pyx_v_value, (&__pyx_v_nv), (&__pyx_v_v))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscmat.pxi":1053
 *     cdef PetscScalar *v = NULL
 *     value = iarray_s(value, &nv, &v)
 *     if rbs*cbs != nv: raise ValueError(             # <<<<<<<<<<<<<<
 *         "incompatible array sizes: nv=%d" % toInt(nv) )
 *     if blocked:
 */
  __pyx_t_1 = (((__pyx_v_rbs * __pyx_v_cbs) != __pyx_v_nv) != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscmat.pxi":1054
 *     value = iarray_s(value, &nv, &v)
 *     if rbs*cbs != nv: raise ValueError(
 *         "incompatible array sizes: nv=%d" % toInt(nv) )             # <<<<<<<<<<<<<<
 *     if blocked:
 *         CHKERR( MatSetValuesBlockedStencil(A,
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nv); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_incompatible_array_sizes_nv_d, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/petscmat.pxi":1053
 *     cdef PetscScalar *v = NULL
 *     value = iarray_s(value, &nv, &v)
 *     if rbs*cbs != nv: raise ValueError(             # <<<<<<<<<<<<<<
 *         "incompatible array sizes: nv=%d" % toInt(nv) )
 *     if blocked:
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1053, __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_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1053, __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(6, 1053, __pyx_L1_error)
  }

  /* "PETSc/petscmat.pxi":1055
 *     if rbs*cbs != nv: raise ValueError(
 *         "incompatible array sizes: nv=%d" % toInt(nv) )
 *     if blocked:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetValuesBlockedStencil(A,
 *                                            1, &r.stencil,
 */
  __pyx_t_1 = (__pyx_v_blocked != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscmat.pxi":1056
 *         "incompatible array sizes: nv=%d" % toInt(nv) )
 *     if blocked:
 *         CHKERR( MatSetValuesBlockedStencil(A,             # <<<<<<<<<<<<<<
 *                                            1, &r.stencil,
 *                                            1, &c.stencil,
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetValuesBlockedStencil(__pyx_v_A, 1, (&__pyx_v_r->stencil), 1, (&__pyx_v_c->stencil), __pyx_v_v, __pyx_v_im)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 1056, __pyx_L1_error)

    /* "PETSc/petscmat.pxi":1055
 *     if rbs*cbs != nv: raise ValueError(
 *         "incompatible array sizes: nv=%d" % toInt(nv) )
 *     if blocked:             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetValuesBlockedStencil(A,
 *                                            1, &r.stencil,
 */
    goto __pyx_L7;
  }

  /* "PETSc/petscmat.pxi":1061
 *                                            v, im) )
 *     else:
 *         CHKERR( MatSetValuesStencil(A,             # <<<<<<<<<<<<<<
 *                                     1, &r.stencil,
 *                                     1, &c.stencil,
 */
  /*else*/ {

    /* "PETSc/petscmat.pxi":1064
 *                                     1, &r.stencil,
 *                                     1, &c.stencil,
 *                                     v, im) )             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetValuesStencil(__pyx_v_A, 1, (&__pyx_v_r->stencil), 1, (&__pyx_v_c->stencil), __pyx_v_v, __pyx_v_im)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(6, 1061, __pyx_L1_error)
  }
  __pyx_L7:;

  /* "PETSc/petscmat.pxi":1065
 *                                     1, &c.stencil,
 *                                     v, im) )
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_int_0);
  __pyx_r = __pyx_int_0;
  goto __pyx_L0;

  /* "PETSc/petscmat.pxi":1041
 *            s.c = asInt(value)
 * 
 * cdef matsetvaluestencil(PetscMat A,             # <<<<<<<<<<<<<<
 *                         _Mat_Stencil r, _Mat_Stencil c, object value,
 *                         PetscInsertMode im, int blocked):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.matsetvaluestencil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscksp.pxi":196
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline KSP ref_KSP(PetscKSP ksp):             # <<<<<<<<<<<<<<
 *     cdef KSP ob = <KSP> KSP()
 *     ob.ksp = ksp
 */

static CYTHON_INLINE struct PyPetscKSPObject *__pyx_f_8petsc4py_5PETSc_ref_KSP(KSP __pyx_v_ksp) {
  struct PyPetscKSPObject *__pyx_v_ob = 0;
  struct PyPetscKSPObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ref_KSP", 0);

  /* "PETSc/petscksp.pxi":197
 * 
 * cdef inline KSP ref_KSP(PetscKSP ksp):
 *     cdef KSP ob = <KSP> KSP()             # <<<<<<<<<<<<<<
 *     ob.ksp = ksp
 *     PetscINCREF(ob.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ob = ((struct PyPetscKSPObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscksp.pxi":198
 * cdef inline KSP ref_KSP(PetscKSP ksp):
 *     cdef KSP ob = <KSP> KSP()
 *     ob.ksp = ksp             # <<<<<<<<<<<<<<
 *     PetscINCREF(ob.obj)
 *     return ob
 */
  __pyx_v_ob->ksp = __pyx_v_ksp;

  /* "PETSc/petscksp.pxi":199
 *     cdef KSP ob = <KSP> KSP()
 *     ob.ksp = ksp
 *     PetscINCREF(ob.obj)             # <<<<<<<<<<<<<<
 *     return ob
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ob->__pyx_base.obj);

  /* "PETSc/petscksp.pxi":200
 *     ob.ksp = ksp
 *     PetscINCREF(ob.obj)
 *     return ob             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ob));
  __pyx_r = __pyx_v_ob;
  goto __pyx_L0;

  /* "PETSc/petscksp.pxi":196
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline KSP ref_KSP(PetscKSP ksp):             # <<<<<<<<<<<<<<
 *     cdef KSP ob = <KSP> KSP()
 *     ob.ksp = ksp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.ref_KSP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscksp.pxi":204
 * # -----------------------------------------------------------------------------
 * 
 * cdef int KSP_Converged(             # <<<<<<<<<<<<<<
 *     PetscKSP  ksp,
 *     PetscInt  its,
 */

static int __pyx_f_8petsc4py_5PETSc_KSP_Converged(KSP __pyx_v_ksp, PetscInt __pyx_v_its, PetscReal __pyx_v_rnm, KSPConvergedReason *__pyx_v_r, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscKSPObject *__pyx_v_Ksp = 0;
  PyObject *__pyx_v_converged = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  PyObject *__pyx_v_reason = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  KSPConvergedReason __pyx_t_9;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("KSP_Converged", 0);

  /* "PETSc/petscksp.pxi":211
 *     void*     ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef KSP Ksp = ref_KSP(ksp)             # <<<<<<<<<<<<<<
 *     (converged, args, kargs) = Ksp.get_attr('__converged__')
 *     reason = converged(Ksp, toInt(its), toReal(rnm), *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_KSP(__pyx_v_ksp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Ksp = ((struct PyPetscKSPObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscksp.pxi":212
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef KSP Ksp = ref_KSP(ksp)
 *     (converged, args, kargs) = Ksp.get_attr('__converged__')             # <<<<<<<<<<<<<<
 *     reason = converged(Ksp, toInt(its), toReal(rnm), *args, **kargs)
 *     if   reason is None:  r[0] = KSP_CONVERGED_ITERATING
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_Ksp->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Ksp), ((char *)"__converged__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 212, __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_CPYTHON
    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(18, 212, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(18, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 212, __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(18, 212, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(18, 212, __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(18, 212, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_converged = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petscksp.pxi":213
 *     cdef KSP Ksp = ref_KSP(ksp)
 *     (converged, args, kargs) = Ksp.get_attr('__converged__')
 *     reason = converged(Ksp, toInt(its), toReal(rnm), *args, **kargs)             # <<<<<<<<<<<<<<
 *     if   reason is None:  r[0] = KSP_CONVERGED_ITERATING
 *     elif reason is False: r[0] = KSP_CONVERGED_ITERATING
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_its); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rnm); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_Ksp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Ksp));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_Ksp));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(18, 213, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(18, 213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_converged, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(18, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_reason = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/petscksp.pxi":214
 *     (converged, args, kargs) = Ksp.get_attr('__converged__')
 *     reason = converged(Ksp, toInt(its), toReal(rnm), *args, **kargs)
 *     if   reason is None:  r[0] = KSP_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *     elif reason is False: r[0] = KSP_CONVERGED_ITERATING
 *     elif reason is True:  r[0] = KSP_CONVERGED_ITS # XXX ?
 */
  __pyx_t_7 = (__pyx_v_reason == Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {
    (__pyx_v_r[0]) = KSP_CONVERGED_ITERATING;
    goto __pyx_L5;
  }

  /* "PETSc/petscksp.pxi":215
 *     reason = converged(Ksp, toInt(its), toReal(rnm), *args, **kargs)
 *     if   reason is None:  r[0] = KSP_CONVERGED_ITERATING
 *     elif reason is False: r[0] = KSP_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *     elif reason is True:  r[0] = KSP_CONVERGED_ITS # XXX ?
 *     else:                 r[0] = reason
 */
  __pyx_t_8 = (__pyx_v_reason == Py_False);
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (__pyx_t_7) {
    (__pyx_v_r[0]) = KSP_CONVERGED_ITERATING;
    goto __pyx_L5;
  }

  /* "PETSc/petscksp.pxi":216
 *     if   reason is None:  r[0] = KSP_CONVERGED_ITERATING
 *     elif reason is False: r[0] = KSP_CONVERGED_ITERATING
 *     elif reason is True:  r[0] = KSP_CONVERGED_ITS # XXX ?             # <<<<<<<<<<<<<<
 *     else:                 r[0] = reason
 *     return 0
 */
  __pyx_t_7 = (__pyx_v_reason == Py_True);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {
    (__pyx_v_r[0]) = KSP_CONVERGED_ITS;
    goto __pyx_L5;
  }

  /* "PETSc/petscksp.pxi":217
 *     elif reason is False: r[0] = KSP_CONVERGED_ITERATING
 *     elif reason is True:  r[0] = KSP_CONVERGED_ITS # XXX ?
 *     else:                 r[0] = reason             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  /*else*/ {
    __pyx_t_9 = ((KSPConvergedReason)__Pyx_PyInt_As_KSPConvergedReason(__pyx_v_reason)); if (unlikely(PyErr_Occurred())) __PYX_ERR(18, 217, __pyx_L1_error)
    (__pyx_v_r[0]) = __pyx_t_9;
  }
  __pyx_L5:;

  /* "PETSc/petscksp.pxi":218
 *     elif reason is True:  r[0] = KSP_CONVERGED_ITS # XXX ?
 *     else:                 r[0] = reason
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscksp.pxi":204
 * # -----------------------------------------------------------------------------
 * 
 * cdef int KSP_Converged(             # <<<<<<<<<<<<<<
 *     PetscKSP  ksp,
 *     PetscInt  its,
 */

  /* 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("petsc4py.PETSc.KSP_Converged", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Ksp);
  __Pyx_XDECREF(__pyx_v_converged);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XDECREF(__pyx_v_reason);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscksp.pxi":222
 * # -----------------------------------------------------------------------------
 * 
 * cdef int KSP_Monitor(             # <<<<<<<<<<<<<<
 *     PetscKSP  ksp,
 *     PetscInt  its,
 */

static int __pyx_f_8petsc4py_5PETSc_KSP_Monitor(KSP __pyx_v_ksp, PetscInt __pyx_v_its, PetscReal __pyx_v_rnm, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscKSPObject *__pyx_v_Ksp = 0;
  PyObject *__pyx_v_monitorlist = 0;
  PyObject *__pyx_v_monitor = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  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)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("KSP_Monitor", 0);

  /* "PETSc/petscksp.pxi":228
 *     void*     ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef KSP Ksp = ref_KSP(ksp)             # <<<<<<<<<<<<<<
 *     cdef object monitorlist = Ksp.get_attr('__monitor__')
 *     if monitorlist is None: return 0
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_KSP(__pyx_v_ksp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Ksp = ((struct PyPetscKSPObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscksp.pxi":229
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef KSP Ksp = ref_KSP(ksp)
 *     cdef object monitorlist = Ksp.get_attr('__monitor__')             # <<<<<<<<<<<<<<
 *     if monitorlist is None: return 0
 *     for (monitor, args, kargs) in monitorlist:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_Ksp->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Ksp), ((char *)"__monitor__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_monitorlist = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscksp.pxi":230
 *     cdef KSP Ksp = ref_KSP(ksp)
 *     cdef object monitorlist = Ksp.get_attr('__monitor__')
 *     if monitorlist is None: return 0             # <<<<<<<<<<<<<<
 *     for (monitor, args, kargs) in monitorlist:
 *         monitor(Ksp, toInt(its), toReal(rnm), *args, **kargs)
 */
  __pyx_t_2 = (__pyx_v_monitorlist == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscksp.pxi":231
 *     cdef object monitorlist = Ksp.get_attr('__monitor__')
 *     if monitorlist is None: return 0
 *     for (monitor, args, kargs) in monitorlist:             # <<<<<<<<<<<<<<
 *         monitor(Ksp, toInt(its), toReal(rnm), *args, **kargs)
 *     return 0
 */
  if (likely(PyList_CheckExact(__pyx_v_monitorlist)) || PyTuple_CheckExact(__pyx_v_monitorlist)) {
    __pyx_t_1 = __pyx_v_monitorlist; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_monitorlist); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 231, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 231, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(18, 231, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 231, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(18, 231, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 231, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      }
    } else {
      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
      if (unlikely(!__pyx_t_6)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(18, 231, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(18, 231, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 231, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(18, 231, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 231, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(18, 231, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) __PYX_ERR(18, 231, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(18, 231, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_monitor, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_args, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_kargs, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "PETSc/petscksp.pxi":232
 *     if monitorlist is None: return 0
 *     for (monitor, args, kargs) in monitorlist:
 *         monitor(Ksp, toInt(its), toReal(rnm), *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_its); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rnm); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(18, 232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)__pyx_v_Ksp));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_Ksp));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_Ksp));
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_9);
    __pyx_t_6 = 0;
    __pyx_t_9 = 0;
    __pyx_t_9 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 232, __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;
    if (unlikely(__pyx_v_kargs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(18, 232, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
      __pyx_t_9 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 232, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      __pyx_t_9 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(18, 232, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    }
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_v_monitor, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(18, 232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "PETSc/petscksp.pxi":231
 *     cdef object monitorlist = Ksp.get_attr('__monitor__')
 *     if monitorlist is None: return 0
 *     for (monitor, args, kargs) in monitorlist:             # <<<<<<<<<<<<<<
 *         monitor(Ksp, toInt(its), toReal(rnm), *args, **kargs)
 *     return 0
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petscksp.pxi":233
 *     for (monitor, args, kargs) in monitorlist:
 *         monitor(Ksp, toInt(its), toReal(rnm), *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscksp.pxi":222
 * # -----------------------------------------------------------------------------
 * 
 * cdef int KSP_Monitor(             # <<<<<<<<<<<<<<
 *     PetscKSP  ksp,
 *     PetscInt  its,
 */

  /* function exit code */
  __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_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP_Monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Ksp);
  __Pyx_XDECREF(__pyx_v_monitorlist);
  __Pyx_XDECREF(__pyx_v_monitor);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscksp.pxi":237
 * # -----------------------------------------------------------------------------
 * 
 * cdef int KSP_ComputeRHS(             # <<<<<<<<<<<<<<
 *     PetscKSP ksp,
 *     PetscVec rhs,
 */

static int __pyx_f_8petsc4py_5PETSc_KSP_ComputeRHS(KSP __pyx_v_ksp, Vec __pyx_v_rhs, void *__pyx_v_ctx) {
  struct PyPetscKSPObject *__pyx_v_Ksp = 0;
  struct PyPetscVecObject *__pyx_v_Rhs = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_computerhs = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("KSP_ComputeRHS", 0);

  /* "PETSc/petscksp.pxi":242
 *     void*    ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef KSP Ksp = ref_KSP(ksp)             # <<<<<<<<<<<<<<
 *     cdef Vec Rhs = ref_Vec(rhs)
 *     cdef object context = Ksp.get_attr('__rhs__')
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_KSP(__pyx_v_ksp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Ksp = ((struct PyPetscKSPObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscksp.pxi":243
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef KSP Ksp = ref_KSP(ksp)
 *     cdef Vec Rhs = ref_Vec(rhs)             # <<<<<<<<<<<<<<
 *     cdef object context = Ksp.get_attr('__rhs__')
 *     if context is None and ctx != NULL: context = <object>ctx
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_rhs)); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Rhs = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscksp.pxi":244
 *     cdef KSP Ksp = ref_KSP(ksp)
 *     cdef Vec Rhs = ref_Vec(rhs)
 *     cdef object context = Ksp.get_attr('__rhs__')             # <<<<<<<<<<<<<<
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_Ksp->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Ksp), ((char *)"__rhs__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscksp.pxi":245
 *     cdef Vec Rhs = ref_Vec(rhs)
 *     cdef object context = Ksp.get_attr('__rhs__')
 *     if context is None and ctx != NULL: context = <object>ctx             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple # sanity check
 *     (computerhs, args, kargs) = context
 */
  __pyx_t_3 = (__pyx_v_context == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_ctx != NULL) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_1 = ((PyObject *)__pyx_v_ctx);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_context, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/petscksp.pxi":246
 *     cdef object context = Ksp.get_attr('__rhs__')
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check             # <<<<<<<<<<<<<<
 *     (computerhs, args, kargs) = context
 *     computerhs(Ksp, Rhs, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(18, 246, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscksp.pxi":247
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 *     (computerhs, args, kargs) = context             # <<<<<<<<<<<<<<
 *     computerhs(Ksp, Rhs, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(18, 247, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(18, 247, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(18, 247, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_computerhs = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscksp.pxi":248
 *     assert context is not None and type(context) is tuple # sanity check
 *     (computerhs, args, kargs) = context
 *     computerhs(Ksp, Rhs, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Ksp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Ksp));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Ksp));
  __Pyx_INCREF(((PyObject *)__pyx_v_Rhs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Rhs));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_Rhs));
  __pyx_t_5 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(18, 248, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_5 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_5 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_computerhs, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 248, __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_6); __pyx_t_6 = 0;

  /* "PETSc/petscksp.pxi":249
 *     (computerhs, args, kargs) = context
 *     computerhs(Ksp, Rhs, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int KSP_ComputeOps(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscksp.pxi":237
 * # -----------------------------------------------------------------------------
 * 
 * cdef int KSP_ComputeRHS(             # <<<<<<<<<<<<<<
 *     PetscKSP ksp,
 *     PetscVec rhs,
 */

  /* 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_AddTraceback("petsc4py.PETSc.KSP_ComputeRHS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Ksp);
  __Pyx_XDECREF((PyObject *)__pyx_v_Rhs);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_computerhs);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscksp.pxi":251
 *     return 0
 * 
 * cdef int KSP_ComputeOps(             # <<<<<<<<<<<<<<
 *     PetscKSP ksp,
 *     PetscMat A,
 */

static int __pyx_f_8petsc4py_5PETSc_KSP_ComputeOps(KSP __pyx_v_ksp, Mat __pyx_v_A, Mat __pyx_v_B, void *__pyx_v_ctx) {
  struct PyPetscKSPObject *__pyx_v_Ksp = 0;
  struct PyPetscMatObject *__pyx_v_Amat = 0;
  struct PyPetscMatObject *__pyx_v_Bmat = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_computeops = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("KSP_ComputeOps", 0);

  /* "PETSc/petscksp.pxi":257
 *     void*    ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef KSP Ksp  = ref_KSP(ksp)             # <<<<<<<<<<<<<<
 *     cdef Mat Amat = ref_Mat(A)
 *     cdef Mat Bmat = ref_Mat(B)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_KSP(__pyx_v_ksp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Ksp = ((struct PyPetscKSPObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscksp.pxi":258
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef KSP Ksp  = ref_KSP(ksp)
 *     cdef Mat Amat = ref_Mat(A)             # <<<<<<<<<<<<<<
 *     cdef Mat Bmat = ref_Mat(B)
 *     cdef object context = Ksp.get_attr('__operators__')
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v_A)); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Amat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscksp.pxi":259
 *     cdef KSP Ksp  = ref_KSP(ksp)
 *     cdef Mat Amat = ref_Mat(A)
 *     cdef Mat Bmat = ref_Mat(B)             # <<<<<<<<<<<<<<
 *     cdef object context = Ksp.get_attr('__operators__')
 *     if context is None and ctx != NULL: context = <object>ctx
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v_B)); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Bmat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscksp.pxi":260
 *     cdef Mat Amat = ref_Mat(A)
 *     cdef Mat Bmat = ref_Mat(B)
 *     cdef object context = Ksp.get_attr('__operators__')             # <<<<<<<<<<<<<<
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_Ksp->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Ksp), ((char *)"__operators__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscksp.pxi":261
 *     cdef Mat Bmat = ref_Mat(B)
 *     cdef object context = Ksp.get_attr('__operators__')
 *     if context is None and ctx != NULL: context = <object>ctx             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple # sanity check
 *     (computeops, args, kargs) = context
 */
  __pyx_t_3 = (__pyx_v_context == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_ctx != NULL) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_1 = ((PyObject *)__pyx_v_ctx);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_context, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/petscksp.pxi":262
 *     cdef object context = Ksp.get_attr('__operators__')
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check             # <<<<<<<<<<<<<<
 *     (computeops, args, kargs) = context
 *     computeops(Ksp, Amat, Bmat, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(18, 262, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscksp.pxi":263
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 *     (computeops, args, kargs) = context             # <<<<<<<<<<<<<<
 *     computeops(Ksp, Amat, Bmat, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(18, 263, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(18, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(18, 263, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(18, 263, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_computeops = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscksp.pxi":264
 *     assert context is not None and type(context) is tuple # sanity check
 *     (computeops, args, kargs) = context
 *     computeops(Ksp, Amat, Bmat, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Ksp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Ksp));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Ksp));
  __Pyx_INCREF(((PyObject *)__pyx_v_Amat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Amat));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_Amat));
  __Pyx_INCREF(((PyObject *)__pyx_v_Bmat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Bmat));
  PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_v_Bmat));
  __pyx_t_5 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(18, 264, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_5 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 264, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_5 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(18, 264, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_computeops, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(18, 264, __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_6); __pyx_t_6 = 0;

  /* "PETSc/petscksp.pxi":265
 *     (computeops, args, kargs) = context
 *     computeops(Ksp, Amat, Bmat, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscksp.pxi":251
 *     return 0
 * 
 * cdef int KSP_ComputeOps(             # <<<<<<<<<<<<<<
 *     PetscKSP ksp,
 *     PetscMat A,
 */

  /* 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_AddTraceback("petsc4py.PETSc.KSP_ComputeOps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Ksp);
  __Pyx_XDECREF((PyObject *)__pyx_v_Amat);
  __Pyx_XDECREF((PyObject *)__pyx_v_Bmat);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_computeops);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscsnes.pxi":216
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline SNES ref_SNES(PetscSNES snes):             # <<<<<<<<<<<<<<
 *     cdef SNES ob = <SNES> SNES()
 *     ob.snes = snes
 */

static CYTHON_INLINE struct PyPetscSNESObject *__pyx_f_8petsc4py_5PETSc_ref_SNES(SNES __pyx_v_snes) {
  struct PyPetscSNESObject *__pyx_v_ob = 0;
  struct PyPetscSNESObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ref_SNES", 0);

  /* "PETSc/petscsnes.pxi":217
 * 
 * cdef inline SNES ref_SNES(PetscSNES snes):
 *     cdef SNES ob = <SNES> SNES()             # <<<<<<<<<<<<<<
 *     ob.snes = snes
 *     PetscINCREF(ob.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ob = ((struct PyPetscSNESObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscsnes.pxi":218
 * cdef inline SNES ref_SNES(PetscSNES snes):
 *     cdef SNES ob = <SNES> SNES()
 *     ob.snes = snes             # <<<<<<<<<<<<<<
 *     PetscINCREF(ob.obj)
 *     return ob
 */
  __pyx_v_ob->snes = __pyx_v_snes;

  /* "PETSc/petscsnes.pxi":219
 *     cdef SNES ob = <SNES> SNES()
 *     ob.snes = snes
 *     PetscINCREF(ob.obj)             # <<<<<<<<<<<<<<
 *     return ob
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ob->__pyx_base.obj);

  /* "PETSc/petscsnes.pxi":220
 *     ob.snes = snes
 *     PetscINCREF(ob.obj)
 *     return ob             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ob));
  __pyx_r = __pyx_v_ob;
  goto __pyx_L0;

  /* "PETSc/petscsnes.pxi":216
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline SNES ref_SNES(PetscSNES snes):             # <<<<<<<<<<<<<<
 *     cdef SNES ob = <SNES> SNES()
 *     ob.snes = snes
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.ref_SNES", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscsnes.pxi":224
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_InitialGuess(             # <<<<<<<<<<<<<<
 *     PetscSNES snes,
 *     PetscVec  x,
 */

static int __pyx_f_8petsc4py_5PETSc_SNES_InitialGuess(SNES __pyx_v_snes, Vec __pyx_v_x, void *__pyx_v_ctx) {
  struct PyPetscSNESObject *__pyx_v_Snes = 0;
  struct PyPetscVecObject *__pyx_v_Xvec = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_initialguess = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("SNES_InitialGuess", 0);

  /* "PETSc/petscsnes.pxi":229
 *     void*     ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)             # <<<<<<<<<<<<<<
 *     cdef Vec  Xvec = ref_Vec(x)
 *     cdef object context = Snes.get_attr('__initialguess__')
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_SNES(__pyx_v_snes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Snes = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":230
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef Vec  Xvec = ref_Vec(x)             # <<<<<<<<<<<<<<
 *     cdef object context = Snes.get_attr('__initialguess__')
 *     if context is None and ctx != NULL: context = <object>ctx
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Xvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":231
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef Vec  Xvec = ref_Vec(x)
 *     cdef object context = Snes.get_attr('__initialguess__')             # <<<<<<<<<<<<<<
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_Snes->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Snes), ((char *)"__initialguess__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":232
 *     cdef Vec  Xvec = ref_Vec(x)
 *     cdef object context = Snes.get_attr('__initialguess__')
 *     if context is None and ctx != NULL: context = <object>ctx             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple # sanity check
 *     (initialguess, args, kargs) = context
 */
  __pyx_t_3 = (__pyx_v_context == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_ctx != NULL) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_1 = ((PyObject *)__pyx_v_ctx);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_context, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/petscsnes.pxi":233
 *     cdef object context = Snes.get_attr('__initialguess__')
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check             # <<<<<<<<<<<<<<
 *     (initialguess, args, kargs) = context
 *     initialguess(Snes, Xvec, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(19, 233, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscsnes.pxi":234
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 *     (initialguess, args, kargs) = context             # <<<<<<<<<<<<<<
 *     initialguess(Snes, Xvec, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(19, 234, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(19, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(19, 234, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(19, 234, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_initialguess = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscsnes.pxi":235
 *     assert context is not None and type(context) is tuple # sanity check
 *     (initialguess, args, kargs) = context
 *     initialguess(Snes, Xvec, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Snes));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Snes));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Snes));
  __Pyx_INCREF(((PyObject *)__pyx_v_Xvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Xvec));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_Xvec));
  __pyx_t_5 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(19, 235, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_5 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_5 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_initialguess, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 235, __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_6); __pyx_t_6 = 0;

  /* "PETSc/petscsnes.pxi":236
 *     (initialguess, args, kargs) = context
 *     initialguess(Snes, Xvec, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscsnes.pxi":224
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_InitialGuess(             # <<<<<<<<<<<<<<
 *     PetscSNES snes,
 *     PetscVec  x,
 */

  /* 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_AddTraceback("petsc4py.PETSc.SNES_InitialGuess", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Snes);
  __Pyx_XDECREF((PyObject *)__pyx_v_Xvec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_initialguess);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscsnes.pxi":240
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_Function(             # <<<<<<<<<<<<<<
 *     PetscSNES snes,
 *     PetscVec  x,
 */

static int __pyx_f_8petsc4py_5PETSc_SNES_Function(SNES __pyx_v_snes, Vec __pyx_v_x, Vec __pyx_v_f, void *__pyx_v_ctx) {
  struct PyPetscSNESObject *__pyx_v_Snes = 0;
  struct PyPetscVecObject *__pyx_v_Xvec = 0;
  struct PyPetscVecObject *__pyx_v_Fvec = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_function = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("SNES_Function", 0);

  /* "PETSc/petscsnes.pxi":246
 *     void*     ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)             # <<<<<<<<<<<<<<
 *     cdef Vec  Xvec = ref_Vec(x)
 *     cdef Vec  Fvec = ref_Vec(f)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_SNES(__pyx_v_snes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Snes = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":247
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef Vec  Xvec = ref_Vec(x)             # <<<<<<<<<<<<<<
 *     cdef Vec  Fvec = ref_Vec(f)
 *     cdef object context = Snes.get_attr('__function__')
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Xvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":248
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef Vec  Xvec = ref_Vec(x)
 *     cdef Vec  Fvec = ref_Vec(f)             # <<<<<<<<<<<<<<
 *     cdef object context = Snes.get_attr('__function__')
 *     if context is None and ctx != NULL: context = <object>ctx
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_f)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Fvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":249
 *     cdef Vec  Xvec = ref_Vec(x)
 *     cdef Vec  Fvec = ref_Vec(f)
 *     cdef object context = Snes.get_attr('__function__')             # <<<<<<<<<<<<<<
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_Snes->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Snes), ((char *)"__function__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":250
 *     cdef Vec  Fvec = ref_Vec(f)
 *     cdef object context = Snes.get_attr('__function__')
 *     if context is None and ctx != NULL: context = <object>ctx             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple # sanity check
 *     (function, args, kargs) = context
 */
  __pyx_t_3 = (__pyx_v_context == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_ctx != NULL) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_1 = ((PyObject *)__pyx_v_ctx);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_context, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/petscsnes.pxi":251
 *     cdef object context = Snes.get_attr('__function__')
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check             # <<<<<<<<<<<<<<
 *     (function, args, kargs) = context
 *     function(Snes, Xvec, Fvec, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(19, 251, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscsnes.pxi":252
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 *     (function, args, kargs) = context             # <<<<<<<<<<<<<<
 *     function(Snes, Xvec, Fvec, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(19, 252, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(19, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(19, 252, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(19, 252, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_function = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscsnes.pxi":253
 *     assert context is not None and type(context) is tuple # sanity check
 *     (function, args, kargs) = context
 *     function(Snes, Xvec, Fvec, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Snes));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Snes));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Snes));
  __Pyx_INCREF(((PyObject *)__pyx_v_Xvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Xvec));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_Xvec));
  __Pyx_INCREF(((PyObject *)__pyx_v_Fvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Fvec));
  PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_v_Fvec));
  __pyx_t_5 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(19, 253, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_5 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_5 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_function, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 253, __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_6); __pyx_t_6 = 0;

  /* "PETSc/petscsnes.pxi":254
 *     (function, args, kargs) = context
 *     function(Snes, Xvec, Fvec, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscsnes.pxi":240
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_Function(             # <<<<<<<<<<<<<<
 *     PetscSNES snes,
 *     PetscVec  x,
 */

  /* 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_AddTraceback("petsc4py.PETSc.SNES_Function", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Snes);
  __Pyx_XDECREF((PyObject *)__pyx_v_Xvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_Fvec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscsnes.pxi":258
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_Update(             # <<<<<<<<<<<<<<
 *     PetscSNES snes,
 *     PetscInt  its,
 */

static int __pyx_f_8petsc4py_5PETSc_SNES_Update(SNES __pyx_v_snes, PetscInt __pyx_v_its) {
  struct PyPetscSNESObject *__pyx_v_Snes = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_update = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("SNES_Update", 0);

  /* "PETSc/petscsnes.pxi":262
 *     PetscInt  its,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)             # <<<<<<<<<<<<<<
 *     cdef object context = Snes.get_attr('__update__')
 *     assert context is not None and type(context) is tuple # sanity check
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_SNES(__pyx_v_snes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Snes = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":263
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef object context = Snes.get_attr('__update__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple # sanity check
 *     (update, args, kargs) = context
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_Snes->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Snes), ((char *)"__update__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":264
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef object context = Snes.get_attr('__update__')
 *     assert context is not None and type(context) is tuple # sanity check             # <<<<<<<<<<<<<<
 *     (update, args, kargs) = context
 *     update(Snes, toInt(its), *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = (__pyx_v_context != Py_None);
    __pyx_t_4 = (__pyx_t_3 != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_3 = (__pyx_t_4 != 0);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(19, 264, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscsnes.pxi":265
 *     cdef object context = Snes.get_attr('__update__')
 *     assert context is not None and type(context) is tuple # sanity check
 *     (update, args, kargs) = context             # <<<<<<<<<<<<<<
 *     update(Snes, toInt(its), *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(19, 265, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(19, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(19, 265, __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(19, 265, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_update = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscsnes.pxi":266
 *     assert context is not None and type(context) is tuple # sanity check
 *     (update, args, kargs) = context
 *     update(Snes, toInt(its), *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_its); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_Snes));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Snes));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_Snes));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(19, 266, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_6 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_update, __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/petscsnes.pxi":267
 *     (update, args, kargs) = context
 *     update(Snes, toInt(its), *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscsnes.pxi":258
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_Update(             # <<<<<<<<<<<<<<
 *     PetscSNES snes,
 *     PetscInt  its,
 */

  /* 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_AddTraceback("petsc4py.PETSc.SNES_Update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Snes);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_update);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscsnes.pxi":271
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_Jacobian(             # <<<<<<<<<<<<<<
 *     PetscSNES snes,
 *     PetscVec  x,
 */

static int __pyx_f_8petsc4py_5PETSc_SNES_Jacobian(SNES __pyx_v_snes, Vec __pyx_v_x, Mat __pyx_v_J, Mat __pyx_v_P, void *__pyx_v_ctx) {
  struct PyPetscSNESObject *__pyx_v_Snes = 0;
  struct PyPetscVecObject *__pyx_v_Xvec = 0;
  struct PyPetscMatObject *__pyx_v_Jmat = 0;
  struct PyPetscMatObject *__pyx_v_Pmat = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_jacobian = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("SNES_Jacobian", 0);

  /* "PETSc/petscsnes.pxi":278
 *     void*     ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)             # <<<<<<<<<<<<<<
 *     cdef Vec  Xvec = ref_Vec(x)
 *     cdef Mat  Jmat = ref_Mat(J)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_SNES(__pyx_v_snes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Snes = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":279
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef Vec  Xvec = ref_Vec(x)             # <<<<<<<<<<<<<<
 *     cdef Mat  Jmat = ref_Mat(J)
 *     cdef Mat  Pmat = ref_Mat(P)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Xvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":280
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef Vec  Xvec = ref_Vec(x)
 *     cdef Mat  Jmat = ref_Mat(J)             # <<<<<<<<<<<<<<
 *     cdef Mat  Pmat = ref_Mat(P)
 *     cdef object context = Snes.get_attr('__jacobian__')
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v_J)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Jmat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":281
 *     cdef Vec  Xvec = ref_Vec(x)
 *     cdef Mat  Jmat = ref_Mat(J)
 *     cdef Mat  Pmat = ref_Mat(P)             # <<<<<<<<<<<<<<
 *     cdef object context = Snes.get_attr('__jacobian__')
 *     if context is None and ctx != NULL: context = <object>ctx
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v_P)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Pmat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":282
 *     cdef Mat  Jmat = ref_Mat(J)
 *     cdef Mat  Pmat = ref_Mat(P)
 *     cdef object context = Snes.get_attr('__jacobian__')             # <<<<<<<<<<<<<<
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_Snes->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Snes), ((char *)"__jacobian__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":283
 *     cdef Mat  Pmat = ref_Mat(P)
 *     cdef object context = Snes.get_attr('__jacobian__')
 *     if context is None and ctx != NULL: context = <object>ctx             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple # sanity check
 *     (jacobian, args, kargs) = context
 */
  __pyx_t_3 = (__pyx_v_context == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_ctx != NULL) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_1 = ((PyObject *)__pyx_v_ctx);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_context, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/petscsnes.pxi":284
 *     cdef object context = Snes.get_attr('__jacobian__')
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check             # <<<<<<<<<<<<<<
 *     (jacobian, args, kargs) = context
 *     jacobian(Snes, Xvec, Jmat, Pmat, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(19, 284, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscsnes.pxi":285
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 *     (jacobian, args, kargs) = context             # <<<<<<<<<<<<<<
 *     jacobian(Snes, Xvec, Jmat, Pmat, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(19, 285, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(19, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(19, 285, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(19, 285, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_jacobian = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscsnes.pxi":286
 *     assert context is not None and type(context) is tuple # sanity check
 *     (jacobian, args, kargs) = context
 *     jacobian(Snes, Xvec, Jmat, Pmat, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Snes));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Snes));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Snes));
  __Pyx_INCREF(((PyObject *)__pyx_v_Xvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Xvec));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_Xvec));
  __Pyx_INCREF(((PyObject *)__pyx_v_Jmat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Jmat));
  PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_v_Jmat));
  __Pyx_INCREF(((PyObject *)__pyx_v_Pmat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pmat));
  PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_v_Pmat));
  __pyx_t_5 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(19, 286, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_5 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_5 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_jacobian, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 286, __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_6); __pyx_t_6 = 0;

  /* "PETSc/petscsnes.pxi":287
 *     (jacobian, args, kargs) = context
 *     jacobian(Snes, Xvec, Jmat, Pmat, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscsnes.pxi":271
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_Jacobian(             # <<<<<<<<<<<<<<
 *     PetscSNES snes,
 *     PetscVec  x,
 */

  /* 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_AddTraceback("petsc4py.PETSc.SNES_Jacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Snes);
  __Pyx_XDECREF((PyObject *)__pyx_v_Xvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_Jmat);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pmat);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_jacobian);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscsnes.pxi":291
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_Objective(             # <<<<<<<<<<<<<<
 *     PetscSNES  snes,
 *     PetscVec   x,
 */

static int __pyx_f_8petsc4py_5PETSc_SNES_Objective(SNES __pyx_v_snes, Vec __pyx_v_x, PetscReal *__pyx_v_o, void *__pyx_v_ctx) {
  struct PyPetscSNESObject *__pyx_v_Snes = 0;
  struct PyPetscVecObject *__pyx_v_Xvec = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_objective = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  PyObject *__pyx_v_obj = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PetscReal __pyx_t_9;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("SNES_Objective", 0);

  /* "PETSc/petscsnes.pxi":297
 *     void*      ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)             # <<<<<<<<<<<<<<
 *     cdef Vec  Xvec = ref_Vec(x)
 *     cdef object context = Snes.get_attr('__objective__')
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_SNES(__pyx_v_snes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Snes = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":298
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef Vec  Xvec = ref_Vec(x)             # <<<<<<<<<<<<<<
 *     cdef object context = Snes.get_attr('__objective__')
 *     if context is None and ctx != NULL: context = <object>ctx
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Xvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":299
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef Vec  Xvec = ref_Vec(x)
 *     cdef object context = Snes.get_attr('__objective__')             # <<<<<<<<<<<<<<
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_Snes->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Snes), ((char *)"__objective__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":300
 *     cdef Vec  Xvec = ref_Vec(x)
 *     cdef object context = Snes.get_attr('__objective__')
 *     if context is None and ctx != NULL: context = <object>ctx             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple # sanity check
 *     (objective, args, kargs) = context
 */
  __pyx_t_3 = (__pyx_v_context == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_ctx != NULL) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_1 = ((PyObject *)__pyx_v_ctx);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_context, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/petscsnes.pxi":301
 *     cdef object context = Snes.get_attr('__objective__')
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check             # <<<<<<<<<<<<<<
 *     (objective, args, kargs) = context
 *     obj = objective(Snes, Xvec, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(19, 301, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscsnes.pxi":302
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 *     (objective, args, kargs) = context             # <<<<<<<<<<<<<<
 *     obj = objective(Snes, Xvec, *args, **kargs)
 *     o[0] = asReal(obj)
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(19, 302, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(19, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(19, 302, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(19, 302, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_objective = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscsnes.pxi":303
 *     assert context is not None and type(context) is tuple # sanity check
 *     (objective, args, kargs) = context
 *     obj = objective(Snes, Xvec, *args, **kargs)             # <<<<<<<<<<<<<<
 *     o[0] = asReal(obj)
 *     return 0
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Snes));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Snes));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Snes));
  __Pyx_INCREF(((PyObject *)__pyx_v_Xvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Xvec));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_Xvec));
  __pyx_t_5 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(19, 303, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_5 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_5 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_objective, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 303, __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_v_obj = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscsnes.pxi":304
 *     (objective, args, kargs) = context
 *     obj = objective(Snes, Xvec, *args, **kargs)
 *     o[0] = asReal(obj)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_obj); if (unlikely(__pyx_t_9 == -1.0 && PyErr_Occurred())) __PYX_ERR(19, 304, __pyx_L1_error)
  (__pyx_v_o[0]) = __pyx_t_9;

  /* "PETSc/petscsnes.pxi":305
 *     obj = objective(Snes, Xvec, *args, **kargs)
 *     o[0] = asReal(obj)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscsnes.pxi":291
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_Objective(             # <<<<<<<<<<<<<<
 *     PetscSNES  snes,
 *     PetscVec   x,
 */

  /* 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_AddTraceback("petsc4py.PETSc.SNES_Objective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Snes);
  __Pyx_XDECREF((PyObject *)__pyx_v_Xvec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_objective);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscsnes.pxi":309
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_Converged(             # <<<<<<<<<<<<<<
 *     PetscSNES  snes,
 *     PetscInt   iters,
 */

static int __pyx_f_8petsc4py_5PETSc_SNES_Converged(SNES __pyx_v_snes, PetscInt __pyx_v_iters, PetscReal __pyx_v_xnorm, PetscReal __pyx_v_gnorm, PetscReal __pyx_v_fnorm, SNESConvergedReason *__pyx_v_r, void *__pyx_v_ctx) {
  struct PyPetscSNESObject *__pyx_v_Snes = 0;
  PyObject *__pyx_v_it = 0;
  PyObject *__pyx_v_xn = 0;
  PyObject *__pyx_v_gn = 0;
  PyObject *__pyx_v_fn = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_converged = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  PyObject *__pyx_v_reason = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  SNESConvergedReason __pyx_t_9;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("SNES_Converged", 0);

  /* "PETSc/petscsnes.pxi":318
 *     void*      ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)             # <<<<<<<<<<<<<<
 *     cdef object it = toInt(iters)
 *     cdef object xn = toReal(xnorm)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_SNES(__pyx_v_snes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Snes = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":319
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef object it = toInt(iters)             # <<<<<<<<<<<<<<
 *     cdef object xn = toReal(xnorm)
 *     cdef object gn = toReal(gnorm)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_iters); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_it = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":320
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef object it = toInt(iters)
 *     cdef object xn = toReal(xnorm)             # <<<<<<<<<<<<<<
 *     cdef object gn = toReal(gnorm)
 *     cdef object fn = toReal(fnorm)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_xnorm); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xn = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":321
 *     cdef object it = toInt(iters)
 *     cdef object xn = toReal(xnorm)
 *     cdef object gn = toReal(gnorm)             # <<<<<<<<<<<<<<
 *     cdef object fn = toReal(fnorm)
 *     cdef object context = Snes.get_attr('__converged__')
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_gnorm); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_gn = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":322
 *     cdef object xn = toReal(xnorm)
 *     cdef object gn = toReal(gnorm)
 *     cdef object fn = toReal(fnorm)             # <<<<<<<<<<<<<<
 *     cdef object context = Snes.get_attr('__converged__')
 *     if context is None and ctx != NULL: context = <object>ctx
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_fnorm); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fn = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":323
 *     cdef object gn = toReal(gnorm)
 *     cdef object fn = toReal(fnorm)
 *     cdef object context = Snes.get_attr('__converged__')             # <<<<<<<<<<<<<<
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_Snes->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Snes), ((char *)"__converged__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":324
 *     cdef object fn = toReal(fnorm)
 *     cdef object context = Snes.get_attr('__converged__')
 *     if context is None and ctx != NULL: context = <object>ctx             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple # sanity check
 *     (converged, args, kargs) = context
 */
  __pyx_t_3 = (__pyx_v_context == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_ctx != NULL) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_1 = ((PyObject *)__pyx_v_ctx);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_context, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/petscsnes.pxi":325
 *     cdef object context = Snes.get_attr('__converged__')
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check             # <<<<<<<<<<<<<<
 *     (converged, args, kargs) = context
 *     reason = converged(Snes, it, (xn, gn, fn), *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(19, 325, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscsnes.pxi":326
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 *     (converged, args, kargs) = context             # <<<<<<<<<<<<<<
 *     reason = converged(Snes, it, (xn, gn, fn), *args, **kargs)
 *     if   reason is None:  r[0] = SNES_CONVERGED_ITERATING
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(19, 326, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(19, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(19, 326, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(19, 326, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_converged = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscsnes.pxi":327
 *     assert context is not None and type(context) is tuple # sanity check
 *     (converged, args, kargs) = context
 *     reason = converged(Snes, it, (xn, gn, fn), *args, **kargs)             # <<<<<<<<<<<<<<
 *     if   reason is None:  r[0] = SNES_CONVERGED_ITERATING
 *     elif reason is False: r[0] = SNES_CONVERGED_ITERATING
 */
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_xn);
  __Pyx_GIVEREF(__pyx_v_xn);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_xn);
  __Pyx_INCREF(__pyx_v_gn);
  __Pyx_GIVEREF(__pyx_v_gn);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_gn);
  __Pyx_INCREF(__pyx_v_fn);
  __Pyx_GIVEREF(__pyx_v_fn);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_fn);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_Snes));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Snes));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_Snes));
  __Pyx_INCREF(__pyx_v_it);
  __Pyx_GIVEREF(__pyx_v_it);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_it);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(19, 327, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_6 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_converged, __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_reason = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "PETSc/petscsnes.pxi":328
 *     (converged, args, kargs) = context
 *     reason = converged(Snes, it, (xn, gn, fn), *args, **kargs)
 *     if   reason is None:  r[0] = SNES_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *     elif reason is False: r[0] = SNES_CONVERGED_ITERATING
 *     elif reason is True:  r[0] = SNES_CONVERGED_ITS # XXX ?
 */
  __pyx_t_2 = (__pyx_v_reason == Py_None);
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {
    (__pyx_v_r[0]) = SNES_CONVERGED_ITERATING;
    goto __pyx_L10;
  }

  /* "PETSc/petscsnes.pxi":329
 *     reason = converged(Snes, it, (xn, gn, fn), *args, **kargs)
 *     if   reason is None:  r[0] = SNES_CONVERGED_ITERATING
 *     elif reason is False: r[0] = SNES_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *     elif reason is True:  r[0] = SNES_CONVERGED_ITS # XXX ?
 *     else:                 r[0] = reason
 */
  __pyx_t_4 = (__pyx_v_reason == Py_False);
  __pyx_t_2 = (__pyx_t_4 != 0);
  if (__pyx_t_2) {
    (__pyx_v_r[0]) = SNES_CONVERGED_ITERATING;
    goto __pyx_L10;
  }

  /* "PETSc/petscsnes.pxi":330
 *     if   reason is None:  r[0] = SNES_CONVERGED_ITERATING
 *     elif reason is False: r[0] = SNES_CONVERGED_ITERATING
 *     elif reason is True:  r[0] = SNES_CONVERGED_ITS # XXX ?             # <<<<<<<<<<<<<<
 *     else:                 r[0] = reason
 *     return 0
 */
  __pyx_t_2 = (__pyx_v_reason == Py_True);
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {
    (__pyx_v_r[0]) = SNES_CONVERGED_ITS;
    goto __pyx_L10;
  }

  /* "PETSc/petscsnes.pxi":331
 *     elif reason is False: r[0] = SNES_CONVERGED_ITERATING
 *     elif reason is True:  r[0] = SNES_CONVERGED_ITS # XXX ?
 *     else:                 r[0] = reason             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  /*else*/ {
    __pyx_t_9 = ((SNESConvergedReason)__Pyx_PyInt_As_SNESConvergedReason(__pyx_v_reason)); if (unlikely(PyErr_Occurred())) __PYX_ERR(19, 331, __pyx_L1_error)
    (__pyx_v_r[0]) = __pyx_t_9;
  }
  __pyx_L10:;

  /* "PETSc/petscsnes.pxi":332
 *     elif reason is True:  r[0] = SNES_CONVERGED_ITS # XXX ?
 *     else:                 r[0] = reason
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscsnes.pxi":309
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_Converged(             # <<<<<<<<<<<<<<
 *     PetscSNES  snes,
 *     PetscInt   iters,
 */

  /* 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_AddTraceback("petsc4py.PETSc.SNES_Converged", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Snes);
  __Pyx_XDECREF(__pyx_v_it);
  __Pyx_XDECREF(__pyx_v_xn);
  __Pyx_XDECREF(__pyx_v_gn);
  __Pyx_XDECREF(__pyx_v_fn);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_converged);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XDECREF(__pyx_v_reason);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscsnes.pxi":336
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_Monitor(             # <<<<<<<<<<<<<<
 *     PetscSNES  snes,
 *     PetscInt   iters,
 */

static int __pyx_f_8petsc4py_5PETSc_SNES_Monitor(SNES __pyx_v_snes, PetscInt __pyx_v_iters, PetscReal __pyx_v_rnorm, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscSNESObject *__pyx_v_Snes = 0;
  PyObject *__pyx_v_monitorlist = 0;
  PyObject *__pyx_v_it = 0;
  PyObject *__pyx_v_rn = 0;
  PyObject *__pyx_v_monitor = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  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)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("SNES_Monitor", 0);

  /* "PETSc/petscsnes.pxi":342
 *     void*      ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)             # <<<<<<<<<<<<<<
 *     cdef object monitorlist = Snes.get_attr('__monitor__')
 *     if monitorlist is None: return 0
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_SNES(__pyx_v_snes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Snes = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":343
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef object monitorlist = Snes.get_attr('__monitor__')             # <<<<<<<<<<<<<<
 *     if monitorlist is None: return 0
 *     cdef object it = toInt(iters)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_Snes->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Snes), ((char *)"__monitor__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_monitorlist = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":344
 *     cdef SNES Snes = ref_SNES(snes)
 *     cdef object monitorlist = Snes.get_attr('__monitor__')
 *     if monitorlist is None: return 0             # <<<<<<<<<<<<<<
 *     cdef object it = toInt(iters)
 *     cdef object rn = toReal(rnorm)
 */
  __pyx_t_2 = (__pyx_v_monitorlist == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscsnes.pxi":345
 *     cdef object monitorlist = Snes.get_attr('__monitor__')
 *     if monitorlist is None: return 0
 *     cdef object it = toInt(iters)             # <<<<<<<<<<<<<<
 *     cdef object rn = toReal(rnorm)
 *     for (monitor, args, kargs) in monitorlist:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_iters); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_it = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":346
 *     if monitorlist is None: return 0
 *     cdef object it = toInt(iters)
 *     cdef object rn = toReal(rnorm)             # <<<<<<<<<<<<<<
 *     for (monitor, args, kargs) in monitorlist:
 *         monitor(Snes, it, rn, *args, **kargs)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rnorm); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rn = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":347
 *     cdef object it = toInt(iters)
 *     cdef object rn = toReal(rnorm)
 *     for (monitor, args, kargs) in monitorlist:             # <<<<<<<<<<<<<<
 *         monitor(Snes, it, rn, *args, **kargs)
 *     return 0
 */
  if (likely(PyList_CheckExact(__pyx_v_monitorlist)) || PyTuple_CheckExact(__pyx_v_monitorlist)) {
    __pyx_t_1 = __pyx_v_monitorlist; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_monitorlist); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(19, 347, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(19, 347, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(19, 347, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      }
    } else {
      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
      if (unlikely(!__pyx_t_6)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(19, 347, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(19, 347, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(19, 347, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(19, 347, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(19, 347, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(19, 347, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) __PYX_ERR(19, 347, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(19, 347, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_monitor, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_args, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_kargs, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "PETSc/petscsnes.pxi":348
 *     cdef object rn = toReal(rnorm)
 *     for (monitor, args, kargs) in monitorlist:
 *         monitor(Snes, it, rn, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_v_Snes));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_Snes));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Snes));
    __Pyx_INCREF(__pyx_v_it);
    __Pyx_GIVEREF(__pyx_v_it);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_it);
    __Pyx_INCREF(__pyx_v_rn);
    __Pyx_GIVEREF(__pyx_v_rn);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_rn);
    __pyx_t_9 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_9)) __PYX_ERR(19, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyNumber_Add(__pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(19, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(__pyx_v_kargs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(19, 348, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
      __pyx_t_9 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_9)) __PYX_ERR(19, 348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      __pyx_t_9 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(19, 348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    }
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_monitor, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(19, 348, __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_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PETSc/petscsnes.pxi":347
 *     cdef object it = toInt(iters)
 *     cdef object rn = toReal(rnorm)
 *     for (monitor, args, kargs) in monitorlist:             # <<<<<<<<<<<<<<
 *         monitor(Snes, it, rn, *args, **kargs)
 *     return 0
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petscsnes.pxi":349
 *     for (monitor, args, kargs) in monitorlist:
 *         monitor(Snes, it, rn, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscsnes.pxi":336
 * # -----------------------------------------------------------------------------
 * 
 * cdef int SNES_Monitor(             # <<<<<<<<<<<<<<
 *     PetscSNES  snes,
 *     PetscInt   iters,
 */

  /* function exit code */
  __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_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES_Monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Snes);
  __Pyx_XDECREF(__pyx_v_monitorlist);
  __Pyx_XDECREF(__pyx_v_it);
  __Pyx_XDECREF(__pyx_v_rn);
  __Pyx_XDECREF(__pyx_v_monitor);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscts.pxi":199
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline TS ref_TS(PetscTS ts):             # <<<<<<<<<<<<<<
 *     cdef TS ob = <TS> TS()
 *     ob.ts = ts
 */

static CYTHON_INLINE struct PyPetscTSObject *__pyx_f_8petsc4py_5PETSc_ref_TS(TS __pyx_v_ts) {
  struct PyPetscTSObject *__pyx_v_ob = 0;
  struct PyPetscTSObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ref_TS", 0);

  /* "PETSc/petscts.pxi":200
 * 
 * cdef inline TS ref_TS(PetscTS ts):
 *     cdef TS ob = <TS> TS()             # <<<<<<<<<<<<<<
 *     ob.ts = ts
 *     PetscINCREF(ob.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ob = ((struct PyPetscTSObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscts.pxi":201
 * cdef inline TS ref_TS(PetscTS ts):
 *     cdef TS ob = <TS> TS()
 *     ob.ts = ts             # <<<<<<<<<<<<<<
 *     PetscINCREF(ob.obj)
 *     return ob
 */
  __pyx_v_ob->ts = __pyx_v_ts;

  /* "PETSc/petscts.pxi":202
 *     cdef TS ob = <TS> TS()
 *     ob.ts = ts
 *     PetscINCREF(ob.obj)             # <<<<<<<<<<<<<<
 *     return ob
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ob->__pyx_base.obj);

  /* "PETSc/petscts.pxi":203
 *     ob.ts = ts
 *     PetscINCREF(ob.obj)
 *     return ob             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ob));
  __pyx_r = __pyx_v_ob;
  goto __pyx_L0;

  /* "PETSc/petscts.pxi":199
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline TS ref_TS(PetscTS ts):             # <<<<<<<<<<<<<<
 *     cdef TS ob = <TS> TS()
 *     ob.ts = ts
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.ref_TS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscts.pxi":207
 * # -----------------------------------------------------------------------------
 * 
 * cdef int TS_RHSFunction(             # <<<<<<<<<<<<<<
 *     PetscTS   ts,
 *     PetscReal t,
 */

static int __pyx_f_8petsc4py_5PETSc_TS_RHSFunction(TS __pyx_v_ts, PetscReal __pyx_v_t, Vec __pyx_v_x, Vec __pyx_v_f, void *__pyx_v_ctx) {
  struct PyPetscTSObject *__pyx_v_Ts = 0;
  struct PyPetscVecObject *__pyx_v_Xvec = 0;
  struct PyPetscVecObject *__pyx_v_Fvec = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_function = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TS_RHSFunction", 0);

  /* "PETSc/petscts.pxi":214
 *     void*     ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS  Ts   = ref_TS(ts)             # <<<<<<<<<<<<<<
 *     cdef Vec Xvec = ref_Vec(x)
 *     cdef Vec Fvec = ref_Vec(f)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TS(__pyx_v_ts)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Ts = ((struct PyPetscTSObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":215
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS  Ts   = ref_TS(ts)
 *     cdef Vec Xvec = ref_Vec(x)             # <<<<<<<<<<<<<<
 *     cdef Vec Fvec = ref_Vec(f)
 *     cdef object context = Ts.get_attr('__rhsfunction__')
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Xvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":216
 *     cdef TS  Ts   = ref_TS(ts)
 *     cdef Vec Xvec = ref_Vec(x)
 *     cdef Vec Fvec = ref_Vec(f)             # <<<<<<<<<<<<<<
 *     cdef object context = Ts.get_attr('__rhsfunction__')
 *     if context is None and ctx != NULL: context = <object>ctx
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_f)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Fvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":217
 *     cdef Vec Xvec = ref_Vec(x)
 *     cdef Vec Fvec = ref_Vec(f)
 *     cdef object context = Ts.get_attr('__rhsfunction__')             # <<<<<<<<<<<<<<
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_Ts->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Ts), ((char *)"__rhsfunction__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":218
 *     cdef Vec Fvec = ref_Vec(f)
 *     cdef object context = Ts.get_attr('__rhsfunction__')
 *     if context is None and ctx != NULL: context = <object>ctx             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple # sanity check
 *     (function, args, kargs) = context
 */
  __pyx_t_3 = (__pyx_v_context == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_ctx != NULL) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_1 = ((PyObject *)__pyx_v_ctx);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_context, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/petscts.pxi":219
 *     cdef object context = Ts.get_attr('__rhsfunction__')
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check             # <<<<<<<<<<<<<<
 *     (function, args, kargs) = context
 *     function(Ts, toReal(t), Xvec, Fvec, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(20, 219, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscts.pxi":220
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 *     (function, args, kargs) = context             # <<<<<<<<<<<<<<
 *     function(Ts, toReal(t), Xvec, Fvec, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(20, 220, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(20, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(20, 220, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(20, 220, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_function = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscts.pxi":221
 *     assert context is not None and type(context) is tuple # sanity check
 *     (function, args, kargs) = context
 *     function(Ts, toReal(t), Xvec, Fvec, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_Ts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Ts));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_Ts));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Xvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Xvec));
  PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_Xvec));
  __Pyx_INCREF(((PyObject *)__pyx_v_Fvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Fvec));
  PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_Fvec));
  __pyx_t_6 = 0;
  __pyx_t_6 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(20, 221, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_6 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_function, __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/petscts.pxi":222
 *     (function, args, kargs) = context
 *     function(Ts, toReal(t), Xvec, Fvec, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TS_RHSJacobian(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscts.pxi":207
 * # -----------------------------------------------------------------------------
 * 
 * cdef int TS_RHSFunction(             # <<<<<<<<<<<<<<
 *     PetscTS   ts,
 *     PetscReal t,
 */

  /* 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_AddTraceback("petsc4py.PETSc.TS_RHSFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Ts);
  __Pyx_XDECREF((PyObject *)__pyx_v_Xvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_Fvec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscts.pxi":224
 *     return 0
 * 
 * cdef int TS_RHSJacobian(             # <<<<<<<<<<<<<<
 *     PetscTS   ts,
 *     PetscReal t,
 */

static int __pyx_f_8petsc4py_5PETSc_TS_RHSJacobian(TS __pyx_v_ts, PetscReal __pyx_v_t, Vec __pyx_v_x, Mat __pyx_v_J, Mat __pyx_v_P, void *__pyx_v_ctx) {
  struct PyPetscTSObject *__pyx_v_Ts = 0;
  struct PyPetscVecObject *__pyx_v_Xvec = 0;
  struct PyPetscMatObject *__pyx_v_Jmat = 0;
  struct PyPetscMatObject *__pyx_v_Pmat = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_jacobian = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TS_RHSJacobian", 0);

  /* "PETSc/petscts.pxi":232
 *     void*     ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS  Ts   = ref_TS(ts)             # <<<<<<<<<<<<<<
 *     cdef Vec Xvec = ref_Vec(x)
 *     cdef Mat Jmat = ref_Mat(J)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TS(__pyx_v_ts)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Ts = ((struct PyPetscTSObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":233
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS  Ts   = ref_TS(ts)
 *     cdef Vec Xvec = ref_Vec(x)             # <<<<<<<<<<<<<<
 *     cdef Mat Jmat = ref_Mat(J)
 *     cdef Mat Pmat = ref_Mat(P)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Xvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":234
 *     cdef TS  Ts   = ref_TS(ts)
 *     cdef Vec Xvec = ref_Vec(x)
 *     cdef Mat Jmat = ref_Mat(J)             # <<<<<<<<<<<<<<
 *     cdef Mat Pmat = ref_Mat(P)
 *     cdef object context = Ts.get_attr('__rhsjacobian__')
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v_J)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Jmat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":235
 *     cdef Vec Xvec = ref_Vec(x)
 *     cdef Mat Jmat = ref_Mat(J)
 *     cdef Mat Pmat = ref_Mat(P)             # <<<<<<<<<<<<<<
 *     cdef object context = Ts.get_attr('__rhsjacobian__')
 *     if context is None and ctx != NULL: context = <object>ctx
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v_P)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Pmat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":236
 *     cdef Mat Jmat = ref_Mat(J)
 *     cdef Mat Pmat = ref_Mat(P)
 *     cdef object context = Ts.get_attr('__rhsjacobian__')             # <<<<<<<<<<<<<<
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_Ts->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Ts), ((char *)"__rhsjacobian__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":237
 *     cdef Mat Pmat = ref_Mat(P)
 *     cdef object context = Ts.get_attr('__rhsjacobian__')
 *     if context is None and ctx != NULL: context = <object>ctx             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple # sanity check
 *     (jacobian, args, kargs) = context
 */
  __pyx_t_3 = (__pyx_v_context == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_ctx != NULL) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_1 = ((PyObject *)__pyx_v_ctx);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_context, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/petscts.pxi":238
 *     cdef object context = Ts.get_attr('__rhsjacobian__')
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check             # <<<<<<<<<<<<<<
 *     (jacobian, args, kargs) = context
 *     jacobian(Ts, toReal(t), Xvec, Jmat, Pmat, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(20, 238, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscts.pxi":239
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 *     (jacobian, args, kargs) = context             # <<<<<<<<<<<<<<
 *     jacobian(Ts, toReal(t), Xvec, Jmat, Pmat, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(20, 239, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(20, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(20, 239, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(20, 239, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_jacobian = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscts.pxi":240
 *     assert context is not None and type(context) is tuple # sanity check
 *     (jacobian, args, kargs) = context
 *     jacobian(Ts, toReal(t), Xvec, Jmat, Pmat, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_Ts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Ts));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_Ts));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Xvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Xvec));
  PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_Xvec));
  __Pyx_INCREF(((PyObject *)__pyx_v_Jmat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Jmat));
  PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_Jmat));
  __Pyx_INCREF(((PyObject *)__pyx_v_Pmat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pmat));
  PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)__pyx_v_Pmat));
  __pyx_t_6 = 0;
  __pyx_t_6 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(20, 240, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_6 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_jacobian, __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/petscts.pxi":241
 *     (jacobian, args, kargs) = context
 *     jacobian(Ts, toReal(t), Xvec, Jmat, Pmat, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscts.pxi":224
 *     return 0
 * 
 * cdef int TS_RHSJacobian(             # <<<<<<<<<<<<<<
 *     PetscTS   ts,
 *     PetscReal t,
 */

  /* 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_AddTraceback("petsc4py.PETSc.TS_RHSJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Ts);
  __Pyx_XDECREF((PyObject *)__pyx_v_Xvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_Jmat);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pmat);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_jacobian);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscts.pxi":245
 * # -----------------------------------------------------------------------------
 * 
 * cdef int TS_IFunction(             # <<<<<<<<<<<<<<
 *     PetscTS   ts,
 *     PetscReal t,
 */

static int __pyx_f_8petsc4py_5PETSc_TS_IFunction(TS __pyx_v_ts, PetscReal __pyx_v_t, Vec __pyx_v_x, Vec __pyx_v_xdot, Vec __pyx_v_f, void *__pyx_v_ctx) {
  struct PyPetscTSObject *__pyx_v_Ts = 0;
  struct PyPetscVecObject *__pyx_v_Xvec = 0;
  struct PyPetscVecObject *__pyx_v_XDvec = 0;
  struct PyPetscVecObject *__pyx_v_Fvec = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_function = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TS_IFunction", 0);

  /* "PETSc/petscts.pxi":253
 *     void*     ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS  Ts    = ref_TS(ts)             # <<<<<<<<<<<<<<
 *     cdef Vec Xvec  = ref_Vec(x)
 *     cdef Vec XDvec = ref_Vec(xdot)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TS(__pyx_v_ts)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Ts = ((struct PyPetscTSObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":254
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS  Ts    = ref_TS(ts)
 *     cdef Vec Xvec  = ref_Vec(x)             # <<<<<<<<<<<<<<
 *     cdef Vec XDvec = ref_Vec(xdot)
 *     cdef Vec Fvec  = ref_Vec(f)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Xvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":255
 *     cdef TS  Ts    = ref_TS(ts)
 *     cdef Vec Xvec  = ref_Vec(x)
 *     cdef Vec XDvec = ref_Vec(xdot)             # <<<<<<<<<<<<<<
 *     cdef Vec Fvec  = ref_Vec(f)
 *     cdef object context = Ts.get_attr('__ifunction__')
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_xdot)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_XDvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":256
 *     cdef Vec Xvec  = ref_Vec(x)
 *     cdef Vec XDvec = ref_Vec(xdot)
 *     cdef Vec Fvec  = ref_Vec(f)             # <<<<<<<<<<<<<<
 *     cdef object context = Ts.get_attr('__ifunction__')
 *     if context is None and ctx != NULL: context = <object>ctx
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_f)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Fvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":257
 *     cdef Vec XDvec = ref_Vec(xdot)
 *     cdef Vec Fvec  = ref_Vec(f)
 *     cdef object context = Ts.get_attr('__ifunction__')             # <<<<<<<<<<<<<<
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_Ts->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Ts), ((char *)"__ifunction__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":258
 *     cdef Vec Fvec  = ref_Vec(f)
 *     cdef object context = Ts.get_attr('__ifunction__')
 *     if context is None and ctx != NULL: context = <object>ctx             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple # sanity check
 *     (function, args, kargs) = context
 */
  __pyx_t_3 = (__pyx_v_context == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_ctx != NULL) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_1 = ((PyObject *)__pyx_v_ctx);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_context, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/petscts.pxi":259
 *     cdef object context = Ts.get_attr('__ifunction__')
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check             # <<<<<<<<<<<<<<
 *     (function, args, kargs) = context
 *     function(Ts, toReal(t), Xvec, XDvec, Fvec, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(20, 259, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscts.pxi":260
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 *     (function, args, kargs) = context             # <<<<<<<<<<<<<<
 *     function(Ts, toReal(t), Xvec, XDvec, Fvec, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(20, 260, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(20, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(20, 260, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(20, 260, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_function = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscts.pxi":261
 *     assert context is not None and type(context) is tuple # sanity check
 *     (function, args, kargs) = context
 *     function(Ts, toReal(t), Xvec, XDvec, Fvec, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_Ts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Ts));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_Ts));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Xvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Xvec));
  PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_Xvec));
  __Pyx_INCREF(((PyObject *)__pyx_v_XDvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_XDvec));
  PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_XDvec));
  __Pyx_INCREF(((PyObject *)__pyx_v_Fvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Fvec));
  PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)__pyx_v_Fvec));
  __pyx_t_6 = 0;
  __pyx_t_6 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(20, 261, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_6 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_function, __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/petscts.pxi":262
 *     (function, args, kargs) = context
 *     function(Ts, toReal(t), Xvec, XDvec, Fvec, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TS_IJacobian(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscts.pxi":245
 * # -----------------------------------------------------------------------------
 * 
 * cdef int TS_IFunction(             # <<<<<<<<<<<<<<
 *     PetscTS   ts,
 *     PetscReal t,
 */

  /* 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_AddTraceback("petsc4py.PETSc.TS_IFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Ts);
  __Pyx_XDECREF((PyObject *)__pyx_v_Xvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_XDvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_Fvec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscts.pxi":264
 *     return 0
 * 
 * cdef int TS_IJacobian(             # <<<<<<<<<<<<<<
 *     PetscTS   ts,
 *     PetscReal t,
 */

static int __pyx_f_8petsc4py_5PETSc_TS_IJacobian(TS __pyx_v_ts, PetscReal __pyx_v_t, Vec __pyx_v_x, Vec __pyx_v_xdot, PetscReal __pyx_v_a, Mat __pyx_v_J, Mat __pyx_v_P, void *__pyx_v_ctx) {
  struct PyPetscTSObject *__pyx_v_Ts = 0;
  struct PyPetscVecObject *__pyx_v_Xvec = 0;
  struct PyPetscVecObject *__pyx_v_XDvec = 0;
  struct PyPetscMatObject *__pyx_v_Jmat = 0;
  struct PyPetscMatObject *__pyx_v_Pmat = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_jacobian = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TS_IJacobian", 0);

  /* "PETSc/petscts.pxi":274
 *     void*     ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS   Ts    = ref_TS(ts)             # <<<<<<<<<<<<<<
 *     cdef Vec  Xvec  = ref_Vec(x)
 *     cdef Vec  XDvec = ref_Vec(xdot)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TS(__pyx_v_ts)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Ts = ((struct PyPetscTSObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":275
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS   Ts    = ref_TS(ts)
 *     cdef Vec  Xvec  = ref_Vec(x)             # <<<<<<<<<<<<<<
 *     cdef Vec  XDvec = ref_Vec(xdot)
 *     cdef Mat  Jmat  = ref_Mat(J)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Xvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":276
 *     cdef TS   Ts    = ref_TS(ts)
 *     cdef Vec  Xvec  = ref_Vec(x)
 *     cdef Vec  XDvec = ref_Vec(xdot)             # <<<<<<<<<<<<<<
 *     cdef Mat  Jmat  = ref_Mat(J)
 *     cdef Mat  Pmat  = ref_Mat(P)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_xdot)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_XDvec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":277
 *     cdef Vec  Xvec  = ref_Vec(x)
 *     cdef Vec  XDvec = ref_Vec(xdot)
 *     cdef Mat  Jmat  = ref_Mat(J)             # <<<<<<<<<<<<<<
 *     cdef Mat  Pmat  = ref_Mat(P)
 *     cdef object context = Ts.get_attr('__ijacobian__')
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v_J)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Jmat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":278
 *     cdef Vec  XDvec = ref_Vec(xdot)
 *     cdef Mat  Jmat  = ref_Mat(J)
 *     cdef Mat  Pmat  = ref_Mat(P)             # <<<<<<<<<<<<<<
 *     cdef object context = Ts.get_attr('__ijacobian__')
 *     if context is None and ctx != NULL: context = <object>ctx
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v_P)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Pmat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":279
 *     cdef Mat  Jmat  = ref_Mat(J)
 *     cdef Mat  Pmat  = ref_Mat(P)
 *     cdef object context = Ts.get_attr('__ijacobian__')             # <<<<<<<<<<<<<<
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_Ts->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Ts), ((char *)"__ijacobian__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":280
 *     cdef Mat  Pmat  = ref_Mat(P)
 *     cdef object context = Ts.get_attr('__ijacobian__')
 *     if context is None and ctx != NULL: context = <object>ctx             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple # sanity check
 *     (jacobian, args, kargs) = context
 */
  __pyx_t_3 = (__pyx_v_context == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_ctx != NULL) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_1 = ((PyObject *)__pyx_v_ctx);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_context, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/petscts.pxi":281
 *     cdef object context = Ts.get_attr('__ijacobian__')
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check             # <<<<<<<<<<<<<<
 *     (jacobian, args, kargs) = context
 *     jacobian(Ts, toReal(t), Xvec, XDvec, toReal(a), Jmat, Pmat, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(20, 281, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscts.pxi":282
 *     if context is None and ctx != NULL: context = <object>ctx
 *     assert context is not None and type(context) is tuple # sanity check
 *     (jacobian, args, kargs) = context             # <<<<<<<<<<<<<<
 *     jacobian(Ts, toReal(t), Xvec, XDvec, toReal(a), Jmat, Pmat, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(20, 282, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(20, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(20, 282, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9_unpacking_done;
    __pyx_L8_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(20, 282, __pyx_L1_error)
    __pyx_L9_unpacking_done:;
  }
  __pyx_v_jacobian = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscts.pxi":283
 *     assert context is not None and type(context) is tuple # sanity check
 *     (jacobian, args, kargs) = context
 *     jacobian(Ts, toReal(t), Xvec, XDvec, toReal(a), Jmat, Pmat, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_a); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_Ts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Ts));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_Ts));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Xvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Xvec));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_Xvec));
  __Pyx_INCREF(((PyObject *)__pyx_v_XDvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_XDvec));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_XDvec));
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_Jmat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Jmat));
  PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_v_Jmat));
  __Pyx_INCREF(((PyObject *)__pyx_v_Pmat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pmat));
  PyTuple_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_v_Pmat));
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 283, __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;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(20, 283, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_5 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_5 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_jacobian, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":284
 *     (jacobian, args, kargs) = context
 *     jacobian(Ts, toReal(t), Xvec, XDvec, toReal(a), Jmat, Pmat, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscts.pxi":264
 *     return 0
 * 
 * cdef int TS_IJacobian(             # <<<<<<<<<<<<<<
 *     PetscTS   ts,
 *     PetscReal t,
 */

  /* 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_AddTraceback("petsc4py.PETSc.TS_IJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Ts);
  __Pyx_XDECREF((PyObject *)__pyx_v_Xvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_XDvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_Jmat);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pmat);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_jacobian);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscts.pxi":288
 * # -----------------------------------------------------------------------------
 * 
 * cdef int TS_Monitor(             # <<<<<<<<<<<<<<
 *     PetscTS   ts,
 *     PetscInt  step,
 */

static int __pyx_f_8petsc4py_5PETSc_TS_Monitor(TS __pyx_v_ts, PetscInt __pyx_v_step, PetscReal __pyx_v_time, Vec __pyx_v_u, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTSObject *__pyx_v_Ts = 0;
  struct PyPetscVecObject *__pyx_v_Vu = 0;
  PyObject *__pyx_v_monitorlist = 0;
  PyObject *__pyx_v_monitor = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  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)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TS_Monitor", 0);

  /* "PETSc/petscts.pxi":295
 *     void*     ctx,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS  Ts = ref_TS(ts)             # <<<<<<<<<<<<<<
 *     cdef Vec Vu = ref_Vec(u)
 *     cdef object monitorlist = Ts.get_attr('__monitor__')
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TS(__pyx_v_ts)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Ts = ((struct PyPetscTSObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":296
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS  Ts = ref_TS(ts)
 *     cdef Vec Vu = ref_Vec(u)             # <<<<<<<<<<<<<<
 *     cdef object monitorlist = Ts.get_attr('__monitor__')
 *     if monitorlist is None: return 0
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_u)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Vu = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":297
 *     cdef TS  Ts = ref_TS(ts)
 *     cdef Vec Vu = ref_Vec(u)
 *     cdef object monitorlist = Ts.get_attr('__monitor__')             # <<<<<<<<<<<<<<
 *     if monitorlist is None: return 0
 *     for (monitor, args, kargs) in monitorlist:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_Ts->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Ts), ((char *)"__monitor__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_monitorlist = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":298
 *     cdef Vec Vu = ref_Vec(u)
 *     cdef object monitorlist = Ts.get_attr('__monitor__')
 *     if monitorlist is None: return 0             # <<<<<<<<<<<<<<
 *     for (monitor, args, kargs) in monitorlist:
 *         monitor(Ts, toInt(step), toReal(time), Vu, *args, **kargs)
 */
  __pyx_t_2 = (__pyx_v_monitorlist == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petscts.pxi":299
 *     cdef object monitorlist = Ts.get_attr('__monitor__')
 *     if monitorlist is None: return 0
 *     for (monitor, args, kargs) in monitorlist:             # <<<<<<<<<<<<<<
 *         monitor(Ts, toInt(step), toReal(time), Vu, *args, **kargs)
 *     return 0
 */
  if (likely(PyList_CheckExact(__pyx_v_monitorlist)) || PyTuple_CheckExact(__pyx_v_monitorlist)) {
    __pyx_t_1 = __pyx_v_monitorlist; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_monitorlist); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(20, 299, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(20, 299, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 299, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(20, 299, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 299, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      }
    } else {
      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
      if (unlikely(!__pyx_t_6)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(20, 299, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(20, 299, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(20, 299, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(20, 299, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(20, 299, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(20, 299, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) __PYX_ERR(20, 299, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(20, 299, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_monitor, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_args, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_kargs, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "PETSc/petscts.pxi":300
 *     if monitorlist is None: return 0
 *     for (monitor, args, kargs) in monitorlist:
 *         monitor(Ts, toInt(step), toReal(time), Vu, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_step); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 300, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_time); if (unlikely(!__pyx_t_9)) __PYX_ERR(20, 300, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(20, 300, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)__pyx_v_Ts));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_Ts));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_Ts));
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_9);
    __Pyx_INCREF(((PyObject *)__pyx_v_Vu));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_Vu));
    PyTuple_SET_ITEM(__pyx_t_8, 3, ((PyObject *)__pyx_v_Vu));
    __pyx_t_6 = 0;
    __pyx_t_9 = 0;
    __pyx_t_9 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_9)) __PYX_ERR(20, 300, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(20, 300, __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;
    if (unlikely(__pyx_v_kargs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(20, 300, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
      __pyx_t_9 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_9)) __PYX_ERR(20, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      __pyx_t_9 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(20, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    }
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_v_monitor, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(20, 300, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "PETSc/petscts.pxi":299
 *     cdef object monitorlist = Ts.get_attr('__monitor__')
 *     if monitorlist is None: return 0
 *     for (monitor, args, kargs) in monitorlist:             # <<<<<<<<<<<<<<
 *         monitor(Ts, toInt(step), toReal(time), Vu, *args, **kargs)
 *     return 0
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":301
 *     for (monitor, args, kargs) in monitorlist:
 *         monitor(Ts, toInt(step), toReal(time), Vu, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscts.pxi":288
 * # -----------------------------------------------------------------------------
 * 
 * cdef int TS_Monitor(             # <<<<<<<<<<<<<<
 *     PetscTS   ts,
 *     PetscInt  step,
 */

  /* function exit code */
  __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_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("petsc4py.PETSc.TS_Monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Ts);
  __Pyx_XDECREF((PyObject *)__pyx_v_Vu);
  __Pyx_XDECREF(__pyx_v_monitorlist);
  __Pyx_XDECREF(__pyx_v_monitor);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscts.pxi":305
 * # -----------------------------------------------------------------------------
 * 
 * cdef int TS_PreStep(             # <<<<<<<<<<<<<<
 *     PetscTS ts,
 *     ) except PETSC_ERR_PYTHON with gil:
 */

static int __pyx_f_8petsc4py_5PETSc_TS_PreStep(TS __pyx_v_ts) {
  struct PyPetscTSObject *__pyx_v_Ts = 0;
  PyObject *__pyx_v_prestep = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TS_PreStep", 0);

  /* "PETSc/petscts.pxi":308
 *     PetscTS ts,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS Ts = ref_TS(ts)             # <<<<<<<<<<<<<<
 *     (prestep, args, kargs) = Ts.get_attr('__prestep__')
 *     prestep(Ts, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TS(__pyx_v_ts)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Ts = ((struct PyPetscTSObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":309
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS Ts = ref_TS(ts)
 *     (prestep, args, kargs) = Ts.get_attr('__prestep__')             # <<<<<<<<<<<<<<
 *     prestep(Ts, *args, **kargs)
 *     return 0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_Ts->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Ts), ((char *)"__prestep__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 309, __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_CPYTHON
    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(20, 309, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(20, 309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 309, __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(20, 309, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(20, 309, __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(20, 309, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_prestep = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petscts.pxi":310
 *     cdef TS Ts = ref_TS(ts)
 *     (prestep, args, kargs) = Ts.get_attr('__prestep__')
 *     prestep(Ts, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_Ts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Ts));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_Ts));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(20, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(20, 310, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_prestep, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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;

  /* "PETSc/petscts.pxi":311
 *     (prestep, args, kargs) = Ts.get_attr('__prestep__')
 *     prestep(Ts, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TS_PostStep(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscts.pxi":305
 * # -----------------------------------------------------------------------------
 * 
 * cdef int TS_PreStep(             # <<<<<<<<<<<<<<
 *     PetscTS ts,
 *     ) except PETSC_ERR_PYTHON with gil:
 */

  /* 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("petsc4py.PETSc.TS_PreStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Ts);
  __Pyx_XDECREF(__pyx_v_prestep);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscts.pxi":313
 *     return 0
 * 
 * cdef int TS_PostStep(             # <<<<<<<<<<<<<<
 *     PetscTS ts,
 *     ) except PETSC_ERR_PYTHON with gil:
 */

static int __pyx_f_8petsc4py_5PETSc_TS_PostStep(TS __pyx_v_ts) {
  struct PyPetscTSObject *__pyx_v_Ts = 0;
  PyObject *__pyx_v_poststep = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TS_PostStep", 0);

  /* "PETSc/petscts.pxi":316
 *     PetscTS ts,
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS Ts = ref_TS(ts)             # <<<<<<<<<<<<<<
 *     (poststep, args, kargs) = Ts.get_attr('__poststep__')
 *     poststep(Ts, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TS(__pyx_v_ts)); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Ts = ((struct PyPetscTSObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscts.pxi":317
 *     ) except PETSC_ERR_PYTHON with gil:
 *     cdef TS Ts = ref_TS(ts)
 *     (poststep, args, kargs) = Ts.get_attr('__poststep__')             # <<<<<<<<<<<<<<
 *     poststep(Ts, *args, **kargs)
 *     return 0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_Ts->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Ts), ((char *)"__poststep__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 317, __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_CPYTHON
    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(20, 317, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(20, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(20, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 317, __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(20, 317, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(20, 317, __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(20, 317, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_poststep = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petscts.pxi":318
 *     cdef TS Ts = ref_TS(ts)
 *     (poststep, args, kargs) = Ts.get_attr('__poststep__')
 *     poststep(Ts, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_Ts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Ts));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_Ts));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(20, 318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(20, 318, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(20, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_poststep, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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;

  /* "PETSc/petscts.pxi":319
 *     (poststep, args, kargs) = Ts.get_attr('__poststep__')
 *     poststep(Ts, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscts.pxi":313
 *     return 0
 * 
 * cdef int TS_PostStep(             # <<<<<<<<<<<<<<
 *     PetscTS ts,
 *     ) except PETSC_ERR_PYTHON with gil:
 */

  /* 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("petsc4py.PETSc.TS_PostStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Ts);
  __Pyx_XDECREF(__pyx_v_poststep);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":154
 * # --------------------------------------------------------------------
 * 
 * cdef inline TAO ref_TAO(PetscTAO tao):             # <<<<<<<<<<<<<<
 *     cdef TAO ob = <TAO> TAO()
 *     ob.tao = tao
 */

static CYTHON_INLINE struct PyPetscTAOObject *__pyx_f_8petsc4py_5PETSc_ref_TAO(Tao __pyx_v_tao) {
  struct PyPetscTAOObject *__pyx_v_ob = 0;
  struct PyPetscTAOObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ref_TAO", 0);

  /* "PETSc/petsctao.pxi":155
 * 
 * cdef inline TAO ref_TAO(PetscTAO tao):
 *     cdef TAO ob = <TAO> TAO()             # <<<<<<<<<<<<<<
 *     ob.tao = tao
 *     PetscINCREF(ob.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TAO), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ob = ((struct PyPetscTAOObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petsctao.pxi":156
 * cdef inline TAO ref_TAO(PetscTAO tao):
 *     cdef TAO ob = <TAO> TAO()
 *     ob.tao = tao             # <<<<<<<<<<<<<<
 *     PetscINCREF(ob.obj)
 *     return ob
 */
  __pyx_v_ob->tao = __pyx_v_tao;

  /* "PETSc/petsctao.pxi":157
 *     cdef TAO ob = <TAO> TAO()
 *     ob.tao = tao
 *     PetscINCREF(ob.obj)             # <<<<<<<<<<<<<<
 *     return ob
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ob->__pyx_base.obj);

  /* "PETSc/petsctao.pxi":158
 *     ob.tao = tao
 *     PetscINCREF(ob.obj)
 *     return ob             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ob));
  __pyx_r = __pyx_v_ob;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":154
 * # --------------------------------------------------------------------
 * 
 * cdef inline TAO ref_TAO(PetscTAO tao):             # <<<<<<<<<<<<<<
 *     cdef TAO ob = <TAO> TAO()
 *     ob.tao = tao
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.ref_TAO", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":162
 * # --------------------------------------------------------------------
 * 
 * cdef int TAO_Objective(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                        PetscVec _x, PetscReal *_f,
 *                        void *ctx) except PETSC_ERR_PYTHON with gil:
 */

static int __pyx_f_8petsc4py_5PETSc_TAO_Objective(Tao __pyx_v__tao, Vec __pyx_v__x, PetscReal *__pyx_v__f, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTAOObject *__pyx_v_tao = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_v_objective = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  PyObject *__pyx_v_retv = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  PetscReal __pyx_t_7;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TAO_Objective", 0);

  /* "PETSc/petsctao.pxi":166
 *                        void *ctx) except PETSC_ERR_PYTHON with gil:
 * 
 *     cdef TAO tao = ref_TAO(_tao)             # <<<<<<<<<<<<<<
 *     cdef Vec x   = ref_Vec(_x)
 *     (objective, args, kargs) = tao.get_attr("__objective__")
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TAO(__pyx_v__tao)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tao = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":167
 * 
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)             # <<<<<<<<<<<<<<
 *     (objective, args, kargs) = tao.get_attr("__objective__")
 *     retv = objective(tao, x, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":168
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)
 *     (objective, args, kargs) = tao.get_attr("__objective__")             # <<<<<<<<<<<<<<
 *     retv = objective(tao, x, *args, **kargs)
 *     _f[0] = asReal(retv)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_tao->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_tao), ((char *)"__objective__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 168, __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_CPYTHON
    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(21, 168, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 168, __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(21, 168, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(21, 168, __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(21, 168, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_objective = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petsctao.pxi":169
 *     cdef Vec x   = ref_Vec(_x)
 *     (objective, args, kargs) = tao.get_attr("__objective__")
 *     retv = objective(tao, x, *args, **kargs)             # <<<<<<<<<<<<<<
 *     _f[0] = asReal(retv)
 *     return 0
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_tao));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tao));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_tao));
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_x));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(21, 169, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_objective, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_retv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":170
 *     (objective, args, kargs) = tao.get_attr("__objective__")
 *     retv = objective(tao, x, *args, **kargs)
 *     _f[0] = asReal(retv)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_retv); if (unlikely(__pyx_t_7 == -1.0 && PyErr_Occurred())) __PYX_ERR(21, 170, __pyx_L1_error)
  (__pyx_v__f[0]) = __pyx_t_7;

  /* "PETSc/petsctao.pxi":171
 *     retv = objective(tao, x, *args, **kargs)
 *     _f[0] = asReal(retv)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TAO_SeparableObjective(PetscTAO _tao,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":162
 * # --------------------------------------------------------------------
 * 
 * cdef int TAO_Objective(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                        PetscVec _x, PetscReal *_f,
 *                        void *ctx) except PETSC_ERR_PYTHON with gil:
 */

  /* 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("petsc4py.PETSc.TAO_Objective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tao);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_objective);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XDECREF(__pyx_v_retv);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":173
 *     return 0
 * 
 * cdef int TAO_SeparableObjective(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                                 PetscVec _x, PetscVec _f,
 *                                 void *ctx) except PETSC_ERR_PYTHON with gil:
 */

static int __pyx_f_8petsc4py_5PETSc_TAO_SeparableObjective(Tao __pyx_v__tao, Vec __pyx_v__x, Vec __pyx_v__f, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTAOObject *__pyx_v_tao = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_f = 0;
  PyObject *__pyx_v_separable = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TAO_SeparableObjective", 0);

  /* "PETSc/petsctao.pxi":177
 *                                 void *ctx) except PETSC_ERR_PYTHON with gil:
 * 
 *     cdef TAO tao = ref_TAO(_tao)             # <<<<<<<<<<<<<<
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Vec f   = ref_Vec(_f)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TAO(__pyx_v__tao)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tao = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":178
 * 
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)             # <<<<<<<<<<<<<<
 *     cdef Vec f   = ref_Vec(_f)
 *     (separable, args, kargs) = tao.get_attr("__separable__")
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":179
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Vec f   = ref_Vec(_f)             # <<<<<<<<<<<<<<
 *     (separable, args, kargs) = tao.get_attr("__separable__")
 *     separable(tao, x, f, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__f)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_f = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":180
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Vec f   = ref_Vec(_f)
 *     (separable, args, kargs) = tao.get_attr("__separable__")             # <<<<<<<<<<<<<<
 *     separable(tao, x, f, *args, **kargs)
 *     return 0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_tao->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_tao), ((char *)"__separable__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 180, __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_CPYTHON
    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(21, 180, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 180, __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(21, 180, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(21, 180, __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(21, 180, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_separable = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petsctao.pxi":181
 *     cdef Vec f   = ref_Vec(_f)
 *     (separable, args, kargs) = tao.get_attr("__separable__")
 *     separable(tao, x, f, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_tao));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tao));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_tao));
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_x));
  __Pyx_INCREF(((PyObject *)__pyx_v_f));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_f));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_f));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(21, 181, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_separable, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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;

  /* "PETSc/petsctao.pxi":182
 *     (separable, args, kargs) = tao.get_attr("__separable__")
 *     separable(tao, x, f, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TAO_Gradient(PetscTAO _tao,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":173
 *     return 0
 * 
 * cdef int TAO_SeparableObjective(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                                 PetscVec _x, PetscVec _f,
 *                                 void *ctx) except PETSC_ERR_PYTHON with gil:
 */

  /* 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("petsc4py.PETSc.TAO_SeparableObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tao);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_separable);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":184
 *     return 0
 * 
 * cdef int TAO_Gradient(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                       PetscVec _x, PetscVec _g,
 *                       void *ctx) except PETSC_ERR_PYTHON with gil:
 */

static int __pyx_f_8petsc4py_5PETSc_TAO_Gradient(Tao __pyx_v__tao, Vec __pyx_v__x, Vec __pyx_v__g, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTAOObject *__pyx_v_tao = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_g = 0;
  PyObject *__pyx_v_gradient = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TAO_Gradient", 0);

  /* "PETSc/petsctao.pxi":188
 *                       void *ctx) except PETSC_ERR_PYTHON with gil:
 * 
 *     cdef TAO tao = ref_TAO(_tao)             # <<<<<<<<<<<<<<
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Vec g   = ref_Vec(_g)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TAO(__pyx_v__tao)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tao = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":189
 * 
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)             # <<<<<<<<<<<<<<
 *     cdef Vec g   = ref_Vec(_g)
 *     (gradient, args, kargs) = tao.get_attr("__gradient__")
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":190
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Vec g   = ref_Vec(_g)             # <<<<<<<<<<<<<<
 *     (gradient, args, kargs) = tao.get_attr("__gradient__")
 *     gradient(tao, x, g, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__g)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_g = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":191
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Vec g   = ref_Vec(_g)
 *     (gradient, args, kargs) = tao.get_attr("__gradient__")             # <<<<<<<<<<<<<<
 *     gradient(tao, x, g, *args, **kargs)
 *     return 0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_tao->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_tao), ((char *)"__gradient__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 191, __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_CPYTHON
    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(21, 191, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 191, __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(21, 191, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(21, 191, __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(21, 191, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_gradient = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petsctao.pxi":192
 *     cdef Vec g   = ref_Vec(_g)
 *     (gradient, args, kargs) = tao.get_attr("__gradient__")
 *     gradient(tao, x, g, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_tao));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tao));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_tao));
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_x));
  __Pyx_INCREF(((PyObject *)__pyx_v_g));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_g));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_g));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(21, 192, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_gradient, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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;

  /* "PETSc/petsctao.pxi":193
 *     (gradient, args, kargs) = tao.get_attr("__gradient__")
 *     gradient(tao, x, g, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":184
 *     return 0
 * 
 * cdef int TAO_Gradient(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                       PetscVec _x, PetscVec _g,
 *                       void *ctx) except PETSC_ERR_PYTHON with gil:
 */

  /* 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("petsc4py.PETSc.TAO_Gradient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tao);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_g);
  __Pyx_XDECREF(__pyx_v_gradient);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":196
 * 
 * 
 * cdef int TAO_ObjGrad(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                      PetscVec _x, PetscReal *_f, PetscVec _g,
 *                      void *ctx) except PETSC_ERR_PYTHON with gil:
 */

static int __pyx_f_8petsc4py_5PETSc_TAO_ObjGrad(Tao __pyx_v__tao, Vec __pyx_v__x, PetscReal *__pyx_v__f, Vec __pyx_v__g, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTAOObject *__pyx_v_tao = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_g = 0;
  PyObject *__pyx_v_objgrad = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  PyObject *__pyx_v_retv = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  PetscReal __pyx_t_7;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TAO_ObjGrad", 0);

  /* "PETSc/petsctao.pxi":200
 *                      void *ctx) except PETSC_ERR_PYTHON with gil:
 * 
 *     cdef TAO tao = ref_TAO(_tao)             # <<<<<<<<<<<<<<
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Vec g   = ref_Vec(_g)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TAO(__pyx_v__tao)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tao = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":201
 * 
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)             # <<<<<<<<<<<<<<
 *     cdef Vec g   = ref_Vec(_g)
 *     (objgrad, args, kargs) = tao.get_attr("__objgrad__")
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":202
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Vec g   = ref_Vec(_g)             # <<<<<<<<<<<<<<
 *     (objgrad, args, kargs) = tao.get_attr("__objgrad__")
 *     retv = objgrad(tao, x, g, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__g)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_g = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":203
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Vec g   = ref_Vec(_g)
 *     (objgrad, args, kargs) = tao.get_attr("__objgrad__")             # <<<<<<<<<<<<<<
 *     retv = objgrad(tao, x, g, *args, **kargs)
 *     _f[0] = asReal(retv)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_tao->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_tao), ((char *)"__objgrad__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 203, __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_CPYTHON
    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(21, 203, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 203, __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(21, 203, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(21, 203, __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(21, 203, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_objgrad = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petsctao.pxi":204
 *     cdef Vec g   = ref_Vec(_g)
 *     (objgrad, args, kargs) = tao.get_attr("__objgrad__")
 *     retv = objgrad(tao, x, g, *args, **kargs)             # <<<<<<<<<<<<<<
 *     _f[0] = asReal(retv)
 *     return 0
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_tao));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tao));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_tao));
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_x));
  __Pyx_INCREF(((PyObject *)__pyx_v_g));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_g));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_g));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(21, 204, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_objgrad, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_retv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":205
 *     (objgrad, args, kargs) = tao.get_attr("__objgrad__")
 *     retv = objgrad(tao, x, g, *args, **kargs)
 *     _f[0] = asReal(retv)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_retv); if (unlikely(__pyx_t_7 == -1.0 && PyErr_Occurred())) __PYX_ERR(21, 205, __pyx_L1_error)
  (__pyx_v__f[0]) = __pyx_t_7;

  /* "PETSc/petsctao.pxi":206
 *     retv = objgrad(tao, x, g, *args, **kargs)
 *     _f[0] = asReal(retv)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TAO_Constraints(PetscTAO _tao,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":196
 * 
 * 
 * cdef int TAO_ObjGrad(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                      PetscVec _x, PetscReal *_f, PetscVec _g,
 *                      void *ctx) except PETSC_ERR_PYTHON with gil:
 */

  /* 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("petsc4py.PETSc.TAO_ObjGrad", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tao);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_g);
  __Pyx_XDECREF(__pyx_v_objgrad);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XDECREF(__pyx_v_retv);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":208
 *     return 0
 * 
 * cdef int TAO_Constraints(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                          PetscVec _x, PetscVec _r,
 *                          void *ctx) except PETSC_ERR_PYTHON with gil:
 */

static int __pyx_f_8petsc4py_5PETSc_TAO_Constraints(Tao __pyx_v__tao, Vec __pyx_v__x, Vec __pyx_v__r, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTAOObject *__pyx_v_tao = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_r = 0;
  PyObject *__pyx_v_constraints = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TAO_Constraints", 0);

  /* "PETSc/petsctao.pxi":212
 *                          void *ctx) except PETSC_ERR_PYTHON with gil:
 * 
 *     cdef TAO tao = ref_TAO(_tao)             # <<<<<<<<<<<<<<
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Vec r   = ref_Vec(_r)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TAO(__pyx_v__tao)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tao = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":213
 * 
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)             # <<<<<<<<<<<<<<
 *     cdef Vec r   = ref_Vec(_r)
 *     (constraints, args, kargs) = tao.get_attr("__constraints__")
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":214
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Vec r   = ref_Vec(_r)             # <<<<<<<<<<<<<<
 *     (constraints, args, kargs) = tao.get_attr("__constraints__")
 *     constraints(tao, x, r, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__r)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_r = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":215
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Vec r   = ref_Vec(_r)
 *     (constraints, args, kargs) = tao.get_attr("__constraints__")             # <<<<<<<<<<<<<<
 *     constraints(tao, x, r, *args, **kargs)
 *     return 0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_tao->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_tao), ((char *)"__constraints__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 215, __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_CPYTHON
    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(21, 215, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 215, __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(21, 215, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(21, 215, __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(21, 215, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_constraints = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petsctao.pxi":216
 *     cdef Vec r   = ref_Vec(_r)
 *     (constraints, args, kargs) = tao.get_attr("__constraints__")
 *     constraints(tao, x, r, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_tao));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tao));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_tao));
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_x));
  __Pyx_INCREF(((PyObject *)__pyx_v_r));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_r));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_r));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(21, 216, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_constraints, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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;

  /* "PETSc/petsctao.pxi":217
 *     (constraints, args, kargs) = tao.get_attr("__constraints__")
 *     constraints(tao, x, r, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TAO_VarBounds(PetscTAO _tao,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":208
 *     return 0
 * 
 * cdef int TAO_Constraints(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                          PetscVec _x, PetscVec _r,
 *                          void *ctx) except PETSC_ERR_PYTHON with gil:
 */

  /* 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("petsc4py.PETSc.TAO_Constraints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tao);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_r);
  __Pyx_XDECREF(__pyx_v_constraints);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":219
 *     return 0
 * 
 * cdef int TAO_VarBounds(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                        PetscVec _xl, PetscVec _xu,
 *                        void *ctx) except PETSC_ERR_PYTHON with gil:
 */

static int __pyx_f_8petsc4py_5PETSc_TAO_VarBounds(Tao __pyx_v__tao, Vec __pyx_v__xl, Vec __pyx_v__xu, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTAOObject *__pyx_v_tao = 0;
  struct PyPetscVecObject *__pyx_v_xl = 0;
  struct PyPetscVecObject *__pyx_v_xu = 0;
  PyObject *__pyx_v_varbounds = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TAO_VarBounds", 0);

  /* "PETSc/petsctao.pxi":223
 *                        void *ctx) except PETSC_ERR_PYTHON with gil:
 * 
 *     cdef TAO tao = ref_TAO(_tao)             # <<<<<<<<<<<<<<
 *     cdef Vec xl  = ref_Vec(_xl)
 *     cdef Vec xu  = ref_Vec(_xu)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TAO(__pyx_v__tao)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tao = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":224
 * 
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec xl  = ref_Vec(_xl)             # <<<<<<<<<<<<<<
 *     cdef Vec xu  = ref_Vec(_xu)
 *     (varbounds, args, kargs) = tao.get_attr("__varbounds__")
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__xl)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xl = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":225
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec xl  = ref_Vec(_xl)
 *     cdef Vec xu  = ref_Vec(_xu)             # <<<<<<<<<<<<<<
 *     (varbounds, args, kargs) = tao.get_attr("__varbounds__")
 *     varbounds(tao, xl, xu, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__xu)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xu = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":226
 *     cdef Vec xl  = ref_Vec(_xl)
 *     cdef Vec xu  = ref_Vec(_xu)
 *     (varbounds, args, kargs) = tao.get_attr("__varbounds__")             # <<<<<<<<<<<<<<
 *     varbounds(tao, xl, xu, *args, **kargs)
 *     return 0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_tao->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_tao), ((char *)"__varbounds__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 226, __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_CPYTHON
    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(21, 226, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 226, __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(21, 226, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(21, 226, __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(21, 226, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_varbounds = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petsctao.pxi":227
 *     cdef Vec xu  = ref_Vec(_xu)
 *     (varbounds, args, kargs) = tao.get_attr("__varbounds__")
 *     varbounds(tao, xl, xu, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_tao));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tao));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_tao));
  __Pyx_INCREF(((PyObject *)__pyx_v_xl));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_xl));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_xl));
  __Pyx_INCREF(((PyObject *)__pyx_v_xu));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_xu));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_xu));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(21, 227, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_varbounds, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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;

  /* "PETSc/petsctao.pxi":228
 *     (varbounds, args, kargs) = tao.get_attr("__varbounds__")
 *     varbounds(tao, xl, xu, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TAO_Hessian(PetscTAO _tao,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":219
 *     return 0
 * 
 * cdef int TAO_VarBounds(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                        PetscVec _xl, PetscVec _xu,
 *                        void *ctx) except PETSC_ERR_PYTHON with gil:
 */

  /* 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("petsc4py.PETSc.TAO_VarBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tao);
  __Pyx_XDECREF((PyObject *)__pyx_v_xl);
  __Pyx_XDECREF((PyObject *)__pyx_v_xu);
  __Pyx_XDECREF(__pyx_v_varbounds);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":230
 *     return 0
 * 
 * cdef int TAO_Hessian(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                      PetscVec  _x,
 *                      PetscMat  _H,
 */

static int __pyx_f_8petsc4py_5PETSc_TAO_Hessian(Tao __pyx_v__tao, Vec __pyx_v__x, Mat __pyx_v__H, Mat __pyx_v__P, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTAOObject *__pyx_v_tao = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscMatObject *__pyx_v_H = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_v_hessian = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TAO_Hessian", 0);

  /* "PETSc/petsctao.pxi":235
 *                      PetscMat  _P,
 *                      void* ctx) except PETSC_ERR_PYTHON with gil:
 *     cdef TAO tao = ref_TAO(_tao)             # <<<<<<<<<<<<<<
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Mat H   = ref_Mat(_H)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TAO(__pyx_v__tao)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tao = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":236
 *                      void* ctx) except PETSC_ERR_PYTHON with gil:
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)             # <<<<<<<<<<<<<<
 *     cdef Mat H   = ref_Mat(_H)
 *     cdef Mat P   = ref_Mat(_P)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":237
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Mat H   = ref_Mat(_H)             # <<<<<<<<<<<<<<
 *     cdef Mat P   = ref_Mat(_P)
 *     (hessian, args, kargs) = tao.get_attr("__hessian__")
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v__H)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_H = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":238
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Mat H   = ref_Mat(_H)
 *     cdef Mat P   = ref_Mat(_P)             # <<<<<<<<<<<<<<
 *     (hessian, args, kargs) = tao.get_attr("__hessian__")
 *     hessian(tao, x, H, P, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v__P)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":239
 *     cdef Mat H   = ref_Mat(_H)
 *     cdef Mat P   = ref_Mat(_P)
 *     (hessian, args, kargs) = tao.get_attr("__hessian__")             # <<<<<<<<<<<<<<
 *     hessian(tao, x, H, P, *args, **kargs)
 *     return 0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_tao->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_tao), ((char *)"__hessian__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 239, __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_CPYTHON
    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(21, 239, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 239, __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(21, 239, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(21, 239, __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(21, 239, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_hessian = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petsctao.pxi":240
 *     cdef Mat P   = ref_Mat(_P)
 *     (hessian, args, kargs) = tao.get_attr("__hessian__")
 *     hessian(tao, x, H, P, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_tao));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tao));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_tao));
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_x));
  __Pyx_INCREF(((PyObject *)__pyx_v_H));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_H));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_H));
  __Pyx_INCREF(((PyObject *)__pyx_v_P));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_P));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(21, 240, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_hessian, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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;

  /* "PETSc/petsctao.pxi":241
 *     (hessian, args, kargs) = tao.get_attr("__hessian__")
 *     hessian(tao, x, H, P, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TAO_Jacobian(PetscTAO _tao,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":230
 *     return 0
 * 
 * cdef int TAO_Hessian(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                      PetscVec  _x,
 *                      PetscMat  _H,
 */

  /* 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("petsc4py.PETSc.TAO_Hessian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tao);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_H);
  __Pyx_XDECREF((PyObject *)__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_hessian);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":243
 *     return 0
 * 
 * cdef int TAO_Jacobian(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                       PetscVec  _x,
 *                       PetscMat  _J,
 */

static int __pyx_f_8petsc4py_5PETSc_TAO_Jacobian(Tao __pyx_v__tao, Vec __pyx_v__x, Mat __pyx_v__J, Mat __pyx_v__P, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTAOObject *__pyx_v_tao = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_v_jacobian = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TAO_Jacobian", 0);

  /* "PETSc/petsctao.pxi":248
 *                       PetscMat  _P,
 *                       void* ctx) except PETSC_ERR_PYTHON with gil:
 *     cdef TAO tao = ref_TAO(_tao)             # <<<<<<<<<<<<<<
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Mat J   = ref_Mat(_J)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TAO(__pyx_v__tao)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tao = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":249
 *                       void* ctx) except PETSC_ERR_PYTHON with gil:
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)             # <<<<<<<<<<<<<<
 *     cdef Mat J   = ref_Mat(_J)
 *     cdef Mat P   = ref_Mat(_P)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":250
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Mat J   = ref_Mat(_J)             # <<<<<<<<<<<<<<
 *     cdef Mat P   = ref_Mat(_P)
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian__")
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v__J)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_J = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":251
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Mat J   = ref_Mat(_J)
 *     cdef Mat P   = ref_Mat(_P)             # <<<<<<<<<<<<<<
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian__")
 *     jacobian(tao, x, J, P, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v__P)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":252
 *     cdef Mat J   = ref_Mat(_J)
 *     cdef Mat P   = ref_Mat(_P)
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian__")             # <<<<<<<<<<<<<<
 *     jacobian(tao, x, J, P, *args, **kargs)
 *     return 0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_tao->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_tao), ((char *)"__jacobian__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 252, __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_CPYTHON
    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(21, 252, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 252, __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(21, 252, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(21, 252, __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(21, 252, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_jacobian = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petsctao.pxi":253
 *     cdef Mat P   = ref_Mat(_P)
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian__")
 *     jacobian(tao, x, J, P, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_tao));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tao));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_tao));
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_x));
  __Pyx_INCREF(((PyObject *)__pyx_v_J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_J));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_J));
  __Pyx_INCREF(((PyObject *)__pyx_v_P));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_P));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(21, 253, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_jacobian, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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;

  /* "PETSc/petsctao.pxi":254
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian__")
 *     jacobian(tao, x, J, P, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TAO_JacobianState(PetscTAO _tao,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":243
 *     return 0
 * 
 * cdef int TAO_Jacobian(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                       PetscVec  _x,
 *                       PetscMat  _J,
 */

  /* 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("petsc4py.PETSc.TAO_Jacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tao);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_J);
  __Pyx_XDECREF((PyObject *)__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_jacobian);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":256
 *     return 0
 * 
 * cdef int TAO_JacobianState(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                            PetscVec  _x,
 *                            PetscMat  _J,
 */

static int __pyx_f_8petsc4py_5PETSc_TAO_JacobianState(Tao __pyx_v__tao, Vec __pyx_v__x, Mat __pyx_v__J, Mat __pyx_v__P, Mat __pyx_v__I, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTAOObject *__pyx_v_tao = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  struct PyPetscMatObject *__pyx_v_I = 0;
  PyObject *__pyx_v_jacobian = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TAO_JacobianState", 0);

  /* "PETSc/petsctao.pxi":262
 *                            PetscMat  _I,
 *                            void* ctx) except PETSC_ERR_PYTHON with gil:
 *     cdef TAO tao = ref_TAO(_tao)             # <<<<<<<<<<<<<<
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Mat J   = ref_Mat(_J)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TAO(__pyx_v__tao)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tao = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":263
 *                            void* ctx) except PETSC_ERR_PYTHON with gil:
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)             # <<<<<<<<<<<<<<
 *     cdef Mat J   = ref_Mat(_J)
 *     cdef Mat P   = ref_Mat(_P)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":264
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Mat J   = ref_Mat(_J)             # <<<<<<<<<<<<<<
 *     cdef Mat P   = ref_Mat(_P)
 *     cdef Mat I   = ref_Mat(_I)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v__J)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_J = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":265
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Mat J   = ref_Mat(_J)
 *     cdef Mat P   = ref_Mat(_P)             # <<<<<<<<<<<<<<
 *     cdef Mat I   = ref_Mat(_I)
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian_state__")
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v__P)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":266
 *     cdef Mat J   = ref_Mat(_J)
 *     cdef Mat P   = ref_Mat(_P)
 *     cdef Mat I   = ref_Mat(_I)             # <<<<<<<<<<<<<<
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian_state__")
 *     jacobian(tao, x, J, P, I, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v__I)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_I = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":267
 *     cdef Mat P   = ref_Mat(_P)
 *     cdef Mat I   = ref_Mat(_I)
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian_state__")             # <<<<<<<<<<<<<<
 *     jacobian(tao, x, J, P, I, *args, **kargs)
 *     return 0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_tao->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_tao), ((char *)"__jacobian_state__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 267, __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_CPYTHON
    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(21, 267, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 267, __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(21, 267, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(21, 267, __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(21, 267, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_jacobian = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petsctao.pxi":268
 *     cdef Mat I   = ref_Mat(_I)
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian_state__")
 *     jacobian(tao, x, J, P, I, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_tao));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tao));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_tao));
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_x));
  __Pyx_INCREF(((PyObject *)__pyx_v_J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_J));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_J));
  __Pyx_INCREF(((PyObject *)__pyx_v_P));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_P));
  __Pyx_INCREF(((PyObject *)__pyx_v_I));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_I));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_I));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(21, 268, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 268, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 268, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_jacobian, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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;

  /* "PETSc/petsctao.pxi":269
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian_state__")
 *     jacobian(tao, x, J, P, I, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TAO_JacobianDesign(PetscTAO _tao,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":256
 *     return 0
 * 
 * cdef int TAO_JacobianState(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                            PetscVec  _x,
 *                            PetscMat  _J,
 */

  /* 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("petsc4py.PETSc.TAO_JacobianState", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tao);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_J);
  __Pyx_XDECREF((PyObject *)__pyx_v_P);
  __Pyx_XDECREF((PyObject *)__pyx_v_I);
  __Pyx_XDECREF(__pyx_v_jacobian);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":271
 *     return 0
 * 
 * cdef int TAO_JacobianDesign(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                             PetscVec  _x,
 *                             PetscMat  _J,
 */

static int __pyx_f_8petsc4py_5PETSc_TAO_JacobianDesign(Tao __pyx_v__tao, Vec __pyx_v__x, Mat __pyx_v__J, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTAOObject *__pyx_v_tao = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  PyObject *__pyx_v_jacobian = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  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;
  PyObject *(*__pyx_t_6)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TAO_JacobianDesign", 0);

  /* "PETSc/petsctao.pxi":275
 *                             PetscMat  _J,
 *                             void* ctx) except PETSC_ERR_PYTHON with gil:
 *     cdef TAO tao = ref_TAO(_tao)             # <<<<<<<<<<<<<<
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Mat J   = ref_Mat(_J)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TAO(__pyx_v__tao)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tao = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":276
 *                             void* ctx) except PETSC_ERR_PYTHON with gil:
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)             # <<<<<<<<<<<<<<
 *     cdef Mat J   = ref_Mat(_J)
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian_design__")
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v__x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":277
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Mat J   = ref_Mat(_J)             # <<<<<<<<<<<<<<
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian_design__")
 *     jacobian(tao, x, J, *args, **kargs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Mat(__pyx_v__J)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_J = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":278
 *     cdef Vec x   = ref_Vec(_x)
 *     cdef Mat J   = ref_Mat(_J)
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian_design__")             # <<<<<<<<<<<<<<
 *     jacobian(tao, x, J, *args, **kargs)
 *     return 0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_tao->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_tao), ((char *)"__jacobian_design__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 278, __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_CPYTHON
    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(21, 278, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 278, __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(21, 278, __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_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_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __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), 3) < 0) __PYX_ERR(21, 278, __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(21, 278, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_jacobian = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_kargs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/petsctao.pxi":279
 *     cdef Mat J   = ref_Mat(_J)
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian_design__")
 *     jacobian(tao, x, J, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_tao));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tao));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_tao));
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_x));
  __Pyx_INCREF(((PyObject *)__pyx_v_J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_J));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_J));
  __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(21, 279, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_jacobian, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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;

  /* "PETSc/petsctao.pxi":280
 *     (jacobian, args, kargs) = tao.get_attr("__jacobian_design__")
 *     jacobian(tao, x, J, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TAO_Converged(PetscTAO _tao,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":271
 *     return 0
 * 
 * cdef int TAO_JacobianDesign(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                             PetscVec  _x,
 *                             PetscMat  _J,
 */

  /* 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("petsc4py.PETSc.TAO_JacobianDesign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tao);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_J);
  __Pyx_XDECREF(__pyx_v_jacobian);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":282
 *     return 0
 * 
 * cdef int TAO_Converged(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                        void* ctx) except PETSC_ERR_PYTHON with gil:
 *     # call first the default convergence test
 */

static int __pyx_f_8petsc4py_5PETSc_TAO_Converged(Tao __pyx_v__tao, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTAOObject *__pyx_v_tao = 0;
  PyObject *__pyx_v_converged = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  PyObject *__pyx_v_reason = NULL;
  TaoConvergedReason __pyx_v_creason;
  int __pyx_r;
  __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)(PyObject *);
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  TaoConvergedReason __pyx_t_12;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TAO_Converged", 0);

  /* "PETSc/petsctao.pxi":285
 *                        void* ctx) except PETSC_ERR_PYTHON with gil:
 *     # call first the default convergence test
 *     CHKERR( TaoDefaultConvergenceTest(_tao, NULL) )             # <<<<<<<<<<<<<<
 *     # call next the user-provided convergence test
 *     cdef TAO tao = ref_TAO(_tao)
 */
  __pyx_t_1 = TaoDefaultConvergenceTest(__pyx_v__tao, NULL); if (unlikely(__pyx_t_1 == PETSC_ERR_PYTHON)) __PYX_ERR(21, 285, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(21, 285, __pyx_L1_error)

  /* "PETSc/petsctao.pxi":287
 *     CHKERR( TaoDefaultConvergenceTest(_tao, NULL) )
 *     # call next the user-provided convergence test
 *     cdef TAO tao = ref_TAO(_tao)             # <<<<<<<<<<<<<<
 *     (converged, args, kargs) = tao.get_attr('__converged__')
 *     reason = converged(tao, *args, **kargs)
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TAO(__pyx_v__tao)); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_tao = ((struct PyPetscTAOObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petsctao.pxi":288
 *     # call next the user-provided convergence test
 *     cdef TAO tao = ref_TAO(_tao)
 *     (converged, args, kargs) = tao.get_attr('__converged__')             # <<<<<<<<<<<<<<
 *     reason = converged(tao, *args, **kargs)
 *     if reason is None:  return 0
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_tao->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_tao), ((char *)"__converged__")); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 288, __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_CPYTHON
    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(21, 288, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(21, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(21, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(21, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(21, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(21, 288, __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(21, 288, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_converged = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_args = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petsctao.pxi":289
 *     cdef TAO tao = ref_TAO(_tao)
 *     (converged, args, kargs) = tao.get_attr('__converged__')
 *     reason = converged(tao, *args, **kargs)             # <<<<<<<<<<<<<<
 *     if reason is None:  return 0
 *     # handle value of convergence reason
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_tao));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tao));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_tao));
  __pyx_t_6 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(21, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(21, 289, __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;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(21, 289, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_6 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(21, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(21, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_converged, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 289, __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_v_reason = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/petsctao.pxi":290
 *     (converged, args, kargs) = tao.get_attr('__converged__')
 *     reason = converged(tao, *args, **kargs)
 *     if reason is None:  return 0             # <<<<<<<<<<<<<<
 *     # handle value of convergence reason
 *     cdef PetscTAOConvergedReason creason = TAO_CONTINUE_ITERATING
 */
  __pyx_t_9 = (__pyx_v_reason == Py_None);
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petsctao.pxi":292
 *     if reason is None:  return 0
 *     # handle value of convergence reason
 *     cdef PetscTAOConvergedReason creason = TAO_CONTINUE_ITERATING             # <<<<<<<<<<<<<<
 *     if reason is False or reason == -1:
 *         creason = TAO_DIVERGED_USER
 */
  __pyx_v_creason = TAO_CONTINUE_ITERATING;

  /* "PETSc/petsctao.pxi":293
 *     # handle value of convergence reason
 *     cdef PetscTAOConvergedReason creason = TAO_CONTINUE_ITERATING
 *     if reason is False or reason == -1:             # <<<<<<<<<<<<<<
 *         creason = TAO_DIVERGED_USER
 *     elif reason is True or reason == 1:
 */
  __pyx_t_9 = (__pyx_v_reason == Py_False);
  __pyx_t_11 = (__pyx_t_9 != 0);
  if (!__pyx_t_11) {
  } else {
    __pyx_t_10 = __pyx_t_11;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_reason, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(21, 293, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_10 = __pyx_t_11;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_10) {

    /* "PETSc/petsctao.pxi":294
 *     cdef PetscTAOConvergedReason creason = TAO_CONTINUE_ITERATING
 *     if reason is False or reason == -1:
 *         creason = TAO_DIVERGED_USER             # <<<<<<<<<<<<<<
 *     elif reason is True or reason == 1:
 *         creason = TAO_CONVERGED_USER
 */
    __pyx_v_creason = TAO_DIVERGED_USER;

    /* "PETSc/petsctao.pxi":293
 *     # handle value of convergence reason
 *     cdef PetscTAOConvergedReason creason = TAO_CONTINUE_ITERATING
 *     if reason is False or reason == -1:             # <<<<<<<<<<<<<<
 *         creason = TAO_DIVERGED_USER
 *     elif reason is True or reason == 1:
 */
    goto __pyx_L6;
  }

  /* "PETSc/petsctao.pxi":295
 *     if reason is False or reason == -1:
 *         creason = TAO_DIVERGED_USER
 *     elif reason is True or reason == 1:             # <<<<<<<<<<<<<<
 *         creason = TAO_CONVERGED_USER
 *     else:
 */
  __pyx_t_11 = (__pyx_v_reason == Py_True);
  __pyx_t_9 = (__pyx_t_11 != 0);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_10 = __pyx_t_9;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_reason, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(21, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(21, 295, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_10 = __pyx_t_9;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_10) {

    /* "PETSc/petsctao.pxi":296
 *         creason = TAO_DIVERGED_USER
 *     elif reason is True or reason == 1:
 *         creason = TAO_CONVERGED_USER             # <<<<<<<<<<<<<<
 *     else:
 *         creason = reason
 */
    __pyx_v_creason = TAO_CONVERGED_USER;

    /* "PETSc/petsctao.pxi":295
 *     if reason is False or reason == -1:
 *         creason = TAO_DIVERGED_USER
 *     elif reason is True or reason == 1:             # <<<<<<<<<<<<<<
 *         creason = TAO_CONVERGED_USER
 *     else:
 */
    goto __pyx_L6;
  }

  /* "PETSc/petsctao.pxi":298
 *         creason = TAO_CONVERGED_USER
 *     else:
 *         creason = reason             # <<<<<<<<<<<<<<
 *         assert creason >= TAO_DIVERGED_USER
 *         assert creason <= TAO_CONVERGED_USER
 */
  /*else*/ {
    __pyx_t_12 = ((TaoConvergedReason)__Pyx_PyInt_As_TaoConvergedReason(__pyx_v_reason)); if (unlikely(PyErr_Occurred())) __PYX_ERR(21, 298, __pyx_L1_error)
    __pyx_v_creason = __pyx_t_12;

    /* "PETSc/petsctao.pxi":299
 *     else:
 *         creason = reason
 *         assert creason >= TAO_DIVERGED_USER             # <<<<<<<<<<<<<<
 *         assert creason <= TAO_CONVERGED_USER
 *     CHKERR( TaoSetConvergedReason(_tao, creason) )
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!((__pyx_v_creason >= TAO_DIVERGED_USER) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(21, 299, __pyx_L1_error)
      }
    }
    #endif

    /* "PETSc/petsctao.pxi":300
 *         creason = reason
 *         assert creason >= TAO_DIVERGED_USER
 *         assert creason <= TAO_CONVERGED_USER             # <<<<<<<<<<<<<<
 *     CHKERR( TaoSetConvergedReason(_tao, creason) )
 *     return 0
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!((__pyx_v_creason <= TAO_CONVERGED_USER) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(21, 300, __pyx_L1_error)
      }
    }
    #endif
  }
  __pyx_L6:;

  /* "PETSc/petsctao.pxi":301
 *         assert creason >= TAO_DIVERGED_USER
 *         assert creason <= TAO_CONVERGED_USER
 *     CHKERR( TaoSetConvergedReason(_tao, creason) )             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetConvergedReason(__pyx_v__tao, __pyx_v_creason)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(21, 301, __pyx_L1_error)

  /* "PETSc/petsctao.pxi":302
 *         assert creason <= TAO_CONVERGED_USER
 *     CHKERR( TaoSetConvergedReason(_tao, creason) )
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int TAO_Monitor(PetscTAO _tao,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":282
 *     return 0
 * 
 * cdef int TAO_Converged(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                        void* ctx) except PETSC_ERR_PYTHON with gil:
 *     # call first the default convergence test
 */

  /* 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_AddTraceback("petsc4py.PETSc.TAO_Converged", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tao);
  __Pyx_XDECREF(__pyx_v_converged);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XDECREF(__pyx_v_reason);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petsctao.pxi":304
 *     return 0
 * 
 * cdef int TAO_Monitor(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                      void* ctx) except PETSC_ERR_PYTHON with gil:
 *     cdef TAO tao = ref_TAO(_tao)
 */

static int __pyx_f_8petsc4py_5PETSc_TAO_Monitor(Tao __pyx_v__tao, CYTHON_UNUSED void *__pyx_v_ctx) {
  struct PyPetscTAOObject *__pyx_v_tao = 0;
  PyObject *__pyx_v_monitorlist = 0;
  PyObject *__pyx_v_monitor = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  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)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("TAO_Monitor", 0);

  /* "PETSc/petsctao.pxi":306
 * cdef int TAO_Monitor(PetscTAO _tao,
 *                      void* ctx) except PETSC_ERR_PYTHON with gil:
 *     cdef TAO tao = ref_TAO(_tao)             # <<<<<<<<<<<<<<
 *     cdef object monitorlist = tao.get_attr('__monitor__')
 *     if monitorlist is None: return 0
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_TAO(__pyx_v__tao)); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tao = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":307
 *                      void* ctx) except PETSC_ERR_PYTHON with gil:
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef object monitorlist = tao.get_attr('__monitor__')             # <<<<<<<<<<<<<<
 *     if monitorlist is None: return 0
 *     for (monitor, args, kargs) in monitorlist:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_tao->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_tao), ((char *)"__monitor__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_monitorlist = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":308
 *     cdef TAO tao = ref_TAO(_tao)
 *     cdef object monitorlist = tao.get_attr('__monitor__')
 *     if monitorlist is None: return 0             # <<<<<<<<<<<<<<
 *     for (monitor, args, kargs) in monitorlist:
 *         monitor(tao, *args, **kargs)
 */
  __pyx_t_2 = (__pyx_v_monitorlist == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/petsctao.pxi":309
 *     cdef object monitorlist = tao.get_attr('__monitor__')
 *     if monitorlist is None: return 0
 *     for (monitor, args, kargs) in monitorlist:             # <<<<<<<<<<<<<<
 *         monitor(tao, *args, **kargs)
 *     return 0
 */
  if (likely(PyList_CheckExact(__pyx_v_monitorlist)) || PyTuple_CheckExact(__pyx_v_monitorlist)) {
    __pyx_t_1 = __pyx_v_monitorlist; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_monitorlist); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(21, 309, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(21, 309, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(21, 309, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(21, 309, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(21, 309, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      }
    } else {
      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
      if (unlikely(!__pyx_t_6)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(21, 309, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(21, 309, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(21, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(21, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(21, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(21, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) __PYX_ERR(21, 309, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(21, 309, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_monitor, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_args, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_kargs, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "PETSc/petsctao.pxi":310
 *     if monitorlist is None: return 0
 *     for (monitor, args, kargs) in monitorlist:
 *         monitor(tao, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(21, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_v_tao));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_tao));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_tao));
    __pyx_t_9 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_9)) __PYX_ERR(21, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyNumber_Add(__pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(21, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(__pyx_v_kargs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(21, 310, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
      __pyx_t_9 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_9)) __PYX_ERR(21, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      __pyx_t_9 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(21, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    }
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_monitor, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(21, 310, __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_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PETSc/petsctao.pxi":309
 *     cdef object monitorlist = tao.get_attr('__monitor__')
 *     if monitorlist is None: return 0
 *     for (monitor, args, kargs) in monitorlist:             # <<<<<<<<<<<<<<
 *         monitor(tao, *args, **kargs)
 *     return 0
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petsctao.pxi":311
 *     for (monitor, args, kargs) in monitorlist:
 *         monitor(tao, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petsctao.pxi":304
 *     return 0
 * 
 * cdef int TAO_Monitor(PetscTAO _tao,             # <<<<<<<<<<<<<<
 *                      void* ctx) except PETSC_ERR_PYTHON with gil:
 *     cdef TAO tao = ref_TAO(_tao)
 */

  /* function exit code */
  __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_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO_Monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tao);
  __Pyx_XDECREF(__pyx_v_monitorlist);
  __Pyx_XDECREF(__pyx_v_monitor);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdm.pxi":108
 * # --------------------------------------------------------------------
 * 
 * cdef inline PetscDMBoundaryType asBoundaryType(object boundary) \             # <<<<<<<<<<<<<<
 *     except <PetscDMBoundaryType>(-1):
 *     if boundary is None:
 */

static CYTHON_INLINE DMBoundaryType __pyx_f_8petsc4py_5PETSc_asBoundaryType(PyObject *__pyx_v_boundary) {
  DMBoundaryType __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  DMBoundaryType __pyx_t_5;
  __Pyx_RefNannySetupContext("asBoundaryType", 0);

  /* "PETSc/petscdm.pxi":110
 * cdef inline PetscDMBoundaryType asBoundaryType(object boundary) \
 *     except <PetscDMBoundaryType>(-1):
 *     if boundary is None:             # <<<<<<<<<<<<<<
 *         return DM_BOUNDARY_NONE
 *     if isinstance(boundary, str):
 */
  __pyx_t_1 = (__pyx_v_boundary == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscdm.pxi":111
 *     except <PetscDMBoundaryType>(-1):
 *     if boundary is None:
 *         return DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *     if isinstance(boundary, str):
 *         if boundary == 'none':
 */
    __pyx_r = DM_BOUNDARY_NONE;
    goto __pyx_L0;

    /* "PETSc/petscdm.pxi":110
 * cdef inline PetscDMBoundaryType asBoundaryType(object boundary) \
 *     except <PetscDMBoundaryType>(-1):
 *     if boundary is None:             # <<<<<<<<<<<<<<
 *         return DM_BOUNDARY_NONE
 *     if isinstance(boundary, str):
 */
  }

  /* "PETSc/petscdm.pxi":112
 *     if boundary is None:
 *         return DM_BOUNDARY_NONE
 *     if isinstance(boundary, str):             # <<<<<<<<<<<<<<
 *         if boundary == 'none':
 *             return DM_BOUNDARY_NONE
 */
  __pyx_t_2 = PyString_Check(__pyx_v_boundary); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscdm.pxi":113
 *         return DM_BOUNDARY_NONE
 *     if isinstance(boundary, str):
 *         if boundary == 'none':             # <<<<<<<<<<<<<<
 *             return DM_BOUNDARY_NONE
 *         elif boundary == 'ghosted':
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_boundary, __pyx_n_s_none, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(22, 113, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "PETSc/petscdm.pxi":114
 *     if isinstance(boundary, str):
 *         if boundary == 'none':
 *             return DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         elif boundary == 'ghosted':
 *             return DM_BOUNDARY_GHOSTED
 */
      __pyx_r = DM_BOUNDARY_NONE;
      goto __pyx_L0;

      /* "PETSc/petscdm.pxi":113
 *         return DM_BOUNDARY_NONE
 *     if isinstance(boundary, str):
 *         if boundary == 'none':             # <<<<<<<<<<<<<<
 *             return DM_BOUNDARY_NONE
 *         elif boundary == 'ghosted':
 */
    }

    /* "PETSc/petscdm.pxi":115
 *         if boundary == 'none':
 *             return DM_BOUNDARY_NONE
 *         elif boundary == 'ghosted':             # <<<<<<<<<<<<<<
 *             return DM_BOUNDARY_GHOSTED
 *         elif boundary == 'mirror':
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_boundary, __pyx_n_s_ghosted, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(22, 115, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "PETSc/petscdm.pxi":116
 *             return DM_BOUNDARY_NONE
 *         elif boundary == 'ghosted':
 *             return DM_BOUNDARY_GHOSTED             # <<<<<<<<<<<<<<
 *         elif boundary == 'mirror':
 *             return DM_BOUNDARY_MIRROR
 */
      __pyx_r = DM_BOUNDARY_GHOSTED;
      goto __pyx_L0;

      /* "PETSc/petscdm.pxi":115
 *         if boundary == 'none':
 *             return DM_BOUNDARY_NONE
 *         elif boundary == 'ghosted':             # <<<<<<<<<<<<<<
 *             return DM_BOUNDARY_GHOSTED
 *         elif boundary == 'mirror':
 */
    }

    /* "PETSc/petscdm.pxi":117
 *         elif boundary == 'ghosted':
 *             return DM_BOUNDARY_GHOSTED
 *         elif boundary == 'mirror':             # <<<<<<<<<<<<<<
 *             return DM_BOUNDARY_MIRROR
 *         elif boundary == 'periodic':
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_boundary, __pyx_n_s_mirror, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(22, 117, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "PETSc/petscdm.pxi":118
 *             return DM_BOUNDARY_GHOSTED
 *         elif boundary == 'mirror':
 *             return DM_BOUNDARY_MIRROR             # <<<<<<<<<<<<<<
 *         elif boundary == 'periodic':
 *             return DM_BOUNDARY_PERIODIC
 */
      __pyx_r = DM_BOUNDARY_MIRROR;
      goto __pyx_L0;

      /* "PETSc/petscdm.pxi":117
 *         elif boundary == 'ghosted':
 *             return DM_BOUNDARY_GHOSTED
 *         elif boundary == 'mirror':             # <<<<<<<<<<<<<<
 *             return DM_BOUNDARY_MIRROR
 *         elif boundary == 'periodic':
 */
    }

    /* "PETSc/petscdm.pxi":119
 *         elif boundary == 'mirror':
 *             return DM_BOUNDARY_MIRROR
 *         elif boundary == 'periodic':             # <<<<<<<<<<<<<<
 *             return DM_BOUNDARY_PERIODIC
 *         elif boundary == 'twist':
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_boundary, __pyx_n_s_periodic, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(22, 119, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "PETSc/petscdm.pxi":120
 *             return DM_BOUNDARY_MIRROR
 *         elif boundary == 'periodic':
 *             return DM_BOUNDARY_PERIODIC             # <<<<<<<<<<<<<<
 *         elif boundary == 'twist':
 *             return DM_BOUNDARY_TWIST
 */
      __pyx_r = DM_BOUNDARY_PERIODIC;
      goto __pyx_L0;

      /* "PETSc/petscdm.pxi":119
 *         elif boundary == 'mirror':
 *             return DM_BOUNDARY_MIRROR
 *         elif boundary == 'periodic':             # <<<<<<<<<<<<<<
 *             return DM_BOUNDARY_PERIODIC
 *         elif boundary == 'twist':
 */
    }

    /* "PETSc/petscdm.pxi":121
 *         elif boundary == 'periodic':
 *             return DM_BOUNDARY_PERIODIC
 *         elif boundary == 'twist':             # <<<<<<<<<<<<<<
 *             return DM_BOUNDARY_TWIST
 *         else:
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_boundary, __pyx_n_s_twist, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(22, 121, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "PETSc/petscdm.pxi":122
 *             return DM_BOUNDARY_PERIODIC
 *         elif boundary == 'twist':
 *             return DM_BOUNDARY_TWIST             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("unknown boundary type: %s" % boundary)
 */
      __pyx_r = DM_BOUNDARY_TWIST;
      goto __pyx_L0;

      /* "PETSc/petscdm.pxi":121
 *         elif boundary == 'periodic':
 *             return DM_BOUNDARY_PERIODIC
 *         elif boundary == 'twist':             # <<<<<<<<<<<<<<
 *             return DM_BOUNDARY_TWIST
 *         else:
 */
    }

    /* "PETSc/petscdm.pxi":124
 *             return DM_BOUNDARY_TWIST
 *         else:
 *             raise ValueError("unknown boundary type: %s" % boundary)             # <<<<<<<<<<<<<<
 *     return boundary
 * 
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unknown_boundary_type_s, __pyx_v_boundary); if (unlikely(!__pyx_t_3)) __PYX_ERR(22, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(22, 124, __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(22, 124, __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(22, 124, __pyx_L1_error)
    }

    /* "PETSc/petscdm.pxi":112
 *     if boundary is None:
 *         return DM_BOUNDARY_NONE
 *     if isinstance(boundary, str):             # <<<<<<<<<<<<<<
 *         if boundary == 'none':
 *             return DM_BOUNDARY_NONE
 */
  }

  /* "PETSc/petscdm.pxi":125
 *         else:
 *             raise ValueError("unknown boundary type: %s" % boundary)
 *     return boundary             # <<<<<<<<<<<<<<
 * 
 * cdef inline PetscInt asBoundary(object boundary,
 */
  __pyx_t_5 = ((DMBoundaryType)__Pyx_PyInt_As_DMBoundaryType(__pyx_v_boundary)); if (unlikely(PyErr_Occurred())) __PYX_ERR(22, 125, __pyx_L1_error)
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "PETSc/petscdm.pxi":108
 * # --------------------------------------------------------------------
 * 
 * cdef inline PetscDMBoundaryType asBoundaryType(object boundary) \             # <<<<<<<<<<<<<<
 *     except <PetscDMBoundaryType>(-1):
 *     if boundary is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.asBoundaryType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = ((DMBoundaryType)-1L);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdm.pxi":127
 *     return boundary
 * 
 * cdef inline PetscInt asBoundary(object boundary,             # <<<<<<<<<<<<<<
 *                                 PetscDMBoundaryType *_x,
 *                                 PetscDMBoundaryType *_y,
 */

static CYTHON_INLINE PetscInt __pyx_f_8petsc4py_5PETSc_asBoundary(PyObject *__pyx_v_boundary, DMBoundaryType *__pyx_v__x, DMBoundaryType *__pyx_v__y, DMBoundaryType *__pyx_v__z) {
  PetscInt __pyx_v_dim;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_z = 0;
  PetscInt __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  DMBoundaryType __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("asBoundary", 0);
  __Pyx_INCREF(__pyx_v_boundary);

  /* "PETSc/petscdm.pxi":131
 *                                 PetscDMBoundaryType *_y,
 *                                 PetscDMBoundaryType *_z) except? -1:
 *     cdef PetscInt dim = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *     cdef object x=None, y=None, z=None
 *     if (boundary is None or
 */
  __pyx_v_dim = PETSC_DECIDE;

  /* "PETSc/petscdm.pxi":132
 *                                 PetscDMBoundaryType *_z) except? -1:
 *     cdef PetscInt dim = PETSC_DECIDE
 *     cdef object x=None, y=None, z=None             # <<<<<<<<<<<<<<
 *     if (boundary is None or
 *         isinstance(boundary, str) or
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_x = Py_None;
  __Pyx_INCREF(Py_None);
  __pyx_v_y = Py_None;
  __Pyx_INCREF(Py_None);
  __pyx_v_z = Py_None;

  /* "PETSc/petscdm.pxi":133
 *     cdef PetscInt dim = PETSC_DECIDE
 *     cdef object x=None, y=None, z=None
 *     if (boundary is None or             # <<<<<<<<<<<<<<
 *         isinstance(boundary, str) or
 *         isinstance(boundary, int)):
 */
  __pyx_t_2 = (__pyx_v_boundary == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "PETSc/petscdm.pxi":134
 *     cdef object x=None, y=None, z=None
 *     if (boundary is None or
 *         isinstance(boundary, str) or             # <<<<<<<<<<<<<<
 *         isinstance(boundary, int)):
 *         _x[0] = _y[0] = _z[0] = asBoundaryType(boundary)
 */
  __pyx_t_3 = PyString_Check(__pyx_v_boundary); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "PETSc/petscdm.pxi":135
 *     if (boundary is None or
 *         isinstance(boundary, str) or
 *         isinstance(boundary, int)):             # <<<<<<<<<<<<<<
 *         _x[0] = _y[0] = _z[0] = asBoundaryType(boundary)
 *     else:
 */
  __pyx_t_2 = PyInt_Check(__pyx_v_boundary); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;

  /* "PETSc/petscdm.pxi":133
 *     cdef PetscInt dim = PETSC_DECIDE
 *     cdef object x=None, y=None, z=None
 *     if (boundary is None or             # <<<<<<<<<<<<<<
 *         isinstance(boundary, str) or
 *         isinstance(boundary, int)):
 */
  if (__pyx_t_1) {

    /* "PETSc/petscdm.pxi":136
 *         isinstance(boundary, str) or
 *         isinstance(boundary, int)):
 *         _x[0] = _y[0] = _z[0] = asBoundaryType(boundary)             # <<<<<<<<<<<<<<
 *     else:
 *         boundary = tuple(boundary)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asBoundaryType(__pyx_v_boundary); if (unlikely(__pyx_t_4 == ((DMBoundaryType)-1L))) __PYX_ERR(22, 136, __pyx_L1_error)
    (__pyx_v__x[0]) = __pyx_t_4;
    (__pyx_v__y[0]) = __pyx_t_4;
    (__pyx_v__z[0]) = __pyx_t_4;

    /* "PETSc/petscdm.pxi":133
 *     cdef PetscInt dim = PETSC_DECIDE
 *     cdef object x=None, y=None, z=None
 *     if (boundary is None or             # <<<<<<<<<<<<<<
 *         isinstance(boundary, str) or
 *         isinstance(boundary, int)):
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscdm.pxi":138
 *         _x[0] = _y[0] = _z[0] = asBoundaryType(boundary)
 *     else:
 *         boundary = tuple(boundary)             # <<<<<<<<<<<<<<
 *         dim = <PetscInt>len(boundary)
 *         if   dim == 0: pass
 */
  /*else*/ {
    __pyx_t_5 = PySequence_Tuple(__pyx_v_boundary); if (unlikely(!__pyx_t_5)) __PYX_ERR(22, 138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_boundary, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PETSc/petscdm.pxi":139
 *     else:
 *         boundary = tuple(boundary)
 *         dim = <PetscInt>len(boundary)             # <<<<<<<<<<<<<<
 *         if   dim == 0: pass
 *         elif dim == 1: (x,) = boundary
 */
    __pyx_t_6 = PyObject_Length(__pyx_v_boundary); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(22, 139, __pyx_L1_error)
    __pyx_v_dim = ((PetscInt)__pyx_t_6);

    /* "PETSc/petscdm.pxi":140
 *         boundary = tuple(boundary)
 *         dim = <PetscInt>len(boundary)
 *         if   dim == 0: pass             # <<<<<<<<<<<<<<
 *         elif dim == 1: (x,) = boundary
 *         elif dim == 2: (x, y) = boundary
 */
    switch (__pyx_v_dim) {
      case 0:
      break;

      /* "PETSc/petscdm.pxi":141
 *         dim = <PetscInt>len(boundary)
 *         if   dim == 0: pass
 *         elif dim == 1: (x,) = boundary             # <<<<<<<<<<<<<<
 *         elif dim == 2: (x, y) = boundary
 *         elif dim == 3: (x, y, z) = boundary
 */
      case 1:
      if ((likely(PyTuple_CheckExact(__pyx_v_boundary))) || (PyList_CheckExact(__pyx_v_boundary))) {
        PyObject* sequence = __pyx_v_boundary;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 1)) {
          if (size > 1) __Pyx_RaiseTooManyValuesError(1);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(22, 141, __pyx_L1_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        } else {
          __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        }
        __Pyx_INCREF(__pyx_t_5);
        #else
        __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(22, 141, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_7 = PyObject_GetIter(__pyx_v_boundary); if (unlikely(!__pyx_t_7)) __PYX_ERR(22, 141, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
        index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 1) < 0) __PYX_ERR(22, 141, __pyx_L1_error)
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L8_unpacking_done;
        __pyx_L7_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(22, 141, __pyx_L1_error)
        __pyx_L8_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_5);
      __pyx_t_5 = 0;
      break;

      /* "PETSc/petscdm.pxi":142
 *         if   dim == 0: pass
 *         elif dim == 1: (x,) = boundary
 *         elif dim == 2: (x, y) = boundary             # <<<<<<<<<<<<<<
 *         elif dim == 3: (x, y, z) = boundary
 *         if dim >= 1: _x[0] = asBoundaryType(x)
 */
      case 2:
      if ((likely(PyTuple_CheckExact(__pyx_v_boundary))) || (PyList_CheckExact(__pyx_v_boundary))) {
        PyObject* sequence = __pyx_v_boundary;
        #if CYTHON_COMPILING_IN_CPYTHON
        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(22, 142, __pyx_L1_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        #else
        __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(22, 142, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(22, 142, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_9 = PyObject_GetIter(__pyx_v_boundary); if (unlikely(!__pyx_t_9)) __PYX_ERR(22, 142, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = Py_TYPE(__pyx_t_9)->tp_iternext;
        index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L9_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L9_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_9), 2) < 0) __PYX_ERR(22, 142, __pyx_L1_error)
        __pyx_t_8 = 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_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(22, 142, __pyx_L1_error)
        __pyx_L10_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_7);
      __pyx_t_7 = 0;
      break;

      /* "PETSc/petscdm.pxi":143
 *         elif dim == 1: (x,) = boundary
 *         elif dim == 2: (x, y) = boundary
 *         elif dim == 3: (x, y, z) = boundary             # <<<<<<<<<<<<<<
 *         if dim >= 1: _x[0] = asBoundaryType(x)
 *         if dim >= 2: _y[0] = asBoundaryType(y)
 */
      case 3:
      if ((likely(PyTuple_CheckExact(__pyx_v_boundary))) || (PyList_CheckExact(__pyx_v_boundary))) {
        PyObject* sequence = __pyx_v_boundary;
        #if CYTHON_COMPILING_IN_CPYTHON
        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(22, 143, __pyx_L1_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(22, 143, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(22, 143, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(22, 143, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_v_boundary); if (unlikely(!__pyx_t_10)) __PYX_ERR(22, 143, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_8 = Py_TYPE(__pyx_t_10)->tp_iternext;
        index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        index = 2; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 3) < 0) __PYX_ERR(22, 143, __pyx_L1_error)
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(22, 143, __pyx_L1_error)
        __pyx_L12_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_9);
      __pyx_t_9 = 0;
      break;
      default: break;
    }

    /* "PETSc/petscdm.pxi":144
 *         elif dim == 2: (x, y) = boundary
 *         elif dim == 3: (x, y, z) = boundary
 *         if dim >= 1: _x[0] = asBoundaryType(x)             # <<<<<<<<<<<<<<
 *         if dim >= 2: _y[0] = asBoundaryType(y)
 *         if dim >= 3: _z[0] = asBoundaryType(z)
 */
    __pyx_t_1 = ((__pyx_v_dim >= 1) != 0);
    if (__pyx_t_1) {
      __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asBoundaryType(__pyx_v_x); if (unlikely(__pyx_t_4 == ((DMBoundaryType)-1L))) __PYX_ERR(22, 144, __pyx_L1_error)
      (__pyx_v__x[0]) = __pyx_t_4;
    }

    /* "PETSc/petscdm.pxi":145
 *         elif dim == 3: (x, y, z) = boundary
 *         if dim >= 1: _x[0] = asBoundaryType(x)
 *         if dim >= 2: _y[0] = asBoundaryType(y)             # <<<<<<<<<<<<<<
 *         if dim >= 3: _z[0] = asBoundaryType(z)
 *     return dim
 */
    __pyx_t_1 = ((__pyx_v_dim >= 2) != 0);
    if (__pyx_t_1) {
      __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asBoundaryType(__pyx_v_y); if (unlikely(__pyx_t_4 == ((DMBoundaryType)-1L))) __PYX_ERR(22, 145, __pyx_L1_error)
      (__pyx_v__y[0]) = __pyx_t_4;
    }

    /* "PETSc/petscdm.pxi":146
 *         if dim >= 1: _x[0] = asBoundaryType(x)
 *         if dim >= 2: _y[0] = asBoundaryType(y)
 *         if dim >= 3: _z[0] = asBoundaryType(z)             # <<<<<<<<<<<<<<
 *     return dim
 * 
 */
    __pyx_t_1 = ((__pyx_v_dim >= 3) != 0);
    if (__pyx_t_1) {
      __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asBoundaryType(__pyx_v_z); if (unlikely(__pyx_t_4 == ((DMBoundaryType)-1L))) __PYX_ERR(22, 146, __pyx_L1_error)
      (__pyx_v__z[0]) = __pyx_t_4;
    }
  }
  __pyx_L3:;

  /* "PETSc/petscdm.pxi":147
 *         if dim >= 2: _y[0] = asBoundaryType(y)
 *         if dim >= 3: _z[0] = asBoundaryType(z)
 *     return dim             # <<<<<<<<<<<<<<
 * 
 * cdef inline object toBoundary(PetscInt dim,
 */
  __pyx_r = __pyx_v_dim;
  goto __pyx_L0;

  /* "PETSc/petscdm.pxi":127
 *     return boundary
 * 
 * cdef inline PetscInt asBoundary(object boundary,             # <<<<<<<<<<<<<<
 *                                 PetscDMBoundaryType *_x,
 *                                 PetscDMBoundaryType *_y,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("petsc4py.PETSc.asBoundary", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1L;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XDECREF(__pyx_v_boundary);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdm.pxi":149
 *     return dim
 * 
 * cdef inline object toBoundary(PetscInt dim,             # <<<<<<<<<<<<<<
 *                               PetscDMBoundaryType x,
 *                               PetscDMBoundaryType y,
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toBoundary(PetscInt __pyx_v_dim, DMBoundaryType __pyx_v_x, DMBoundaryType __pyx_v_y, DMBoundaryType __pyx_v_z) {
  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_RefNannySetupContext("toBoundary", 0);

  /* "PETSc/petscdm.pxi":153
 *                               PetscDMBoundaryType y,
 *                               PetscDMBoundaryType z):
 *     if   dim == 0: return ()             # <<<<<<<<<<<<<<
 *     elif dim == 1: return (x,)
 *     elif dim == 2: return (x, y)
 */
  switch (__pyx_v_dim) {
    case 0:
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    goto __pyx_L0;
    break;

    /* "PETSc/petscdm.pxi":154
 *                               PetscDMBoundaryType z):
 *     if   dim == 0: return ()
 *     elif dim == 1: return (x,)             # <<<<<<<<<<<<<<
 *     elif dim == 2: return (x, y)
 *     elif dim == 3: return (x, y, z)
 */
    case 1:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyInt_From_DMBoundaryType(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 154, __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_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;

    /* "PETSc/petscdm.pxi":155
 *     if   dim == 0: return ()
 *     elif dim == 1: return (x,)
 *     elif dim == 2: return (x, y)             # <<<<<<<<<<<<<<
 *     elif dim == 3: return (x, y, z)
 * 
 */
    case 2:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_DMBoundaryType(__pyx_v_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyInt_From_DMBoundaryType(__pyx_v_y); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(22, 155, __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_1);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "PETSc/petscdm.pxi":156
 *     elif dim == 1: return (x,)
 *     elif dim == 2: return (x, y)
 *     elif dim == 3: return (x, y, z)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
    case 3:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyInt_From_DMBoundaryType(__pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(22, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyInt_From_DMBoundaryType(__pyx_v_y); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyInt_From_DMBoundaryType(__pyx_v_z); if (unlikely(!__pyx_t_2)) __PYX_ERR(22, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(22, 156, __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_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    break;
    default: break;
  }

  /* "PETSc/petscdm.pxi":149
 *     return dim
 * 
 * cdef inline object toBoundary(PetscInt dim,             # <<<<<<<<<<<<<<
 *                               PetscDMBoundaryType x,
 *                               PetscDMBoundaryType y,
 */

  /* 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.toBoundary", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":88
 * # --------------------------------------------------------------------
 * 
 * cdef inline PetscDMDAStencilType asStencil(object stencil) \             # <<<<<<<<<<<<<<
 *     except <PetscDMDAStencilType>(-1):
 *     if isinstance(stencil, str):
 */

static CYTHON_INLINE DMDAStencilType __pyx_f_8petsc4py_5PETSc_asStencil(PyObject *__pyx_v_stencil) {
  DMDAStencilType __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  DMDAStencilType __pyx_t_5;
  __Pyx_RefNannySetupContext("asStencil", 0);

  /* "PETSc/petscdmda.pxi":90
 * cdef inline PetscDMDAStencilType asStencil(object stencil) \
 *     except <PetscDMDAStencilType>(-1):
 *     if isinstance(stencil, str):             # <<<<<<<<<<<<<<
 *         if   stencil == "star": return DMDA_STENCIL_STAR
 *         elif stencil == "box":  return DMDA_STENCIL_BOX
 */
  __pyx_t_1 = PyString_Check(__pyx_v_stencil); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscdmda.pxi":91
 *     except <PetscDMDAStencilType>(-1):
 *     if isinstance(stencil, str):
 *         if   stencil == "star": return DMDA_STENCIL_STAR             # <<<<<<<<<<<<<<
 *         elif stencil == "box":  return DMDA_STENCIL_BOX
 *         else: raise ValueError("unknown stencil type: %s" % stencil)
 */
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_stencil, __pyx_n_s_star, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(7, 91, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_r = DMDA_STENCIL_STAR;
      goto __pyx_L0;
    }

    /* "PETSc/petscdmda.pxi":92
 *     if isinstance(stencil, str):
 *         if   stencil == "star": return DMDA_STENCIL_STAR
 *         elif stencil == "box":  return DMDA_STENCIL_BOX             # <<<<<<<<<<<<<<
 *         else: raise ValueError("unknown stencil type: %s" % stencil)
 *     return stencil
 */
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_stencil, __pyx_n_s_box, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(7, 92, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_r = DMDA_STENCIL_BOX;
      goto __pyx_L0;
    }

    /* "PETSc/petscdmda.pxi":93
 *         if   stencil == "star": return DMDA_STENCIL_STAR
 *         elif stencil == "box":  return DMDA_STENCIL_BOX
 *         else: raise ValueError("unknown stencil type: %s" % stencil)             # <<<<<<<<<<<<<<
 *     return stencil
 * 
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unknown_stencil_type_s, __pyx_v_stencil); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 93, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 93, __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(7, 93, __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(7, 93, __pyx_L1_error)
    }

    /* "PETSc/petscdmda.pxi":90
 * cdef inline PetscDMDAStencilType asStencil(object stencil) \
 *     except <PetscDMDAStencilType>(-1):
 *     if isinstance(stencil, str):             # <<<<<<<<<<<<<<
 *         if   stencil == "star": return DMDA_STENCIL_STAR
 *         elif stencil == "box":  return DMDA_STENCIL_BOX
 */
  }

  /* "PETSc/petscdmda.pxi":94
 *         elif stencil == "box":  return DMDA_STENCIL_BOX
 *         else: raise ValueError("unknown stencil type: %s" % stencil)
 *     return stencil             # <<<<<<<<<<<<<<
 * 
 * cdef inline object toStencil(PetscDMDAStencilType stype):
 */
  __pyx_t_5 = ((DMDAStencilType)__Pyx_PyInt_As_DMDAStencilType(__pyx_v_stencil)); if (unlikely(PyErr_Occurred())) __PYX_ERR(7, 94, __pyx_L1_error)
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":88
 * # --------------------------------------------------------------------
 * 
 * cdef inline PetscDMDAStencilType asStencil(object stencil) \             # <<<<<<<<<<<<<<
 *     except <PetscDMDAStencilType>(-1):
 *     if isinstance(stencil, str):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.asStencil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = ((DMDAStencilType)-1L);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":96
 *     return stencil
 * 
 * cdef inline object toStencil(PetscDMDAStencilType stype):             # <<<<<<<<<<<<<<
 *     if   stype == DMDA_STENCIL_STAR: return "star"
 *     elif stype == DMDA_STENCIL_BOX:  return "box"
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toStencil(DMDAStencilType __pyx_v_stype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("toStencil", 0);

  /* "PETSc/petscdmda.pxi":97
 * 
 * cdef inline object toStencil(PetscDMDAStencilType stype):
 *     if   stype == DMDA_STENCIL_STAR: return "star"             # <<<<<<<<<<<<<<
 *     elif stype == DMDA_STENCIL_BOX:  return "box"
 * 
 */
  switch (__pyx_v_stype) {
    case DMDA_STENCIL_STAR:
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_star);
    __pyx_r = __pyx_n_s_star;
    goto __pyx_L0;
    break;

    /* "PETSc/petscdmda.pxi":98
 * cdef inline object toStencil(PetscDMDAStencilType stype):
 *     if   stype == DMDA_STENCIL_STAR: return "star"
 *     elif stype == DMDA_STENCIL_BOX:  return "box"             # <<<<<<<<<<<<<<
 * 
 * cdef inline PetscDMDAInterpolationType dainterpolationtype(object itype) \
 */
    case DMDA_STENCIL_BOX:
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_box);
    __pyx_r = __pyx_n_s_box;
    goto __pyx_L0;
    break;
    default: break;
  }

  /* "PETSc/petscdmda.pxi":96
 *     return stencil
 * 
 * cdef inline object toStencil(PetscDMDAStencilType stype):             # <<<<<<<<<<<<<<
 *     if   stype == DMDA_STENCIL_STAR: return "star"
 *     elif stype == DMDA_STENCIL_BOX:  return "box"
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":100
 *     elif stype == DMDA_STENCIL_BOX:  return "box"
 * 
 * cdef inline PetscDMDAInterpolationType dainterpolationtype(object itype) \             # <<<<<<<<<<<<<<
 *     except <PetscDMDAInterpolationType>(-1):
 *     if (isinstance(itype, str)):
 */

static CYTHON_INLINE DMDAInterpolationType __pyx_f_8petsc4py_5PETSc_dainterpolationtype(PyObject *__pyx_v_itype) {
  DMDAInterpolationType __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  DMDAInterpolationType __pyx_t_5;
  __Pyx_RefNannySetupContext("dainterpolationtype", 0);

  /* "PETSc/petscdmda.pxi":102
 * cdef inline PetscDMDAInterpolationType dainterpolationtype(object itype) \
 *     except <PetscDMDAInterpolationType>(-1):
 *     if (isinstance(itype, str)):             # <<<<<<<<<<<<<<
 *         if itype in ("q0", "Q0"): return DMDA_INTERPOLATION_Q0
 *         if itype in ("q1", "Q1"): return DMDA_INTERPOLATION_Q1
 */
  __pyx_t_1 = PyString_Check(__pyx_v_itype); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscdmda.pxi":103
 *     except <PetscDMDAInterpolationType>(-1):
 *     if (isinstance(itype, str)):
 *         if itype in ("q0", "Q0"): return DMDA_INTERPOLATION_Q0             # <<<<<<<<<<<<<<
 *         if itype in ("q1", "Q1"): return DMDA_INTERPOLATION_Q1
 *         else: raise ValueError("unknown interpolation type: %s" % itype)
 */
    __Pyx_INCREF(__pyx_v_itype);
    __pyx_t_3 = __pyx_v_itype;
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_q0, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(7, 103, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_Q0, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(7, 103, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __pyx_r = DMDA_Q0;
      goto __pyx_L0;
    }

    /* "PETSc/petscdmda.pxi":104
 *     if (isinstance(itype, str)):
 *         if itype in ("q0", "Q0"): return DMDA_INTERPOLATION_Q0
 *         if itype in ("q1", "Q1"): return DMDA_INTERPOLATION_Q1             # <<<<<<<<<<<<<<
 *         else: raise ValueError("unknown interpolation type: %s" % itype)
 *     return itype
 */
    __Pyx_INCREF(__pyx_v_itype);
    __pyx_t_3 = __pyx_v_itype;
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_q1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(7, 104, __pyx_L1_error)
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_Q1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(7, 104, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_r = DMDA_Q1;
      goto __pyx_L0;
    }

    /* "PETSc/petscdmda.pxi":105
 *         if itype in ("q0", "Q0"): return DMDA_INTERPOLATION_Q0
 *         if itype in ("q1", "Q1"): return DMDA_INTERPOLATION_Q1
 *         else: raise ValueError("unknown interpolation type: %s" % itype)             # <<<<<<<<<<<<<<
 *     return itype
 * 
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unknown_interpolation_type_s, __pyx_v_itype); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 105, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 105, __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(7, 105, __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(7, 105, __pyx_L1_error)
    }

    /* "PETSc/petscdmda.pxi":102
 * cdef inline PetscDMDAInterpolationType dainterpolationtype(object itype) \
 *     except <PetscDMDAInterpolationType>(-1):
 *     if (isinstance(itype, str)):             # <<<<<<<<<<<<<<
 *         if itype in ("q0", "Q0"): return DMDA_INTERPOLATION_Q0
 *         if itype in ("q1", "Q1"): return DMDA_INTERPOLATION_Q1
 */
  }

  /* "PETSc/petscdmda.pxi":106
 *         if itype in ("q1", "Q1"): return DMDA_INTERPOLATION_Q1
 *         else: raise ValueError("unknown interpolation type: %s" % itype)
 *     return itype             # <<<<<<<<<<<<<<
 * 
 * cdef inline PetscDMDAElementType daelementtype(object etype) \
 */
  __pyx_t_5 = ((DMDAInterpolationType)__Pyx_PyInt_As_DMDAInterpolationType(__pyx_v_itype)); if (unlikely(PyErr_Occurred())) __PYX_ERR(7, 106, __pyx_L1_error)
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":100
 *     elif stype == DMDA_STENCIL_BOX:  return "box"
 * 
 * cdef inline PetscDMDAInterpolationType dainterpolationtype(object itype) \             # <<<<<<<<<<<<<<
 *     except <PetscDMDAInterpolationType>(-1):
 *     if (isinstance(itype, str)):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.dainterpolationtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = ((DMDAInterpolationType)-1L);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":108
 *     return itype
 * 
 * cdef inline PetscDMDAElementType daelementtype(object etype) \             # <<<<<<<<<<<<<<
 *     except <PetscDMDAElementType>(-1):
 *     if (isinstance(etype, str)):
 */

static CYTHON_INLINE DMDAElementType __pyx_f_8petsc4py_5PETSc_daelementtype(PyObject *__pyx_v_etype) {
  DMDAElementType __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  DMDAElementType __pyx_t_5;
  __Pyx_RefNannySetupContext("daelementtype", 0);

  /* "PETSc/petscdmda.pxi":110
 * cdef inline PetscDMDAElementType daelementtype(object etype) \
 *     except <PetscDMDAElementType>(-1):
 *     if (isinstance(etype, str)):             # <<<<<<<<<<<<<<
 *         if etype in ("p1", "P1"): return DMDA_ELEMENT_P1
 *         if etype in ("q1", "Q1"): return DMDA_ELEMENT_Q1
 */
  __pyx_t_1 = PyString_Check(__pyx_v_etype); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscdmda.pxi":111
 *     except <PetscDMDAElementType>(-1):
 *     if (isinstance(etype, str)):
 *         if etype in ("p1", "P1"): return DMDA_ELEMENT_P1             # <<<<<<<<<<<<<<
 *         if etype in ("q1", "Q1"): return DMDA_ELEMENT_Q1
 *         else: raise ValueError("unknown element type: %s" % etype)
 */
    __Pyx_INCREF(__pyx_v_etype);
    __pyx_t_3 = __pyx_v_etype;
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_p1, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(7, 111, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_P1, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(7, 111, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __pyx_r = DMDA_ELEMENT_P1;
      goto __pyx_L0;
    }

    /* "PETSc/petscdmda.pxi":112
 *     if (isinstance(etype, str)):
 *         if etype in ("p1", "P1"): return DMDA_ELEMENT_P1
 *         if etype in ("q1", "Q1"): return DMDA_ELEMENT_Q1             # <<<<<<<<<<<<<<
 *         else: raise ValueError("unknown element type: %s" % etype)
 *     return etype
 */
    __Pyx_INCREF(__pyx_v_etype);
    __pyx_t_3 = __pyx_v_etype;
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_q1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(7, 112, __pyx_L1_error)
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_Q1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(7, 112, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_r = DMDA_ELEMENT_Q1;
      goto __pyx_L0;
    }

    /* "PETSc/petscdmda.pxi":113
 *         if etype in ("p1", "P1"): return DMDA_ELEMENT_P1
 *         if etype in ("q1", "Q1"): return DMDA_ELEMENT_Q1
 *         else: raise ValueError("unknown element type: %s" % etype)             # <<<<<<<<<<<<<<
 *     return etype
 * 
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unknown_element_type_s, __pyx_v_etype); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 113, __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(7, 113, __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(7, 113, __pyx_L1_error)
    }

    /* "PETSc/petscdmda.pxi":110
 * cdef inline PetscDMDAElementType daelementtype(object etype) \
 *     except <PetscDMDAElementType>(-1):
 *     if (isinstance(etype, str)):             # <<<<<<<<<<<<<<
 *         if etype in ("p1", "P1"): return DMDA_ELEMENT_P1
 *         if etype in ("q1", "Q1"): return DMDA_ELEMENT_Q1
 */
  }

  /* "PETSc/petscdmda.pxi":114
 *         if etype in ("q1", "Q1"): return DMDA_ELEMENT_Q1
 *         else: raise ValueError("unknown element type: %s" % etype)
 *     return etype             # <<<<<<<<<<<<<<
 * 
 * cdef inline int DMDAGetDim(PetscDM da, PetscInt *dim) nogil:
 */
  __pyx_t_5 = ((DMDAElementType)__Pyx_PyInt_As_DMDAElementType(__pyx_v_etype)); if (unlikely(PyErr_Occurred())) __PYX_ERR(7, 114, __pyx_L1_error)
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":108
 *     return itype
 * 
 * cdef inline PetscDMDAElementType daelementtype(object etype) \             # <<<<<<<<<<<<<<
 *     except <PetscDMDAElementType>(-1):
 *     if (isinstance(etype, str)):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.daelementtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = ((DMDAElementType)-1L);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":116
 *     return etype
 * 
 * cdef inline int DMDAGetDim(PetscDM da, PetscInt *dim) nogil:             # <<<<<<<<<<<<<<
 *      return DMDAGetInfo(da, dim,
 *                         NULL, NULL, NULL,
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_DMDAGetDim(DM __pyx_v_da, PetscInt *__pyx_v_dim) {
  int __pyx_r;

  /* "PETSc/petscdmda.pxi":117
 * 
 * cdef inline int DMDAGetDim(PetscDM da, PetscInt *dim) nogil:
 *      return DMDAGetInfo(da, dim,             # <<<<<<<<<<<<<<
 *                         NULL, NULL, NULL,
 *                         NULL, NULL, NULL,
 */
  __pyx_r = DMDAGetInfo(__pyx_v_da, __pyx_v_dim, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":116
 *     return etype
 * 
 * cdef inline int DMDAGetDim(PetscDM da, PetscInt *dim) nogil:             # <<<<<<<<<<<<<<
 *      return DMDAGetInfo(da, dim,
 *                         NULL, NULL, NULL,
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":124
 *                         NULL)
 * 
 * cdef inline PetscInt asDims(dims,             # <<<<<<<<<<<<<<
 *                             PetscInt *_M,
 *                             PetscInt *_N,
 */

static CYTHON_INLINE PetscInt __pyx_f_8petsc4py_5PETSc_asDims(PyObject *__pyx_v_dims, PetscInt *__pyx_v__M, PetscInt *__pyx_v__N, PetscInt *__pyx_v__P) {
  PetscInt __pyx_v_dim;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_v_P = 0;
  PetscInt __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PetscInt __pyx_t_8;
  __Pyx_RefNannySetupContext("asDims", 0);
  __Pyx_INCREF(__pyx_v_dims);

  /* "PETSc/petscdmda.pxi":128
 *                             PetscInt *_N,
 *                             PetscInt *_P) except? -1:
 *     cdef PetscInt dim = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *     cdef object M=None, N=None, P=None
 *     dims = tuple(dims)
 */
  __pyx_v_dim = PETSC_DECIDE;

  /* "PETSc/petscdmda.pxi":129
 *                             PetscInt *_P) except? -1:
 *     cdef PetscInt dim = PETSC_DECIDE
 *     cdef object M=None, N=None, P=None             # <<<<<<<<<<<<<<
 *     dims = tuple(dims)
 *     dim = <PetscInt>len(dims)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_M = Py_None;
  __Pyx_INCREF(Py_None);
  __pyx_v_N = Py_None;
  __Pyx_INCREF(Py_None);
  __pyx_v_P = Py_None;

  /* "PETSc/petscdmda.pxi":130
 *     cdef PetscInt dim = PETSC_DECIDE
 *     cdef object M=None, N=None, P=None
 *     dims = tuple(dims)             # <<<<<<<<<<<<<<
 *     dim = <PetscInt>len(dims)
 *     if   dim == 0: pass
 */
  __pyx_t_1 = PySequence_Tuple(__pyx_v_dims); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dims, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscdmda.pxi":131
 *     cdef object M=None, N=None, P=None
 *     dims = tuple(dims)
 *     dim = <PetscInt>len(dims)             # <<<<<<<<<<<<<<
 *     if   dim == 0: pass
 *     elif dim == 1: M, = dims
 */
  __pyx_t_2 = PyObject_Length(__pyx_v_dims); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(7, 131, __pyx_L1_error)
  __pyx_v_dim = ((PetscInt)__pyx_t_2);

  /* "PETSc/petscdmda.pxi":132
 *     dims = tuple(dims)
 *     dim = <PetscInt>len(dims)
 *     if   dim == 0: pass             # <<<<<<<<<<<<<<
 *     elif dim == 1: M, = dims
 *     elif dim == 2: M, N = dims
 */
  switch (__pyx_v_dim) {
    case 0:
    break;

    /* "PETSc/petscdmda.pxi":133
 *     dim = <PetscInt>len(dims)
 *     if   dim == 0: pass
 *     elif dim == 1: M, = dims             # <<<<<<<<<<<<<<
 *     elif dim == 2: M, N = dims
 *     elif dim == 3: M, N, P = dims
 */
    case 1:
    if ((likely(PyTuple_CheckExact(__pyx_v_dims))) || (PyList_CheckExact(__pyx_v_dims))) {
      PyObject* sequence = __pyx_v_dims;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 1)) {
        if (size > 1) __Pyx_RaiseTooManyValuesError(1);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(7, 133, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      }
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 133, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_v_dims); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 133, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 1) < 0) __PYX_ERR(7, 133, __pyx_L1_error)
      __pyx_t_4 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L4_unpacking_done;
      __pyx_L3_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(7, 133, __pyx_L1_error)
      __pyx_L4_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
    __pyx_t_1 = 0;
    break;

    /* "PETSc/petscdmda.pxi":134
 *     if   dim == 0: pass
 *     elif dim == 1: M, = dims
 *     elif dim == 2: M, N = dims             # <<<<<<<<<<<<<<
 *     elif dim == 3: M, N, P = dims
 *     if dim >= 1: _M[0] = asInt(M)
 */
    case 2:
    if ((likely(PyTuple_CheckExact(__pyx_v_dims))) || (PyList_CheckExact(__pyx_v_dims))) {
      PyObject* sequence = __pyx_v_dims;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(7, 134, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_v_dims); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_3 = __pyx_t_4(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_5), 2) < 0) __PYX_ERR(7, 134, __pyx_L1_error)
      __pyx_t_4 = 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_4 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(7, 134, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_3);
    __pyx_t_3 = 0;
    break;

    /* "PETSc/petscdmda.pxi":135
 *     elif dim == 1: M, = dims
 *     elif dim == 2: M, N = dims
 *     elif dim == 3: M, N, P = dims             # <<<<<<<<<<<<<<
 *     if dim >= 1: _M[0] = asInt(M)
 *     if dim >= 2: _N[0] = asInt(N)
 */
    case 3:
    if ((likely(PyTuple_CheckExact(__pyx_v_dims))) || (PyList_CheckExact(__pyx_v_dims))) {
      PyObject* sequence = __pyx_v_dims;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(7, 135, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 135, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 135, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 135, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_v_dims); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 135, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_4(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 2; __pyx_t_5 = __pyx_t_4(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_6), 3) < 0) __PYX_ERR(7, 135, __pyx_L1_error)
      __pyx_t_4 = 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_4 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(7, 135, __pyx_L1_error)
      __pyx_L8_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_5);
    __pyx_t_5 = 0;
    break;
    default: break;
  }

  /* "PETSc/petscdmda.pxi":136
 *     elif dim == 2: M, N = dims
 *     elif dim == 3: M, N, P = dims
 *     if dim >= 1: _M[0] = asInt(M)             # <<<<<<<<<<<<<<
 *     if dim >= 2: _N[0] = asInt(N)
 *     if dim >= 3: _P[0] = asInt(P)
 */
  __pyx_t_7 = ((__pyx_v_dim >= 1) != 0);
  if (__pyx_t_7) {
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_M); if (unlikely(__pyx_t_8 == -1L && PyErr_Occurred())) __PYX_ERR(7, 136, __pyx_L1_error)
    (__pyx_v__M[0]) = __pyx_t_8;
  }

  /* "PETSc/petscdmda.pxi":137
 *     elif dim == 3: M, N, P = dims
 *     if dim >= 1: _M[0] = asInt(M)
 *     if dim >= 2: _N[0] = asInt(N)             # <<<<<<<<<<<<<<
 *     if dim >= 3: _P[0] = asInt(P)
 *     return dim
 */
  __pyx_t_7 = ((__pyx_v_dim >= 2) != 0);
  if (__pyx_t_7) {
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_N); if (unlikely(__pyx_t_8 == -1L && PyErr_Occurred())) __PYX_ERR(7, 137, __pyx_L1_error)
    (__pyx_v__N[0]) = __pyx_t_8;
  }

  /* "PETSc/petscdmda.pxi":138
 *     if dim >= 1: _M[0] = asInt(M)
 *     if dim >= 2: _N[0] = asInt(N)
 *     if dim >= 3: _P[0] = asInt(P)             # <<<<<<<<<<<<<<
 *     return dim
 * 
 */
  __pyx_t_7 = ((__pyx_v_dim >= 3) != 0);
  if (__pyx_t_7) {
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_P); if (unlikely(__pyx_t_8 == -1L && PyErr_Occurred())) __PYX_ERR(7, 138, __pyx_L1_error)
    (__pyx_v__P[0]) = __pyx_t_8;
  }

  /* "PETSc/petscdmda.pxi":139
 *     if dim >= 2: _N[0] = asInt(N)
 *     if dim >= 3: _P[0] = asInt(P)
 *     return dim             # <<<<<<<<<<<<<<
 * 
 * cdef inline tuple toDims(PetscInt dim,
 */
  __pyx_r = __pyx_v_dim;
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":124
 *                         NULL)
 * 
 * cdef inline PetscInt asDims(dims,             # <<<<<<<<<<<<<<
 *                             PetscInt *_M,
 *                             PetscInt *_N,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.asDims", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1L;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_dims);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":141
 *     return dim
 * 
 * cdef inline tuple toDims(PetscInt dim,             # <<<<<<<<<<<<<<
 *                          PetscInt M,
 *                          PetscInt N,
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toDims(PetscInt __pyx_v_dim, PetscInt __pyx_v_M, PetscInt __pyx_v_N, PetscInt __pyx_v_P) {
  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_RefNannySetupContext("toDims", 0);

  /* "PETSc/petscdmda.pxi":145
 *                          PetscInt N,
 *                          PetscInt P):
 *     if   dim == 0: return ()             # <<<<<<<<<<<<<<
 *     elif dim == 1: return (toInt(M),)
 *     elif dim == 2: return (toInt(M), toInt(N))
 */
  switch (__pyx_v_dim) {
    case 0:
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    goto __pyx_L0;
    break;

    /* "PETSc/petscdmda.pxi":146
 *                          PetscInt P):
 *     if   dim == 0: return ()
 *     elif dim == 1: return (toInt(M),)             # <<<<<<<<<<<<<<
 *     elif dim == 2: return (toInt(M), toInt(N))
 *     elif dim == 3: return (toInt(M), toInt(N), toInt(P))
 */
    case 1:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_M); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 146, __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_r = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;

    /* "PETSc/petscdmda.pxi":147
 *     if   dim == 0: return ()
 *     elif dim == 1: return (toInt(M),)
 *     elif dim == 2: return (toInt(M), toInt(N))             # <<<<<<<<<<<<<<
 *     elif dim == 3: return (toInt(M), toInt(N), toInt(P))
 * 
 */
    case 2:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_M); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 147, __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_1);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_1 = 0;
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "PETSc/petscdmda.pxi":148
 *     elif dim == 1: return (toInt(M),)
 *     elif dim == 2: return (toInt(M), toInt(N))
 *     elif dim == 3: return (toInt(M), toInt(N), toInt(P))             # <<<<<<<<<<<<<<
 * 
 * cdef inline tuple asOwnershipRanges(object ownership_ranges,
 */
    case 3:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_M); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_P); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 148, __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_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
    break;
    default: break;
  }

  /* "PETSc/petscdmda.pxi":141
 *     return dim
 * 
 * cdef inline tuple toDims(PetscInt dim,             # <<<<<<<<<<<<<<
 *                          PetscInt M,
 *                          PetscInt N,
 */

  /* function exit code */
  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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("petsc4py.PETSc.toDims", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":150
 *     elif dim == 3: return (toInt(M), toInt(N), toInt(P))
 * 
 * cdef inline tuple asOwnershipRanges(object ownership_ranges,             # <<<<<<<<<<<<<<
 *                                     PetscInt dim,
 *                                     PetscInt *m, PetscInt *n, PetscInt *p,
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_asOwnershipRanges(PyObject *__pyx_v_ownership_ranges, PetscInt __pyx_v_dim, PetscInt *__pyx_v_m, PetscInt *__pyx_v_n, PetscInt *__pyx_v_p, PetscInt **__pyx_v__x, PetscInt **__pyx_v__y, PetscInt **__pyx_v__z) {
  PyObject *__pyx_v_ranges = 0;
  PetscInt __pyx_v_rdim;
  PetscInt __pyx_v_nlx;
  PetscInt __pyx_v_nly;
  PetscInt __pyx_v_nlz;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("asOwnershipRanges", 0);

  /* "PETSc/petscdmda.pxi":156
 *                                     PetscInt **_y,
 *                                     PetscInt **_z):
 *     cdef object ranges = list(ownership_ranges)             # <<<<<<<<<<<<<<
 *     cdef PetscInt rdim = <PetscInt>len(ranges)
 *     cdef PetscInt nlx=0, nly=0, nlz=0
 */
  __pyx_t_1 = PySequence_List(__pyx_v_ownership_ranges); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ranges = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscdmda.pxi":157
 *                                     PetscInt **_z):
 *     cdef object ranges = list(ownership_ranges)
 *     cdef PetscInt rdim = <PetscInt>len(ranges)             # <<<<<<<<<<<<<<
 *     cdef PetscInt nlx=0, nly=0, nlz=0
 *     if dim == PETSC_DECIDE: dim = rdim
 */
  __pyx_t_2 = PyObject_Length(__pyx_v_ranges); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(7, 157, __pyx_L1_error)
  __pyx_v_rdim = ((PetscInt)__pyx_t_2);

  /* "PETSc/petscdmda.pxi":158
 *     cdef object ranges = list(ownership_ranges)
 *     cdef PetscInt rdim = <PetscInt>len(ranges)
 *     cdef PetscInt nlx=0, nly=0, nlz=0             # <<<<<<<<<<<<<<
 *     if dim == PETSC_DECIDE: dim = rdim
 *     elif dim != rdim: raise ValueError(
 */
  __pyx_v_nlx = 0;
  __pyx_v_nly = 0;
  __pyx_v_nlz = 0;

  /* "PETSc/petscdmda.pxi":159
 *     cdef PetscInt rdim = <PetscInt>len(ranges)
 *     cdef PetscInt nlx=0, nly=0, nlz=0
 *     if dim == PETSC_DECIDE: dim = rdim             # <<<<<<<<<<<<<<
 *     elif dim != rdim: raise ValueError(
 *         "number of dimensions %d and number ownership ranges %d" %
 */
  __pyx_t_3 = ((__pyx_v_dim == PETSC_DECIDE) != 0);
  if (__pyx_t_3) {
    __pyx_v_dim = __pyx_v_rdim;
    goto __pyx_L3;
  }

  /* "PETSc/petscdmda.pxi":160
 *     cdef PetscInt nlx=0, nly=0, nlz=0
 *     if dim == PETSC_DECIDE: dim = rdim
 *     elif dim != rdim: raise ValueError(             # <<<<<<<<<<<<<<
 *         "number of dimensions %d and number ownership ranges %d" %
 *         (toInt(dim), toInt(rdim)))
 */
  __pyx_t_3 = ((__pyx_v_dim != __pyx_v_rdim) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscdmda.pxi":162
 *     elif dim != rdim: raise ValueError(
 *         "number of dimensions %d and number ownership ranges %d" %
 *         (toInt(dim), toInt(rdim)))             # <<<<<<<<<<<<<<
 *     if dim >= 1:
 *         ranges[0] = iarray_i(ranges[0], &nlx, _x)
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_rdim); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 162, __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_t_1 = 0;
    __pyx_t_4 = 0;

    /* "PETSc/petscdmda.pxi":161
 *     if dim == PETSC_DECIDE: dim = rdim
 *     elif dim != rdim: raise ValueError(
 *         "number of dimensions %d and number ownership ranges %d" %             # <<<<<<<<<<<<<<
 *         (toInt(dim), toInt(rdim)))
 *     if dim >= 1:
 */
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_number_of_dimensions_d_and_numbe, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/petscdmda.pxi":160
 *     cdef PetscInt nlx=0, nly=0, nlz=0
 *     if dim == PETSC_DECIDE: dim = rdim
 *     elif dim != rdim: raise ValueError(             # <<<<<<<<<<<<<<
 *         "number of dimensions %d and number ownership ranges %d" %
 *         (toInt(dim), toInt(rdim)))
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 160, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 160, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(7, 160, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/petscdmda.pxi":163
 *         "number of dimensions %d and number ownership ranges %d" %
 *         (toInt(dim), toInt(rdim)))
 *     if dim >= 1:             # <<<<<<<<<<<<<<
 *         ranges[0] = iarray_i(ranges[0], &nlx, _x)
 *         if m[0] == PETSC_DECIDE: m[0] = nlx
 */
  __pyx_t_3 = ((__pyx_v_dim >= 1) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscdmda.pxi":164
 *         (toInt(dim), toInt(rdim)))
 *     if dim >= 1:
 *         ranges[0] = iarray_i(ranges[0], &nlx, _x)             # <<<<<<<<<<<<<<
 *         if m[0] == PETSC_DECIDE: m[0] = nlx
 *         elif m[0] != nlx: raise ValueError(
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_ranges, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_t_4, (&__pyx_v_nlx), __pyx_v__x)); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__Pyx_SetItemInt(__pyx_v_ranges, 0, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(7, 164, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/petscdmda.pxi":165
 *     if dim >= 1:
 *         ranges[0] = iarray_i(ranges[0], &nlx, _x)
 *         if m[0] == PETSC_DECIDE: m[0] = nlx             # <<<<<<<<<<<<<<
 *         elif m[0] != nlx: raise ValueError(
 *             "ownership range size %d and number or processors %d" %
 */
    __pyx_t_3 = (((__pyx_v_m[0]) == PETSC_DECIDE) != 0);
    if (__pyx_t_3) {
      (__pyx_v_m[0]) = __pyx_v_nlx;
      goto __pyx_L5;
    }

    /* "PETSc/petscdmda.pxi":166
 *         ranges[0] = iarray_i(ranges[0], &nlx, _x)
 *         if m[0] == PETSC_DECIDE: m[0] = nlx
 *         elif m[0] != nlx: raise ValueError(             # <<<<<<<<<<<<<<
 *             "ownership range size %d and number or processors %d" %
 *             (toInt(nlx), toInt(m[0])))
 */
    __pyx_t_3 = (((__pyx_v_m[0]) != __pyx_v_nlx) != 0);
    if (__pyx_t_3) {

      /* "PETSc/petscdmda.pxi":168
 *         elif m[0] != nlx: raise ValueError(
 *             "ownership range size %d and number or processors %d" %
 *             (toInt(nlx), toInt(m[0])))             # <<<<<<<<<<<<<<
 *     if dim >= 2:
 *         ranges[1] = iarray_i(ranges[1], &nly, _y)
 */
      __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nlx); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 168, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_m[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 168, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 168, __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;

      /* "PETSc/petscdmda.pxi":167
 *         if m[0] == PETSC_DECIDE: m[0] = nlx
 *         elif m[0] != nlx: raise ValueError(
 *             "ownership range size %d and number or processors %d" %             # <<<<<<<<<<<<<<
 *             (toInt(nlx), toInt(m[0])))
 *     if dim >= 2:
 */
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_ownership_range_size_d_and_numbe, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "PETSc/petscdmda.pxi":166
 *         ranges[0] = iarray_i(ranges[0], &nlx, _x)
 *         if m[0] == PETSC_DECIDE: m[0] = nlx
 *         elif m[0] != nlx: raise ValueError(             # <<<<<<<<<<<<<<
 *             "ownership range size %d and number or processors %d" %
 *             (toInt(nlx), toInt(m[0])))
 */
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 166, __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 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 166, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(7, 166, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "PETSc/petscdmda.pxi":163
 *         "number of dimensions %d and number ownership ranges %d" %
 *         (toInt(dim), toInt(rdim)))
 *     if dim >= 1:             # <<<<<<<<<<<<<<
 *         ranges[0] = iarray_i(ranges[0], &nlx, _x)
 *         if m[0] == PETSC_DECIDE: m[0] = nlx
 */
  }

  /* "PETSc/petscdmda.pxi":169
 *             "ownership range size %d and number or processors %d" %
 *             (toInt(nlx), toInt(m[0])))
 *     if dim >= 2:             # <<<<<<<<<<<<<<
 *         ranges[1] = iarray_i(ranges[1], &nly, _y)
 *         if n[0] == PETSC_DECIDE: n[0] = nly
 */
  __pyx_t_3 = ((__pyx_v_dim >= 2) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscdmda.pxi":170
 *             (toInt(nlx), toInt(m[0])))
 *     if dim >= 2:
 *         ranges[1] = iarray_i(ranges[1], &nly, _y)             # <<<<<<<<<<<<<<
 *         if n[0] == PETSC_DECIDE: n[0] = nly
 *         elif n[0] != nly: raise ValueError(
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_ranges, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_t_4, (&__pyx_v_nly), __pyx_v__y)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__Pyx_SetItemInt(__pyx_v_ranges, 1, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(7, 170, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PETSc/petscdmda.pxi":171
 *     if dim >= 2:
 *         ranges[1] = iarray_i(ranges[1], &nly, _y)
 *         if n[0] == PETSC_DECIDE: n[0] = nly             # <<<<<<<<<<<<<<
 *         elif n[0] != nly: raise ValueError(
 *             "ownership range size %d and number or processors %d" %
 */
    __pyx_t_3 = (((__pyx_v_n[0]) == PETSC_DECIDE) != 0);
    if (__pyx_t_3) {
      (__pyx_v_n[0]) = __pyx_v_nly;
      goto __pyx_L7;
    }

    /* "PETSc/petscdmda.pxi":172
 *         ranges[1] = iarray_i(ranges[1], &nly, _y)
 *         if n[0] == PETSC_DECIDE: n[0] = nly
 *         elif n[0] != nly: raise ValueError(             # <<<<<<<<<<<<<<
 *             "ownership range size %d and number or processors %d" %
 *             (toInt(nly), toInt(n[0])))
 */
    __pyx_t_3 = (((__pyx_v_n[0]) != __pyx_v_nly) != 0);
    if (__pyx_t_3) {

      /* "PETSc/petscdmda.pxi":174
 *         elif n[0] != nly: raise ValueError(
 *             "ownership range size %d and number or processors %d" %
 *             (toInt(nly), toInt(n[0])))             # <<<<<<<<<<<<<<
 *     if dim >= 3:
 *         ranges[2] = iarray_i(ranges[2], &nlz, _z)
 */
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nly); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_n[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 174, __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_t_1 = 0;
      __pyx_t_4 = 0;

      /* "PETSc/petscdmda.pxi":173
 *         if n[0] == PETSC_DECIDE: n[0] = nly
 *         elif n[0] != nly: raise ValueError(
 *             "ownership range size %d and number or processors %d" %             # <<<<<<<<<<<<<<
 *             (toInt(nly), toInt(n[0])))
 *     if dim >= 3:
 */
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_ownership_range_size_d_and_numbe, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 173, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "PETSc/petscdmda.pxi":172
 *         ranges[1] = iarray_i(ranges[1], &nly, _y)
 *         if n[0] == PETSC_DECIDE: n[0] = nly
 *         elif n[0] != nly: raise ValueError(             # <<<<<<<<<<<<<<
 *             "ownership range size %d and number or processors %d" %
 *             (toInt(nly), toInt(n[0])))
 */
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 172, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(7, 172, __pyx_L1_error)
    }
    __pyx_L7:;

    /* "PETSc/petscdmda.pxi":169
 *             "ownership range size %d and number or processors %d" %
 *             (toInt(nlx), toInt(m[0])))
 *     if dim >= 2:             # <<<<<<<<<<<<<<
 *         ranges[1] = iarray_i(ranges[1], &nly, _y)
 *         if n[0] == PETSC_DECIDE: n[0] = nly
 */
  }

  /* "PETSc/petscdmda.pxi":175
 *             "ownership range size %d and number or processors %d" %
 *             (toInt(nly), toInt(n[0])))
 *     if dim >= 3:             # <<<<<<<<<<<<<<
 *         ranges[2] = iarray_i(ranges[2], &nlz, _z)
 *         if p[0] == PETSC_DECIDE: p[0] = nlz
 */
  __pyx_t_3 = ((__pyx_v_dim >= 3) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscdmda.pxi":176
 *             (toInt(nly), toInt(n[0])))
 *     if dim >= 3:
 *         ranges[2] = iarray_i(ranges[2], &nlz, _z)             # <<<<<<<<<<<<<<
 *         if p[0] == PETSC_DECIDE: p[0] = nlz
 *         elif p[0] != nlz: raise ValueError(
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_ranges, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 176, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_t_4, (&__pyx_v_nlz), __pyx_v__z)); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 176, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__Pyx_SetItemInt(__pyx_v_ranges, 2, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(7, 176, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/petscdmda.pxi":177
 *     if dim >= 3:
 *         ranges[2] = iarray_i(ranges[2], &nlz, _z)
 *         if p[0] == PETSC_DECIDE: p[0] = nlz             # <<<<<<<<<<<<<<
 *         elif p[0] != nlz: raise ValueError(
 *             "ownership range size %d and number or processors %d" %
 */
    __pyx_t_3 = (((__pyx_v_p[0]) == PETSC_DECIDE) != 0);
    if (__pyx_t_3) {
      (__pyx_v_p[0]) = __pyx_v_nlz;
      goto __pyx_L9;
    }

    /* "PETSc/petscdmda.pxi":178
 *         ranges[2] = iarray_i(ranges[2], &nlz, _z)
 *         if p[0] == PETSC_DECIDE: p[0] = nlz
 *         elif p[0] != nlz: raise ValueError(             # <<<<<<<<<<<<<<
 *             "ownership range size %d and number or processors %d" %
 *              (toInt(nlz), toInt(p[0])))
 */
    __pyx_t_3 = (((__pyx_v_p[0]) != __pyx_v_nlz) != 0);
    if (__pyx_t_3) {

      /* "PETSc/petscdmda.pxi":180
 *         elif p[0] != nlz: raise ValueError(
 *             "ownership range size %d and number or processors %d" %
 *              (toInt(nlz), toInt(p[0])))             # <<<<<<<<<<<<<<
 *     return ranges
 * 
 */
      __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nlz); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_p[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 180, __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;

      /* "PETSc/petscdmda.pxi":179
 *         if p[0] == PETSC_DECIDE: p[0] = nlz
 *         elif p[0] != nlz: raise ValueError(
 *             "ownership range size %d and number or processors %d" %             # <<<<<<<<<<<<<<
 *              (toInt(nlz), toInt(p[0])))
 *     return ranges
 */
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_ownership_range_size_d_and_numbe, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 179, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "PETSc/petscdmda.pxi":178
 *         ranges[2] = iarray_i(ranges[2], &nlz, _z)
 *         if p[0] == PETSC_DECIDE: p[0] = nlz
 *         elif p[0] != nlz: raise ValueError(             # <<<<<<<<<<<<<<
 *             "ownership range size %d and number or processors %d" %
 *              (toInt(nlz), toInt(p[0])))
 */
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 178, __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 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(7, 178, __pyx_L1_error)
    }
    __pyx_L9:;

    /* "PETSc/petscdmda.pxi":175
 *             "ownership range size %d and number or processors %d" %
 *             (toInt(nly), toInt(n[0])))
 *     if dim >= 3:             # <<<<<<<<<<<<<<
 *         ranges[2] = iarray_i(ranges[2], &nlz, _z)
 *         if p[0] == PETSC_DECIDE: p[0] = nlz
 */
  }

  /* "PETSc/petscdmda.pxi":181
 *             "ownership range size %d and number or processors %d" %
 *              (toInt(nlz), toInt(p[0])))
 *     return ranges             # <<<<<<<<<<<<<<
 * 
 * cdef inline tuple toOwnershipRanges(PetscInt dim,
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(PyTuple_CheckExact(__pyx_v_ranges))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_ranges)->tp_name), 0))) __PYX_ERR(7, 181, __pyx_L1_error)
  __Pyx_INCREF(__pyx_v_ranges);
  __pyx_r = ((PyObject*)__pyx_v_ranges);
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":150
 *     elif dim == 3: return (toInt(M), toInt(N), toInt(P))
 * 
 * cdef inline tuple asOwnershipRanges(object ownership_ranges,             # <<<<<<<<<<<<<<
 *                                     PetscInt dim,
 *                                     PetscInt *m, PetscInt *n, PetscInt *p,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.asOwnershipRanges", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ranges);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":183
 *     return ranges
 * 
 * cdef inline tuple toOwnershipRanges(PetscInt dim,             # <<<<<<<<<<<<<<
 *                                     PetscInt m, PetscInt n, PetscInt p,
 *                                     const_PetscInt *lx,
 */

static CYTHON_INLINE PyObject *__pyx_f_8petsc4py_5PETSc_toOwnershipRanges(PetscInt __pyx_v_dim, PetscInt __pyx_v_m, PetscInt __pyx_v_n, PetscInt __pyx_v_p, const PetscInt *__pyx_v_lx, const PetscInt *__pyx_v_ly, const PetscInt *__pyx_v_lz) {
  PyObject *__pyx_v_ranges = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("toOwnershipRanges", 0);

  /* "PETSc/petscdmda.pxi":189
 *                                     const_PetscInt *lz):
 *     # Returns tuple of arrays containing ownership ranges as Python arrays
 *     ranges = [array_i(m, lx)]             # <<<<<<<<<<<<<<
 *     if dim > 1:
 *         ranges.append(array_i(n, ly))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_m, __pyx_v_lx)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_ranges = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmda.pxi":190
 *     # Returns tuple of arrays containing ownership ranges as Python arrays
 *     ranges = [array_i(m, lx)]
 *     if dim > 1:             # <<<<<<<<<<<<<<
 *         ranges.append(array_i(n, ly))
 *     if dim > 2:
 */
  __pyx_t_3 = ((__pyx_v_dim > 1) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscdmda.pxi":191
 *     ranges = [array_i(m, lx)]
 *     if dim > 1:
 *         ranges.append(array_i(n, ly))             # <<<<<<<<<<<<<<
 *     if dim > 2:
 *         ranges.append(array_i(p, lz))
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_n, __pyx_v_ly)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_ranges, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(7, 191, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "PETSc/petscdmda.pxi":190
 *     # Returns tuple of arrays containing ownership ranges as Python arrays
 *     ranges = [array_i(m, lx)]
 *     if dim > 1:             # <<<<<<<<<<<<<<
 *         ranges.append(array_i(n, ly))
 *     if dim > 2:
 */
  }

  /* "PETSc/petscdmda.pxi":192
 *     if dim > 1:
 *         ranges.append(array_i(n, ly))
 *     if dim > 2:             # <<<<<<<<<<<<<<
 *         ranges.append(array_i(p, lz))
 *     return tuple(ranges)
 */
  __pyx_t_3 = ((__pyx_v_dim > 2) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscdmda.pxi":193
 *         ranges.append(array_i(n, ly))
 *     if dim > 2:
 *         ranges.append(array_i(p, lz))             # <<<<<<<<<<<<<<
 *     return tuple(ranges)
 * 
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_p, __pyx_v_lz)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_ranges, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(7, 193, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "PETSc/petscdmda.pxi":192
 *     if dim > 1:
 *         ranges.append(array_i(n, ly))
 *     if dim > 2:             # <<<<<<<<<<<<<<
 *         ranges.append(array_i(p, lz))
 *     return tuple(ranges)
 */
  }

  /* "PETSc/petscdmda.pxi":194
 *     if dim > 2:
 *         ranges.append(array_i(p, lz))
 *     return tuple(ranges)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_AsTuple(__pyx_v_ranges); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":183
 *     return ranges
 * 
 * cdef inline tuple toOwnershipRanges(PetscInt dim,             # <<<<<<<<<<<<<<
 *                                     PetscInt m, PetscInt n, PetscInt p,
 *                                     const_PetscInt *lx,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.toOwnershipRanges", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ranges);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":205
 *     cdef readonly ndarray array
 * 
 *     def __cinit__(self, DMDA da not None, Vec vec not None, bint DOF=False):             # <<<<<<<<<<<<<<
 *         #
 *         cdef PetscInt dim=0, dof=0
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_da = 0;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  int __pyx_v_DOF;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_da,&__pyx_n_s_vec,&__pyx_n_s_DOF,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_da)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(7, 205, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DOF);
          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(7, 205, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_da = ((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)values[0]);
    __pyx_v_vec = ((struct PyPetscVecObject *)values[1]);
    if (values[2]) {
      __pyx_v_DOF = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_DOF == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 205, __pyx_L3_error)
    } else {
      __pyx_v_DOF = ((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(7, 205, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._DMDA_Vec_array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_da), __pyx_ptype_8petsc4py_5PETSc_DMDA, 0, "da", 0))) __PYX_ERR(7, 205, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(7, 205, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array___cinit__(((struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self), __pyx_v_da, __pyx_v_vec, __pyx_v_DOF);

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

static int __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array___cinit__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self, struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_da, struct PyPetscVecObject *__pyx_v_vec, int __pyx_v_DOF) {
  PetscInt __pyx_v_dim;
  PetscInt __pyx_v_dof;
  PetscInt __pyx_v_lxs;
  PetscInt __pyx_v_lys;
  PetscInt __pyx_v_lzs;
  PetscInt __pyx_v_lxm;
  PetscInt __pyx_v_lym;
  PetscInt __pyx_v_lzm;
  PetscInt __pyx_v_gxs;
  PetscInt __pyx_v_gys;
  PetscInt __pyx_v_gzs;
  PetscInt __pyx_v_gxm;
  PetscInt __pyx_v_gym;
  PetscInt __pyx_v_gzm;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_xs;
  PetscInt __pyx_v_ys;
  PetscInt __pyx_v_zs;
  PetscInt __pyx_v_xm;
  PetscInt __pyx_v_ym;
  PetscInt __pyx_v_zm;
  PyObject *__pyx_v_starts = 0;
  PyObject *__pyx_v_sizes = 0;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_f;
  Py_ssize_t __pyx_v_d;
  PyObject *__pyx_v_shape = 0;
  PyObject *__pyx_v_strides = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscInt __pyx_t_3;
  PetscInt __pyx_t_4;
  PetscInt __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;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/petscdmda.pxi":207
 *     def __cinit__(self, DMDA da not None, Vec vec not None, bint DOF=False):
 *         #
 *         cdef PetscInt dim=0, dof=0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetInfo(da.dm,
 *                             &dim, NULL, NULL, NULL, NULL, NULL, NULL,
 */
  __pyx_v_dim = 0;
  __pyx_v_dof = 0;

  /* "PETSc/petscdmda.pxi":208
 *         #
 *         cdef PetscInt dim=0, dof=0
 *         CHKERR( DMDAGetInfo(da.dm,             # <<<<<<<<<<<<<<
 *                             &dim, NULL, NULL, NULL, NULL, NULL, NULL,
 *                             &dof, NULL, NULL, NULL, NULL, NULL) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetInfo(__pyx_v_da->__pyx_base.dm, (&__pyx_v_dim), NULL, NULL, NULL, NULL, NULL, NULL, (&__pyx_v_dof), NULL, NULL, NULL, NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(7, 208, __pyx_L1_error)

  /* "PETSc/petscdmda.pxi":211
 *                             &dim, NULL, NULL, NULL, NULL, NULL, NULL,
 *                             &dof, NULL, NULL, NULL, NULL, NULL) )
 *         cdef PetscInt lxs=0, lys=0, lzs=0             # <<<<<<<<<<<<<<
 *         cdef PetscInt lxm=0, lym=0, lzm=0
 *         CHKERR( DMDAGetCorners(da.dm,
 */
  __pyx_v_lxs = 0;
  __pyx_v_lys = 0;
  __pyx_v_lzs = 0;

  /* "PETSc/petscdmda.pxi":212
 *                             &dof, NULL, NULL, NULL, NULL, NULL) )
 *         cdef PetscInt lxs=0, lys=0, lzs=0
 *         cdef PetscInt lxm=0, lym=0, lzm=0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetCorners(da.dm,
 *                                &lxs, &lys, &lzs,
 */
  __pyx_v_lxm = 0;
  __pyx_v_lym = 0;
  __pyx_v_lzm = 0;

  /* "PETSc/petscdmda.pxi":213
 *         cdef PetscInt lxs=0, lys=0, lzs=0
 *         cdef PetscInt lxm=0, lym=0, lzm=0
 *         CHKERR( DMDAGetCorners(da.dm,             # <<<<<<<<<<<<<<
 *                                &lxs, &lys, &lzs,
 *                                &lxm, &lym, &lzm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetCorners(__pyx_v_da->__pyx_base.dm, (&__pyx_v_lxs), (&__pyx_v_lys), (&__pyx_v_lzs), (&__pyx_v_lxm), (&__pyx_v_lym), (&__pyx_v_lzm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(7, 213, __pyx_L1_error)

  /* "PETSc/petscdmda.pxi":216
 *                                &lxs, &lys, &lzs,
 *                                &lxm, &lym, &lzm) )
 *         cdef PetscInt gxs=0, gys=0, gzs=0             # <<<<<<<<<<<<<<
 *         cdef PetscInt gxm=0, gym=0, gzm=0
 *         CHKERR( DMDAGetGhostCorners(da.dm,
 */
  __pyx_v_gxs = 0;
  __pyx_v_gys = 0;
  __pyx_v_gzs = 0;

  /* "PETSc/petscdmda.pxi":217
 *                                &lxm, &lym, &lzm) )
 *         cdef PetscInt gxs=0, gys=0, gzs=0
 *         cdef PetscInt gxm=0, gym=0, gzm=0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetGhostCorners(da.dm,
 *                                     &gxs, &gys, &gzs,
 */
  __pyx_v_gxm = 0;
  __pyx_v_gym = 0;
  __pyx_v_gzm = 0;

  /* "PETSc/petscdmda.pxi":218
 *         cdef PetscInt gxs=0, gys=0, gzs=0
 *         cdef PetscInt gxm=0, gym=0, gzm=0
 *         CHKERR( DMDAGetGhostCorners(da.dm,             # <<<<<<<<<<<<<<
 *                                     &gxs, &gys, &gzs,
 *                                     &gxm, &gym, &gzm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetGhostCorners(__pyx_v_da->__pyx_base.dm, (&__pyx_v_gxs), (&__pyx_v_gys), (&__pyx_v_gzs), (&__pyx_v_gxm), (&__pyx_v_gym), (&__pyx_v_gzm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(7, 218, __pyx_L1_error)

  /* "PETSc/petscdmda.pxi":222
 *                                     &gxm, &gym, &gzm) )
 *         #
 *         cdef PetscInt n=0             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetLocalSize(vec.vec, &n) )
 *         cdef PetscInt xs, ys, zs, xm, ym, zm
 */
  __pyx_v_n = 0;

  /* "PETSc/petscdmda.pxi":223
 *         #
 *         cdef PetscInt n=0
 *         CHKERR( VecGetLocalSize(vec.vec, &n) )             # <<<<<<<<<<<<<<
 *         cdef PetscInt xs, ys, zs, xm, ym, zm
 *         if (n == lxm*lym*lzm*dof):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetLocalSize(__pyx_v_vec->vec, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(7, 223, __pyx_L1_error)

  /* "PETSc/petscdmda.pxi":225
 *         CHKERR( VecGetLocalSize(vec.vec, &n) )
 *         cdef PetscInt xs, ys, zs, xm, ym, zm
 *         if (n == lxm*lym*lzm*dof):             # <<<<<<<<<<<<<<
 *             xs, ys, zs = lxs, lys, lzs
 *             xm, ym, zm = lxm, lym, lzm
 */
  __pyx_t_2 = ((__pyx_v_n == (((__pyx_v_lxm * __pyx_v_lym) * __pyx_v_lzm) * __pyx_v_dof)) != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscdmda.pxi":226
 *         cdef PetscInt xs, ys, zs, xm, ym, zm
 *         if (n == lxm*lym*lzm*dof):
 *             xs, ys, zs = lxs, lys, lzs             # <<<<<<<<<<<<<<
 *             xm, ym, zm = lxm, lym, lzm
 *         elif (n == gxm*gym*gzm*dof):
 */
    __pyx_t_3 = __pyx_v_lxs;
    __pyx_t_4 = __pyx_v_lys;
    __pyx_t_5 = __pyx_v_lzs;
    __pyx_v_xs = __pyx_t_3;
    __pyx_v_ys = __pyx_t_4;
    __pyx_v_zs = __pyx_t_5;

    /* "PETSc/petscdmda.pxi":227
 *         if (n == lxm*lym*lzm*dof):
 *             xs, ys, zs = lxs, lys, lzs
 *             xm, ym, zm = lxm, lym, lzm             # <<<<<<<<<<<<<<
 *         elif (n == gxm*gym*gzm*dof):
 *             xs, ys, zs = gxs, gys, gzs
 */
    __pyx_t_5 = __pyx_v_lxm;
    __pyx_t_4 = __pyx_v_lym;
    __pyx_t_3 = __pyx_v_lzm;
    __pyx_v_xm = __pyx_t_5;
    __pyx_v_ym = __pyx_t_4;
    __pyx_v_zm = __pyx_t_3;

    /* "PETSc/petscdmda.pxi":225
 *         CHKERR( VecGetLocalSize(vec.vec, &n) )
 *         cdef PetscInt xs, ys, zs, xm, ym, zm
 *         if (n == lxm*lym*lzm*dof):             # <<<<<<<<<<<<<<
 *             xs, ys, zs = lxs, lys, lzs
 *             xm, ym, zm = lxm, lym, lzm
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscdmda.pxi":228
 *             xs, ys, zs = lxs, lys, lzs
 *             xm, ym, zm = lxm, lym, lzm
 *         elif (n == gxm*gym*gzm*dof):             # <<<<<<<<<<<<<<
 *             xs, ys, zs = gxs, gys, gzs
 *             xm, ym, zm = gxm, gym, gzm
 */
  __pyx_t_2 = ((__pyx_v_n == (((__pyx_v_gxm * __pyx_v_gym) * __pyx_v_gzm) * __pyx_v_dof)) != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscdmda.pxi":229
 *             xm, ym, zm = lxm, lym, lzm
 *         elif (n == gxm*gym*gzm*dof):
 *             xs, ys, zs = gxs, gys, gzs             # <<<<<<<<<<<<<<
 *             xm, ym, zm = gxm, gym, gzm
 *         else:
 */
    __pyx_t_3 = __pyx_v_gxs;
    __pyx_t_4 = __pyx_v_gys;
    __pyx_t_5 = __pyx_v_gzs;
    __pyx_v_xs = __pyx_t_3;
    __pyx_v_ys = __pyx_t_4;
    __pyx_v_zs = __pyx_t_5;

    /* "PETSc/petscdmda.pxi":230
 *         elif (n == gxm*gym*gzm*dof):
 *             xs, ys, zs = gxs, gys, gzs
 *             xm, ym, zm = gxm, gym, gzm             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError(
 */
    __pyx_t_5 = __pyx_v_gxm;
    __pyx_t_4 = __pyx_v_gym;
    __pyx_t_3 = __pyx_v_gzm;
    __pyx_v_xm = __pyx_t_5;
    __pyx_v_ym = __pyx_t_4;
    __pyx_v_zm = __pyx_t_3;

    /* "PETSc/petscdmda.pxi":228
 *             xs, ys, zs = lxs, lys, lzs
 *             xm, ym, zm = lxm, lym, lzm
 *         elif (n == gxm*gym*gzm*dof):             # <<<<<<<<<<<<<<
 *             xs, ys, zs = gxs, gys, gzs
 *             xm, ym, zm = gxm, gym, gzm
 */
    goto __pyx_L3;
  }

  /* "PETSc/petscdmda.pxi":232
 *             xm, ym, zm = gxm, gym, gzm
 *         else:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 "Vector local size %d is not compatible "
 *                 "with DMDA local sizes %s"
 */
  /*else*/ {

    /* "PETSc/petscdmda.pxi":235
 *                 "Vector local size %d is not compatible "
 *                 "with DMDA local sizes %s"
 *                 % (<Py_ssize_t>n, toDims(dim, lxm, lym, lzm)))             # <<<<<<<<<<<<<<
 *         #
 *         cdef tuple starts = toDims(dim, xs, ys, zs)
 */
    __pyx_t_6 = PyInt_FromSsize_t(((Py_ssize_t)__pyx_v_n)); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toDims(__pyx_v_dim, __pyx_v_lxm, __pyx_v_lym, __pyx_v_lzm); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Vector_local_size_d_is_not_compa, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "PETSc/petscdmda.pxi":232
 *             xm, ym, zm = gxm, gym, gzm
 *         else:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 "Vector local size %d is not compatible "
 *                 "with DMDA local sizes %s"
 */
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 232, __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 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(7, 232, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/petscdmda.pxi":237
 *                 % (<Py_ssize_t>n, toDims(dim, lxm, lym, lzm)))
 *         #
 *         cdef tuple starts = toDims(dim, xs, ys, zs)             # <<<<<<<<<<<<<<
 *         cdef tuple sizes  = toDims(dim, xm, ym, zm)
 *         cdef Py_ssize_t k = <Py_ssize_t>sizeof(PetscScalar)
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toDims(__pyx_v_dim, __pyx_v_xs, __pyx_v_ys, __pyx_v_zs); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_starts = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "PETSc/petscdmda.pxi":238
 *         #
 *         cdef tuple starts = toDims(dim, xs, ys, zs)
 *         cdef tuple sizes  = toDims(dim, xm, ym, zm)             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t k = <Py_ssize_t>sizeof(PetscScalar)
 *         cdef Py_ssize_t f = <Py_ssize_t>dof
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toDims(__pyx_v_dim, __pyx_v_xm, __pyx_v_ym, __pyx_v_zm); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_sizes = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "PETSc/petscdmda.pxi":239
 *         cdef tuple starts = toDims(dim, xs, ys, zs)
 *         cdef tuple sizes  = toDims(dim, xm, ym, zm)
 *         cdef Py_ssize_t k = <Py_ssize_t>sizeof(PetscScalar)             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t f = <Py_ssize_t>dof
 *         cdef Py_ssize_t d = <Py_ssize_t>dim
 */
  __pyx_v_k = ((Py_ssize_t)(sizeof(PetscScalar)));

  /* "PETSc/petscdmda.pxi":240
 *         cdef tuple sizes  = toDims(dim, xm, ym, zm)
 *         cdef Py_ssize_t k = <Py_ssize_t>sizeof(PetscScalar)
 *         cdef Py_ssize_t f = <Py_ssize_t>dof             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t d = <Py_ssize_t>dim
 *         cdef tuple shape   = toDims(dim, xm, ym, zm)
 */
  __pyx_v_f = ((Py_ssize_t)__pyx_v_dof);

  /* "PETSc/petscdmda.pxi":241
 *         cdef Py_ssize_t k = <Py_ssize_t>sizeof(PetscScalar)
 *         cdef Py_ssize_t f = <Py_ssize_t>dof
 *         cdef Py_ssize_t d = <Py_ssize_t>dim             # <<<<<<<<<<<<<<
 *         cdef tuple shape   = toDims(dim, xm, ym, zm)
 *         cdef tuple strides = (k*f, k*f*xm, k*f*xm*ym)[:d]
 */
  __pyx_v_d = ((Py_ssize_t)__pyx_v_dim);

  /* "PETSc/petscdmda.pxi":242
 *         cdef Py_ssize_t f = <Py_ssize_t>dof
 *         cdef Py_ssize_t d = <Py_ssize_t>dim
 *         cdef tuple shape   = toDims(dim, xm, ym, zm)             # <<<<<<<<<<<<<<
 *         cdef tuple strides = (k*f, k*f*xm, k*f*xm*ym)[:d]
 *         if DOF or f > 1: shape   += (f,)
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toDims(__pyx_v_dim, __pyx_v_xm, __pyx_v_ym, __pyx_v_zm); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_shape = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "PETSc/petscdmda.pxi":243
 *         cdef Py_ssize_t d = <Py_ssize_t>dim
 *         cdef tuple shape   = toDims(dim, xm, ym, zm)
 *         cdef tuple strides = (k*f, k*f*xm, k*f*xm*ym)[:d]             # <<<<<<<<<<<<<<
 *         if DOF or f > 1: shape   += (f,)
 *         if DOF or f > 1: strides += (k,)
 */
  __pyx_t_7 = PyInt_FromSsize_t((__pyx_v_k * __pyx_v_f)); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyInt_FromSsize_t(((__pyx_v_k * __pyx_v_f) * __pyx_v_xm)); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = PyInt_FromSsize_t((((__pyx_v_k * __pyx_v_f) * __pyx_v_xm) * __pyx_v_ym)); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 243, __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 = __Pyx_PyObject_GetSlice(__pyx_t_9, 0, __pyx_v_d, NULL, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (!(likely(PyTuple_CheckExact(__pyx_t_6))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(7, 243, __pyx_L1_error)
  __pyx_v_strides = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "PETSc/petscdmda.pxi":244
 *         cdef tuple shape   = toDims(dim, xm, ym, zm)
 *         cdef tuple strides = (k*f, k*f*xm, k*f*xm*ym)[:d]
 *         if DOF or f > 1: shape   += (f,)             # <<<<<<<<<<<<<<
 *         if DOF or f > 1: strides += (k,)
 *         #
 */
  __pyx_t_10 = (__pyx_v_DOF != 0);
  if (!__pyx_t_10) {
  } else {
    __pyx_t_2 = __pyx_t_10;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_10 = ((__pyx_v_f > 1) != 0);
  __pyx_t_2 = __pyx_t_10;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_f); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 244, __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 = 0;
    __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_shape, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF_SET(__pyx_v_shape, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;
  }

  /* "PETSc/petscdmda.pxi":245
 *         cdef tuple strides = (k*f, k*f*xm, k*f*xm*ym)[:d]
 *         if DOF or f > 1: shape   += (f,)
 *         if DOF or f > 1: strides += (k,)             # <<<<<<<<<<<<<<
 *         #
 *         self.vecbuf = _Vec_buffer(vec)
 */
  __pyx_t_10 = (__pyx_v_DOF != 0);
  if (!__pyx_t_10) {
  } else {
    __pyx_t_2 = __pyx_t_10;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_10 = ((__pyx_v_f > 1) != 0);
  __pyx_t_2 = __pyx_t_10;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 245, __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 = 0;
    __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_strides, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF_SET(__pyx_v_strides, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;
  }

  /* "PETSc/petscdmda.pxi":247
 *         if DOF or f > 1: strides += (k,)
 *         #
 *         self.vecbuf = _Vec_buffer(vec)             # <<<<<<<<<<<<<<
 *         self.starts = starts
 *         self.sizes = sizes
 */
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vec));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_vec));
  __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc__Vec_buffer), __pyx_t_6, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_GIVEREF(__pyx_t_9);
  __Pyx_GOTREF(__pyx_v_self->vecbuf);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->vecbuf));
  __pyx_v_self->vecbuf = ((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "PETSc/petscdmda.pxi":248
 *         #
 *         self.vecbuf = _Vec_buffer(vec)
 *         self.starts = starts             # <<<<<<<<<<<<<<
 *         self.sizes = sizes
 *         self.shape = shape
 */
  __Pyx_INCREF(__pyx_v_starts);
  __Pyx_GIVEREF(__pyx_v_starts);
  __Pyx_GOTREF(__pyx_v_self->starts);
  __Pyx_DECREF(__pyx_v_self->starts);
  __pyx_v_self->starts = __pyx_v_starts;

  /* "PETSc/petscdmda.pxi":249
 *         self.vecbuf = _Vec_buffer(vec)
 *         self.starts = starts
 *         self.sizes = sizes             # <<<<<<<<<<<<<<
 *         self.shape = shape
 *         self.strides = strides
 */
  __Pyx_INCREF(__pyx_v_sizes);
  __Pyx_GIVEREF(__pyx_v_sizes);
  __Pyx_GOTREF(__pyx_v_self->sizes);
  __Pyx_DECREF(__pyx_v_self->sizes);
  __pyx_v_self->sizes = __pyx_v_sizes;

  /* "PETSc/petscdmda.pxi":250
 *         self.starts = starts
 *         self.sizes = sizes
 *         self.shape = shape             # <<<<<<<<<<<<<<
 *         self.strides = strides
 * 
 */
  __Pyx_INCREF(__pyx_v_shape);
  __Pyx_GIVEREF(__pyx_v_shape);
  __Pyx_GOTREF(__pyx_v_self->shape);
  __Pyx_DECREF(__pyx_v_self->shape);
  __pyx_v_self->shape = __pyx_v_shape;

  /* "PETSc/petscdmda.pxi":251
 *         self.sizes = sizes
 *         self.shape = shape
 *         self.strides = strides             # <<<<<<<<<<<<<<
 * 
 *     cdef int acquire(self) except -1:
 */
  __Pyx_INCREF(__pyx_v_strides);
  __Pyx_GIVEREF(__pyx_v_strides);
  __Pyx_GOTREF(__pyx_v_self->strides);
  __Pyx_DECREF(__pyx_v_self->strides);
  __pyx_v_self->strides = __pyx_v_strides;

  /* "PETSc/petscdmda.pxi":205
 *     cdef readonly ndarray array
 * 
 *     def __cinit__(self, DMDA da not None, Vec vec not None, bint DOF=False):             # <<<<<<<<<<<<<<
 *         #
 *         cdef PetscInt dim=0, dof=0
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("petsc4py.PETSc._DMDA_Vec_array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_starts);
  __Pyx_XDECREF(__pyx_v_sizes);
  __Pyx_XDECREF(__pyx_v_shape);
  __Pyx_XDECREF(__pyx_v_strides);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":253
 *         self.strides = strides
 * 
 *     cdef int acquire(self) except -1:             # <<<<<<<<<<<<<<
 *         self.vecbuf.acquire()
 *         if self.array is None:
 */

static int __pyx_f_8petsc4py_5PETSc_15_DMDA_Vec_array_acquire(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("acquire", 0);

  /* "PETSc/petscdmda.pxi":254
 * 
 *     cdef int acquire(self) except -1:
 *         self.vecbuf.acquire()             # <<<<<<<<<<<<<<
 *         if self.array is None:
 *             self.array = asarray(self.vecbuf)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->vecbuf->__pyx_vtab)->acquire(__pyx_v_self->vecbuf); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(7, 254, __pyx_L1_error)

  /* "PETSc/petscdmda.pxi":255
 *     cdef int acquire(self) except -1:
 *         self.vecbuf.acquire()
 *         if self.array is None:             # <<<<<<<<<<<<<<
 *             self.array = asarray(self.vecbuf)
 *             self.array.shape = self.shape
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_self->array) == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscdmda.pxi":256
 *         self.vecbuf.acquire()
 *         if self.array is None:
 *             self.array = asarray(self.vecbuf)             # <<<<<<<<<<<<<<
 *             self.array.shape = self.shape
 *             self.array.strides = self.strides
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_self->vecbuf);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_asarray(__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->array);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->array));
    __pyx_v_self->array = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "PETSc/petscdmda.pxi":257
 *         if self.array is None:
 *             self.array = asarray(self.vecbuf)
 *             self.array.shape = self.shape             # <<<<<<<<<<<<<<
 *             self.array.strides = self.strides
 *         return 0
 */
    __pyx_t_5 = __pyx_v_self->shape;
    __Pyx_INCREF(__pyx_t_5);
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->array), __pyx_n_s_shape, __pyx_t_5) < 0) __PYX_ERR(7, 257, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/petscdmda.pxi":258
 *             self.array = asarray(self.vecbuf)
 *             self.array.shape = self.shape
 *             self.array.strides = self.strides             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_t_5 = __pyx_v_self->strides;
    __Pyx_INCREF(__pyx_t_5);
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->array), __pyx_n_s_strides, __pyx_t_5) < 0) __PYX_ERR(7, 258, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/petscdmda.pxi":255
 *     cdef int acquire(self) except -1:
 *         self.vecbuf.acquire()
 *         if self.array is None:             # <<<<<<<<<<<<<<
 *             self.array = asarray(self.vecbuf)
 *             self.array.shape = self.shape
 */
  }

  /* "PETSc/petscdmda.pxi":259
 *             self.array.shape = self.shape
 *             self.array.strides = self.strides
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int release(self) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":253
 *         self.strides = strides
 * 
 *     cdef int acquire(self) except -1:             # <<<<<<<<<<<<<<
 *         self.vecbuf.acquire()
 *         if self.array is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc._DMDA_Vec_array.acquire", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":261
 *         return 0
 * 
 *     cdef int release(self) except -1:             # <<<<<<<<<<<<<<
 *         self.vecbuf.release()
 *         self.array = None
 */

static int __pyx_f_8petsc4py_5PETSc_15_DMDA_Vec_array_release(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("release", 0);

  /* "PETSc/petscdmda.pxi":262
 * 
 *     cdef int release(self) except -1:
 *         self.vecbuf.release()             # <<<<<<<<<<<<<<
 *         self.array = None
 *         return 0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_self->vecbuf->__pyx_vtab)->release(__pyx_v_self->vecbuf); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(7, 262, __pyx_L1_error)

  /* "PETSc/petscdmda.pxi":263
 *     cdef int release(self) except -1:
 *         self.vecbuf.release()
 *         self.array = None             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->array);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->array));
  __pyx_v_self->array = ((PyArrayObject *)Py_None);

  /* "PETSc/petscdmda.pxi":264
 *         self.vecbuf.release()
 *         self.array = None
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":261
 *         return 0
 * 
 *     cdef int release(self) except -1:             # <<<<<<<<<<<<<<
 *         self.vecbuf.release()
 *         self.array = None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._DMDA_Vec_array.release", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":268
 *     #
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         index = adjust_index_exp(self.starts, index)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_2__getitem__(((struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self), ((PyObject *)__pyx_v_index));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_2__getitem__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "PETSc/petscdmda.pxi":269
 * 
 *     def __getitem__(self, index):
 *         self.acquire()             # <<<<<<<<<<<<<<
 *         index = adjust_index_exp(self.starts, index)
 *         return self.array[index]
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self->__pyx_vtab)->acquire(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(7, 269, __pyx_L1_error)

  /* "PETSc/petscdmda.pxi":270
 *     def __getitem__(self, index):
 *         self.acquire()
 *         index = adjust_index_exp(self.starts, index)             # <<<<<<<<<<<<<<
 *         return self.array[index]
 * 
 */
  __pyx_t_2 = __pyx_v_self->starts;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_adjust_index_exp(__pyx_t_2, __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscdmda.pxi":271
 *         self.acquire()
 *         index = adjust_index_exp(self.starts, index)
 *         return self.array[index]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, index, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self->array), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":268
 *     #
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         index = adjust_index_exp(self.starts, index)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc._DMDA_Vec_array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":273
 *         return self.array[index]
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         index = adjust_index_exp(self.starts, index)
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_5__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_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_4__setitem__(((struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_4__setitem__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "PETSc/petscdmda.pxi":274
 * 
 *     def __setitem__(self, index, value):
 *         self.acquire()             # <<<<<<<<<<<<<<
 *         index = adjust_index_exp(self.starts, index)
 *         self.array[index] = value
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self->__pyx_vtab)->acquire(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(7, 274, __pyx_L1_error)

  /* "PETSc/petscdmda.pxi":275
 *     def __setitem__(self, index, value):
 *         self.acquire()
 *         index = adjust_index_exp(self.starts, index)             # <<<<<<<<<<<<<<
 *         self.array[index] = value
 * 
 */
  __pyx_t_2 = __pyx_v_self->starts;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_adjust_index_exp(__pyx_t_2, __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/petscdmda.pxi":276
 *         self.acquire()
 *         index = adjust_index_exp(self.starts, index)
 *         self.array[index] = value             # <<<<<<<<<<<<<<
 * 
 *     # 'with' statement (PEP 343)
 */
  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->array), __pyx_v_index, __pyx_v_value) < 0)) __PYX_ERR(7, 276, __pyx_L1_error)

  /* "PETSc/petscdmda.pxi":273
 *         return self.array[index]
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         index = adjust_index_exp(self.starts, index)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc._DMDA_Vec_array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":280
 *     # 'with' statement (PEP 343)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_7__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_15_DMDA_Vec_array_6__enter__[] = "_DMDA_Vec_array.__enter__(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_7__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_6__enter__(((struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_6__enter__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "PETSc/petscdmda.pxi":281
 * 
 *     def __enter__(self):
 *         self.acquire()             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self->__pyx_vtab)->acquire(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(7, 281, __pyx_L1_error)

  /* "PETSc/petscdmda.pxi":282
 *     def __enter__(self):
 *         self.acquire()
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *exc):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":280
 *     # 'with' statement (PEP 343)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self.acquire()
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._DMDA_Vec_array.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":284
 *         return self
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         self.release()
 *         return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_9__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_15_DMDA_Vec_array_8__exit__[] = "_DMDA_Vec_array.__exit__(self, *exc)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_9__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_exc = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_8__exit__(((struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self), __pyx_v_exc);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_8__exit__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "PETSc/petscdmda.pxi":285
 * 
 *     def __exit__(self, *exc):
 *         self.release()             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self->__pyx_vtab)->release(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(7, 285, __pyx_L1_error)

  /* "PETSc/petscdmda.pxi":286
 *     def __exit__(self, *exc):
 *         self.release()
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":284
 *         return self
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         self.release()
 *         return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._DMDA_Vec_array.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":201
 * 
 *     cdef _Vec_buffer vecbuf
 *     cdef readonly tuple starts, sizes             # <<<<<<<<<<<<<<
 *     cdef readonly tuple shape, strides
 *     cdef readonly ndarray array
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_6starts_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_6starts_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_6starts___get__(((struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_6starts___get__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->starts);
  __pyx_r = __pyx_v_self->starts;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_5sizes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_5sizes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_5sizes___get__(((struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_5sizes___get__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->sizes);
  __pyx_r = __pyx_v_self->sizes;
  goto __pyx_L0;

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

/* "PETSc/petscdmda.pxi":202
 *     cdef _Vec_buffer vecbuf
 *     cdef readonly tuple starts, sizes
 *     cdef readonly tuple shape, strides             # <<<<<<<<<<<<<<
 *     cdef readonly ndarray array
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_5shape_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_5shape___get__(((struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_5shape___get__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->shape);
  __pyx_r = __pyx_v_self->shape;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_7strides_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_7strides___get__(((struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_7strides___get__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->strides);
  __pyx_r = __pyx_v_self->strides;
  goto __pyx_L0;

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

/* "PETSc/petscdmda.pxi":203
 *     cdef readonly tuple starts, sizes
 *     cdef readonly tuple shape, strides
 *     cdef readonly ndarray array             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, DMDA da not None, Vec vec not None, bint DOF=False):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_5array_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_5array_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_5array___get__(((struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_15_DMDA_Vec_array_5array___get__(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->array));
  __pyx_r = ((PyObject *)__pyx_v_self->array);
  goto __pyx_L0;

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

/* "PETSc/petscdmda.pxi":289
 * 
 * 
 * cdef object adjust_index_exp(object starts, object index):             # <<<<<<<<<<<<<<
 *      if not isinstance(index, tuple):
 *          return adjust_index(starts[0], index)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_adjust_index_exp(PyObject *__pyx_v_starts, PyObject *__pyx_v_index) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_start = 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;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("adjust_index_exp", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "PETSc/petscdmda.pxi":290
 * 
 * cdef object adjust_index_exp(object starts, object index):
 *      if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
 *          return adjust_index(starts[0], index)
 *      index = list(index)
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscdmda.pxi":291
 * cdef object adjust_index_exp(object starts, object index):
 *      if not isinstance(index, tuple):
 *          return adjust_index(starts[0], index)             # <<<<<<<<<<<<<<
 *      index = list(index)
 *      for i, start in enumerate(starts):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_starts, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_adjust_index(__pyx_t_3, __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "PETSc/petscdmda.pxi":290
 * 
 * cdef object adjust_index_exp(object starts, object index):
 *      if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
 *          return adjust_index(starts[0], index)
 *      index = list(index)
 */
  }

  /* "PETSc/petscdmda.pxi":292
 *      if not isinstance(index, tuple):
 *          return adjust_index(starts[0], index)
 *      index = list(index)             # <<<<<<<<<<<<<<
 *      for i, start in enumerate(starts):
 *          index[i] = adjust_index(start, index[i])
 */
  __pyx_t_4 = PySequence_List(__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/petscdmda.pxi":293
 *          return adjust_index(starts[0], index)
 *      index = list(index)
 *      for i, start in enumerate(starts):             # <<<<<<<<<<<<<<
 *          index[i] = adjust_index(start, index[i])
 *      index = tuple(index)
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_4 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_starts)) || PyTuple_CheckExact(__pyx_v_starts)) {
    __pyx_t_3 = __pyx_v_starts; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_starts); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 293, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(7, 293, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 293, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(7, 293, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 293, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      }
    } else {
      __pyx_t_7 = __pyx_t_6(__pyx_t_3);
      if (unlikely(!__pyx_t_7)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(7, 293, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_XDECREF_SET(__pyx_v_start, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4);
    __pyx_t_4 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PETSc/petscdmda.pxi":294
 *      index = list(index)
 *      for i, start in enumerate(starts):
 *          index[i] = adjust_index(start, index[i])             # <<<<<<<<<<<<<<
 *      index = tuple(index)
 *      return index
 */
    __pyx_t_7 = PyObject_GetItem(__pyx_v_index, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_adjust_index(__pyx_v_start, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_index, __pyx_v_i, __pyx_t_8) < 0)) __PYX_ERR(7, 294, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "PETSc/petscdmda.pxi":293
 *          return adjust_index(starts[0], index)
 *      index = list(index)
 *      for i, start in enumerate(starts):             # <<<<<<<<<<<<<<
 *          index[i] = adjust_index(start, index[i])
 *      index = tuple(index)
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "PETSc/petscdmda.pxi":295
 *      for i, start in enumerate(starts):
 *          index[i] = adjust_index(start, index[i])
 *      index = tuple(index)             # <<<<<<<<<<<<<<
 *      return index
 * 
 */
  __pyx_t_4 = PySequence_Tuple(__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/petscdmda.pxi":296
 *          index[i] = adjust_index(start, index[i])
 *      index = tuple(index)
 *      return index             # <<<<<<<<<<<<<<
 * 
 * cdef object adjust_index(object lbound, object index):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_index);
  __pyx_r = __pyx_v_index;
  goto __pyx_L0;

  /* "PETSc/petscdmda.pxi":289
 * 
 * 
 * cdef object adjust_index_exp(object starts, object index):             # <<<<<<<<<<<<<<
 *      if not isinstance(index, tuple):
 *          return adjust_index(starts[0], index)
 */

  /* 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_8);
  __Pyx_AddTraceback("petsc4py.PETSc.adjust_index_exp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmda.pxi":298
 *      return index
 * 
 * cdef object adjust_index(object lbound, object index):             # <<<<<<<<<<<<<<
 *     if index is None:
 *         return index
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_adjust_index(PyObject *__pyx_v_lbound, PyObject *__pyx_v_index) {
  PyObject *__pyx_v_start = NULL;
  PyObject *__pyx_v_stop = NULL;
  PyObject *__pyx_v_step = 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;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("adjust_index", 0);

  /* "PETSc/petscdmda.pxi":299
 * 
 * cdef object adjust_index(object lbound, object index):
 *     if index is None:             # <<<<<<<<<<<<<<
 *         return index
 *     if index is Ellipsis:
 */
  __pyx_t_1 = (__pyx_v_index == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscdmda.pxi":300
 * cdef object adjust_index(object lbound, object index):
 *     if index is None:
 *         return index             # <<<<<<<<<<<<<<
 *     if index is Ellipsis:
 *         return index
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_index);
    __pyx_r = __pyx_v_index;
    goto __pyx_L0;

    /* "PETSc/petscdmda.pxi":299
 * 
 * cdef object adjust_index(object lbound, object index):
 *     if index is None:             # <<<<<<<<<<<<<<
 *         return index
 *     if index is Ellipsis:
 */
  }

  /* "PETSc/petscdmda.pxi":301
 *     if index is None:
 *         return index
 *     if index is Ellipsis:             # <<<<<<<<<<<<<<
 *         return index
 *     if isinstance(index, slice):
 */
  __pyx_t_2 = (__pyx_v_index == __pyx_builtin_Ellipsis);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/petscdmda.pxi":302
 *         return index
 *     if index is Ellipsis:
 *         return index             # <<<<<<<<<<<<<<
 *     if isinstance(index, slice):
 *         start = index.start
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_index);
    __pyx_r = __pyx_v_index;
    goto __pyx_L0;

    /* "PETSc/petscdmda.pxi":301
 *     if index is None:
 *         return index
 *     if index is Ellipsis:             # <<<<<<<<<<<<<<
 *         return index
 *     if isinstance(index, slice):
 */
  }

  /* "PETSc/petscdmda.pxi":303
 *     if index is Ellipsis:
 *         return index
 *     if isinstance(index, slice):             # <<<<<<<<<<<<<<
 *         start = index.start
 *         stop  = index.stop
 */
  __pyx_t_1 = PySlice_Check(__pyx_v_index); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/petscdmda.pxi":304
 *         return index
 *     if isinstance(index, slice):
 *         start = index.start             # <<<<<<<<<<<<<<
 *         stop  = index.stop
 *         step  = index.step
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_start = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PETSc/petscdmda.pxi":305
 *     if isinstance(index, slice):
 *         start = index.start
 *         stop  = index.stop             # <<<<<<<<<<<<<<
 *         step  = index.step
 *         if start is not None: start -= lbound
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_stop = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PETSc/petscdmda.pxi":306
 *         start = index.start
 *         stop  = index.stop
 *         step  = index.step             # <<<<<<<<<<<<<<
 *         if start is not None: start -= lbound
 *         if stop  is not None: stop  -= lbound
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_step = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "PETSc/petscdmda.pxi":307
 *         stop  = index.stop
 *         step  = index.step
 *         if start is not None: start -= lbound             # <<<<<<<<<<<<<<
 *         if stop  is not None: stop  -= lbound
 *         return slice(start, stop, step)
 */
    __pyx_t_2 = (__pyx_v_start != Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_v_start, __pyx_v_lbound); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/petscdmda.pxi":308
 *         step  = index.step
 *         if start is not None: start -= lbound
 *         if stop  is not None: stop  -= lbound             # <<<<<<<<<<<<<<
 *         return slice(start, stop, step)
 *     try:
 */
    __pyx_t_1 = (__pyx_v_stop != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_v_stop, __pyx_v_lbound); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/petscdmda.pxi":309
 *         if start is not None: start -= lbound
 *         if stop  is not None: stop  -= lbound
 *         return slice(start, stop, step)             # <<<<<<<<<<<<<<
 *     try:
 *         return index - lbound
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PySlice_New(__pyx_v_start, __pyx_v_stop, __pyx_v_step); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/petscdmda.pxi":303
 *     if index is Ellipsis:
 *         return index
 *     if isinstance(index, slice):             # <<<<<<<<<<<<<<
 *         start = index.start
 *         stop  = index.stop
 */
  }

  /* "PETSc/petscdmda.pxi":310
 *         if stop  is not None: stop  -= lbound
 *         return slice(start, stop, step)
 *     try:             # <<<<<<<<<<<<<<
 *         return index - lbound
 *     except TypeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "PETSc/petscdmda.pxi":311
 *         return slice(start, stop, step)
 *     try:
 *         return index - lbound             # <<<<<<<<<<<<<<
 *     except TypeError:
 *         return index
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyNumber_Subtract(__pyx_v_index, __pyx_v_lbound); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 311, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L12_try_return;

      /* "PETSc/petscdmda.pxi":310
 *         if stop  is not None: stop  -= lbound
 *         return slice(start, stop, step)
 *     try:             # <<<<<<<<<<<<<<
 *         return index - lbound
 *     except TypeError:
 */
    }
    __pyx_L8_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/petscdmda.pxi":312
 *     try:
 *         return index - lbound
 *     except TypeError:             # <<<<<<<<<<<<<<
 *         return index
 * 
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("petsc4py.PETSc.adjust_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(7, 312, __pyx_L10_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_9);

      /* "PETSc/petscdmda.pxi":313
 *         return index - lbound
 *     except TypeError:
 *         return index             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_index);
      __pyx_r = __pyx_v_index;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L11_except_return;
    }
    goto __pyx_L10_except_error;
    __pyx_L10_except_error:;

    /* "PETSc/petscdmda.pxi":310
 *         if stop  is not None: stop  -= lbound
 *         return slice(start, stop, step)
 *     try:             # <<<<<<<<<<<<<<
 *         return index - lbound
 *     except TypeError:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L12_try_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L11_except_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
  }

  /* "PETSc/petscdmda.pxi":298
 *      return index
 * 
 * cdef object adjust_index(object lbound, object index):             # <<<<<<<<<<<<<<
 *     if index is None:
 *         return index
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("petsc4py.PETSc.adjust_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_stop);
  __Pyx_XDECREF(__pyx_v_step);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmcomposite.pxi":27
 *     cdef object access
 * 
 *     def __cinit__(self, DM dm, Vec gvec not None, locs=None):             # <<<<<<<<<<<<<<
 *         self.dm = dm.dm
 *         CHKERR( PetscINCREF(<PetscObject*>&self.dm) )
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_19_DMComposite_access_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_19_DMComposite_access_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscDMObject *__pyx_v_dm = 0;
  struct PyPetscVecObject *__pyx_v_gvec = 0;
  PyObject *__pyx_v_locs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dm,&__pyx_n_s_gvec,&__pyx_n_s_locs,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_dm)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gvec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(23, 27, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_locs);
          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(23, 27, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_dm = ((struct PyPetscDMObject *)values[0]);
    __pyx_v_gvec = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_locs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(23, 27, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._DMComposite_access.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_8petsc4py_5PETSc_DM, 1, "dm", 0))) __PYX_ERR(23, 27, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gvec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "gvec", 0))) __PYX_ERR(23, 27, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_19_DMComposite_access___cinit__(((struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *)__pyx_v_self), __pyx_v_dm, __pyx_v_gvec, __pyx_v_locs);

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

static int __pyx_pf_8petsc4py_5PETSc_19_DMComposite_access___cinit__(struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm, struct PyPetscVecObject *__pyx_v_gvec, PyObject *__pyx_v_locs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  DM __pyx_t_1;
  int __pyx_t_2;
  Vec __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_locs);

  /* "PETSc/petscdmcomposite.pxi":28
 * 
 *     def __cinit__(self, DM dm, Vec gvec not None, locs=None):
 *         self.dm = dm.dm             # <<<<<<<<<<<<<<
 *         CHKERR( PetscINCREF(<PetscObject*>&self.dm) )
 *         self.gvec = gvec.vec
 */
  __pyx_t_1 = __pyx_v_dm->dm;
  __pyx_v_self->dm = __pyx_t_1;

  /* "PETSc/petscdmcomposite.pxi":29
 *     def __cinit__(self, DM dm, Vec gvec not None, locs=None):
 *         self.dm = dm.dm
 *         CHKERR( PetscINCREF(<PetscObject*>&self.dm) )             # <<<<<<<<<<<<<<
 *         self.gvec = gvec.vec
 *         CHKERR( PetscINCREF(<PetscObject*>&self.gvec) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_PetscINCREF(((PetscObject *)(&__pyx_v_self->dm)))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(23, 29, __pyx_L1_error)

  /* "PETSc/petscdmcomposite.pxi":30
 *         self.dm = dm.dm
 *         CHKERR( PetscINCREF(<PetscObject*>&self.dm) )
 *         self.gvec = gvec.vec             # <<<<<<<<<<<<<<
 *         CHKERR( PetscINCREF(<PetscObject*>&self.gvec) )
 *         if locs is None:
 */
  __pyx_t_3 = __pyx_v_gvec->vec;
  __pyx_v_self->gvec = __pyx_t_3;

  /* "PETSc/petscdmcomposite.pxi":31
 *         CHKERR( PetscINCREF(<PetscObject*>&self.dm) )
 *         self.gvec = gvec.vec
 *         CHKERR( PetscINCREF(<PetscObject*>&self.gvec) )             # <<<<<<<<<<<<<<
 *         if locs is None:
 *             CHKERR( DMCompositeGetNumberDM(self.dm, &self.nlocs) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_PetscINCREF(((PetscObject *)(&__pyx_v_self->gvec)))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(23, 31, __pyx_L1_error)

  /* "PETSc/petscdmcomposite.pxi":32
 *         self.gvec = gvec.vec
 *         CHKERR( PetscINCREF(<PetscObject*>&self.gvec) )
 *         if locs is None:             # <<<<<<<<<<<<<<
 *             CHKERR( DMCompositeGetNumberDM(self.dm, &self.nlocs) )
 *             locs = arange(0, <long>self.nlocs, 1)
 */
  __pyx_t_4 = (__pyx_v_locs == Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "PETSc/petscdmcomposite.pxi":33
 *         CHKERR( PetscINCREF(<PetscObject*>&self.gvec) )
 *         if locs is None:
 *             CHKERR( DMCompositeGetNumberDM(self.dm, &self.nlocs) )             # <<<<<<<<<<<<<<
 *             locs = arange(0, <long>self.nlocs, 1)
 *         self.locs_mem = iarray_i(locs, &self.nlocs, &self.locs)
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetNumberDM(__pyx_v_self->dm, (&__pyx_v_self->nlocs))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(23, 33, __pyx_L1_error)

    /* "PETSc/petscdmcomposite.pxi":34
 *         if locs is None:
 *             CHKERR( DMCompositeGetNumberDM(self.dm, &self.nlocs) )
 *             locs = arange(0, <long>self.nlocs, 1)             # <<<<<<<<<<<<<<
 *         self.locs_mem = iarray_i(locs, &self.nlocs, &self.locs)
 *         self.vecs_mem = oarray_p(empty_p(self.nlocs), NULL, <void**>&self.vecs)
 */
    __pyx_t_6 = __Pyx_PyInt_From_long(((long)__pyx_v_self->nlocs)); if (unlikely(!__pyx_t_6)) __PYX_ERR(23, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_arange(__pyx_int_0, __pyx_t_6, __pyx_int_1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(23, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_locs, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "PETSc/petscdmcomposite.pxi":32
 *         self.gvec = gvec.vec
 *         CHKERR( PetscINCREF(<PetscObject*>&self.gvec) )
 *         if locs is None:             # <<<<<<<<<<<<<<
 *             CHKERR( DMCompositeGetNumberDM(self.dm, &self.nlocs) )
 *             locs = arange(0, <long>self.nlocs, 1)
 */
  }

  /* "PETSc/petscdmcomposite.pxi":35
 *             CHKERR( DMCompositeGetNumberDM(self.dm, &self.nlocs) )
 *             locs = arange(0, <long>self.nlocs, 1)
 *         self.locs_mem = iarray_i(locs, &self.nlocs, &self.locs)             # <<<<<<<<<<<<<<
 *         self.vecs_mem = oarray_p(empty_p(self.nlocs), NULL, <void**>&self.vecs)
 *         self.access   = None
 */
  __pyx_t_7 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_locs, (&__pyx_v_self->nlocs), (&__pyx_v_self->locs))); if (unlikely(!__pyx_t_7)) __PYX_ERR(23, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_GOTREF(__pyx_v_self->locs_mem);
  __Pyx_DECREF(__pyx_v_self->locs_mem);
  __pyx_v_self->locs_mem = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "PETSc/petscdmcomposite.pxi":36
 *             locs = arange(0, <long>self.nlocs, 1)
 *         self.locs_mem = iarray_i(locs, &self.nlocs, &self.locs)
 *         self.vecs_mem = oarray_p(empty_p(self.nlocs), NULL, <void**>&self.vecs)             # <<<<<<<<<<<<<<
 *         self.access   = None
 * 
 */
  __pyx_t_7 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_self->nlocs)); if (unlikely(!__pyx_t_7)) __PYX_ERR(23, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_7, NULL, ((void **)(&__pyx_v_self->vecs)))); if (unlikely(!__pyx_t_6)) __PYX_ERR(23, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->vecs_mem);
  __Pyx_DECREF(__pyx_v_self->vecs_mem);
  __pyx_v_self->vecs_mem = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmcomposite.pxi":37
 *         self.locs_mem = iarray_i(locs, &self.nlocs, &self.locs)
 *         self.vecs_mem = oarray_p(empty_p(self.nlocs), NULL, <void**>&self.vecs)
 *         self.access   = None             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->access);
  __Pyx_DECREF(__pyx_v_self->access);
  __pyx_v_self->access = Py_None;

  /* "PETSc/petscdmcomposite.pxi":27
 *     cdef object access
 * 
 *     def __cinit__(self, DM dm, Vec gvec not None, locs=None):             # <<<<<<<<<<<<<<
 *         self.dm = dm.dm
 *         CHKERR( PetscINCREF(<PetscObject*>&self.dm) )
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc._DMComposite_access.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_locs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmcomposite.pxi":39
 *         self.access   = None
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMDestroy(&self.dm) )
 *         CHKERR( VecDestroy(&self.gvec) )
 */

/* Python wrapper */
static void __pyx_pw_8petsc4py_5PETSc_19_DMComposite_access_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8petsc4py_5PETSc_19_DMComposite_access_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8petsc4py_5PETSc_19_DMComposite_access_2__dealloc__(((struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *)__pyx_v_self));

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

static void __pyx_pf_8petsc4py_5PETSc_19_DMComposite_access_2__dealloc__(struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "PETSc/petscdmcomposite.pxi":40
 * 
 *     def __dealloc__(self):
 *         CHKERR( DMDestroy(&self.dm) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecDestroy(&self.gvec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDestroy((&__pyx_v_self->dm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(23, 40, __pyx_L1_error)

  /* "PETSc/petscdmcomposite.pxi":41
 *     def __dealloc__(self):
 *         CHKERR( DMDestroy(&self.dm) )
 *         CHKERR( VecDestroy(&self.gvec) )             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecDestroy((&__pyx_v_self->gvec))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(23, 41, __pyx_L1_error)

  /* "PETSc/petscdmcomposite.pxi":39
 *         self.access   = None
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMDestroy(&self.dm) )
 *         CHKERR( VecDestroy(&self.gvec) )
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("petsc4py.PETSc._DMComposite_access.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PETSc/petscdmcomposite.pxi":43
 *         CHKERR( VecDestroy(&self.gvec) )
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i, n = self.nlocs
 *         CHKERR( DMCompositeGetAccessArray(self.dm, self.gvec, self.nlocs, self.locs, self.vecs) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_19_DMComposite_access_5__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_19_DMComposite_access_4__enter__[] = "_DMComposite_access.__enter__(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_19_DMComposite_access_5__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_19_DMComposite_access_4__enter__(((struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_19_DMComposite_access_4__enter__(struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *__pyx_v_self) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "PETSc/petscdmcomposite.pxi":44
 * 
 *     def __enter__(self):
 *         cdef Py_ssize_t i, n = self.nlocs             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGetAccessArray(self.dm, self.gvec, self.nlocs, self.locs, self.vecs) )
 *         self.access = [ref_Vec(self.vecs[i]) for i from 0 <= i < n]
 */
  __pyx_t_1 = __pyx_v_self->nlocs;
  __pyx_v_n = __pyx_t_1;

  /* "PETSc/petscdmcomposite.pxi":45
 *     def __enter__(self):
 *         cdef Py_ssize_t i, n = self.nlocs
 *         CHKERR( DMCompositeGetAccessArray(self.dm, self.gvec, self.nlocs, self.locs, self.vecs) )             # <<<<<<<<<<<<<<
 *         self.access = [ref_Vec(self.vecs[i]) for i from 0 <= i < n]
 *         return tuple(self.access)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetAccessArray(__pyx_v_self->dm, __pyx_v_self->gvec, __pyx_v_self->nlocs, __pyx_v_self->locs, __pyx_v_self->vecs)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(23, 45, __pyx_L1_error)

  /* "PETSc/petscdmcomposite.pxi":46
 *         cdef Py_ssize_t i, n = self.nlocs
 *         CHKERR( DMCompositeGetAccessArray(self.dm, self.gvec, self.nlocs, self.locs, self.vecs) )
 *         self.access = [ref_Vec(self.vecs[i]) for i from 0 <= i < n]             # <<<<<<<<<<<<<<
 *         return tuple(self.access)
 * 
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(23, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {
    __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec((__pyx_v_self->vecs[__pyx_v_i]))); if (unlikely(!__pyx_t_5)) __PYX_ERR(23, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_5))) __PYX_ERR(23, 46, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->access);
  __Pyx_DECREF(__pyx_v_self->access);
  __pyx_v_self->access = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/petscdmcomposite.pxi":47
 *         CHKERR( DMCompositeGetAccessArray(self.dm, self.gvec, self.nlocs, self.locs, self.vecs) )
 *         self.access = [ref_Vec(self.vecs[i]) for i from 0 <= i < n]
 *         return tuple(self.access)             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *exc):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PySequence_Tuple(__pyx_v_self->access); if (unlikely(!__pyx_t_3)) __PYX_ERR(23, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmcomposite.pxi":43
 *         CHKERR( VecDestroy(&self.gvec) )
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i, n = self.nlocs
 *         CHKERR( DMCompositeGetAccessArray(self.dm, self.gvec, self.nlocs, self.locs, self.vecs) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc._DMComposite_access.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmcomposite.pxi":49
 *         return tuple(self.access)
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i, n = self.nlocs
 *         for i from 0 <= i < n: (<Vec>self.access[i]).vec = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_19_DMComposite_access_7__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_19_DMComposite_access_6__exit__[] = "_DMComposite_access.__exit__(self, *exc)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_19_DMComposite_access_7__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_exc = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_19_DMComposite_access_6__exit__(((struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *)__pyx_v_self), __pyx_v_exc);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_19_DMComposite_access_6__exit__(struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "PETSc/petscdmcomposite.pxi":50
 * 
 *     def __exit__(self, *exc):
 *         cdef Py_ssize_t i, n = self.nlocs             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n: (<Vec>self.access[i]).vec = NULL
 *         CHKERR( DMCompositeRestoreAccessArray(self.dm, self.gvec, self.nlocs, self.locs, self.vecs) )
 */
  __pyx_t_1 = __pyx_v_self->nlocs;
  __pyx_v_n = __pyx_t_1;

  /* "PETSc/petscdmcomposite.pxi":51
 *     def __exit__(self, *exc):
 *         cdef Py_ssize_t i, n = self.nlocs
 *         for i from 0 <= i < n: (<Vec>self.access[i]).vec = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeRestoreAccessArray(self.dm, self.gvec, self.nlocs, self.locs, self.vecs) )
 *         self.access   = None
 */
  __pyx_t_2 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->access, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(23, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    ((struct PyPetscVecObject *)__pyx_t_3)->vec = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }

  /* "PETSc/petscdmcomposite.pxi":52
 *         cdef Py_ssize_t i, n = self.nlocs
 *         for i from 0 <= i < n: (<Vec>self.access[i]).vec = NULL
 *         CHKERR( DMCompositeRestoreAccessArray(self.dm, self.gvec, self.nlocs, self.locs, self.vecs) )             # <<<<<<<<<<<<<<
 *         self.access   = None
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeRestoreAccessArray(__pyx_v_self->dm, __pyx_v_self->gvec, __pyx_v_self->nlocs, __pyx_v_self->locs, __pyx_v_self->vecs)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(23, 52, __pyx_L1_error)

  /* "PETSc/petscdmcomposite.pxi":53
 *         for i from 0 <= i < n: (<Vec>self.access[i]).vec = NULL
 *         CHKERR( DMCompositeRestoreAccessArray(self.dm, self.gvec, self.nlocs, self.locs, self.vecs) )
 *         self.access   = None             # <<<<<<<<<<<<<<
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->access);
  __Pyx_DECREF(__pyx_v_self->access);
  __pyx_v_self->access = Py_None;

  /* "PETSc/petscdmcomposite.pxi":49
 *         return tuple(self.access)
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i, n = self.nlocs
 *         for i from 0 <= i < n: (<Vec>self.access[i]).vec = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc._DMComposite_access.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":50
 *     int DMShellSetCreateSubDM(PetscDM,PetscDMShellCreateSubDM)
 * 
 * cdef int DMSHELL_CreateGlobalVector(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec *v) except PETSC_ERR_PYTHON with gil:
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateGlobalVector(DM __pyx_v_dm, Vec *__pyx_v_v) {
  struct PyPetscDMObject *__pyx_v_Dm = 0;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_create_gvec = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  Vec __pyx_t_9;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_CreateGlobalVector", 0);

  /* "PETSc/petscdmshell.pxi":53
 *     PetscDM dm,
 *     PetscVec *v) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()             # <<<<<<<<<<<<<<
 *     cdef Vec vec
 *     Dm.dm = dm
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 53, __pyx_L1_error)
  __pyx_v_Dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":55
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec vec
 *     Dm.dm = dm             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__create_global_vector__')
 */
  __pyx_v_Dm->dm = __pyx_v_dm;

  /* "PETSc/petscdmshell.pxi":56
 *     cdef Vec vec
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)             # <<<<<<<<<<<<<<
 *     context = Dm.get_attr('__create_global_vector__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":57
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__create_global_vector__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (create_gvec, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dm), ((char *)"__create_global_vector__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":58
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__create_global_vector__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (create_gvec, args, kargs) = context
 *     vec = create_gvec(Dm, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 58, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":59
 *     context = Dm.get_attr('__create_global_vector__')
 *     assert context is not None and type(context) is tuple
 *     (create_gvec, args, kargs) = context             # <<<<<<<<<<<<<<
 *     vec = create_gvec(Dm, *args, **kargs)
 *     PetscINCREF(vec.obj)
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 59, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 59, __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(8, 59, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_create_gvec = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":60
 *     assert context is not None and type(context) is tuple
 *     (create_gvec, args, kargs) = context
 *     vec = create_gvec(Dm, *args, **kargs)             # <<<<<<<<<<<<<<
 *     PetscINCREF(vec.obj)
 *     v[0] = vec.vec
 */
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dm));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Dm));
  __pyx_t_1 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 60, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_1 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_create_gvec, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 60, __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_8petsc4py_5PETSc_Vec))))) __PYX_ERR(8, 60, __pyx_L1_error)
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":61
 *     (create_gvec, args, kargs) = context
 *     vec = create_gvec(Dm, *args, **kargs)
 *     PetscINCREF(vec.obj)             # <<<<<<<<<<<<<<
 *     v[0] = vec.vec
 *     return 0
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_vec->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":62
 *     vec = create_gvec(Dm, *args, **kargs)
 *     PetscINCREF(vec.obj)
 *     v[0] = vec.vec             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_9 = __pyx_v_vec->vec;
  (__pyx_v_v[0]) = __pyx_t_9;

  /* "PETSc/petscdmshell.pxi":63
 *     PetscINCREF(vec.obj)
 *     v[0] = vec.vec
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_CreateLocalVector(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":50
 *     int DMShellSetCreateSubDM(PetscDM,PetscDMShellCreateSubDM)
 * 
 * cdef int DMSHELL_CreateGlobalVector(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec *v) except PETSC_ERR_PYTHON with gil:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_CreateGlobalVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dm);
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_create_gvec);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":65
 *     return 0
 * 
 * cdef int DMSHELL_CreateLocalVector(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec *v) except PETSC_ERR_PYTHON with gil:
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateLocalVector(DM __pyx_v_dm, Vec *__pyx_v_v) {
  struct PyPetscDMObject *__pyx_v_Dm = 0;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_create_lvec = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  Vec __pyx_t_9;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_CreateLocalVector", 0);

  /* "PETSc/petscdmshell.pxi":68
 *     PetscDM dm,
 *     PetscVec *v) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()             # <<<<<<<<<<<<<<
 *     cdef Vec vec
 *     Dm.dm = dm
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 68, __pyx_L1_error)
  __pyx_v_Dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":70
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec vec
 *     Dm.dm = dm             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__create_local_vector__')
 */
  __pyx_v_Dm->dm = __pyx_v_dm;

  /* "PETSc/petscdmshell.pxi":71
 *     cdef Vec vec
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)             # <<<<<<<<<<<<<<
 *     context = Dm.get_attr('__create_local_vector__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":72
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__create_local_vector__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (create_lvec, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dm), ((char *)"__create_local_vector__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":73
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__create_local_vector__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (create_lvec, args, kargs) = context
 *     vec = create_lvec(Dm, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 73, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":74
 *     context = Dm.get_attr('__create_local_vector__')
 *     assert context is not None and type(context) is tuple
 *     (create_lvec, args, kargs) = context             # <<<<<<<<<<<<<<
 *     vec = create_lvec(Dm, *args, **kargs)
 *     PetscINCREF(vec.obj)
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 74, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 74, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 74, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 74, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 74, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 74, __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(8, 74, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_create_lvec = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":75
 *     assert context is not None and type(context) is tuple
 *     (create_lvec, args, kargs) = context
 *     vec = create_lvec(Dm, *args, **kargs)             # <<<<<<<<<<<<<<
 *     PetscINCREF(vec.obj)
 *     v[0] = vec.vec
 */
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dm));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Dm));
  __pyx_t_1 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 75, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_1 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 75, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 75, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_create_lvec, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 75, __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_8petsc4py_5PETSc_Vec))))) __PYX_ERR(8, 75, __pyx_L1_error)
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":76
 *     (create_lvec, args, kargs) = context
 *     vec = create_lvec(Dm, *args, **kargs)
 *     PetscINCREF(vec.obj)             # <<<<<<<<<<<<<<
 *     v[0] = vec.vec
 *     return 0
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_vec->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":77
 *     vec = create_lvec(Dm, *args, **kargs)
 *     PetscINCREF(vec.obj)
 *     v[0] = vec.vec             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_9 = __pyx_v_vec->vec;
  (__pyx_v_v[0]) = __pyx_t_9;

  /* "PETSc/petscdmshell.pxi":78
 *     PetscINCREF(vec.obj)
 *     v[0] = vec.vec
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_GlobalToLocalBegin(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":65
 *     return 0
 * 
 * cdef int DMSHELL_CreateLocalVector(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec *v) except PETSC_ERR_PYTHON with gil:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_CreateLocalVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dm);
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_create_lvec);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":80
 *     return 0
 * 
 * cdef int DMSHELL_GlobalToLocalBegin(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec g,
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_GlobalToLocalBegin(DM __pyx_v_dm, Vec __pyx_v_g, InsertMode __pyx_v_mode, Vec __pyx_v_l) {
  struct PyPetscDMObject *__pyx_v_Dm = 0;
  struct PyPetscVecObject *__pyx_v_gvec = 0;
  struct PyPetscVecObject *__pyx_v_lvec = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_begin = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_GlobalToLocalBegin", 0);

  /* "PETSc/petscdmshell.pxi":85
 *     PetscInsertMode mode,
 *     PetscVec l) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()             # <<<<<<<<<<<<<<
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 85, __pyx_L1_error)
  __pyx_v_Dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":86
 *     PetscVec l) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec gvec = ref_Vec(g)             # <<<<<<<<<<<<<<
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_g)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_gvec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":87
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)             # <<<<<<<<<<<<<<
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_l)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_lvec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":88
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__g2l_begin__')
 */
  __pyx_v_Dm->dm = __pyx_v_dm;

  /* "PETSc/petscdmshell.pxi":89
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)             # <<<<<<<<<<<<<<
 *     context = Dm.get_attr('__g2l_begin__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":90
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__g2l_begin__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (begin, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dm), ((char *)"__g2l_begin__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":91
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__g2l_begin__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (begin, args, kargs) = context
 *     begin(Dm, gvec, mode, lvec, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 91, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":92
 *     context = Dm.get_attr('__g2l_begin__')
 *     assert context is not None and type(context) is tuple
 *     (begin, args, kargs) = context             # <<<<<<<<<<<<<<
 *     begin(Dm, gvec, mode, lvec, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 92, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 92, __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(8, 92, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_begin = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":93
 *     assert context is not None and type(context) is tuple
 *     (begin, args, kargs) = context
 *     begin(Dm, gvec, mode, lvec, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = __Pyx_PyInt_From_InsertMode(__pyx_v_mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dm));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_Dm));
  __Pyx_INCREF(((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_gvec));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_lvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lvec));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_lvec));
  __pyx_t_6 = 0;
  __pyx_t_6 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 93, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_6 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_begin, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 93, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petscdmshell.pxi":94
 *     (begin, args, kargs) = context
 *     begin(Dm, gvec, mode, lvec, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_GlobalToLocalEnd(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":80
 *     return 0
 * 
 * cdef int DMSHELL_GlobalToLocalBegin(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec g,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_GlobalToLocalBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dm);
  __Pyx_XDECREF((PyObject *)__pyx_v_gvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_lvec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_begin);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":96
 *     return 0
 * 
 * cdef int DMSHELL_GlobalToLocalEnd(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec g,
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_GlobalToLocalEnd(DM __pyx_v_dm, Vec __pyx_v_g, InsertMode __pyx_v_mode, Vec __pyx_v_l) {
  struct PyPetscDMObject *__pyx_v_Dm = 0;
  struct PyPetscVecObject *__pyx_v_gvec = 0;
  struct PyPetscVecObject *__pyx_v_lvec = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_end = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_GlobalToLocalEnd", 0);

  /* "PETSc/petscdmshell.pxi":101
 *     PetscInsertMode mode,
 *     PetscVec l) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()             # <<<<<<<<<<<<<<
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 101, __pyx_L1_error)
  __pyx_v_Dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":102
 *     PetscVec l) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec gvec = ref_Vec(g)             # <<<<<<<<<<<<<<
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_g)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_gvec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":103
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)             # <<<<<<<<<<<<<<
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_l)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_lvec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":104
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__g2l_end__')
 */
  __pyx_v_Dm->dm = __pyx_v_dm;

  /* "PETSc/petscdmshell.pxi":105
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)             # <<<<<<<<<<<<<<
 *     context = Dm.get_attr('__g2l_end__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":106
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__g2l_end__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (end, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dm), ((char *)"__g2l_end__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":107
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__g2l_end__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (end, args, kargs) = context
 *     end(Dm, gvec, mode, lvec, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 107, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":108
 *     context = Dm.get_attr('__g2l_end__')
 *     assert context is not None and type(context) is tuple
 *     (end, args, kargs) = context             # <<<<<<<<<<<<<<
 *     end(Dm, gvec, mode, lvec, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 108, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 108, __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(8, 108, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_end = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":109
 *     assert context is not None and type(context) is tuple
 *     (end, args, kargs) = context
 *     end(Dm, gvec, mode, lvec, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = __Pyx_PyInt_From_InsertMode(__pyx_v_mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dm));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_Dm));
  __Pyx_INCREF(((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_gvec));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_lvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lvec));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_lvec));
  __pyx_t_6 = 0;
  __pyx_t_6 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 109, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_6 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_end, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 109, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petscdmshell.pxi":110
 *     (end, args, kargs) = context
 *     end(Dm, gvec, mode, lvec, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_LocalToGlobalBegin(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":96
 *     return 0
 * 
 * cdef int DMSHELL_GlobalToLocalEnd(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec g,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_GlobalToLocalEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dm);
  __Pyx_XDECREF((PyObject *)__pyx_v_gvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_lvec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_end);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":112
 *     return 0
 * 
 * cdef int DMSHELL_LocalToGlobalBegin(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec g,
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_LocalToGlobalBegin(DM __pyx_v_dm, Vec __pyx_v_g, InsertMode __pyx_v_mode, Vec __pyx_v_l) {
  struct PyPetscDMObject *__pyx_v_Dm = 0;
  struct PyPetscVecObject *__pyx_v_gvec = 0;
  struct PyPetscVecObject *__pyx_v_lvec = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_begin = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_LocalToGlobalBegin", 0);

  /* "PETSc/petscdmshell.pxi":117
 *     PetscInsertMode mode,
 *     PetscVec l) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()             # <<<<<<<<<<<<<<
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 117, __pyx_L1_error)
  __pyx_v_Dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":118
 *     PetscVec l) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec gvec = ref_Vec(g)             # <<<<<<<<<<<<<<
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_g)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_gvec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":119
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)             # <<<<<<<<<<<<<<
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_l)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_lvec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":120
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__l2g_begin__')
 */
  __pyx_v_Dm->dm = __pyx_v_dm;

  /* "PETSc/petscdmshell.pxi":121
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)             # <<<<<<<<<<<<<<
 *     context = Dm.get_attr('__l2g_begin__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":122
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__l2g_begin__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (begin, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dm), ((char *)"__l2g_begin__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":123
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__l2g_begin__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (begin, args, kargs) = context
 *     begin(Dm, gvec, mode, lvec, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 123, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":124
 *     context = Dm.get_attr('__l2g_begin__')
 *     assert context is not None and type(context) is tuple
 *     (begin, args, kargs) = context             # <<<<<<<<<<<<<<
 *     begin(Dm, gvec, mode, lvec, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 124, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 124, __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(8, 124, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_begin = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":125
 *     assert context is not None and type(context) is tuple
 *     (begin, args, kargs) = context
 *     begin(Dm, gvec, mode, lvec, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = __Pyx_PyInt_From_InsertMode(__pyx_v_mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dm));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_Dm));
  __Pyx_INCREF(((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_gvec));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_lvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lvec));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_lvec));
  __pyx_t_6 = 0;
  __pyx_t_6 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 125, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_6 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_begin, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 125, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petscdmshell.pxi":126
 *     (begin, args, kargs) = context
 *     begin(Dm, gvec, mode, lvec, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_LocalToGlobalEnd(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":112
 *     return 0
 * 
 * cdef int DMSHELL_LocalToGlobalBegin(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec g,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_LocalToGlobalBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dm);
  __Pyx_XDECREF((PyObject *)__pyx_v_gvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_lvec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_begin);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":128
 *     return 0
 * 
 * cdef int DMSHELL_LocalToGlobalEnd(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec g,
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_LocalToGlobalEnd(DM __pyx_v_dm, Vec __pyx_v_g, InsertMode __pyx_v_mode, Vec __pyx_v_l) {
  struct PyPetscDMObject *__pyx_v_Dm = 0;
  struct PyPetscVecObject *__pyx_v_gvec = 0;
  struct PyPetscVecObject *__pyx_v_lvec = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_end = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_LocalToGlobalEnd", 0);

  /* "PETSc/petscdmshell.pxi":133
 *     PetscInsertMode mode,
 *     PetscVec l) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()             # <<<<<<<<<<<<<<
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 133, __pyx_L1_error)
  __pyx_v_Dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":134
 *     PetscVec l) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec gvec = ref_Vec(g)             # <<<<<<<<<<<<<<
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_g)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_gvec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":135
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)             # <<<<<<<<<<<<<<
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_l)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_lvec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":136
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__l2g_end__')
 */
  __pyx_v_Dm->dm = __pyx_v_dm;

  /* "PETSc/petscdmshell.pxi":137
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)             # <<<<<<<<<<<<<<
 *     context = Dm.get_attr('__l2g_end__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":138
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__l2g_end__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (end, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dm), ((char *)"__l2g_end__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":139
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__l2g_end__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (end, args, kargs) = context
 *     end(Dm, gvec, mode, lvec, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 139, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":140
 *     context = Dm.get_attr('__l2g_end__')
 *     assert context is not None and type(context) is tuple
 *     (end, args, kargs) = context             # <<<<<<<<<<<<<<
 *     end(Dm, gvec, mode, lvec, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 140, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 140, __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(8, 140, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_end = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":141
 *     assert context is not None and type(context) is tuple
 *     (end, args, kargs) = context
 *     end(Dm, gvec, mode, lvec, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = __Pyx_PyInt_From_InsertMode(__pyx_v_mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dm));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_Dm));
  __Pyx_INCREF(((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_gvec));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_lvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lvec));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_lvec));
  __pyx_t_6 = 0;
  __pyx_t_6 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 141, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_6 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 141, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 141, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_end, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 141, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petscdmshell.pxi":142
 *     (end, args, kargs) = context
 *     end(Dm, gvec, mode, lvec, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_LocalToLocalBegin(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":128
 *     return 0
 * 
 * cdef int DMSHELL_LocalToGlobalEnd(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec g,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_LocalToGlobalEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dm);
  __Pyx_XDECREF((PyObject *)__pyx_v_gvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_lvec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_end);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":144
 *     return 0
 * 
 * cdef int DMSHELL_LocalToLocalBegin(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec g,
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_LocalToLocalBegin(DM __pyx_v_dm, Vec __pyx_v_g, InsertMode __pyx_v_mode, Vec __pyx_v_l) {
  struct PyPetscDMObject *__pyx_v_Dm = 0;
  struct PyPetscVecObject *__pyx_v_gvec = 0;
  struct PyPetscVecObject *__pyx_v_lvec = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_begin = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_LocalToLocalBegin", 0);

  /* "PETSc/petscdmshell.pxi":149
 *     PetscInsertMode mode,
 *     PetscVec l) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()             # <<<<<<<<<<<<<<
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 149, __pyx_L1_error)
  __pyx_v_Dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":150
 *     PetscVec l) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec gvec = ref_Vec(g)             # <<<<<<<<<<<<<<
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_g)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_gvec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":151
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)             # <<<<<<<<<<<<<<
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_l)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_lvec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":152
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__l2l_begin__')
 */
  __pyx_v_Dm->dm = __pyx_v_dm;

  /* "PETSc/petscdmshell.pxi":153
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)             # <<<<<<<<<<<<<<
 *     context = Dm.get_attr('__l2l_begin__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":154
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__l2l_begin__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (begin, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dm), ((char *)"__l2l_begin__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":155
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__l2l_begin__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (begin, args, kargs) = context
 *     begin(Dm, gvec, mode, lvec, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 155, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":156
 *     context = Dm.get_attr('__l2l_begin__')
 *     assert context is not None and type(context) is tuple
 *     (begin, args, kargs) = context             # <<<<<<<<<<<<<<
 *     begin(Dm, gvec, mode, lvec, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 156, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 156, __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(8, 156, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_begin = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":157
 *     assert context is not None and type(context) is tuple
 *     (begin, args, kargs) = context
 *     begin(Dm, gvec, mode, lvec, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = __Pyx_PyInt_From_InsertMode(__pyx_v_mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dm));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_Dm));
  __Pyx_INCREF(((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_gvec));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_lvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lvec));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_lvec));
  __pyx_t_6 = 0;
  __pyx_t_6 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 157, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_6 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_begin, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 157, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petscdmshell.pxi":158
 *     (begin, args, kargs) = context
 *     begin(Dm, gvec, mode, lvec, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_LocalToLocalEnd(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":144
 *     return 0
 * 
 * cdef int DMSHELL_LocalToLocalBegin(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec g,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_LocalToLocalBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dm);
  __Pyx_XDECREF((PyObject *)__pyx_v_gvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_lvec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_begin);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":160
 *     return 0
 * 
 * cdef int DMSHELL_LocalToLocalEnd(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec g,
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_LocalToLocalEnd(DM __pyx_v_dm, Vec __pyx_v_g, InsertMode __pyx_v_mode, Vec __pyx_v_l) {
  struct PyPetscDMObject *__pyx_v_Dm = 0;
  struct PyPetscVecObject *__pyx_v_gvec = 0;
  struct PyPetscVecObject *__pyx_v_lvec = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_end = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_LocalToLocalEnd", 0);

  /* "PETSc/petscdmshell.pxi":165
 *     PetscInsertMode mode,
 *     PetscVec l) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()             # <<<<<<<<<<<<<<
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 165, __pyx_L1_error)
  __pyx_v_Dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":166
 *     PetscVec l) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec gvec = ref_Vec(g)             # <<<<<<<<<<<<<<
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_g)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_gvec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":167
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)             # <<<<<<<<<<<<<<
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_l)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_lvec = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":168
 *     cdef Vec gvec = ref_Vec(g)
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__l2l_end__')
 */
  __pyx_v_Dm->dm = __pyx_v_dm;

  /* "PETSc/petscdmshell.pxi":169
 *     cdef Vec lvec = ref_Vec(l)
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)             # <<<<<<<<<<<<<<
 *     context = Dm.get_attr('__l2l_end__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":170
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__l2l_end__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (end, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dm), ((char *)"__l2l_end__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":171
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__l2l_end__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (end, args, kargs) = context
 *     end(Dm, gvec, mode, lvec, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 171, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":172
 *     context = Dm.get_attr('__l2l_end__')
 *     assert context is not None and type(context) is tuple
 *     (end, args, kargs) = context             # <<<<<<<<<<<<<<
 *     end(Dm, gvec, mode, lvec, *args, **kargs)
 *     return 0
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 172, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 172, __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(8, 172, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_end = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":173
 *     assert context is not None and type(context) is tuple
 *     (end, args, kargs) = context
 *     end(Dm, gvec, mode, lvec, *args, **kargs)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = __Pyx_PyInt_From_InsertMode(__pyx_v_mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dm));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_Dm));
  __Pyx_INCREF(((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_gvec));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_lvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lvec));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_lvec));
  __pyx_t_6 = 0;
  __pyx_t_6 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 173, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_6 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 173, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 173, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_end, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 173, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/petscdmshell.pxi":174
 *     (end, args, kargs) = context
 *     end(Dm, gvec, mode, lvec, *args, **kargs)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_CreateMatrix(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":160
 *     return 0
 * 
 * cdef int DMSHELL_LocalToLocalEnd(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscVec g,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_LocalToLocalEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dm);
  __Pyx_XDECREF((PyObject *)__pyx_v_gvec);
  __Pyx_XDECREF((PyObject *)__pyx_v_lvec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_end);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":176
 *     return 0
 * 
 * cdef int DMSHELL_CreateMatrix(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscMat *cmat) except PETSC_ERR_PYTHON with gil:
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateMatrix(DM __pyx_v_dm, Mat *__pyx_v_cmat) {
  struct PyPetscDMObject *__pyx_v_Dm = 0;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_matrix = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  Mat __pyx_t_9;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_CreateMatrix", 0);

  /* "PETSc/petscdmshell.pxi":179
 *     PetscDM dm,
 *     PetscMat *cmat) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()             # <<<<<<<<<<<<<<
 *     cdef Mat mat
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 179, __pyx_L1_error)
  __pyx_v_Dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":182
 *     cdef Mat mat
 * 
 *     Dm.dm = dm             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__create_matrix__')
 */
  __pyx_v_Dm->dm = __pyx_v_dm;

  /* "PETSc/petscdmshell.pxi":183
 * 
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)             # <<<<<<<<<<<<<<
 *     context = Dm.get_attr('__create_matrix__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":184
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__create_matrix__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (matrix, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dm), ((char *)"__create_matrix__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":185
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__create_matrix__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (matrix, args, kargs) = context
 *     mat = matrix(Dm, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 185, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":186
 *     context = Dm.get_attr('__create_matrix__')
 *     assert context is not None and type(context) is tuple
 *     (matrix, args, kargs) = context             # <<<<<<<<<<<<<<
 *     mat = matrix(Dm, *args, **kargs)
 *     PetscINCREF(mat.obj)
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 186, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 186, __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(8, 186, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_matrix = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":187
 *     assert context is not None and type(context) is tuple
 *     (matrix, args, kargs) = context
 *     mat = matrix(Dm, *args, **kargs)             # <<<<<<<<<<<<<<
 *     PetscINCREF(mat.obj)
 *     cmat[0] = mat.mat
 */
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dm));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Dm));
  __pyx_t_1 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 187, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_1 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_matrix, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 187, __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_8petsc4py_5PETSc_Mat))))) __PYX_ERR(8, 187, __pyx_L1_error)
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":188
 *     (matrix, args, kargs) = context
 *     mat = matrix(Dm, *args, **kargs)
 *     PetscINCREF(mat.obj)             # <<<<<<<<<<<<<<
 *     cmat[0] = mat.mat
 *     return 0
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_mat->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":189
 *     mat = matrix(Dm, *args, **kargs)
 *     PetscINCREF(mat.obj)
 *     cmat[0] = mat.mat             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_9 = __pyx_v_mat->mat;
  (__pyx_v_cmat[0]) = __pyx_t_9;

  /* "PETSc/petscdmshell.pxi":190
 *     PetscINCREF(mat.obj)
 *     cmat[0] = mat.mat
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_Coarsen(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":176
 *     return 0
 * 
 * cdef int DMSHELL_CreateMatrix(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscMat *cmat) except PETSC_ERR_PYTHON with gil:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_CreateMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dm);
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_matrix);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":192
 *     return 0
 * 
 * cdef int DMSHELL_Coarsen(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     MPI_Comm comm,
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_Coarsen(DM __pyx_v_dm, MPI_Comm __pyx_v_comm, DM *__pyx_v_dmc) {
  struct PyPetscDMObject *__pyx_v_Dm = 0;
  struct PyPetscDMObject *__pyx_v_Dmc = 0;
  struct PyPetscCommObject *__pyx_v_Comm = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_coarsen = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  DM __pyx_t_9;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_Coarsen", 0);

  /* "PETSc/petscdmshell.pxi":196
 *     MPI_Comm comm,
 *     PetscDM *dmc) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()             # <<<<<<<<<<<<<<
 *     cdef DM Dmc
 *     cdef Comm Comm = new_Comm(comm)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 196, __pyx_L1_error)
  __pyx_v_Dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":198
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef DM Dmc
 *     cdef Comm Comm = new_Comm(comm)             # <<<<<<<<<<<<<<
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_new_Comm(__pyx_v_comm)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_Comm = ((struct PyPetscCommObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":199
 *     cdef DM Dmc
 *     cdef Comm Comm = new_Comm(comm)
 *     Dm.dm = dm             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__coarsen__')
 */
  __pyx_v_Dm->dm = __pyx_v_dm;

  /* "PETSc/petscdmshell.pxi":200
 *     cdef Comm Comm = new_Comm(comm)
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)             # <<<<<<<<<<<<<<
 *     context = Dm.get_attr('__coarsen__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":201
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__coarsen__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (coarsen, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dm), ((char *)"__coarsen__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":202
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__coarsen__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (coarsen, args, kargs) = context
 *     Dmc = coarsen(Dm, Comm, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 202, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":203
 *     context = Dm.get_attr('__coarsen__')
 *     assert context is not None and type(context) is tuple
 *     (coarsen, args, kargs) = context             # <<<<<<<<<<<<<<
 *     Dmc = coarsen(Dm, Comm, *args, **kargs)
 *     PetscINCREF(Dmc.obj)
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 203, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 203, __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(8, 203, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_coarsen = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":204
 *     assert context is not None and type(context) is tuple
 *     (coarsen, args, kargs) = context
 *     Dmc = coarsen(Dm, Comm, *args, **kargs)             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dmc.obj)
 *     dmc[0] = Dmc.dm
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dm));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Dm));
  __Pyx_INCREF(((PyObject *)__pyx_v_Comm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Comm));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_Comm));
  __pyx_t_1 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 204, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_1 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_coarsen, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 204, __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_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 204, __pyx_L1_error)
  __pyx_v_Dmc = ((struct PyPetscDMObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":205
 *     (coarsen, args, kargs) = context
 *     Dmc = coarsen(Dm, Comm, *args, **kargs)
 *     PetscINCREF(Dmc.obj)             # <<<<<<<<<<<<<<
 *     dmc[0] = Dmc.dm
 *     return 0
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dmc->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":206
 *     Dmc = coarsen(Dm, Comm, *args, **kargs)
 *     PetscINCREF(Dmc.obj)
 *     dmc[0] = Dmc.dm             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_9 = __pyx_v_Dmc->dm;
  (__pyx_v_dmc[0]) = __pyx_t_9;

  /* "PETSc/petscdmshell.pxi":207
 *     PetscINCREF(Dmc.obj)
 *     dmc[0] = Dmc.dm
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_Refine(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":192
 *     return 0
 * 
 * cdef int DMSHELL_Coarsen(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     MPI_Comm comm,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_Coarsen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dm);
  __Pyx_XDECREF((PyObject *)__pyx_v_Dmc);
  __Pyx_XDECREF((PyObject *)__pyx_v_Comm);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_coarsen);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":209
 *     return 0
 * 
 * cdef int DMSHELL_Refine(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     MPI_Comm comm,
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_Refine(DM __pyx_v_dm, MPI_Comm __pyx_v_comm, DM *__pyx_v_dmf) {
  struct PyPetscDMObject *__pyx_v_Dm = 0;
  struct PyPetscDMObject *__pyx_v_Dmf = 0;
  struct PyPetscCommObject *__pyx_v_Comm = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_refine = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  DM __pyx_t_9;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_Refine", 0);

  /* "PETSc/petscdmshell.pxi":213
 *     MPI_Comm comm,
 *     PetscDM *dmf) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()             # <<<<<<<<<<<<<<
 *     cdef DM Dmf
 *     cdef Comm Comm = new_Comm(comm)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 213, __pyx_L1_error)
  __pyx_v_Dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":215
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef DM Dmf
 *     cdef Comm Comm = new_Comm(comm)             # <<<<<<<<<<<<<<
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_new_Comm(__pyx_v_comm)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_Comm = ((struct PyPetscCommObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":216
 *     cdef DM Dmf
 *     cdef Comm Comm = new_Comm(comm)
 *     Dm.dm = dm             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__refine__')
 */
  __pyx_v_Dm->dm = __pyx_v_dm;

  /* "PETSc/petscdmshell.pxi":217
 *     cdef Comm Comm = new_Comm(comm)
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)             # <<<<<<<<<<<<<<
 *     context = Dm.get_attr('__refine__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":218
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__refine__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (refine, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dm), ((char *)"__refine__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":219
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__refine__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (refine, args, kargs) = context
 *     Dmf = refine(Dm, Comm, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 219, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":220
 *     context = Dm.get_attr('__refine__')
 *     assert context is not None and type(context) is tuple
 *     (refine, args, kargs) = context             # <<<<<<<<<<<<<<
 *     Dmf = refine(Dm, Comm, *args, **kargs)
 *     PetscINCREF(Dmf.obj)
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 220, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 220, __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(8, 220, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_refine = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":221
 *     assert context is not None and type(context) is tuple
 *     (refine, args, kargs) = context
 *     Dmf = refine(Dm, Comm, *args, **kargs)             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dmf.obj)
 *     dmf[0] = Dmf.dm
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dm));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Dm));
  __Pyx_INCREF(((PyObject *)__pyx_v_Comm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Comm));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_Comm));
  __pyx_t_1 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 221, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_1 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_refine, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 221, __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_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 221, __pyx_L1_error)
  __pyx_v_Dmf = ((struct PyPetscDMObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":222
 *     (refine, args, kargs) = context
 *     Dmf = refine(Dm, Comm, *args, **kargs)
 *     PetscINCREF(Dmf.obj)             # <<<<<<<<<<<<<<
 *     dmf[0] = Dmf.dm
 *     return 0
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dmf->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":223
 *     Dmf = refine(Dm, Comm, *args, **kargs)
 *     PetscINCREF(Dmf.obj)
 *     dmf[0] = Dmf.dm             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_9 = __pyx_v_Dmf->dm;
  (__pyx_v_dmf[0]) = __pyx_t_9;

  /* "PETSc/petscdmshell.pxi":224
 *     PetscINCREF(Dmf.obj)
 *     dmf[0] = Dmf.dm
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_CreateInterpolation(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":209
 *     return 0
 * 
 * cdef int DMSHELL_Refine(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     MPI_Comm comm,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_Refine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dm);
  __Pyx_XDECREF((PyObject *)__pyx_v_Dmf);
  __Pyx_XDECREF((PyObject *)__pyx_v_Comm);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_refine);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":226
 *     return 0
 * 
 * cdef int DMSHELL_CreateInterpolation(             # <<<<<<<<<<<<<<
 *     PetscDM dmc,
 *     PetscDM dmf,
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateInterpolation(DM __pyx_v_dmc, DM __pyx_v_dmf, Mat *__pyx_v_cmat, Vec *__pyx_v_cvec) {
  struct PyPetscDMObject *__pyx_v_Dmc = 0;
  struct PyPetscDMObject *__pyx_v_Dmf = 0;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_interpolation = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  Mat __pyx_t_9;
  Vec __pyx_t_10;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_CreateInterpolation", 0);

  /* "PETSc/petscdmshell.pxi":231
 *     PetscMat *cmat,
 *     PetscVec *cvec) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dmc = subtype_DM(dmc)()             # <<<<<<<<<<<<<<
 *     cdef DM Dmf = subtype_DM(dmf)()
 *     cdef Mat mat
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dmc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 231, __pyx_L1_error)
  __pyx_v_Dmc = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":232
 *     PetscVec *cvec) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dmc = subtype_DM(dmc)()
 *     cdef DM Dmf = subtype_DM(dmf)()             # <<<<<<<<<<<<<<
 *     cdef Mat mat
 *     cdef Vec vec
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dmf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 232, __pyx_L1_error)
  __pyx_v_Dmf = ((struct PyPetscDMObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscdmshell.pxi":235
 *     cdef Mat mat
 *     cdef Vec vec
 *     Dmc.dm = dmc             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dmc.obj)
 *     Dmf.dm = dmf
 */
  __pyx_v_Dmc->dm = __pyx_v_dmc;

  /* "PETSc/petscdmshell.pxi":236
 *     cdef Vec vec
 *     Dmc.dm = dmc
 *     PetscINCREF(Dmc.obj)             # <<<<<<<<<<<<<<
 *     Dmf.dm = dmf
 *     PetscINCREF(Dmf.obj)
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dmc->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":237
 *     Dmc.dm = dmc
 *     PetscINCREF(Dmc.obj)
 *     Dmf.dm = dmf             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dmf.obj)
 *     context = Dmc.get_attr('__create_interpolation__')
 */
  __pyx_v_Dmf->dm = __pyx_v_dmf;

  /* "PETSc/petscdmshell.pxi":238
 *     PetscINCREF(Dmc.obj)
 *     Dmf.dm = dmf
 *     PetscINCREF(Dmf.obj)             # <<<<<<<<<<<<<<
 *     context = Dmc.get_attr('__create_interpolation__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dmf->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":239
 *     Dmf.dm = dmf
 *     PetscINCREF(Dmf.obj)
 *     context = Dmc.get_attr('__create_interpolation__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (interpolation, args, kargs) = context
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dmc->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dmc), ((char *)"__create_interpolation__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscdmshell.pxi":240
 *     PetscINCREF(Dmf.obj)
 *     context = Dmc.get_attr('__create_interpolation__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (interpolation, args, kargs) = context
 *     mat, vec = interpolation(Dmc, Dmf, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 240, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":241
 *     context = Dmc.get_attr('__create_interpolation__')
 *     assert context is not None and type(context) is tuple
 *     (interpolation, args, kargs) = context             # <<<<<<<<<<<<<<
 *     mat, vec = interpolation(Dmc, Dmf, *args, **kargs)
 *     PetscINCREF(mat.obj)
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 241, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 241, __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(8, 241, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_interpolation = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":242
 *     assert context is not None and type(context) is tuple
 *     (interpolation, args, kargs) = context
 *     mat, vec = interpolation(Dmc, Dmf, *args, **kargs)             # <<<<<<<<<<<<<<
 *     PetscINCREF(mat.obj)
 *     cmat[0] = mat.mat
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dmc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dmc));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Dmc));
  __Pyx_INCREF(((PyObject *)__pyx_v_Dmf));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dmf));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_Dmf));
  __pyx_t_2 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 242, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_2 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_interpolation, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_CPYTHON
    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(8, 242, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 242, __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;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(8, 242, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(8, 242, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(8, 242, __pyx_L1_error)
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(8, 242, __pyx_L1_error)
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscdmshell.pxi":243
 *     (interpolation, args, kargs) = context
 *     mat, vec = interpolation(Dmc, Dmf, *args, **kargs)
 *     PetscINCREF(mat.obj)             # <<<<<<<<<<<<<<
 *     cmat[0] = mat.mat
 *     if vec is None:
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_mat->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":244
 *     mat, vec = interpolation(Dmc, Dmf, *args, **kargs)
 *     PetscINCREF(mat.obj)
 *     cmat[0] = mat.mat             # <<<<<<<<<<<<<<
 *     if vec is None:
 *         cvec[0] = NULL
 */
  __pyx_t_9 = __pyx_v_mat->mat;
  (__pyx_v_cmat[0]) = __pyx_t_9;

  /* "PETSc/petscdmshell.pxi":245
 *     PetscINCREF(mat.obj)
 *     cmat[0] = mat.mat
 *     if vec is None:             # <<<<<<<<<<<<<<
 *         cvec[0] = NULL
 *     else:
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_vec) == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "PETSc/petscdmshell.pxi":246
 *     cmat[0] = mat.mat
 *     if vec is None:
 *         cvec[0] = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         PetscINCREF(vec.obj)
 */
    (__pyx_v_cvec[0]) = NULL;

    /* "PETSc/petscdmshell.pxi":245
 *     PetscINCREF(mat.obj)
 *     cmat[0] = mat.mat
 *     if vec is None:             # <<<<<<<<<<<<<<
 *         cvec[0] = NULL
 *     else:
 */
    goto __pyx_L9;
  }

  /* "PETSc/petscdmshell.pxi":248
 *         cvec[0] = NULL
 *     else:
 *         PetscINCREF(vec.obj)             # <<<<<<<<<<<<<<
 *         cvec[0] = vec.vec
 *     return 0
 */
  /*else*/ {
    __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_vec->__pyx_base.obj);

    /* "PETSc/petscdmshell.pxi":249
 *     else:
 *         PetscINCREF(vec.obj)
 *         cvec[0] = vec.vec             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_10 = __pyx_v_vec->vec;
    (__pyx_v_cvec[0]) = __pyx_t_10;
  }
  __pyx_L9:;

  /* "PETSc/petscdmshell.pxi":250
 *         PetscINCREF(vec.obj)
 *         cvec[0] = vec.vec
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_CreateInjection(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":226
 *     return 0
 * 
 * cdef int DMSHELL_CreateInterpolation(             # <<<<<<<<<<<<<<
 *     PetscDM dmc,
 *     PetscDM dmf,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_CreateInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dmc);
  __Pyx_XDECREF((PyObject *)__pyx_v_Dmf);
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_interpolation);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":252
 *     return 0
 * 
 * cdef int DMSHELL_CreateInjection(             # <<<<<<<<<<<<<<
 *     PetscDM dmc,
 *     PetscDM dmf,
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateInjection(DM __pyx_v_dmc, DM __pyx_v_dmf, Mat *__pyx_v_cmat) {
  struct PyPetscDMObject *__pyx_v_Dmc = 0;
  struct PyPetscDMObject *__pyx_v_Dmf = 0;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_injection = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  Mat __pyx_t_9;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_CreateInjection", 0);

  /* "PETSc/petscdmshell.pxi":256
 *     PetscDM dmf,
 *     PetscMat *cmat) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dmc = subtype_DM(dmc)()             # <<<<<<<<<<<<<<
 *     cdef DM Dmf = subtype_DM(dmf)()
 *     cdef Mat mat
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dmc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 256, __pyx_L1_error)
  __pyx_v_Dmc = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":257
 *     PetscMat *cmat) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dmc = subtype_DM(dmc)()
 *     cdef DM Dmf = subtype_DM(dmf)()             # <<<<<<<<<<<<<<
 *     cdef Mat mat
 *     Dmc.dm = dmc
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dmf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 257, __pyx_L1_error)
  __pyx_v_Dmf = ((struct PyPetscDMObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/petscdmshell.pxi":259
 *     cdef DM Dmf = subtype_DM(dmf)()
 *     cdef Mat mat
 *     Dmc.dm = dmc             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dmc.obj)
 *     Dmf.dm = dmf
 */
  __pyx_v_Dmc->dm = __pyx_v_dmc;

  /* "PETSc/petscdmshell.pxi":260
 *     cdef Mat mat
 *     Dmc.dm = dmc
 *     PetscINCREF(Dmc.obj)             # <<<<<<<<<<<<<<
 *     Dmf.dm = dmf
 *     PetscINCREF(Dmf.obj)
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dmc->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":261
 *     Dmc.dm = dmc
 *     PetscINCREF(Dmc.obj)
 *     Dmf.dm = dmf             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dmf.obj)
 *     context = Dmc.get_attr('__create_injection__')
 */
  __pyx_v_Dmf->dm = __pyx_v_dmf;

  /* "PETSc/petscdmshell.pxi":262
 *     PetscINCREF(Dmc.obj)
 *     Dmf.dm = dmf
 *     PetscINCREF(Dmf.obj)             # <<<<<<<<<<<<<<
 *     context = Dmc.get_attr('__create_injection__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dmf->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":263
 *     Dmf.dm = dmf
 *     PetscINCREF(Dmf.obj)
 *     context = Dmc.get_attr('__create_injection__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (injection, args, kargs) = context
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dmc->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dmc), ((char *)"__create_injection__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/petscdmshell.pxi":264
 *     PetscINCREF(Dmf.obj)
 *     context = Dmc.get_attr('__create_injection__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (injection, args, kargs) = context
 *     mat = injection(Dmc, Dmf, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 264, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":265
 *     context = Dmc.get_attr('__create_injection__')
 *     assert context is not None and type(context) is tuple
 *     (injection, args, kargs) = context             # <<<<<<<<<<<<<<
 *     mat = injection(Dmc, Dmf, *args, **kargs)
 *     PetscINCREF(mat.obj)
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 265, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 265, __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(8, 265, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_injection = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":266
 *     assert context is not None and type(context) is tuple
 *     (injection, args, kargs) = context
 *     mat = injection(Dmc, Dmf, *args, **kargs)             # <<<<<<<<<<<<<<
 *     PetscINCREF(mat.obj)
 *     cmat[0] = mat.mat
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dmc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dmc));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Dmc));
  __Pyx_INCREF(((PyObject *)__pyx_v_Dmf));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dmf));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_Dmf));
  __pyx_t_2 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 266, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_2 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_injection, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(8, 266, __pyx_L1_error)
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":267
 *     (injection, args, kargs) = context
 *     mat = injection(Dmc, Dmf, *args, **kargs)
 *     PetscINCREF(mat.obj)             # <<<<<<<<<<<<<<
 *     cmat[0] = mat.mat
 *     return 0
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_mat->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":268
 *     mat = injection(Dmc, Dmf, *args, **kargs)
 *     PetscINCREF(mat.obj)
 *     cmat[0] = mat.mat             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_9 = __pyx_v_mat->mat;
  (__pyx_v_cmat[0]) = __pyx_t_9;

  /* "PETSc/petscdmshell.pxi":269
 *     PetscINCREF(mat.obj)
 *     cmat[0] = mat.mat
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_CreateFieldDecomposition(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":252
 *     return 0
 * 
 * cdef int DMSHELL_CreateInjection(             # <<<<<<<<<<<<<<
 *     PetscDM dmc,
 *     PetscDM dmf,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_CreateInjection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dmc);
  __Pyx_XDECREF((PyObject *)__pyx_v_Dmf);
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_injection);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":271
 *     return 0
 * 
 * cdef int DMSHELL_CreateFieldDecomposition(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscInt *clen,
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateFieldDecomposition(DM __pyx_v_dm, PetscInt *__pyx_v_clen, char ***__pyx_v_namelist, IS **__pyx_v_islist, DM **__pyx_v_dmlist) {
  struct PyPetscDMObject *__pyx_v_Dm = 0;
  int __pyx_v_i;
  const char *__pyx_v_cname;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_decomp = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  PyObject *__pyx_v_names = NULL;
  PyObject *__pyx_v_ises = NULL;
  PyObject *__pyx_v_dms = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  IS __pyx_t_13;
  DM __pyx_t_14;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_CreateFieldDecomposition", 0);

  /* "PETSc/petscdmshell.pxi":277
 *     PetscIS **islist,
 *     PetscDM **dmlist) except PETSC_ERR_PYTHON with gil:
 *     cdef DM Dm = subtype_DM(dm)()             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef const_char *cname = NULL
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_dm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 277, __pyx_L1_error)
  __pyx_v_Dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":279
 *     cdef DM Dm = subtype_DM(dm)()
 *     cdef int i
 *     cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 */
  __pyx_v_cname = NULL;

  /* "PETSc/petscdmshell.pxi":280
 *     cdef int i
 *     cdef const_char *cname = NULL
 *     Dm.dm = dm             # <<<<<<<<<<<<<<
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__create_field_decomp__')
 */
  __pyx_v_Dm->dm = __pyx_v_dm;

  /* "PETSc/petscdmshell.pxi":281
 *     cdef const_char *cname = NULL
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)             # <<<<<<<<<<<<<<
 *     context = Dm.get_attr('__create_field_decomp__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_Dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":282
 *     Dm.dm = dm
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__create_field_decomp__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (decomp, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_Dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_Dm), ((char *)"__create_field_decomp__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":283
 *     PetscINCREF(Dm.obj)
 *     context = Dm.get_attr('__create_field_decomp__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (decomp, args, kargs) = context
 *     names, ises, dms = decomp(Dm, *args, **kargs)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 283, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":284
 *     context = Dm.get_attr('__create_field_decomp__')
 *     assert context is not None and type(context) is tuple
 *     (decomp, args, kargs) = context             # <<<<<<<<<<<<<<
 *     names, ises, dms = decomp(Dm, *args, **kargs)
 * 
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 284, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 284, __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(8, 284, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_decomp = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":285
 *     assert context is not None and type(context) is tuple
 *     (decomp, args, kargs) = context
 *     names, ises, dms = decomp(Dm, *args, **kargs)             # <<<<<<<<<<<<<<
 * 
 *     if clen != NULL:
 */
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Dm));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Dm));
  __pyx_t_1 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 285, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_1 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_decomp, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 285, __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(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
    PyObject* sequence = __pyx_t_6;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 285, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(8, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_9); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 2; __pyx_t_7 = __pyx_t_8(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_9), 3) < 0) __PYX_ERR(8, 285, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(8, 285, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  __pyx_v_names = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_ises = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_dms = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "PETSc/petscdmshell.pxi":287
 *     names, ises, dms = decomp(Dm, *args, **kargs)
 * 
 *     if clen != NULL:             # <<<<<<<<<<<<<<
 *         if names is not None:
 *             clen[0] = <PetscInt>len(names)
 */
  __pyx_t_3 = ((__pyx_v_clen != NULL) != 0);
  if (__pyx_t_3) {

    /* "PETSc/petscdmshell.pxi":288
 * 
 *     if clen != NULL:
 *         if names is not None:             # <<<<<<<<<<<<<<
 *             clen[0] = <PetscInt>len(names)
 *         elif ises is not None:
 */
    __pyx_t_3 = (__pyx_v_names != Py_None);
    __pyx_t_4 = (__pyx_t_3 != 0);
    if (__pyx_t_4) {

      /* "PETSc/petscdmshell.pxi":289
 *     if clen != NULL:
 *         if names is not None:
 *             clen[0] = <PetscInt>len(names)             # <<<<<<<<<<<<<<
 *         elif ises is not None:
 *             clen[0] = <PetscInt>len(ises)
 */
      __pyx_t_10 = PyObject_Length(__pyx_v_names); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(8, 289, __pyx_L1_error)
      (__pyx_v_clen[0]) = ((PetscInt)__pyx_t_10);

      /* "PETSc/petscdmshell.pxi":288
 * 
 *     if clen != NULL:
 *         if names is not None:             # <<<<<<<<<<<<<<
 *             clen[0] = <PetscInt>len(names)
 *         elif ises is not None:
 */
      goto __pyx_L10;
    }

    /* "PETSc/petscdmshell.pxi":290
 *         if names is not None:
 *             clen[0] = <PetscInt>len(names)
 *         elif ises is not None:             # <<<<<<<<<<<<<<
 *             clen[0] = <PetscInt>len(ises)
 *         elif dms is not None:
 */
    __pyx_t_4 = (__pyx_v_ises != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {

      /* "PETSc/petscdmshell.pxi":291
 *             clen[0] = <PetscInt>len(names)
 *         elif ises is not None:
 *             clen[0] = <PetscInt>len(ises)             # <<<<<<<<<<<<<<
 *         elif dms is not None:
 *             clen[0] = <PetscInt>len(dms)
 */
      __pyx_t_10 = PyObject_Length(__pyx_v_ises); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(8, 291, __pyx_L1_error)
      (__pyx_v_clen[0]) = ((PetscInt)__pyx_t_10);

      /* "PETSc/petscdmshell.pxi":290
 *         if names is not None:
 *             clen[0] = <PetscInt>len(names)
 *         elif ises is not None:             # <<<<<<<<<<<<<<
 *             clen[0] = <PetscInt>len(ises)
 *         elif dms is not None:
 */
      goto __pyx_L10;
    }

    /* "PETSc/petscdmshell.pxi":292
 *         elif ises is not None:
 *             clen[0] = <PetscInt>len(ises)
 *         elif dms is not None:             # <<<<<<<<<<<<<<
 *             clen[0] = <PetscInt>len(dms)
 *         else:
 */
    __pyx_t_3 = (__pyx_v_dms != Py_None);
    __pyx_t_4 = (__pyx_t_3 != 0);
    if (__pyx_t_4) {

      /* "PETSc/petscdmshell.pxi":293
 *             clen[0] = <PetscInt>len(ises)
 *         elif dms is not None:
 *             clen[0] = <PetscInt>len(dms)             # <<<<<<<<<<<<<<
 *         else:
 *             clen[0] = 0
 */
      __pyx_t_10 = PyObject_Length(__pyx_v_dms); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(8, 293, __pyx_L1_error)
      (__pyx_v_clen[0]) = ((PetscInt)__pyx_t_10);

      /* "PETSc/petscdmshell.pxi":292
 *         elif ises is not None:
 *             clen[0] = <PetscInt>len(ises)
 *         elif dms is not None:             # <<<<<<<<<<<<<<
 *             clen[0] = <PetscInt>len(dms)
 *         else:
 */
      goto __pyx_L10;
    }

    /* "PETSc/petscdmshell.pxi":295
 *             clen[0] = <PetscInt>len(dms)
 *         else:
 *             clen[0] = 0             # <<<<<<<<<<<<<<
 * 
 *     if namelist != NULL and names is not None:
 */
    /*else*/ {
      (__pyx_v_clen[0]) = 0;
    }
    __pyx_L10:;

    /* "PETSc/petscdmshell.pxi":287
 *     names, ises, dms = decomp(Dm, *args, **kargs)
 * 
 *     if clen != NULL:             # <<<<<<<<<<<<<<
 *         if names is not None:
 *             clen[0] = <PetscInt>len(names)
 */
  }

  /* "PETSc/petscdmshell.pxi":297
 *             clen[0] = 0
 * 
 *     if namelist != NULL and names is not None:             # <<<<<<<<<<<<<<
 *         CHKERR( PetscMalloc(len(names)*sizeof(char**), namelist) )
 *         for i in range(len(names)):
 */
  __pyx_t_3 = ((__pyx_v_namelist != NULL) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_4 = __pyx_t_3;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_names != Py_None);
  __pyx_t_5 = (__pyx_t_3 != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_4) {

    /* "PETSc/petscdmshell.pxi":298
 * 
 *     if namelist != NULL and names is not None:
 *         CHKERR( PetscMalloc(len(names)*sizeof(char**), namelist) )             # <<<<<<<<<<<<<<
 *         for i in range(len(names)):
 *             names[i] = str2bytes(names[i], &cname)
 */
    __pyx_t_10 = PyObject_Length(__pyx_v_names); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(8, 298, __pyx_L1_error)
    __pyx_t_11 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscMalloc((__pyx_t_10 * (sizeof(char **))), __pyx_v_namelist)); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(8, 298, __pyx_L1_error)

    /* "PETSc/petscdmshell.pxi":299
 *     if namelist != NULL and names is not None:
 *         CHKERR( PetscMalloc(len(names)*sizeof(char**), namelist) )
 *         for i in range(len(names)):             # <<<<<<<<<<<<<<
 *             names[i] = str2bytes(names[i], &cname)
 *             CHKERR( PetscStrallocpy(cname, &(namelist[0][i])) )
 */
    __pyx_t_10 = PyObject_Length(__pyx_v_names); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(8, 299, __pyx_L1_error)
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "PETSc/petscdmshell.pxi":300
 *         CHKERR( PetscMalloc(len(names)*sizeof(char**), namelist) )
 *         for i in range(len(names)):
 *             names[i] = str2bytes(names[i], &cname)             # <<<<<<<<<<<<<<
 *             CHKERR( PetscStrallocpy(cname, &(namelist[0][i])) )
 * 
 */
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_names, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_t_6, (&__pyx_v_cname)); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(__Pyx_SetItemInt(__pyx_v_names, __pyx_v_i, __pyx_t_7, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(8, 300, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "PETSc/petscdmshell.pxi":301
 *         for i in range(len(names)):
 *             names[i] = str2bytes(names[i], &cname)
 *             CHKERR( PetscStrallocpy(cname, &(namelist[0][i])) )             # <<<<<<<<<<<<<<
 * 
 *     if islist != NULL and ises is not None:
 */
      __pyx_t_12 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscStrallocpy(__pyx_v_cname, (&((__pyx_v_namelist[0])[__pyx_v_i])))); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(8, 301, __pyx_L1_error)
    }

    /* "PETSc/petscdmshell.pxi":297
 *             clen[0] = 0
 * 
 *     if namelist != NULL and names is not None:             # <<<<<<<<<<<<<<
 *         CHKERR( PetscMalloc(len(names)*sizeof(char**), namelist) )
 *         for i in range(len(names)):
 */
  }

  /* "PETSc/petscdmshell.pxi":303
 *             CHKERR( PetscStrallocpy(cname, &(namelist[0][i])) )
 * 
 *     if islist != NULL and ises is not None:             # <<<<<<<<<<<<<<
 *         CHKERR( PetscMalloc(len(ises)*sizeof(PetscIS), islist) )
 *         for i in range(len(ises)):
 */
  __pyx_t_5 = ((__pyx_v_islist != NULL) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_5 = (__pyx_v_ises != Py_None);
  __pyx_t_3 = (__pyx_t_5 != 0);
  __pyx_t_4 = __pyx_t_3;
  __pyx_L17_bool_binop_done:;
  if (__pyx_t_4) {

    /* "PETSc/petscdmshell.pxi":304
 * 
 *     if islist != NULL and ises is not None:
 *         CHKERR( PetscMalloc(len(ises)*sizeof(PetscIS), islist) )             # <<<<<<<<<<<<<<
 *         for i in range(len(ises)):
 *             islist[0][i] = (<IS?>ises[i]).iset
 */
    __pyx_t_10 = PyObject_Length(__pyx_v_ises); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(8, 304, __pyx_L1_error)
    __pyx_t_11 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscMalloc((__pyx_t_10 * (sizeof(IS))), __pyx_v_islist)); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(8, 304, __pyx_L1_error)

    /* "PETSc/petscdmshell.pxi":305
 *     if islist != NULL and ises is not None:
 *         CHKERR( PetscMalloc(len(ises)*sizeof(PetscIS), islist) )
 *         for i in range(len(ises)):             # <<<<<<<<<<<<<<
 *             islist[0][i] = (<IS?>ises[i]).iset
 *             PetscINCREF((<IS?>ises[i]).obj)
 */
    __pyx_t_10 = PyObject_Length(__pyx_v_ises); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(8, 305, __pyx_L1_error)
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "PETSc/petscdmshell.pxi":306
 *         CHKERR( PetscMalloc(len(ises)*sizeof(PetscIS), islist) )
 *         for i in range(len(ises)):
 *             islist[0][i] = (<IS?>ises[i]).iset             # <<<<<<<<<<<<<<
 *             PetscINCREF((<IS?>ises[i]).obj)
 * 
 */
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_ises, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (!(likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(8, 306, __pyx_L1_error)
      __pyx_t_13 = ((struct PyPetscISObject *)__pyx_t_7)->iset;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      ((__pyx_v_islist[0])[__pyx_v_i]) = __pyx_t_13;

      /* "PETSc/petscdmshell.pxi":307
 *         for i in range(len(ises)):
 *             islist[0][i] = (<IS?>ises[i]).iset
 *             PetscINCREF((<IS?>ises[i]).obj)             # <<<<<<<<<<<<<<
 * 
 *     if dmlist != NULL and dms is not None:
 */
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_ises, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (!(likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(8, 307, __pyx_L1_error)
      __pyx_f_8petsc4py_5PETSc_PetscINCREF(((struct PyPetscISObject *)__pyx_t_7)->__pyx_base.obj);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }

    /* "PETSc/petscdmshell.pxi":303
 *             CHKERR( PetscStrallocpy(cname, &(namelist[0][i])) )
 * 
 *     if islist != NULL and ises is not None:             # <<<<<<<<<<<<<<
 *         CHKERR( PetscMalloc(len(ises)*sizeof(PetscIS), islist) )
 *         for i in range(len(ises)):
 */
  }

  /* "PETSc/petscdmshell.pxi":309
 *             PetscINCREF((<IS?>ises[i]).obj)
 * 
 *     if dmlist != NULL and dms is not None:             # <<<<<<<<<<<<<<
 *         CHKERR( PetscMalloc(len(dms)*sizeof(PetscDM), dmlist) )
 *         for i in range(len(dms)):
 */
  __pyx_t_3 = ((__pyx_v_dmlist != NULL) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_4 = __pyx_t_3;
    goto __pyx_L22_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_dms != Py_None);
  __pyx_t_5 = (__pyx_t_3 != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L22_bool_binop_done:;
  if (__pyx_t_4) {

    /* "PETSc/petscdmshell.pxi":310
 * 
 *     if dmlist != NULL and dms is not None:
 *         CHKERR( PetscMalloc(len(dms)*sizeof(PetscDM), dmlist) )             # <<<<<<<<<<<<<<
 *         for i in range(len(dms)):
 *             dmlist[0][i] = (<DM?>dms[i]).dm
 */
    __pyx_t_10 = PyObject_Length(__pyx_v_dms); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(8, 310, __pyx_L1_error)
    __pyx_t_11 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscMalloc((__pyx_t_10 * (sizeof(DM))), __pyx_v_dmlist)); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(8, 310, __pyx_L1_error)

    /* "PETSc/petscdmshell.pxi":311
 *     if dmlist != NULL and dms is not None:
 *         CHKERR( PetscMalloc(len(dms)*sizeof(PetscDM), dmlist) )
 *         for i in range(len(dms)):             # <<<<<<<<<<<<<<
 *             dmlist[0][i] = (<DM?>dms[i]).dm
 *             PetscINCREF((<DM?>dms[i]).obj)
 */
    __pyx_t_10 = PyObject_Length(__pyx_v_dms); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(8, 311, __pyx_L1_error)
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "PETSc/petscdmshell.pxi":312
 *         CHKERR( PetscMalloc(len(dms)*sizeof(PetscDM), dmlist) )
 *         for i in range(len(dms)):
 *             dmlist[0][i] = (<DM?>dms[i]).dm             # <<<<<<<<<<<<<<
 *             PetscINCREF((<DM?>dms[i]).obj)
 *     return 0
 */
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_dms, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 312, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (!(likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_8petsc4py_5PETSc_DM)))) __PYX_ERR(8, 312, __pyx_L1_error)
      __pyx_t_14 = ((struct PyPetscDMObject *)__pyx_t_7)->dm;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      ((__pyx_v_dmlist[0])[__pyx_v_i]) = __pyx_t_14;

      /* "PETSc/petscdmshell.pxi":313
 *         for i in range(len(dms)):
 *             dmlist[0][i] = (<DM?>dms[i]).dm
 *             PetscINCREF((<DM?>dms[i]).obj)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_dms, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (!(likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_8petsc4py_5PETSc_DM)))) __PYX_ERR(8, 313, __pyx_L1_error)
      __pyx_f_8petsc4py_5PETSc_PetscINCREF(((struct PyPetscDMObject *)__pyx_t_7)->__pyx_base.obj);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }

    /* "PETSc/petscdmshell.pxi":309
 *             PetscINCREF((<IS?>ises[i]).obj)
 * 
 *     if dmlist != NULL and dms is not None:             # <<<<<<<<<<<<<<
 *         CHKERR( PetscMalloc(len(dms)*sizeof(PetscDM), dmlist) )
 *         for i in range(len(dms)):
 */
  }

  /* "PETSc/petscdmshell.pxi":314
 *             dmlist[0][i] = (<DM?>dms[i]).dm
 *             PetscINCREF((<DM?>dms[i]).obj)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int DMSHELL_CreateSubDM(
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/petscdmshell.pxi":271
 *     return 0
 * 
 * cdef int DMSHELL_CreateFieldDecomposition(             # <<<<<<<<<<<<<<
 *     PetscDM dm,
 *     PetscInt *clen,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_CreateFieldDecomposition", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Dm);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_decomp);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XDECREF(__pyx_v_names);
  __Pyx_XDECREF(__pyx_v_ises);
  __Pyx_XDECREF(__pyx_v_dms);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/petscdmshell.pxi":316
 *     return 0
 * 
 * cdef int DMSHELL_CreateSubDM(             # <<<<<<<<<<<<<<
 *     PetscDM cdm,
 *     PetscInt numFields,
 */

static int __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateSubDM(DM __pyx_v_cdm, PetscInt __pyx_v_numFields, PetscInt *__pyx_v_cfields, IS *__pyx_v_ciset, DM *__pyx_v_csubdm) {
  struct PyPetscDMObject *__pyx_v_dm = 0;
  struct PyPetscISObject *__pyx_v_iset = 0;
  struct PyPetscDMObject *__pyx_v_subdm = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_v_create_subdm = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kargs = NULL;
  PyArrayObject *__pyx_v_fields = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __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)(PyObject *);
  IS __pyx_t_9;
  DM __pyx_t_10;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("DMSHELL_CreateSubDM", 0);

  /* "PETSc/petscdmshell.pxi":322
 *     PetscIS *ciset,
 *     PetscDM *csubdm) except PETSC_ERR_PYTHON with gil:
 *     cdef DM dm = subtype_DM(cdm)()             # <<<<<<<<<<<<<<
 *     cdef IS iset
 *     cdef DM subdm
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_cdm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 322, __pyx_L1_error)
  __pyx_v_dm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":325
 *     cdef IS iset
 *     cdef DM subdm
 *     dm.dm = cdm             # <<<<<<<<<<<<<<
 *     PetscINCREF(dm.obj)
 *     context = dm.get_attr('__create_subdm__')
 */
  __pyx_v_dm->dm = __pyx_v_cdm;

  /* "PETSc/petscdmshell.pxi":326
 *     cdef DM subdm
 *     dm.dm = cdm
 *     PetscINCREF(dm.obj)             # <<<<<<<<<<<<<<
 *     context = dm.get_attr('__create_subdm__')
 *     assert context is not None and type(context) is tuple
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_dm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":327
 *     dm.dm = cdm
 *     PetscINCREF(dm.obj)
 *     context = dm.get_attr('__create_subdm__')             # <<<<<<<<<<<<<<
 *     assert context is not None and type(context) is tuple
 *     (create_subdm, args, kargs) = context
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_dm->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_dm), ((char *)"__create_subdm__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":328
 *     PetscINCREF(dm.obj)
 *     context = dm.get_attr('__create_subdm__')
 *     assert context is not None and type(context) is tuple             # <<<<<<<<<<<<<<
 *     (create_subdm, args, kargs) = context
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = (__pyx_v_context != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_context)) == ((PyObject *)(&PyTuple_Type)));
    __pyx_t_4 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(8, 328, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/petscdmshell.pxi":329
 *     context = dm.get_attr('__create_subdm__')
 *     assert context is not None and type(context) is tuple
 *     (create_subdm, args, kargs) = context             # <<<<<<<<<<<<<<
 * 
 *     fields = array_i(numFields, cfields)
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_context))) || (PyList_CheckExact(__pyx_v_context))) {
    PyObject* sequence = __pyx_v_context;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 329, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_v_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(8, 329, __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(8, 329, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_create_subdm = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_args = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_kargs = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":331
 *     (create_subdm, args, kargs) = context
 * 
 *     fields = array_i(numFields, cfields)             # <<<<<<<<<<<<<<
 * 
 *     iset, subdm = create_subdm(dm, fields, *args, **kargs)
 */
  __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_numFields, __pyx_v_cfields)); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_v_fields = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "PETSc/petscdmshell.pxi":333
 *     fields = array_i(numFields, cfields)
 * 
 *     iset, subdm = create_subdm(dm, fields, *args, **kargs)             # <<<<<<<<<<<<<<
 * 
 *     PetscINCREF(iset.obj)
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_dm));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dm));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_dm));
  __Pyx_INCREF(((PyObject *)__pyx_v_fields));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fields));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_fields));
  __pyx_t_1 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_kargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(8, 333, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_kargs))) {
    __pyx_t_1 = PyDict_Copy(__pyx_v_kargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kargs, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_create_subdm, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 333, __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(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
    PyObject* sequence = __pyx_t_6;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(8, 333, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 333, __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;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(8, 333, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(8, 333, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_IS))))) __PYX_ERR(8, 333, __pyx_L1_error)
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(8, 333, __pyx_L1_error)
  __pyx_v_iset = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_subdm = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/petscdmshell.pxi":335
 *     iset, subdm = create_subdm(dm, fields, *args, **kargs)
 * 
 *     PetscINCREF(iset.obj)             # <<<<<<<<<<<<<<
 *     PetscINCREF(subdm.obj)
 *     ciset[0] = iset.iset
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_iset->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":336
 * 
 *     PetscINCREF(iset.obj)
 *     PetscINCREF(subdm.obj)             # <<<<<<<<<<<<<<
 *     ciset[0] = iset.iset
 *     csubdm[0] = subdm.dm
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_subdm->__pyx_base.obj);

  /* "PETSc/petscdmshell.pxi":337
 *     PetscINCREF(iset.obj)
 *     PetscINCREF(subdm.obj)
 *     ciset[0] = iset.iset             # <<<<<<<<<<<<<<
 *     csubdm[0] = subdm.dm
 */
  __pyx_t_9 = __pyx_v_iset->iset;
  (__pyx_v_ciset[0]) = __pyx_t_9;

  /* "PETSc/petscdmshell.pxi":338
 *     PetscINCREF(subdm.obj)
 *     ciset[0] = iset.iset
 *     csubdm[0] = subdm.dm             # <<<<<<<<<<<<<<
 */
  __pyx_t_10 = __pyx_v_subdm->dm;
  (__pyx_v_csubdm[0]) = __pyx_t_10;

  /* "PETSc/petscdmshell.pxi":316
 *     return 0
 * 
 * cdef int DMSHELL_CreateSubDM(             # <<<<<<<<<<<<<<
 *     PetscDM cdm,
 *     PetscInt numFields,
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMSHELL_CreateSubDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = PETSC_ERR_PYTHON;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dm);
  __Pyx_XDECREF((PyObject *)__pyx_v_iset);
  __Pyx_XDECREF((PyObject *)__pyx_v_subdm);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_create_subdm);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XDECREF((PyObject *)__pyx_v_fields);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/Error.pyx":7
 *     _traceback_ = []
 * 
 *     def __init__(self, int ierr=0):             # <<<<<<<<<<<<<<
 *         self.ierr = ierr
 *         RuntimeError.__init__(self, self.ierr)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5Error_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5Error___init__[] = "Error.__init__(self, int ierr=0)";
static PyMethodDef __pyx_mdef_8petsc4py_5PETSc_5Error_1__init__ = {"__init__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5Error_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5Error___init__};
static PyObject *__pyx_pw_8petsc4py_5PETSc_5Error_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  int __pyx_v_ierr;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_ierr,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ierr);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 7, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    if (values[1]) {
      __pyx_v_ierr = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_ierr == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7, __pyx_L3_error)
    } else {
      __pyx_v_ierr = ((int)((int)0));
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 7, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Error.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5Error___init__(__pyx_self, __pyx_v_self, __pyx_v_ierr);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5Error___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_ierr) {
  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;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "PETSc/Error.pyx":8
 * 
 *     def __init__(self, int ierr=0):
 *         self.ierr = ierr             # <<<<<<<<<<<<<<
 *         RuntimeError.__init__(self, self.ierr)
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ierr); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ierr, __pyx_t_1) < 0) __PYX_ERR(1, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Error.pyx":9
 *     def __init__(self, int ierr=0):
 *         self.ierr = ierr
 *         RuntimeError.__init__(self, self.ierr)             # <<<<<<<<<<<<<<
 * 
 *     def __nonzero__(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_RuntimeError, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ierr); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Error.pyx":7
 *     _traceback_ = []
 * 
 *     def __init__(self, int ierr=0):             # <<<<<<<<<<<<<<
 *         self.ierr = ierr
 *         RuntimeError.__init__(self, self.ierr)
 */

  /* 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.Error.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Error.pyx":11
 *         RuntimeError.__init__(self, self.ierr)
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         cdef int ierr = self.ierr
 *         return ierr != 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5Error_3__nonzero__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5Error_2__nonzero__[] = "Error.__nonzero__(self)";
static PyMethodDef __pyx_mdef_8petsc4py_5PETSc_5Error_3__nonzero__ = {"__nonzero__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5Error_3__nonzero__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5Error_2__nonzero__};
static PyObject *__pyx_pw_8petsc4py_5PETSc_5Error_3__nonzero__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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);
        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_self)) != 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, "__nonzero__") < 0)) __PYX_ERR(1, 11, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__nonzero__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 11, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Error.__nonzero__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5Error_2__nonzero__(__pyx_self, __pyx_v_self);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5Error_2__nonzero__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  int __pyx_v_ierr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__nonzero__", 0);

  /* "PETSc/Error.pyx":12
 * 
 *     def __nonzero__(self):
 *         cdef int ierr = self.ierr             # <<<<<<<<<<<<<<
 *         return ierr != 0
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ierr); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __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(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ierr = __pyx_t_2;

  /* "PETSc/Error.pyx":13
 *     def __nonzero__(self):
 *         cdef int ierr = self.ierr
 *         return ierr != 0             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_ierr != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Error.pyx":11
 *         RuntimeError.__init__(self, self.ierr)
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         cdef int ierr = self.ierr
 *         return ierr != 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Error.__nonzero__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Error.pyx":15
 *         return ierr != 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'PETSc.Error(%d)' % self.ierr
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5Error_5__repr__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5Error_4__repr__[] = "Error.__repr__(self)";
static PyMethodDef __pyx_mdef_8petsc4py_5PETSc_5Error_5__repr__ = {"__repr__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5Error_5__repr__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5Error_4__repr__};
static PyObject *__pyx_pw_8petsc4py_5PETSc_5Error_5__repr__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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);
        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_self)) != 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, "__repr__") < 0)) __PYX_ERR(1, 15, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__repr__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 15, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Error.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5Error_4__repr__(__pyx_self, __pyx_v_self);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5Error_4__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "PETSc/Error.pyx":16
 * 
 *     def __repr__(self):
 *         return 'PETSc.Error(%d)' % self.ierr             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ierr); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_PETSc_Error_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 16, __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;

  /* "PETSc/Error.pyx":15
 *         return ierr != 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'PETSc.Error(%d)' % self.ierr
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Error.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Error.pyx":18
 *         return 'PETSc.Error(%d)' % self.ierr
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef int csize=1, crank=0
 *         if not (<int>PetscFinalizeCalled):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5Error_7__str__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5Error_6__str__[] = "Error.__str__(self)";
static PyMethodDef __pyx_mdef_8petsc4py_5PETSc_5Error_7__str__ = {"__str__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5Error_7__str__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5Error_6__str__};
static PyObject *__pyx_pw_8petsc4py_5PETSc_5Error_7__str__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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);
        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_self)) != 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, "__str__") < 0)) __PYX_ERR(1, 18, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__str__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 18, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Error.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5Error_6__str__(__pyx_self, __pyx_v_self);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5Error_6__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  int __pyx_v_csize;
  int __pyx_v_crank;
  Py_ssize_t __pyx_v_width;
  int __pyx_v_rank;
  PyObject *__pyx_v_tblist = NULL;
  PyObject *__pyx_v_entry = NULL;
  PyObject *__pyx_v_tbline = NULL;
  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;
  int __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "PETSc/Error.pyx":19
 * 
 *     def __str__(self):
 *         cdef int csize=1, crank=0             # <<<<<<<<<<<<<<
 *         if not (<int>PetscFinalizeCalled):
 *             MPI_Comm_size(PETSC_COMM_WORLD, &csize)
 */
  __pyx_v_csize = 1;
  __pyx_v_crank = 0;

  /* "PETSc/Error.pyx":20
 *     def __str__(self):
 *         cdef int csize=1, crank=0
 *         if not (<int>PetscFinalizeCalled):             # <<<<<<<<<<<<<<
 *             MPI_Comm_size(PETSC_COMM_WORLD, &csize)
 *             MPI_Comm_rank(PETSC_COMM_WORLD, &crank)
 */
  __pyx_t_1 = ((!(((int)PetscFinalizeCalled) != 0)) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Error.pyx":21
 *         cdef int csize=1, crank=0
 *         if not (<int>PetscFinalizeCalled):
 *             MPI_Comm_size(PETSC_COMM_WORLD, &csize)             # <<<<<<<<<<<<<<
 *             MPI_Comm_rank(PETSC_COMM_WORLD, &crank)
 *         width, rank = len(str(csize-1)), crank
 */
    MPI_Comm_size(PETSC_COMM_WORLD, (&__pyx_v_csize));

    /* "PETSc/Error.pyx":22
 *         if not (<int>PetscFinalizeCalled):
 *             MPI_Comm_size(PETSC_COMM_WORLD, &csize)
 *             MPI_Comm_rank(PETSC_COMM_WORLD, &crank)             # <<<<<<<<<<<<<<
 *         width, rank = len(str(csize-1)), crank
 *         tblist = ['error code %d' % self.ierr]
 */
    MPI_Comm_rank(PETSC_COMM_WORLD, (&__pyx_v_crank));

    /* "PETSc/Error.pyx":20
 *     def __str__(self):
 *         cdef int csize=1, crank=0
 *         if not (<int>PetscFinalizeCalled):             # <<<<<<<<<<<<<<
 *             MPI_Comm_size(PETSC_COMM_WORLD, &csize)
 *             MPI_Comm_rank(PETSC_COMM_WORLD, &crank)
 */
  }

  /* "PETSc/Error.pyx":23
 *             MPI_Comm_size(PETSC_COMM_WORLD, &csize)
 *             MPI_Comm_rank(PETSC_COMM_WORLD, &crank)
 *         width, rank = len(str(csize-1)), crank             # <<<<<<<<<<<<<<
 *         tblist = ['error code %d' % self.ierr]
 *         for entry in self._traceback_:
 */
  __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_csize - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 23, __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(((PyObject *)(&PyString_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_v_crank;
  __pyx_v_width = __pyx_t_4;
  __pyx_v_rank = __pyx_t_5;

  /* "PETSc/Error.pyx":24
 *             MPI_Comm_rank(PETSC_COMM_WORLD, &crank)
 *         width, rank = len(str(csize-1)), crank
 *         tblist = ['error code %d' % self.ierr]             # <<<<<<<<<<<<<<
 *         for entry in self._traceback_:
 *             tbline = '[%*d] %s' % (width, rank, entry)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ierr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_error_code_d, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 24, __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_v_tblist = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Error.pyx":25
 *         width, rank = len(str(csize-1)), crank
 *         tblist = ['error code %d' % self.ierr]
 *         for entry in self._traceback_:             # <<<<<<<<<<<<<<
 *             tbline = '[%*d] %s' % (width, rank, entry)
 *             tblist.append(tbline)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_traceback); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 25, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 25, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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(1, 25, __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(1, 25, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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(1, 25, __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(1, 25, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_6(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 25, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PETSc/Error.pyx":26
 *         tblist = ['error code %d' % self.ierr]
 *         for entry in self._traceback_:
 *             tbline = '[%*d] %s' % (width, rank, entry)             # <<<<<<<<<<<<<<
 *             tblist.append(tbline)
 *         return '\n'.join(tblist)
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 26, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_rank); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 26, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 26, __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_7);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_entry);
    __Pyx_GIVEREF(__pyx_v_entry);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_entry);
    __pyx_t_2 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_d_s, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 26, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_tbline, ((PyObject*)__pyx_t_7));
    __pyx_t_7 = 0;

    /* "PETSc/Error.pyx":27
 *         for entry in self._traceback_:
 *             tbline = '[%*d] %s' % (width, rank, entry)
 *             tblist.append(tbline)             # <<<<<<<<<<<<<<
 *         return '\n'.join(tblist)
 * 
 */
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_tblist, __pyx_v_tbline); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(1, 27, __pyx_L1_error)

    /* "PETSc/Error.pyx":25
 *         width, rank = len(str(csize-1)), crank
 *         tblist = ['error code %d' % self.ierr]
 *         for entry in self._traceback_:             # <<<<<<<<<<<<<<
 *             tbline = '[%*d] %s' % (width, rank, entry)
 *             tblist.append(tbline)
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/Error.pyx":28
 *             tbline = '[%*d] %s' % (width, rank, entry)
 *             tblist.append(tbline)
 *         return '\n'.join(tblist)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyString_Join(__pyx_kp_s__32, __pyx_v_tblist); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Error.pyx":18
 *         return 'PETSc.Error(%d)' % self.ierr
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef int csize=1, crank=0
 *         if not (<int>PetscFinalizeCalled):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("petsc4py.PETSc.Error.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tblist);
  __Pyx_XDECREF(__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_tbline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":8
 *     cdef object       _prefix
 * 
 *     def __init__(self, prefix=None):             # <<<<<<<<<<<<<<
 *         self.opt = NULL
 *         self.prefix  = prefix
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_7Options_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_7Options_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_prefix);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(24, 8, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_prefix = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(24, 8, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options___init__(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), __pyx_v_prefix);

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

static int __pyx_pf_8petsc4py_5PETSc_7Options___init__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_prefix) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "PETSc/Options.pyx":9
 * 
 *     def __init__(self, prefix=None):
 *         self.opt = NULL             # <<<<<<<<<<<<<<
 *         self.prefix  = prefix
 * 
 */
  __pyx_v_self->opt = NULL;

  /* "PETSc/Options.pyx":10
 *     def __init__(self, prefix=None):
 *         self.opt = NULL
 *         self.prefix  = prefix             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix, __pyx_v_prefix) < 0) __PYX_ERR(24, 10, __pyx_L1_error)

  /* "PETSc/Options.pyx":8
 *     cdef object       _prefix
 * 
 *     def __init__(self, prefix=None):             # <<<<<<<<<<<<<<
 *         self.opt = NULL
 *         self.prefix  = prefix
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":12
 *         self.prefix  = prefix
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.opt == NULL: return
 *         CHKERR( PetscOptionsDestroy(&self.opt) )
 */

/* Python wrapper */
static void __pyx_pw_8petsc4py_5PETSc_7Options_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8petsc4py_5PETSc_7Options_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8petsc4py_5PETSc_7Options_2__dealloc__(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self));

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

static void __pyx_pf_8petsc4py_5PETSc_7Options_2__dealloc__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "PETSc/Options.pyx":13
 * 
 *     def __dealloc__(self):
 *         if self.opt == NULL: return             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsDestroy(&self.opt) )
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->opt == NULL) != 0);
  if (__pyx_t_1) {
    goto __pyx_L0;
  }

  /* "PETSc/Options.pyx":14
 *     def __dealloc__(self):
 *         if self.opt == NULL: return
 *         CHKERR( PetscOptionsDestroy(&self.opt) )             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, item):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsDestroy((&__pyx_v_self->opt))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(24, 14, __pyx_L1_error)

  /* "PETSc/Options.pyx":12
 *         self.prefix  = prefix
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.opt == NULL: return
 *         CHKERR( PetscOptionsDestroy(&self.opt) )
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("petsc4py.PETSc.Options.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PETSc/Options.pyx":16
 *         CHKERR( PetscOptionsDestroy(&self.opt) )
 * 
 *     def __contains__(self, item):             # <<<<<<<<<<<<<<
 *         return self.hasName(item)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_7Options_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_7Options_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_4__contains__(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), ((PyObject *)__pyx_v_item));

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

static int __pyx_pf_8petsc4py_5PETSc_7Options_4__contains__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_item) {
  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;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "PETSc/Options.pyx":17
 * 
 *     def __contains__(self, item):
 *         return self.hasName(item)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, item):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_hasName); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_item); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 17, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(24, 17, __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_item);
    __Pyx_GIVEREF(__pyx_v_item);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_item);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 17, __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_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(24, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "PETSc/Options.pyx":16
 *         CHKERR( PetscOptionsDestroy(&self.opt) )
 * 
 *     def __contains__(self, item):             # <<<<<<<<<<<<<<
 *         return self.hasName(item)
 * 
 */

  /* 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("petsc4py.PETSc.Options.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":19
 *         return self.hasName(item)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.getString(item)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_6__getitem__(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), ((PyObject *)__pyx_v_item));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_6__getitem__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_item) {
  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_RefNannySetupContext("__getitem__", 0);

  /* "PETSc/Options.pyx":20
 * 
 *     def __getitem__(self, item):
 *         return self.getString(item)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, item, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getString); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_item); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(24, 20, __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_item);
    __Pyx_GIVEREF(__pyx_v_item);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_item);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 20, __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_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Options.pyx":19
 *         return self.hasName(item)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.getString(item)
 * 
 */

  /* 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("petsc4py.PETSc.Options.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":22
 *         return self.getString(item)
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.setValue(item, value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_7Options_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_7Options_9__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_pf_8petsc4py_5PETSc_7Options_8__setitem__(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_7Options_8__setitem__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "PETSc/Options.pyx":23
 * 
 *     def __setitem__(self, item, value):
 *         self.setValue(item, value)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, item):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setValue); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(24, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_v_item);
  __Pyx_GIVEREF(__pyx_v_item);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_item);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_value);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Options.pyx":22
 *         return self.getString(item)
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.setValue(item, value)
 * 
 */

  /* 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_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":25
 *         self.setValue(item, value)
 * 
 *     def __delitem__(self, item):             # <<<<<<<<<<<<<<
 *         self.delValue(item)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_7Options_11__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_7Options_11__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_10__delitem__(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), ((PyObject *)__pyx_v_item));

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

static int __pyx_pf_8petsc4py_5PETSc_7Options_10__delitem__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_item) {
  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;
  __Pyx_RefNannySetupContext("__delitem__", 0);

  /* "PETSc/Options.pyx":26
 * 
 *     def __delitem__(self, item):
 *         self.delValue(item)             # <<<<<<<<<<<<<<
 * 
 *     property prefix:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_delValue); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_item); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 26, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(24, 26, __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_item);
    __Pyx_GIVEREF(__pyx_v_item);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_item);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 26, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Options.pyx":25
 *         self.setValue(item, value)
 * 
 *     def __delitem__(self, item):             # <<<<<<<<<<<<<<
 *         self.delValue(item)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":29
 * 
 *     property prefix:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._prefix
 *         def __set__(self, prefix):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_6prefix_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_6prefix_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_6prefix___get__(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_6prefix___get__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/Options.pyx":30
 *     property prefix:
 *         def __get__(self):
 *             return self._prefix             # <<<<<<<<<<<<<<
 *         def __set__(self, prefix):
 *             self._prefix = getprefix(prefix)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_prefix);
  __pyx_r = __pyx_v_self->_prefix;
  goto __pyx_L0;

  /* "PETSc/Options.pyx":29
 * 
 *     property prefix:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._prefix
 *         def __set__(self, prefix):
 */

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

/* "PETSc/Options.pyx":31
 *         def __get__(self):
 *             return self._prefix
 *         def __set__(self, prefix):             # <<<<<<<<<<<<<<
 *             self._prefix = getprefix(prefix)
 *         def __del__(self):
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_7Options_6prefix_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_7Options_6prefix_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_6prefix_2__set__(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), ((PyObject *)__pyx_v_prefix));

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

static int __pyx_pf_8petsc4py_5PETSc_7Options_6prefix_2__set__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_prefix) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Options.pyx":32
 *             return self._prefix
 *         def __set__(self, prefix):
 *             self._prefix = getprefix(prefix)             # <<<<<<<<<<<<<<
 *         def __del__(self):
 *             self._prefix = None
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_getprefix(__pyx_v_prefix, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_prefix);
  __Pyx_DECREF(__pyx_v_self->_prefix);
  __pyx_v_self->_prefix = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Options.pyx":31
 *         def __get__(self):
 *             return self._prefix
 *         def __set__(self, prefix):             # <<<<<<<<<<<<<<
 *             self._prefix = getprefix(prefix)
 *         def __del__(self):
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.prefix.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":33
 *         def __set__(self, prefix):
 *             self._prefix = getprefix(prefix)
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._prefix = None
 *     #
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_7Options_6prefix_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_7Options_6prefix_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_6prefix_4__del__(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_7Options_6prefix_4__del__(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);

  /* "PETSc/Options.pyx":34
 *             self._prefix = getprefix(prefix)
 *         def __del__(self):
 *             self._prefix = None             # <<<<<<<<<<<<<<
 *     #
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_prefix);
  __Pyx_DECREF(__pyx_v_self->_prefix);
  __pyx_v_self->_prefix = Py_None;

  /* "PETSc/Options.pyx":33
 *         def __set__(self, prefix):
 *             self._prefix = getprefix(prefix)
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._prefix = None
 *     #
 */

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

/* "PETSc/Options.pyx":37
 *     #
 * 
 *     def create(self):             # <<<<<<<<<<<<<<
 *         if self.opt != NULL: return
 *         CHKERR( PetscOptionsCreate(&self.opt) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_13create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_12create[] = "Options.create(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_13create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("create", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "create", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_12create(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_12create(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/Options.pyx":38
 * 
 *     def create(self):
 *         if self.opt != NULL: return             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsCreate(&self.opt) )
 *         return self
 */
  __pyx_t_1 = ((__pyx_v_self->opt != NULL) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "PETSc/Options.pyx":39
 *     def create(self):
 *         if self.opt != NULL: return
 *         CHKERR( PetscOptionsCreate(&self.opt) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsCreate((&__pyx_v_self->opt))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(24, 39, __pyx_L1_error)

  /* "PETSc/Options.pyx":40
 *         if self.opt != NULL: return
 *         CHKERR( PetscOptionsCreate(&self.opt) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Options.pyx":37
 *     #
 * 
 *     def create(self):             # <<<<<<<<<<<<<<
 *         if self.opt != NULL: return
 *         CHKERR( PetscOptionsCreate(&self.opt) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":42
 *         return self
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         if self.opt == NULL: return
 *         CHKERR( PetscOptionsDestroy(&self.opt) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_15destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_14destroy[] = "Options.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_15destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_14destroy(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_14destroy(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/Options.pyx":43
 * 
 *     def destroy(self):
 *         if self.opt == NULL: return             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsDestroy(&self.opt) )
 *         return self
 */
  __pyx_t_1 = ((__pyx_v_self->opt == NULL) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "PETSc/Options.pyx":44
 *     def destroy(self):
 *         if self.opt == NULL: return
 *         CHKERR( PetscOptionsDestroy(&self.opt) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsDestroy((&__pyx_v_self->opt))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(24, 44, __pyx_L1_error)

  /* "PETSc/Options.pyx":45
 *         if self.opt == NULL: return
 *         CHKERR( PetscOptionsDestroy(&self.opt) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Options.pyx":42
 *         return self
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         if self.opt == NULL: return
 *         CHKERR( PetscOptionsDestroy(&self.opt) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":47
 *         return self
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         if self.opt == NULL: return
 *         CHKERR( PetscOptionsClear(self.opt) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_17clear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_16clear[] = "Options.clear(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_17clear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("clear", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clear", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_16clear(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_16clear(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("clear", 0);

  /* "PETSc/Options.pyx":48
 * 
 *     def clear(self):
 *         if self.opt == NULL: return             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsClear(self.opt) )
 *         return self
 */
  __pyx_t_1 = ((__pyx_v_self->opt == NULL) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "PETSc/Options.pyx":49
 *     def clear(self):
 *         if self.opt == NULL: return
 *         CHKERR( PetscOptionsClear(self.opt) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsClear(__pyx_v_self->opt)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(24, 49, __pyx_L1_error)

  /* "PETSc/Options.pyx":50
 *         if self.opt == NULL: return
 *         CHKERR( PetscOptionsClear(self.opt) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def view(self, Viewer viewer=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Options.pyx":47
 *         return self
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         if self.opt == NULL: return
 *         CHKERR( PetscOptionsClear(self.opt) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":52
 *         return self
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_19view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_18view[] = "Options.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_19view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(24, 52, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(24, 52, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(24, 52, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_18view(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_18view(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/Options.pyx":53
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PetscOptionsView(self.opt, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/Options.pyx":54
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsView(self.opt, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/Options.pyx":55
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PetscOptionsView(self.opt, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsView(__pyx_v_self->opt, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(24, 55, __pyx_L1_error)

  /* "PETSc/Options.pyx":52
 *         return self
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":57
 *         CHKERR( PetscOptionsView(self.opt, vwr) )
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsSetFromOptions(self.opt) )
 *     #
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_21setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_20setFromOptions[] = "Options.setFromOptions(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_21setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_20setFromOptions(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_20setFromOptions(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/Options.pyx":58
 * 
 *     def setFromOptions(self):
 *         CHKERR( PetscOptionsSetFromOptions(self.opt) )             # <<<<<<<<<<<<<<
 *     #
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsSetFromOptions(__pyx_v_self->opt)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(24, 58, __pyx_L1_error)

  /* "PETSc/Options.pyx":57
 *         CHKERR( PetscOptionsView(self.opt, vwr) )
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsSetFromOptions(self.opt) )
 *     #
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":61
 *     #
 * 
 *     def prefixPush(self, prefix):             # <<<<<<<<<<<<<<
 *         prefix = getprefix(prefix)
 *         cdef const_char *cprefix = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_23prefixPush(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_22prefixPush[] = "Options.prefixPush(self, prefix)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_23prefixPush(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prefixPush (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,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);
        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_prefix)) != 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, "prefixPush") < 0)) __PYX_ERR(24, 61, __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_prefix = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prefixPush", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(24, 61, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.prefixPush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_22prefixPush(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), __pyx_v_prefix);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_22prefixPush(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_prefix) {
  const char *__pyx_v_cprefix;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("prefixPush", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "PETSc/Options.pyx":62
 * 
 *     def prefixPush(self, prefix):
 *         prefix = getprefix(prefix)             # <<<<<<<<<<<<<<
 *         cdef const_char *cprefix = NULL
 *         prefix = str2bytes(prefix, &cprefix)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_getprefix(__pyx_v_prefix, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Options.pyx":63
 *     def prefixPush(self, prefix):
 *         prefix = getprefix(prefix)
 *         cdef const_char *cprefix = NULL             # <<<<<<<<<<<<<<
 *         prefix = str2bytes(prefix, &cprefix)
 *         CHKERR( PetscOptionsPrefixPush(self.opt, cprefix) )
 */
  __pyx_v_cprefix = NULL;

  /* "PETSc/Options.pyx":64
 *         prefix = getprefix(prefix)
 *         cdef const_char *cprefix = NULL
 *         prefix = str2bytes(prefix, &cprefix)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsPrefixPush(self.opt, cprefix) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_prefix, (&__pyx_v_cprefix)); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Options.pyx":65
 *         cdef const_char *cprefix = NULL
 *         prefix = str2bytes(prefix, &cprefix)
 *         CHKERR( PetscOptionsPrefixPush(self.opt, cprefix) )             # <<<<<<<<<<<<<<
 * 
 *     def prefixPop(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsPrefixPush(__pyx_v_self->opt, __pyx_v_cprefix)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(24, 65, __pyx_L1_error)

  /* "PETSc/Options.pyx":61
 *     #
 * 
 *     def prefixPush(self, prefix):             # <<<<<<<<<<<<<<
 *         prefix = getprefix(prefix)
 *         cdef const_char *cprefix = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.prefixPush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":67
 *         CHKERR( PetscOptionsPrefixPush(self.opt, cprefix) )
 * 
 *     def prefixPop(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsPrefixPop(self.opt) )
 *     #
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_25prefixPop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_24prefixPop[] = "Options.prefixPop(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_25prefixPop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prefixPop (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("prefixPop", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "prefixPop", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_24prefixPop(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_24prefixPop(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("prefixPop", 0);

  /* "PETSc/Options.pyx":68
 * 
 *     def prefixPop(self):
 *         CHKERR( PetscOptionsPrefixPop(self.opt) )             # <<<<<<<<<<<<<<
 *     #
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsPrefixPop(__pyx_v_self->opt)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(24, 68, __pyx_L1_error)

  /* "PETSc/Options.pyx":67
 *         CHKERR( PetscOptionsPrefixPush(self.opt, cprefix) )
 * 
 *     def prefixPop(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsPrefixPop(self.opt) )
 *     #
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.prefixPop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":71
 *     #
 * 
 *     def hasName(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *pr = NULL
 *         cdef const_char *nm = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_27hasName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_26hasName[] = "Options.hasName(self, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_27hasName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hasName (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);
        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, "hasName") < 0)) __PYX_ERR(24, 71, __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("hasName", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(24, 71, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.hasName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_26hasName(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), __pyx_v_name);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_26hasName(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name) {
  const char *__pyx_v_pr;
  const char *__pyx_v_nm;
  CYTHON_UNUSED PyObject *__pyx_v_tmp = NULL;
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("hasName", 0);

  /* "PETSc/Options.pyx":72
 * 
 *     def hasName(self, name):
 *         cdef const_char *pr = NULL             # <<<<<<<<<<<<<<
 *         cdef const_char *nm = NULL
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 */
  __pyx_v_pr = NULL;

  /* "PETSc/Options.pyx":73
 *     def hasName(self, name):
 *         cdef const_char *pr = NULL
 *         cdef const_char *nm = NULL             # <<<<<<<<<<<<<<
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 *         cdef PetscBool flag = PETSC_FALSE
 */
  __pyx_v_nm = NULL;

  /* "PETSc/Options.pyx":74
 *         cdef const_char *pr = NULL
 *         cdef const_char *nm = NULL
 *         tmp = getpair(self.prefix, name, &pr, &nm)             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( PetscOptionsHasName(self.opt, pr, nm, &flag) )
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_getpair(__pyx_t_1, __pyx_v_name, (&__pyx_v_pr), (&__pyx_v_nm)); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_tmp = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/Options.pyx":75
 *         cdef const_char *nm = NULL
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsHasName(self.opt, pr, nm, &flag) )
 *         return <bint> flag
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/Options.pyx":76
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( PetscOptionsHasName(self.opt, pr, nm, &flag) )             # <<<<<<<<<<<<<<
 *         return <bint> flag
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsHasName(__pyx_v_self->opt, __pyx_v_pr, __pyx_v_nm, (&__pyx_v_flag))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(24, 76, __pyx_L1_error)

  /* "PETSc/Options.pyx":77
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( PetscOptionsHasName(self.opt, pr, nm, &flag) )
 *         return <bint> flag             # <<<<<<<<<<<<<<
 * 
 *     def setValue(self, name, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Options.pyx":71
 *     #
 * 
 *     def hasName(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *pr = NULL
 *         cdef const_char *nm = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.hasName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":79
 *         return <bint> flag
 * 
 *     def setValue(self, name, value):             # <<<<<<<<<<<<<<
 *         cdef const_char *pr = NULL
 *         cdef const_char *nm = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_29setValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_28setValue[] = "Options.setValue(self, name, value)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_29setValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValue (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_value,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValue", 1, 2, 2, 1); __PYX_ERR(24, 79, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValue") < 0)) __PYX_ERR(24, 79, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_name = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValue", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(24, 79, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.setValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_28setValue(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), __pyx_v_name, __pyx_v_value);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_28setValue(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  const char *__pyx_v_pr;
  const char *__pyx_v_nm;
  CYTHON_UNUSED PyObject *__pyx_v_tmp = NULL;
  PyObject *__pyx_v_option = NULL;
  const char *__pyx_v_key;
  const char *__pyx_v_val;
  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;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("setValue", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "PETSc/Options.pyx":80
 * 
 *     def setValue(self, name, value):
 *         cdef const_char *pr = NULL             # <<<<<<<<<<<<<<
 *         cdef const_char *nm = NULL
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 */
  __pyx_v_pr = NULL;

  /* "PETSc/Options.pyx":81
 *     def setValue(self, name, value):
 *         cdef const_char *pr = NULL
 *         cdef const_char *nm = NULL             # <<<<<<<<<<<<<<
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 *         if pr == NULL:
 */
  __pyx_v_nm = NULL;

  /* "PETSc/Options.pyx":82
 *         cdef const_char *pr = NULL
 *         cdef const_char *nm = NULL
 *         tmp = getpair(self.prefix, name, &pr, &nm)             # <<<<<<<<<<<<<<
 *         if pr == NULL:
 *             option = bytes2str(nm)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_getpair(__pyx_t_1, __pyx_v_name, (&__pyx_v_pr), (&__pyx_v_nm)); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_tmp = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/Options.pyx":83
 *         cdef const_char *nm = NULL
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 *         if pr == NULL:             # <<<<<<<<<<<<<<
 *             option = bytes2str(nm)
 *         else:
 */
  __pyx_t_3 = ((__pyx_v_pr == NULL) != 0);
  if (__pyx_t_3) {

    /* "PETSc/Options.pyx":84
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 *         if pr == NULL:
 *             option = bytes2str(nm)             # <<<<<<<<<<<<<<
 *         else:
 *             option = '-%s%s' % (bytes2str(pr), bytes2str(&nm[1]))
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_nm); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_option = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PETSc/Options.pyx":83
 *         cdef const_char *nm = NULL
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 *         if pr == NULL:             # <<<<<<<<<<<<<<
 *             option = bytes2str(nm)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Options.pyx":86
 *             option = bytes2str(nm)
 *         else:
 *             option = '-%s%s' % (bytes2str(pr), bytes2str(&nm[1]))             # <<<<<<<<<<<<<<
 *         if type(value) is bool:
 *             value = str(value).lower()
 */
  /*else*/ {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_pr); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_bytes2str((&(__pyx_v_nm[1]))); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(24, 86, __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_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_option = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "PETSc/Options.pyx":87
 *         else:
 *             option = '-%s%s' % (bytes2str(pr), bytes2str(&nm[1]))
 *         if type(value) is bool:             # <<<<<<<<<<<<<<
 *             value = str(value).lower()
 *         elif value is not None :
 */
  __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_value)) == ((PyObject*)&PyBool_Type));
  __pyx_t_5 = (__pyx_t_3 != 0);
  if (__pyx_t_5) {

    /* "PETSc/Options.pyx":88
 *             option = '-%s%s' % (bytes2str(pr), bytes2str(&nm[1]))
 *         if type(value) is bool:
 *             value = str(value).lower()             # <<<<<<<<<<<<<<
 *         elif value is not None :
 *             value = str(value)
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(24, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_value);
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(24, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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(24, 88, __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(24, 88, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "PETSc/Options.pyx":87
 *         else:
 *             option = '-%s%s' % (bytes2str(pr), bytes2str(&nm[1]))
 *         if type(value) is bool:             # <<<<<<<<<<<<<<
 *             value = str(value).lower()
 *         elif value is not None :
 */
    goto __pyx_L4;
  }

  /* "PETSc/Options.pyx":89
 *         if type(value) is bool:
 *             value = str(value).lower()
 *         elif value is not None :             # <<<<<<<<<<<<<<
 *             value = str(value)
 *         cdef const_char *key = NULL
 */
  __pyx_t_5 = (__pyx_v_value != Py_None);
  __pyx_t_3 = (__pyx_t_5 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Options.pyx":90
 *             value = str(value).lower()
 *         elif value is not None :
 *             value = str(value)             # <<<<<<<<<<<<<<
 *         cdef const_char *key = NULL
 *         cdef const_char *val = NULL
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value);
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(24, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/Options.pyx":89
 *         if type(value) is bool:
 *             value = str(value).lower()
 *         elif value is not None :             # <<<<<<<<<<<<<<
 *             value = str(value)
 *         cdef const_char *key = NULL
 */
  }
  __pyx_L4:;

  /* "PETSc/Options.pyx":91
 *         elif value is not None :
 *             value = str(value)
 *         cdef const_char *key = NULL             # <<<<<<<<<<<<<<
 *         cdef const_char *val = NULL
 *         option = str2bytes(option, &key)
 */
  __pyx_v_key = NULL;

  /* "PETSc/Options.pyx":92
 *             value = str(value)
 *         cdef const_char *key = NULL
 *         cdef const_char *val = NULL             # <<<<<<<<<<<<<<
 *         option = str2bytes(option, &key)
 *         value  = str2bytes(value,  &val)
 */
  __pyx_v_val = NULL;

  /* "PETSc/Options.pyx":93
 *         cdef const_char *key = NULL
 *         cdef const_char *val = NULL
 *         option = str2bytes(option, &key)             # <<<<<<<<<<<<<<
 *         value  = str2bytes(value,  &val)
 *         CHKERR( PetscOptionsSetValue(self.opt, key, val) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_option, (&__pyx_v_key)); if (unlikely(!__pyx_t_4)) __PYX_ERR(24, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_option, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/Options.pyx":94
 *         cdef const_char *val = NULL
 *         option = str2bytes(option, &key)
 *         value  = str2bytes(value,  &val)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsSetValue(self.opt, key, val) )
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_value, (&__pyx_v_val)); if (unlikely(!__pyx_t_4)) __PYX_ERR(24, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/Options.pyx":95
 *         option = str2bytes(option, &key)
 *         value  = str2bytes(value,  &val)
 *         CHKERR( PetscOptionsSetValue(self.opt, key, val) )             # <<<<<<<<<<<<<<
 * 
 *     def delValue(self, name):
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsSetValue(__pyx_v_self->opt, __pyx_v_key, __pyx_v_val)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(24, 95, __pyx_L1_error)

  /* "PETSc/Options.pyx":79
 *         return <bint> flag
 * 
 *     def setValue(self, name, value):             # <<<<<<<<<<<<<<
 *         cdef const_char *pr = NULL
 *         cdef const_char *nm = NULL
 */

  /* 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_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.setValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp);
  __Pyx_XDECREF(__pyx_v_option);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":97
 *         CHKERR( PetscOptionsSetValue(self.opt, key, val) )
 * 
 *     def delValue(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *pr = NULL
 *         cdef const_char *nm = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_31delValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_30delValue[] = "Options.delValue(self, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_31delValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("delValue (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);
        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, "delValue") < 0)) __PYX_ERR(24, 97, __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("delValue", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(24, 97, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.delValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_30delValue(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), __pyx_v_name);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_30delValue(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name) {
  const char *__pyx_v_pr;
  const char *__pyx_v_nm;
  CYTHON_UNUSED PyObject *__pyx_v_tmp = NULL;
  PyObject *__pyx_v_option = NULL;
  const char *__pyx_v_key;
  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;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("delValue", 0);

  /* "PETSc/Options.pyx":98
 * 
 *     def delValue(self, name):
 *         cdef const_char *pr = NULL             # <<<<<<<<<<<<<<
 *         cdef const_char *nm = NULL
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 */
  __pyx_v_pr = NULL;

  /* "PETSc/Options.pyx":99
 *     def delValue(self, name):
 *         cdef const_char *pr = NULL
 *         cdef const_char *nm = NULL             # <<<<<<<<<<<<<<
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 *         if pr == NULL:
 */
  __pyx_v_nm = NULL;

  /* "PETSc/Options.pyx":100
 *         cdef const_char *pr = NULL
 *         cdef const_char *nm = NULL
 *         tmp = getpair(self.prefix, name, &pr, &nm)             # <<<<<<<<<<<<<<
 *         if pr == NULL:
 *             option = bytes2str(nm)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_getpair(__pyx_t_1, __pyx_v_name, (&__pyx_v_pr), (&__pyx_v_nm)); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_tmp = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/Options.pyx":101
 *         cdef const_char *nm = NULL
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 *         if pr == NULL:             # <<<<<<<<<<<<<<
 *             option = bytes2str(nm)
 *         else:
 */
  __pyx_t_3 = ((__pyx_v_pr == NULL) != 0);
  if (__pyx_t_3) {

    /* "PETSc/Options.pyx":102
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 *         if pr == NULL:
 *             option = bytes2str(nm)             # <<<<<<<<<<<<<<
 *         else:
 *             option = '-%s%s' % (bytes2str(pr), bytes2str(&nm[1]))
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_nm); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_option = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PETSc/Options.pyx":101
 *         cdef const_char *nm = NULL
 *         tmp = getpair(self.prefix, name, &pr, &nm)
 *         if pr == NULL:             # <<<<<<<<<<<<<<
 *             option = bytes2str(nm)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Options.pyx":104
 *             option = bytes2str(nm)
 *         else:
 *             option = '-%s%s' % (bytes2str(pr), bytes2str(&nm[1]))             # <<<<<<<<<<<<<<
 *         cdef const_char *key = NULL
 *         option = str2bytes(option, &key)
 */
  /*else*/ {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_pr); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_bytes2str((&(__pyx_v_nm[1]))); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(24, 104, __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_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_option = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "PETSc/Options.pyx":105
 *         else:
 *             option = '-%s%s' % (bytes2str(pr), bytes2str(&nm[1]))
 *         cdef const_char *key = NULL             # <<<<<<<<<<<<<<
 *         option = str2bytes(option, &key)
 *         CHKERR( PetscOptionsClearValue(self.opt, key) )
 */
  __pyx_v_key = NULL;

  /* "PETSc/Options.pyx":106
 *             option = '-%s%s' % (bytes2str(pr), bytes2str(&nm[1]))
 *         cdef const_char *key = NULL
 *         option = str2bytes(option, &key)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsClearValue(self.opt, key) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_option, (&__pyx_v_key)); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_option, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Options.pyx":107
 *         cdef const_char *key = NULL
 *         option = str2bytes(option, &key)
 *         CHKERR( PetscOptionsClearValue(self.opt, key) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsClearValue(__pyx_v_self->opt, __pyx_v_key)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(24, 107, __pyx_L1_error)

  /* "PETSc/Options.pyx":97
 *         CHKERR( PetscOptionsSetValue(self.opt, key, val) )
 * 
 *     def delValue(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *pr = NULL
 *         cdef const_char *nm = NULL
 */

  /* 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_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.delValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp);
  __Pyx_XDECREF(__pyx_v_option);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":111
 *     #
 * 
 *     def getBool(self, name, default=None):             # <<<<<<<<<<<<<<
 *         return getopt(self.opt, OPT_BOOL, self.prefix, name, default)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_33getBool(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_32getBool[] = "Options.getBool(self, name, default=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_33getBool(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getBool") < 0)) __PYX_ERR(24, 111, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getBool", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(24, 111, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.getBool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_32getBool(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), __pyx_v_name, __pyx_v_default);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_32getBool(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getBool", 0);

  /* "PETSc/Options.pyx":112
 * 
 *     def getBool(self, name, default=None):
 *         return getopt(self.opt, OPT_BOOL, self.prefix, name, default)             # <<<<<<<<<<<<<<
 * 
 *     def getInt(self, name, default=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_getopt(__pyx_v_self->opt, __pyx_e_8petsc4py_5PETSc_OPT_BOOL, __pyx_t_1, __pyx_v_name, __pyx_v_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 112, __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;

  /* "PETSc/Options.pyx":111
 *     #
 * 
 *     def getBool(self, name, default=None):             # <<<<<<<<<<<<<<
 *         return getopt(self.opt, OPT_BOOL, self.prefix, name, default)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.getBool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":114
 *         return getopt(self.opt, OPT_BOOL, self.prefix, name, default)
 * 
 *     def getInt(self, name, default=None):             # <<<<<<<<<<<<<<
 *         return getopt(self.opt, OPT_INT, self.prefix, name, default)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_35getInt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_34getInt[] = "Options.getInt(self, name, default=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_35getInt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getInt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getInt") < 0)) __PYX_ERR(24, 114, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getInt", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(24, 114, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.getInt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_34getInt(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), __pyx_v_name, __pyx_v_default);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_34getInt(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getInt", 0);

  /* "PETSc/Options.pyx":115
 * 
 *     def getInt(self, name, default=None):
 *         return getopt(self.opt, OPT_INT, self.prefix, name, default)             # <<<<<<<<<<<<<<
 * 
 *     def getReal(self, name, default=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_getopt(__pyx_v_self->opt, __pyx_e_8petsc4py_5PETSc_OPT_INT, __pyx_t_1, __pyx_v_name, __pyx_v_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 115, __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;

  /* "PETSc/Options.pyx":114
 *         return getopt(self.opt, OPT_BOOL, self.prefix, name, default)
 * 
 *     def getInt(self, name, default=None):             # <<<<<<<<<<<<<<
 *         return getopt(self.opt, OPT_INT, self.prefix, name, default)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.getInt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":117
 *         return getopt(self.opt, OPT_INT, self.prefix, name, default)
 * 
 *     def getReal(self, name, default=None):             # <<<<<<<<<<<<<<
 *         return getopt(self.opt, OPT_REAL, self.prefix, name, default)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_37getReal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_36getReal[] = "Options.getReal(self, name, default=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_37getReal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getReal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getReal") < 0)) __PYX_ERR(24, 117, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getReal", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(24, 117, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.getReal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_36getReal(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), __pyx_v_name, __pyx_v_default);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_36getReal(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getReal", 0);

  /* "PETSc/Options.pyx":118
 * 
 *     def getReal(self, name, default=None):
 *         return getopt(self.opt, OPT_REAL, self.prefix, name, default)             # <<<<<<<<<<<<<<
 * 
 *     def getScalar(self, name, default=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_getopt(__pyx_v_self->opt, __pyx_e_8petsc4py_5PETSc_OPT_REAL, __pyx_t_1, __pyx_v_name, __pyx_v_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 118, __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;

  /* "PETSc/Options.pyx":117
 *         return getopt(self.opt, OPT_INT, self.prefix, name, default)
 * 
 *     def getReal(self, name, default=None):             # <<<<<<<<<<<<<<
 *         return getopt(self.opt, OPT_REAL, self.prefix, name, default)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.getReal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":120
 *         return getopt(self.opt, OPT_REAL, self.prefix, name, default)
 * 
 *     def getScalar(self, name, default=None):             # <<<<<<<<<<<<<<
 *         return getopt(self.opt, OPT_SCALAR, self.prefix, name, default)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_39getScalar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_38getScalar[] = "Options.getScalar(self, name, default=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_39getScalar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getScalar (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getScalar") < 0)) __PYX_ERR(24, 120, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getScalar", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(24, 120, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.getScalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_38getScalar(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), __pyx_v_name, __pyx_v_default);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_38getScalar(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getScalar", 0);

  /* "PETSc/Options.pyx":121
 * 
 *     def getScalar(self, name, default=None):
 *         return getopt(self.opt, OPT_SCALAR, self.prefix, name, default)             # <<<<<<<<<<<<<<
 * 
 *     def getString(self, name, default=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_getopt(__pyx_v_self->opt, __pyx_e_8petsc4py_5PETSc_OPT_SCALAR, __pyx_t_1, __pyx_v_name, __pyx_v_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 121, __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;

  /* "PETSc/Options.pyx":120
 *         return getopt(self.opt, OPT_REAL, self.prefix, name, default)
 * 
 *     def getScalar(self, name, default=None):             # <<<<<<<<<<<<<<
 *         return getopt(self.opt, OPT_SCALAR, self.prefix, name, default)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.getScalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":123
 *         return getopt(self.opt, OPT_SCALAR, self.prefix, name, default)
 * 
 *     def getString(self, name, default=None):             # <<<<<<<<<<<<<<
 *         return getopt(self.opt, OPT_STRING, self.prefix, name, default)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_41getString(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_40getString[] = "Options.getString(self, name, default=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_41getString(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getString (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getString") < 0)) __PYX_ERR(24, 123, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getString", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(24, 123, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Options.getString", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_40getString(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self), __pyx_v_name, __pyx_v_default);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_40getString(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getString", 0);

  /* "PETSc/Options.pyx":124
 * 
 *     def getString(self, name, default=None):
 *         return getopt(self.opt, OPT_STRING, self.prefix, name, default)             # <<<<<<<<<<<<<<
 * 
 *     def getAll(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(24, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_getopt(__pyx_v_self->opt, __pyx_e_8petsc4py_5PETSc_OPT_STRING, __pyx_t_1, __pyx_v_name, __pyx_v_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 124, __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;

  /* "PETSc/Options.pyx":123
 *         return getopt(self.opt, OPT_SCALAR, self.prefix, name, default)
 * 
 *     def getString(self, name, default=None):             # <<<<<<<<<<<<<<
 *         return getopt(self.opt, OPT_STRING, self.prefix, name, default)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.getString", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Options.pyx":126
 *         return getopt(self.opt, OPT_STRING, self.prefix, name, default)
 * 
 *     def getAll(self):             # <<<<<<<<<<<<<<
 *         cdef char *allopts = NULL
 *         CHKERR( PetscOptionsGetAll(self.opt, &allopts) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_43getAll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Options_42getAll[] = "Options.getAll(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Options_43getAll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getAll (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getAll", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getAll", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Options_42getAll(((struct __pyx_obj_8petsc4py_5PETSc_Options *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Options_42getAll(struct __pyx_obj_8petsc4py_5PETSc_Options *__pyx_v_self) {
  char *__pyx_v_allopts;
  PyObject *__pyx_v_options = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getAll", 0);

  /* "PETSc/Options.pyx":127
 * 
 *     def getAll(self):
 *         cdef char *allopts = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscOptionsGetAll(self.opt, &allopts) )
 *         options = bytes2str(allopts)
 */
  __pyx_v_allopts = NULL;

  /* "PETSc/Options.pyx":128
 *     def getAll(self):
 *         cdef char *allopts = NULL
 *         CHKERR( PetscOptionsGetAll(self.opt, &allopts) )             # <<<<<<<<<<<<<<
 *         options = bytes2str(allopts)
 *         CHKERR( PetscFree(allopts) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscOptionsGetAll(__pyx_v_self->opt, (&__pyx_v_allopts))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(24, 128, __pyx_L1_error)

  /* "PETSc/Options.pyx":129
 *         cdef char *allopts = NULL
 *         CHKERR( PetscOptionsGetAll(self.opt, &allopts) )
 *         options = bytes2str(allopts)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscFree(allopts) )
 *         return parseopt(options, self.prefix)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_allopts); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_options = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/Options.pyx":130
 *         CHKERR( PetscOptionsGetAll(self.opt, &allopts) )
 *         options = bytes2str(allopts)
 *         CHKERR( PetscFree(allopts) )             # <<<<<<<<<<<<<<
 *         return parseopt(options, self.prefix)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscFree(__pyx_v_allopts)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(24, 130, __pyx_L1_error)

  /* "PETSc/Options.pyx":131
 *         options = bytes2str(allopts)
 *         CHKERR( PetscFree(allopts) )
 *         return parseopt(options, self.prefix)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(24, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_parseopt(__pyx_v_options, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(24, 131, __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;

  /* "PETSc/Options.pyx":126
 *         return getopt(self.opt, OPT_STRING, self.prefix, name, default)
 * 
 *     def getAll(self):             # <<<<<<<<<<<<<<
 *         cdef char *allopts = NULL
 *         CHKERR( PetscOptionsGetAll(self.opt, &allopts) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Options.getAll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_options);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":6
 * 
 *     @classmethod
 *     def getVersion(cls, patch=False, devel=False,             # <<<<<<<<<<<<<<
 *                    date=False, author=False):
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_1getVersion(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_getVersion[] = "Sys.getVersion(type cls, patch=False, devel=False, date=False, author=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_1getVersion(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_patch = 0;
  PyObject *__pyx_v_devel = 0;
  PyObject *__pyx_v_date = 0;
  PyObject *__pyx_v_author = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getVersion (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_patch,&__pyx_n_s_devel,&__pyx_n_s_date,&__pyx_n_s_author,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)Py_False);
    values[1] = ((PyObject *)Py_False);

    /* "PETSc/Sys.pyx":7
 *     @classmethod
 *     def getVersion(cls, patch=False, devel=False,
 *                    date=False, author=False):             # <<<<<<<<<<<<<<
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 *         cdef int cminor = PETSC_VERSION_MINOR
 */
    values[2] = ((PyObject *)Py_False);
    values[3] = ((PyObject *)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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_patch);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_devel);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_date);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_author);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getVersion") < 0)) __PYX_ERR(25, 6, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_patch = values[0];
    __pyx_v_devel = values[1];
    __pyx_v_date = values[2];
    __pyx_v_author = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getVersion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(25, 6, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.getVersion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_getVersion(((PyTypeObject*)__pyx_v_cls), __pyx_v_patch, __pyx_v_devel, __pyx_v_date, __pyx_v_author);

  /* "PETSc/Sys.pyx":6
 * 
 *     @classmethod
 *     def getVersion(cls, patch=False, devel=False,             # <<<<<<<<<<<<<<
 *                    date=False, author=False):
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 */

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_getVersion(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_patch, PyObject *__pyx_v_devel, PyObject *__pyx_v_date, PyObject *__pyx_v_author) {
  int __pyx_v_cmajor;
  int __pyx_v_cminor;
  int __pyx_v_cmicro;
  int __pyx_v_cpatch;
  int __pyx_v_cdevel;
  const char *__pyx_v_cdate;
  const char *__pyx_v_cauthorinfo;
  PyObject *__pyx_v_version = NULL;
  PyObject *__pyx_v_out = NULL;
  PyObject *__pyx_v_s = 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;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("getVersion", 0);
  __Pyx_INCREF(__pyx_v_date);
  __Pyx_INCREF(__pyx_v_author);

  /* "PETSc/Sys.pyx":8
 *     def getVersion(cls, patch=False, devel=False,
 *                    date=False, author=False):
 *         cdef int cmajor = PETSC_VERSION_MAJOR             # <<<<<<<<<<<<<<
 *         cdef int cminor = PETSC_VERSION_MINOR
 *         cdef int cmicro = PETSC_VERSION_SUBMINOR
 */
  __pyx_v_cmajor = PETSC_VERSION_MAJOR;

  /* "PETSc/Sys.pyx":9
 *                    date=False, author=False):
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 *         cdef int cminor = PETSC_VERSION_MINOR             # <<<<<<<<<<<<<<
 *         cdef int cmicro = PETSC_VERSION_SUBMINOR
 *         cdef int cpatch = PETSC_VERSION_PATCH
 */
  __pyx_v_cminor = PETSC_VERSION_MINOR;

  /* "PETSc/Sys.pyx":10
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 *         cdef int cminor = PETSC_VERSION_MINOR
 *         cdef int cmicro = PETSC_VERSION_SUBMINOR             # <<<<<<<<<<<<<<
 *         cdef int cpatch = PETSC_VERSION_PATCH
 *         cdef int cdevel = not PETSC_VERSION_RELEASE
 */
  __pyx_v_cmicro = PETSC_VERSION_SUBMINOR;

  /* "PETSc/Sys.pyx":11
 *         cdef int cminor = PETSC_VERSION_MINOR
 *         cdef int cmicro = PETSC_VERSION_SUBMINOR
 *         cdef int cpatch = PETSC_VERSION_PATCH             # <<<<<<<<<<<<<<
 *         cdef int cdevel = not PETSC_VERSION_RELEASE
 *         cdef const_char *cdate = PETSC_VERSION_DATE
 */
  __pyx_v_cpatch = PETSC_VERSION_PATCH;

  /* "PETSc/Sys.pyx":12
 *         cdef int cmicro = PETSC_VERSION_SUBMINOR
 *         cdef int cpatch = PETSC_VERSION_PATCH
 *         cdef int cdevel = not PETSC_VERSION_RELEASE             # <<<<<<<<<<<<<<
 *         cdef const_char *cdate = PETSC_VERSION_DATE
 *         cdef const_char *cauthorinfo = PETSC_AUTHOR_INFO
 */
  __pyx_v_cdevel = (!PETSC_VERSION_RELEASE);

  /* "PETSc/Sys.pyx":13
 *         cdef int cpatch = PETSC_VERSION_PATCH
 *         cdef int cdevel = not PETSC_VERSION_RELEASE
 *         cdef const_char *cdate = PETSC_VERSION_DATE             # <<<<<<<<<<<<<<
 *         cdef const_char *cauthorinfo = PETSC_AUTHOR_INFO
 *         version = (cmajor, cminor, cmicro)
 */
  __pyx_v_cdate = PETSC_VERSION_DATE;

  /* "PETSc/Sys.pyx":14
 *         cdef int cdevel = not PETSC_VERSION_RELEASE
 *         cdef const_char *cdate = PETSC_VERSION_DATE
 *         cdef const_char *cauthorinfo = PETSC_AUTHOR_INFO             # <<<<<<<<<<<<<<
 *         version = (cmajor, cminor, cmicro)
 *         out = version
 */
  __pyx_v_cauthorinfo = PETSC_AUTHOR_INFO;

  /* "PETSc/Sys.pyx":15
 *         cdef const_char *cdate = PETSC_VERSION_DATE
 *         cdef const_char *cauthorinfo = PETSC_AUTHOR_INFO
 *         version = (cmajor, cminor, cmicro)             # <<<<<<<<<<<<<<
 *         out = version
 *         if patch or devel or date or author:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_cmajor); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_cminor); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_cmicro); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 15, __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;
  __pyx_v_version = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/Sys.pyx":16
 *         cdef const_char *cauthorinfo = PETSC_AUTHOR_INFO
 *         version = (cmajor, cminor, cmicro)
 *         out = version             # <<<<<<<<<<<<<<
 *         if patch or devel or date or author:
 *             out = [version]
 */
  __Pyx_INCREF(__pyx_v_version);
  __pyx_v_out = __pyx_v_version;

  /* "PETSc/Sys.pyx":17
 *         version = (cmajor, cminor, cmicro)
 *         out = version
 *         if patch or devel or date or author:             # <<<<<<<<<<<<<<
 *             out = [version]
 *             if patch:
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_patch); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(25, 17, __pyx_L1_error)
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_devel); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(25, 17, __pyx_L1_error)
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_date); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(25, 17, __pyx_L1_error)
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_author); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(25, 17, __pyx_L1_error)
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "PETSc/Sys.pyx":18
 *         out = version
 *         if patch or devel or date or author:
 *             out = [version]             # <<<<<<<<<<<<<<
 *             if patch:
 *                 out.append(cpatch)
 */
    __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 18, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_version);
    __Pyx_GIVEREF(__pyx_v_version);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_version);
    __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/Sys.pyx":19
 *         if patch or devel or date or author:
 *             out = [version]
 *             if patch:             # <<<<<<<<<<<<<<
 *                 out.append(cpatch)
 *             if devel:
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_patch); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(25, 19, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "PETSc/Sys.pyx":20
 *             out = [version]
 *             if patch:
 *                 out.append(cpatch)             # <<<<<<<<<<<<<<
 *             if devel:
 *                 out.append(<bint>cdevel)
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_cpatch); if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 20, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_out, __pyx_t_4); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(25, 20, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "PETSc/Sys.pyx":19
 *         if patch or devel or date or author:
 *             out = [version]
 *             if patch:             # <<<<<<<<<<<<<<
 *                 out.append(cpatch)
 *             if devel:
 */
    }

    /* "PETSc/Sys.pyx":21
 *             if patch:
 *                 out.append(cpatch)
 *             if devel:             # <<<<<<<<<<<<<<
 *                 out.append(<bint>cdevel)
 *             if date:
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_devel); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(25, 21, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "PETSc/Sys.pyx":22
 *                 out.append(cpatch)
 *             if devel:
 *                 out.append(<bint>cdevel)             # <<<<<<<<<<<<<<
 *             if date:
 *                 date = bytes2str(cdate)
 */
      __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_cdevel != 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 22, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_out, __pyx_t_4); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(25, 22, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "PETSc/Sys.pyx":21
 *             if patch:
 *                 out.append(cpatch)
 *             if devel:             # <<<<<<<<<<<<<<
 *                 out.append(<bint>cdevel)
 *             if date:
 */
    }

    /* "PETSc/Sys.pyx":23
 *             if devel:
 *                 out.append(<bint>cdevel)
 *             if date:             # <<<<<<<<<<<<<<
 *                 date = bytes2str(cdate)
 *                 out.append(date)
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_date); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(25, 23, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "PETSc/Sys.pyx":24
 *                 out.append(<bint>cdevel)
 *             if date:
 *                 date = bytes2str(cdate)             # <<<<<<<<<<<<<<
 *                 out.append(date)
 *             if author:
 */
      __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cdate); if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 24, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_date, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "PETSc/Sys.pyx":25
 *             if date:
 *                 date = bytes2str(cdate)
 *                 out.append(date)             # <<<<<<<<<<<<<<
 *             if author:
 *                 author = bytes2str(cauthorinfo).split('\n')
 */
      __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_out, __pyx_v_date); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(25, 25, __pyx_L1_error)

      /* "PETSc/Sys.pyx":23
 *             if devel:
 *                 out.append(<bint>cdevel)
 *             if date:             # <<<<<<<<<<<<<<
 *                 date = bytes2str(cdate)
 *                 out.append(date)
 */
    }

    /* "PETSc/Sys.pyx":26
 *                 date = bytes2str(cdate)
 *                 out.append(date)
 *             if author:             # <<<<<<<<<<<<<<
 *                 author = bytes2str(cauthorinfo).split('\n')
 *                 author = [s.strip() for s in author if s]
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_author); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(25, 26, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "PETSc/Sys.pyx":27
 *                 out.append(date)
 *             if author:
 *                 author = bytes2str(cauthorinfo).split('\n')             # <<<<<<<<<<<<<<
 *                 author = [s.strip() for s in author if s]
 *                 out.append(author)
 */
      __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cauthorinfo); if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 27, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 27, __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__33, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 27, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_author, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "PETSc/Sys.pyx":28
 *             if author:
 *                 author = bytes2str(cauthorinfo).split('\n')
 *                 author = [s.strip() for s in author if s]             # <<<<<<<<<<<<<<
 *                 out.append(author)
 *         return tuple(out)
 */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 28, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(PyList_CheckExact(__pyx_v_author)) || PyTuple_CheckExact(__pyx_v_author)) {
        __pyx_t_3 = __pyx_v_author; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
      } else {
        __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_author); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 28, __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(25, 28, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_9)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(25, 28, __pyx_L1_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 28, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          } else {
            if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(25, 28, __pyx_L1_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 28, __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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(25, 28, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_s); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(25, 28, __pyx_L1_error)
        if (__pyx_t_5) {
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 28, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_10 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && 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_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 28, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          } else {
            __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 28, __pyx_L1_error)
          }
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_2))) __PYX_ERR(25, 28, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_author, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "PETSc/Sys.pyx":29
 *                 author = bytes2str(cauthorinfo).split('\n')
 *                 author = [s.strip() for s in author if s]
 *                 out.append(author)             # <<<<<<<<<<<<<<
 *         return tuple(out)
 * 
 */
      __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_out, __pyx_v_author); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(25, 29, __pyx_L1_error)

      /* "PETSc/Sys.pyx":26
 *                 date = bytes2str(cdate)
 *                 out.append(date)
 *             if author:             # <<<<<<<<<<<<<<
 *                 author = bytes2str(cauthorinfo).split('\n')
 *                 author = [s.strip() for s in author if s]
 */
    }

    /* "PETSc/Sys.pyx":17
 *         version = (cmajor, cminor, cmicro)
 *         out = version
 *         if patch or devel or date or author:             # <<<<<<<<<<<<<<
 *             out = [version]
 *             if patch:
 */
  }

  /* "PETSc/Sys.pyx":30
 *                 author = [s.strip() for s in author if s]
 *                 out.append(author)
 *         return tuple(out)             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PySequence_Tuple(__pyx_v_out); if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Sys.pyx":6
 * 
 *     @classmethod
 *     def getVersion(cls, patch=False, devel=False,             # <<<<<<<<<<<<<<
 *                    date=False, author=False):
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 */

  /* 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_10);
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.getVersion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_version);
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_date);
  __Pyx_XDECREF(__pyx_v_author);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":33
 * 
 *     @classmethod
 *     def getVersionInfo(cls):             # <<<<<<<<<<<<<<
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 *         cdef int cminor = PETSC_VERSION_MINOR
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_3getVersionInfo(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_2getVersionInfo[] = "Sys.getVersionInfo(type cls)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_3getVersionInfo(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getVersionInfo (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getVersionInfo", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getVersionInfo", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_2getVersionInfo(((PyTypeObject*)__pyx_v_cls));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_2getVersionInfo(CYTHON_UNUSED PyTypeObject *__pyx_v_cls) {
  int __pyx_v_cmajor;
  int __pyx_v_cminor;
  int __pyx_v_cmicro;
  int __pyx_v_cpatch;
  int __pyx_v_crelease;
  const char *__pyx_v_cdate;
  const char *__pyx_v_cauthorinfo;
  PyObject *__pyx_v_author = NULL;
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("getVersionInfo", 0);

  /* "PETSc/Sys.pyx":34
 *     @classmethod
 *     def getVersionInfo(cls):
 *         cdef int cmajor = PETSC_VERSION_MAJOR             # <<<<<<<<<<<<<<
 *         cdef int cminor = PETSC_VERSION_MINOR
 *         cdef int cmicro = PETSC_VERSION_SUBMINOR
 */
  __pyx_v_cmajor = PETSC_VERSION_MAJOR;

  /* "PETSc/Sys.pyx":35
 *     def getVersionInfo(cls):
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 *         cdef int cminor = PETSC_VERSION_MINOR             # <<<<<<<<<<<<<<
 *         cdef int cmicro = PETSC_VERSION_SUBMINOR
 *         cdef int cpatch = PETSC_VERSION_PATCH
 */
  __pyx_v_cminor = PETSC_VERSION_MINOR;

  /* "PETSc/Sys.pyx":36
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 *         cdef int cminor = PETSC_VERSION_MINOR
 *         cdef int cmicro = PETSC_VERSION_SUBMINOR             # <<<<<<<<<<<<<<
 *         cdef int cpatch = PETSC_VERSION_PATCH
 *         cdef int crelease = PETSC_VERSION_RELEASE
 */
  __pyx_v_cmicro = PETSC_VERSION_SUBMINOR;

  /* "PETSc/Sys.pyx":37
 *         cdef int cminor = PETSC_VERSION_MINOR
 *         cdef int cmicro = PETSC_VERSION_SUBMINOR
 *         cdef int cpatch = PETSC_VERSION_PATCH             # <<<<<<<<<<<<<<
 *         cdef int crelease = PETSC_VERSION_RELEASE
 *         cdef const_char *cdate = PETSC_VERSION_DATE
 */
  __pyx_v_cpatch = PETSC_VERSION_PATCH;

  /* "PETSc/Sys.pyx":38
 *         cdef int cmicro = PETSC_VERSION_SUBMINOR
 *         cdef int cpatch = PETSC_VERSION_PATCH
 *         cdef int crelease = PETSC_VERSION_RELEASE             # <<<<<<<<<<<<<<
 *         cdef const_char *cdate = PETSC_VERSION_DATE
 *         cdef const_char *cauthorinfo = PETSC_AUTHOR_INFO
 */
  __pyx_v_crelease = PETSC_VERSION_RELEASE;

  /* "PETSc/Sys.pyx":39
 *         cdef int cpatch = PETSC_VERSION_PATCH
 *         cdef int crelease = PETSC_VERSION_RELEASE
 *         cdef const_char *cdate = PETSC_VERSION_DATE             # <<<<<<<<<<<<<<
 *         cdef const_char *cauthorinfo = PETSC_AUTHOR_INFO
 *         author = bytes2str(cauthorinfo).split('\n')
 */
  __pyx_v_cdate = PETSC_VERSION_DATE;

  /* "PETSc/Sys.pyx":40
 *         cdef int crelease = PETSC_VERSION_RELEASE
 *         cdef const_char *cdate = PETSC_VERSION_DATE
 *         cdef const_char *cauthorinfo = PETSC_AUTHOR_INFO             # <<<<<<<<<<<<<<
 *         author = bytes2str(cauthorinfo).split('\n')
 *         author = [s.strip() for s in author if s]
 */
  __pyx_v_cauthorinfo = PETSC_AUTHOR_INFO;

  /* "PETSc/Sys.pyx":41
 *         cdef const_char *cdate = PETSC_VERSION_DATE
 *         cdef const_char *cauthorinfo = PETSC_AUTHOR_INFO
 *         author = bytes2str(cauthorinfo).split('\n')             # <<<<<<<<<<<<<<
 *         author = [s.strip() for s in author if s]
 *         return dict(major      = cmajor,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cauthorinfo); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_author = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":42
 *         cdef const_char *cauthorinfo = PETSC_AUTHOR_INFO
 *         author = bytes2str(cauthorinfo).split('\n')
 *         author = [s.strip() for s in author if s]             # <<<<<<<<<<<<<<
 *         return dict(major      = cmajor,
 *                     minor      = cminor,
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_v_author)) || PyTuple_CheckExact(__pyx_v_author)) {
    __pyx_t_2 = __pyx_v_author; __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_author); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 42, __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(25, 42, __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_COMPILING_IN_CPYTHON
        __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(25, 42, __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(25, 42, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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(25, 42, __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(25, 42, __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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(25, 42, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_s); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(25, 42, __pyx_L1_error)
    if (__pyx_t_6) {
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_strip); if (unlikely(!__pyx_t_7)) __PYX_ERR(25, 42, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(25, 42, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(25, 42, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(25, 42, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_author, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":43
 *         author = bytes2str(cauthorinfo).split('\n')
 *         author = [s.strip() for s in author if s]
 *         return dict(major      = cmajor,             # <<<<<<<<<<<<<<
 *                     minor      = cminor,
 *                     subminor   = cmicro,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_cmajor); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_major, __pyx_t_2) < 0) __PYX_ERR(25, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/Sys.pyx":44
 *         author = [s.strip() for s in author if s]
 *         return dict(major      = cmajor,
 *                     minor      = cminor,             # <<<<<<<<<<<<<<
 *                     subminor   = cmicro,
 *                     patch      = cpatch,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_cminor); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_minor, __pyx_t_2) < 0) __PYX_ERR(25, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/Sys.pyx":45
 *         return dict(major      = cmajor,
 *                     minor      = cminor,
 *                     subminor   = cmicro,             # <<<<<<<<<<<<<<
 *                     patch      = cpatch,
 *                     release    = <bint>crelease,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_cmicro); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_subminor, __pyx_t_2) < 0) __PYX_ERR(25, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/Sys.pyx":46
 *                     minor      = cminor,
 *                     subminor   = cmicro,
 *                     patch      = cpatch,             # <<<<<<<<<<<<<<
 *                     release    = <bint>crelease,
 *                     date       = bytes2str(cdate),
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_cpatch); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_patch, __pyx_t_2) < 0) __PYX_ERR(25, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/Sys.pyx":47
 *                     subminor   = cmicro,
 *                     patch      = cpatch,
 *                     release    = <bint>crelease,             # <<<<<<<<<<<<<<
 *                     date       = bytes2str(cdate),
 *                     authorinfo = author)
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_crelease != 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_release, __pyx_t_2) < 0) __PYX_ERR(25, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/Sys.pyx":48
 *                     patch      = cpatch,
 *                     release    = <bint>crelease,
 *                     date       = bytes2str(cdate),             # <<<<<<<<<<<<<<
 *                     authorinfo = author)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cdate); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_date, __pyx_t_2) < 0) __PYX_ERR(25, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/Sys.pyx":49
 *                     release    = <bint>crelease,
 *                     date       = bytes2str(cdate),
 *                     authorinfo = author)             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_authorinfo, __pyx_v_author) < 0) __PYX_ERR(25, 43, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Sys.pyx":33
 * 
 *     @classmethod
 *     def getVersionInfo(cls):             # <<<<<<<<<<<<<<
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 *         cdef int cminor = PETSC_VERSION_MINOR
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.getVersionInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_author);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":54
 * 
 *     @classmethod
 *     def isInitialized(cls):             # <<<<<<<<<<<<<<
 *         return <bint>PetscInitializeCalled
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_5isInitialized(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_4isInitialized[] = "Sys.isInitialized(type cls)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_5isInitialized(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isInitialized (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("isInitialized", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "isInitialized", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_4isInitialized(((PyTypeObject*)__pyx_v_cls));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_4isInitialized(CYTHON_UNUSED PyTypeObject *__pyx_v_cls) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("isInitialized", 0);

  /* "PETSc/Sys.pyx":55
 *     @classmethod
 *     def isInitialized(cls):
 *         return <bint>PetscInitializeCalled             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_PetscBool(PetscInitializeCalled); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Sys.pyx":54
 * 
 *     @classmethod
 *     def isInitialized(cls):             # <<<<<<<<<<<<<<
 *         return <bint>PetscInitializeCalled
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.isInitialized", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":58
 * 
 *     @classmethod
 *     def isFinalized(cls):             # <<<<<<<<<<<<<<
 *         return <bint>PetscFinalizeCalled
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_7isFinalized(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_6isFinalized[] = "Sys.isFinalized(type cls)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_7isFinalized(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isFinalized (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("isFinalized", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "isFinalized", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_6isFinalized(((PyTypeObject*)__pyx_v_cls));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_6isFinalized(CYTHON_UNUSED PyTypeObject *__pyx_v_cls) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("isFinalized", 0);

  /* "PETSc/Sys.pyx":59
 *     @classmethod
 *     def isFinalized(cls):
 *         return <bint>PetscFinalizeCalled             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_PetscBool(PetscFinalizeCalled); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Sys.pyx":58
 * 
 *     @classmethod
 *     def isFinalized(cls):             # <<<<<<<<<<<<<<
 *         return <bint>PetscFinalizeCalled
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.isFinalized", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":64
 * 
 *     @classmethod
 *     def getDefaultComm(cls):             # <<<<<<<<<<<<<<
 *         cdef Comm comm = Comm()
 *         comm.comm = PETSC_COMM_DEFAULT
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_9getDefaultComm(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_8getDefaultComm[] = "Sys.getDefaultComm(type cls)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_9getDefaultComm(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDefaultComm (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDefaultComm", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDefaultComm", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_8getDefaultComm(((PyTypeObject*)__pyx_v_cls));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_8getDefaultComm(CYTHON_UNUSED PyTypeObject *__pyx_v_cls) {
  struct PyPetscCommObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getDefaultComm", 0);

  /* "PETSc/Sys.pyx":65
 *     @classmethod
 *     def getDefaultComm(cls):
 *         cdef Comm comm = Comm()             # <<<<<<<<<<<<<<
 *         comm.comm = PETSC_COMM_DEFAULT
 *         return comm
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_comm = ((struct PyPetscCommObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":66
 *     def getDefaultComm(cls):
 *         cdef Comm comm = Comm()
 *         comm.comm = PETSC_COMM_DEFAULT             # <<<<<<<<<<<<<<
 *         return comm
 * 
 */
  __pyx_v_comm->comm = __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT;

  /* "PETSc/Sys.pyx":67
 *         cdef Comm comm = Comm()
 *         comm.comm = PETSC_COMM_DEFAULT
 *         return comm             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_comm));
  __pyx_r = ((PyObject *)__pyx_v_comm);
  goto __pyx_L0;

  /* "PETSc/Sys.pyx":64
 * 
 *     @classmethod
 *     def getDefaultComm(cls):             # <<<<<<<<<<<<<<
 *         cdef Comm comm = Comm()
 *         comm.comm = PETSC_COMM_DEFAULT
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.getDefaultComm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_comm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":70
 * 
 *     @classmethod
 *     def setDefaultComm(cls, comm):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_WORLD)
 *         if ccomm == MPI_COMM_NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_11setDefaultComm(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_10setDefaultComm[] = "Sys.setDefaultComm(type cls, comm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_11setDefaultComm(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDefaultComm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,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);
        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_comm)) != 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, "setDefaultComm") < 0)) __PYX_ERR(25, 70, __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_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDefaultComm", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(25, 70, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.setDefaultComm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_10setDefaultComm(((PyTypeObject*)__pyx_v_cls), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_10setDefaultComm(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("setDefaultComm", 0);

  /* "PETSc/Sys.pyx":71
 *     @classmethod
 *     def setDefaultComm(cls, comm):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_WORLD)             # <<<<<<<<<<<<<<
 *         if ccomm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, PETSC_COMM_WORLD); if (unlikely(PyErr_Occurred())) __PYX_ERR(25, 71, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Sys.pyx":72
 *     def setDefaultComm(cls, comm):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_WORLD)
 *         if ccomm == MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("null communicator")
 *         global PETSC_COMM_DEFAULT
 */
  __pyx_t_2 = ((__pyx_v_ccomm == MPI_COMM_NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Sys.pyx":73
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_WORLD)
 *         if ccomm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *         global PETSC_COMM_DEFAULT
 *         PETSC_COMM_DEFAULT = ccomm
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 73, __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(25, 73, __pyx_L1_error)

    /* "PETSc/Sys.pyx":72
 *     def setDefaultComm(cls, comm):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_WORLD)
 *         if ccomm == MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("null communicator")
 *         global PETSC_COMM_DEFAULT
 */
  }

  /* "PETSc/Sys.pyx":75
 *             raise ValueError("null communicator")
 *         global PETSC_COMM_DEFAULT
 *         PETSC_COMM_DEFAULT = ccomm             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT = __pyx_v_ccomm;

  /* "PETSc/Sys.pyx":70
 * 
 *     @classmethod
 *     def setDefaultComm(cls, comm):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_WORLD)
 *         if ccomm == MPI_COMM_NULL:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.setDefaultComm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":80
 * 
 *     @classmethod
 *     def Print(cls, *args, **kargs):             # <<<<<<<<<<<<<<
 *         cdef object comm = kargs.get('comm', None)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_13Print(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_12Print[] = "Sys.Print(type cls, *args, **kargs)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_13Print(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Print (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "Print", 1))) return NULL;
  __pyx_v_kargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_12Print(((PyTypeObject*)__pyx_v_cls), __pyx_v_args, __pyx_v_kargs);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_12Print(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_comm = 0;
  MPI_Comm __pyx_v_ccomm;
  PyObject *__pyx_v_sep = 0;
  PyObject *__pyx_v_end = 0;
  PyObject *__pyx_v_format = NULL;
  PyObject *__pyx_v_message = NULL;
  const char *__pyx_v_m;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  MPI_Comm __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("Print", 0);
  __Pyx_INCREF(__pyx_v_args);

  /* "PETSc/Sys.pyx":81
 *     @classmethod
 *     def Print(cls, *args, **kargs):
 *         cdef object comm = kargs.get('comm', None)             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef object sep = kargs.get('sep', ' ')
 */
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_kargs, __pyx_n_s_comm, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_comm = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":82
 *     def Print(cls, *args, **kargs):
 *         cdef object comm = kargs.get('comm', None)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef object sep = kargs.get('sep', ' ')
 *         cdef object end = kargs.get('end', '\n')
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(25, 82, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_2;

  /* "PETSc/Sys.pyx":83
 *         cdef object comm = kargs.get('comm', None)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef object sep = kargs.get('sep', ' ')             # <<<<<<<<<<<<<<
 *         cdef object end = kargs.get('end', '\n')
 *         if comm_rank(ccomm) == 0:
 */
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_kargs, __pyx_n_s_sep, __pyx_kp_s__2); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sep = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":84
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef object sep = kargs.get('sep', ' ')
 *         cdef object end = kargs.get('end', '\n')             # <<<<<<<<<<<<<<
 *         if comm_rank(ccomm) == 0:
 *             if not args: args = ('',)
 */
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_kargs, __pyx_n_s_end, __pyx_kp_s__32); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_end = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":85
 *         cdef object sep = kargs.get('sep', ' ')
 *         cdef object end = kargs.get('end', '\n')
 *         if comm_rank(ccomm) == 0:             # <<<<<<<<<<<<<<
 *             if not args: args = ('',)
 *             format = ['%s', sep] * len(args)
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_comm_rank(__pyx_v_ccomm); if (unlikely(__pyx_t_3 == -1 && PyErr_Occurred())) __PYX_ERR(25, 85, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 == 0) != 0);
  if (__pyx_t_4) {

    /* "PETSc/Sys.pyx":86
 *         cdef object end = kargs.get('end', '\n')
 *         if comm_rank(ccomm) == 0:
 *             if not args: args = ('',)             # <<<<<<<<<<<<<<
 *             format = ['%s', sep] * len(args)
 *             format[-1] = end
 */
    __pyx_t_4 = (__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_v_args) != 0);
    __pyx_t_5 = ((!__pyx_t_4) != 0);
    if (__pyx_t_5) {
      __Pyx_INCREF(__pyx_tuple__36);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_tuple__36);
    }

    /* "PETSc/Sys.pyx":87
 *         if comm_rank(ccomm) == 0:
 *             if not args: args = ('',)
 *             format = ['%s', sep] * len(args)             # <<<<<<<<<<<<<<
 *             format[-1] = end
 *             message = ''.join(format) % args
 */
    __pyx_t_6 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(25, 87, __pyx_L1_error)
    __pyx_t_1 = PyList_New(2 * ((__pyx_t_6<0) ? 0:__pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    { Py_ssize_t __pyx_temp;
      for (__pyx_temp=0; __pyx_temp < __pyx_t_6; __pyx_temp++) {
        __Pyx_INCREF(__pyx_kp_s_s);
        __Pyx_GIVEREF(__pyx_kp_s_s);
        PyList_SET_ITEM(__pyx_t_1, __pyx_temp * 2, __pyx_kp_s_s);
        __Pyx_INCREF(__pyx_v_sep);
        __Pyx_GIVEREF(__pyx_v_sep);
        PyList_SET_ITEM(__pyx_t_1, __pyx_temp * 2 + 1, __pyx_v_sep);
      }
    }
    __pyx_v_format = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "PETSc/Sys.pyx":88
 *             if not args: args = ('',)
 *             format = ['%s', sep] * len(args)
 *             format[-1] = end             # <<<<<<<<<<<<<<
 *             message = ''.join(format) % args
 *         else:
 */
    if (unlikely(__Pyx_SetItemInt(__pyx_v_format, -1L, __pyx_v_end, long, 1, __Pyx_PyInt_From_long, 1, 1, 1) < 0)) __PYX_ERR(25, 88, __pyx_L1_error)

    /* "PETSc/Sys.pyx":89
 *             format = ['%s', sep] * len(args)
 *             format[-1] = end
 *             message = ''.join(format) % args             # <<<<<<<<<<<<<<
 *         else:
 *             message = ''
 */
    __pyx_t_1 = __Pyx_PyString_Join(__pyx_kp_s__10, __pyx_v_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyNumber_Remainder(__pyx_t_1, __pyx_v_args); if (unlikely(!__pyx_t_7)) __PYX_ERR(25, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_message = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "PETSc/Sys.pyx":85
 *         cdef object sep = kargs.get('sep', ' ')
 *         cdef object end = kargs.get('end', '\n')
 *         if comm_rank(ccomm) == 0:             # <<<<<<<<<<<<<<
 *             if not args: args = ('',)
 *             format = ['%s', sep] * len(args)
 */
    goto __pyx_L3;
  }

  /* "PETSc/Sys.pyx":91
 *             message = ''.join(format) % args
 *         else:
 *             message = ''             # <<<<<<<<<<<<<<
 *         cdef const_char *m = NULL
 *         message = str2bytes(message, &m)
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_kp_s__10);
    __pyx_v_message = __pyx_kp_s__10;
  }
  __pyx_L3:;

  /* "PETSc/Sys.pyx":92
 *         else:
 *             message = ''
 *         cdef const_char *m = NULL             # <<<<<<<<<<<<<<
 *         message = str2bytes(message, &m)
 *         CHKERR( PetscPrintf(ccomm, m) )
 */
  __pyx_v_m = NULL;

  /* "PETSc/Sys.pyx":93
 *             message = ''
 *         cdef const_char *m = NULL
 *         message = str2bytes(message, &m)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPrintf(ccomm, m) )
 * 
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_message, (&__pyx_v_m)); if (unlikely(!__pyx_t_7)) __PYX_ERR(25, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "PETSc/Sys.pyx":94
 *         cdef const_char *m = NULL
 *         message = str2bytes(message, &m)
 *         CHKERR( PetscPrintf(ccomm, m) )             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPrintf(__pyx_v_ccomm, __pyx_v_m)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(25, 94, __pyx_L1_error)

  /* "PETSc/Sys.pyx":80
 * 
 *     @classmethod
 *     def Print(cls, *args, **kargs):             # <<<<<<<<<<<<<<
 *         cdef object comm = kargs.get('comm', None)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

  /* 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_7);
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.Print", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_comm);
  __Pyx_XDECREF(__pyx_v_sep);
  __Pyx_XDECREF(__pyx_v_end);
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":97
 * 
 *     @classmethod
 *     def syncPrint(cls, *args, **kargs):             # <<<<<<<<<<<<<<
 *         cdef object comm = kargs.get('comm', None)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_15syncPrint(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_14syncPrint[] = "Sys.syncPrint(type cls, *args, **kargs)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_15syncPrint(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("syncPrint (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "syncPrint", 1))) return NULL;
  __pyx_v_kargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_14syncPrint(((PyTypeObject*)__pyx_v_cls), __pyx_v_args, __pyx_v_kargs);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_14syncPrint(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_comm = 0;
  MPI_Comm __pyx_v_ccomm;
  PyObject *__pyx_v_sep = 0;
  PyObject *__pyx_v_end = 0;
  PyObject *__pyx_v_flush = 0;
  PyObject *__pyx_v_format = NULL;
  PyObject *__pyx_v_message = NULL;
  const char *__pyx_v_m;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  MPI_Comm __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("syncPrint", 0);
  __Pyx_INCREF(__pyx_v_args);

  /* "PETSc/Sys.pyx":98
 *     @classmethod
 *     def syncPrint(cls, *args, **kargs):
 *         cdef object comm = kargs.get('comm', None)             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef object sep = kargs.get('sep', ' ')
 */
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_kargs, __pyx_n_s_comm, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_comm = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":99
 *     def syncPrint(cls, *args, **kargs):
 *         cdef object comm = kargs.get('comm', None)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef object sep = kargs.get('sep', ' ')
 *         cdef object end = kargs.get('end', '\n')
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(25, 99, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_2;

  /* "PETSc/Sys.pyx":100
 *         cdef object comm = kargs.get('comm', None)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef object sep = kargs.get('sep', ' ')             # <<<<<<<<<<<<<<
 *         cdef object end = kargs.get('end', '\n')
 *         cdef object flush = kargs.get('flush', False)
 */
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_kargs, __pyx_n_s_sep, __pyx_kp_s__2); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sep = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":101
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef object sep = kargs.get('sep', ' ')
 *         cdef object end = kargs.get('end', '\n')             # <<<<<<<<<<<<<<
 *         cdef object flush = kargs.get('flush', False)
 *         if not args: args = ('',)
 */
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_kargs, __pyx_n_s_end, __pyx_kp_s__32); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_end = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":102
 *         cdef object sep = kargs.get('sep', ' ')
 *         cdef object end = kargs.get('end', '\n')
 *         cdef object flush = kargs.get('flush', False)             # <<<<<<<<<<<<<<
 *         if not args: args = ('',)
 *         format = ['%s', sep] * len(args)
 */
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_kargs, __pyx_n_s_flush, Py_False); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_flush = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":103
 *         cdef object end = kargs.get('end', '\n')
 *         cdef object flush = kargs.get('flush', False)
 *         if not args: args = ('',)             # <<<<<<<<<<<<<<
 *         format = ['%s', sep] * len(args)
 *         format[-1] = end
 */
  __pyx_t_3 = (__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_v_args) != 0);
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {
    __Pyx_INCREF(__pyx_tuple__37);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_tuple__37);
  }

  /* "PETSc/Sys.pyx":104
 *         cdef object flush = kargs.get('flush', False)
 *         if not args: args = ('',)
 *         format = ['%s', sep] * len(args)             # <<<<<<<<<<<<<<
 *         format[-1] = end
 *         message = ''.join(format) % args
 */
  __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(25, 104, __pyx_L1_error)
  __pyx_t_1 = PyList_New(2 * ((__pyx_t_5<0) ? 0:__pyx_t_5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_t_5; __pyx_temp++) {
      __Pyx_INCREF(__pyx_kp_s_s);
      __Pyx_GIVEREF(__pyx_kp_s_s);
      PyList_SET_ITEM(__pyx_t_1, __pyx_temp * 2, __pyx_kp_s_s);
      __Pyx_INCREF(__pyx_v_sep);
      __Pyx_GIVEREF(__pyx_v_sep);
      PyList_SET_ITEM(__pyx_t_1, __pyx_temp * 2 + 1, __pyx_v_sep);
    }
  }
  __pyx_v_format = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":105
 *         if not args: args = ('',)
 *         format = ['%s', sep] * len(args)
 *         format[-1] = end             # <<<<<<<<<<<<<<
 *         message = ''.join(format) % args
 *         cdef const_char *m = NULL
 */
  if (unlikely(__Pyx_SetItemInt(__pyx_v_format, -1L, __pyx_v_end, long, 1, __Pyx_PyInt_From_long, 1, 1, 1) < 0)) __PYX_ERR(25, 105, __pyx_L1_error)

  /* "PETSc/Sys.pyx":106
 *         format = ['%s', sep] * len(args)
 *         format[-1] = end
 *         message = ''.join(format) % args             # <<<<<<<<<<<<<<
 *         cdef const_char *m = NULL
 *         message = str2bytes(message, &m)
 */
  __pyx_t_1 = __Pyx_PyString_Join(__pyx_kp_s__10, __pyx_v_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyNumber_Remainder(__pyx_t_1, __pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(25, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_message = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/Sys.pyx":107
 *         format[-1] = end
 *         message = ''.join(format) % args
 *         cdef const_char *m = NULL             # <<<<<<<<<<<<<<
 *         message = str2bytes(message, &m)
 *         CHKERR( PetscSynchronizedPrintf(ccomm, m) )
 */
  __pyx_v_m = NULL;

  /* "PETSc/Sys.pyx":108
 *         message = ''.join(format) % args
 *         cdef const_char *m = NULL
 *         message = str2bytes(message, &m)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSynchronizedPrintf(ccomm, m) )
 *         if flush: CHKERR( PetscSynchronizedFlush(ccomm, PETSC_STDOUT) )
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_message, (&__pyx_v_m)); if (unlikely(!__pyx_t_6)) __PYX_ERR(25, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "PETSc/Sys.pyx":109
 *         cdef const_char *m = NULL
 *         message = str2bytes(message, &m)
 *         CHKERR( PetscSynchronizedPrintf(ccomm, m) )             # <<<<<<<<<<<<<<
 *         if flush: CHKERR( PetscSynchronizedFlush(ccomm, PETSC_STDOUT) )
 * 
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSynchronizedPrintf(__pyx_v_ccomm, __pyx_v_m)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(25, 109, __pyx_L1_error)

  /* "PETSc/Sys.pyx":110
 *         message = str2bytes(message, &m)
 *         CHKERR( PetscSynchronizedPrintf(ccomm, m) )
 *         if flush: CHKERR( PetscSynchronizedFlush(ccomm, PETSC_STDOUT) )             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_flush); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(25, 110, __pyx_L1_error)
  if (__pyx_t_4) {
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSynchronizedFlush(__pyx_v_ccomm, PETSC_STDOUT)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(25, 110, __pyx_L1_error)
  }

  /* "PETSc/Sys.pyx":97
 * 
 *     @classmethod
 *     def syncPrint(cls, *args, **kargs):             # <<<<<<<<<<<<<<
 *         cdef object comm = kargs.get('comm', None)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

  /* 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_AddTraceback("petsc4py.PETSc.Sys.syncPrint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_comm);
  __Pyx_XDECREF(__pyx_v_sep);
  __Pyx_XDECREF(__pyx_v_end);
  __Pyx_XDECREF(__pyx_v_flush);
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":113
 * 
 *     @classmethod
 *     def syncFlush(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         CHKERR( PetscSynchronizedFlush(ccomm, PETSC_STDOUT) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_17syncFlush(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_16syncFlush[] = "Sys.syncFlush(type cls, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_17syncFlush(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("syncFlush (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "syncFlush") < 0)) __PYX_ERR(25, 113, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("syncFlush", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(25, 113, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.syncFlush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_16syncFlush(((PyTypeObject*)__pyx_v_cls), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_16syncFlush(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("syncFlush", 0);

  /* "PETSc/Sys.pyx":114
 *     @classmethod
 *     def syncFlush(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSynchronizedFlush(ccomm, PETSC_STDOUT) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(25, 114, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Sys.pyx":115
 *     def syncFlush(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         CHKERR( PetscSynchronizedFlush(ccomm, PETSC_STDOUT) )             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSynchronizedFlush(__pyx_v_ccomm, PETSC_STDOUT)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(25, 115, __pyx_L1_error)

  /* "PETSc/Sys.pyx":113
 * 
 *     @classmethod
 *     def syncFlush(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         CHKERR( PetscSynchronizedFlush(ccomm, PETSC_STDOUT) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.syncFlush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":120
 * 
 *     @classmethod
 *     def splitOwnership(cls, size, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_19splitOwnership(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_18splitOwnership[] = "Sys.splitOwnership(type cls, size, bsize=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_19splitOwnership(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("splitOwnership (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_bsize,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "splitOwnership") < 0)) __PYX_ERR(25, 120, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_size = values[0];
    __pyx_v_bsize = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("splitOwnership", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(25, 120, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.splitOwnership", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_18splitOwnership(((PyTypeObject*)__pyx_v_cls), __pyx_v_size, __pyx_v_bsize, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_18splitOwnership(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_N;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("splitOwnership", 0);

  /* "PETSc/Sys.pyx":121
 *     @classmethod
 *     def splitOwnership(cls, size, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs=0, n=0, N=0
 *         Sys_Sizes(size, bsize, &bs, &n, &N)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(25, 121, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Sys.pyx":122
 *     def splitOwnership(cls, size, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0             # <<<<<<<<<<<<<<
 *         Sys_Sizes(size, bsize, &bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1
 */
  __pyx_v_bs = 0;
  __pyx_v_n = 0;
  __pyx_v_N = 0;

  /* "PETSc/Sys.pyx":123
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0
 *         Sys_Sizes(size, bsize, &bs, &n, &N)             # <<<<<<<<<<<<<<
 *         if bs == PETSC_DECIDE: bs = 1
 *         if n > 0: n = n // bs
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Sys_Sizes(__pyx_v_size, __pyx_v_bsize, (&__pyx_v_bs), (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(25, 123, __pyx_L1_error)

  /* "PETSc/Sys.pyx":124
 *         cdef PetscInt bs=0, n=0, N=0
 *         Sys_Sizes(size, bsize, &bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1             # <<<<<<<<<<<<<<
 *         if n > 0: n = n // bs
 *         if N > 0: N = N // bs
 */
  __pyx_t_3 = ((__pyx_v_bs == PETSC_DECIDE) != 0);
  if (__pyx_t_3) {
    __pyx_v_bs = 1;
  }

  /* "PETSc/Sys.pyx":125
 *         Sys_Sizes(size, bsize, &bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1
 *         if n > 0: n = n // bs             # <<<<<<<<<<<<<<
 *         if N > 0: N = N // bs
 *         CHKERR( PetscSplitOwnership(ccomm, &n, &N) )
 */
  __pyx_t_3 = ((__pyx_v_n > 0) != 0);
  if (__pyx_t_3) {
    __pyx_v_n = (__pyx_v_n / __pyx_v_bs);
  }

  /* "PETSc/Sys.pyx":126
 *         if bs == PETSC_DECIDE: bs = 1
 *         if n > 0: n = n // bs
 *         if N > 0: N = N // bs             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSplitOwnership(ccomm, &n, &N) )
 *         n = n * bs
 */
  __pyx_t_3 = ((__pyx_v_N > 0) != 0);
  if (__pyx_t_3) {
    __pyx_v_N = (__pyx_v_N / __pyx_v_bs);
  }

  /* "PETSc/Sys.pyx":127
 *         if n > 0: n = n // bs
 *         if N > 0: N = N // bs
 *         CHKERR( PetscSplitOwnership(ccomm, &n, &N) )             # <<<<<<<<<<<<<<
 *         n = n * bs
 *         N = N * bs
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSplitOwnership(__pyx_v_ccomm, (&__pyx_v_n), (&__pyx_v_N))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(25, 127, __pyx_L1_error)

  /* "PETSc/Sys.pyx":128
 *         if N > 0: N = N // bs
 *         CHKERR( PetscSplitOwnership(ccomm, &n, &N) )
 *         n = n * bs             # <<<<<<<<<<<<<<
 *         N = N * bs
 *         return (toInt(n), toInt(N))
 */
  __pyx_v_n = (__pyx_v_n * __pyx_v_bs);

  /* "PETSc/Sys.pyx":129
 *         CHKERR( PetscSplitOwnership(ccomm, &n, &N) )
 *         n = n * bs
 *         N = N * bs             # <<<<<<<<<<<<<<
 *         return (toInt(n), toInt(N))
 * 
 */
  __pyx_v_N = (__pyx_v_N * __pyx_v_bs);

  /* "PETSc/Sys.pyx":130
 *         n = n * bs
 *         N = N * bs
 *         return (toInt(n), toInt(N))             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(25, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_5)) __PYX_ERR(25, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(25, 130, __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_5);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "PETSc/Sys.pyx":120
 * 
 *     @classmethod
 *     def splitOwnership(cls, size, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.splitOwnership", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":133
 * 
 *     @classmethod
 *     def sleep(cls, seconds=1):             # <<<<<<<<<<<<<<
 *         cdef int s = seconds
 *         CHKERR( PetscSleep(s) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_21sleep(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_20sleep[] = "Sys.sleep(type cls, seconds=1)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_21sleep(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_seconds = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sleep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_seconds,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_1);
    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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_seconds);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sleep") < 0)) __PYX_ERR(25, 133, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_seconds = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sleep", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(25, 133, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.sleep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_20sleep(((PyTypeObject*)__pyx_v_cls), __pyx_v_seconds);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_20sleep(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_seconds) {
  int __pyx_v_s;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("sleep", 0);

  /* "PETSc/Sys.pyx":134
 *     @classmethod
 *     def sleep(cls, seconds=1):
 *         cdef int s = seconds             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSleep(s) )
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_seconds); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(25, 134, __pyx_L1_error)
  __pyx_v_s = __pyx_t_1;

  /* "PETSc/Sys.pyx":135
 *     def sleep(cls, seconds=1):
 *         cdef int s = seconds
 *         CHKERR( PetscSleep(s) )             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSleep(__pyx_v_s)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(25, 135, __pyx_L1_error)

  /* "PETSc/Sys.pyx":133
 * 
 *     @classmethod
 *     def sleep(cls, seconds=1):             # <<<<<<<<<<<<<<
 *         cdef int s = seconds
 *         CHKERR( PetscSleep(s) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.sleep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":140
 * 
 *     @classmethod
 *     def pushErrorHandler(cls, errhandler):             # <<<<<<<<<<<<<<
 *         cdef PetscErrorHandlerFunction handler = NULL
 *         if errhandler == "python":
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_23pushErrorHandler(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_22pushErrorHandler[] = "Sys.pushErrorHandler(type cls, errhandler)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_23pushErrorHandler(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_errhandler = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pushErrorHandler (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_errhandler,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);
        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_errhandler)) != 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, "pushErrorHandler") < 0)) __PYX_ERR(25, 140, __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_errhandler = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pushErrorHandler", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(25, 140, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.pushErrorHandler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_22pushErrorHandler(((PyTypeObject*)__pyx_v_cls), __pyx_v_errhandler);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_22pushErrorHandler(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_errhandler) {
  PetscErrorHandlerFunction __pyx_v_handler;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("pushErrorHandler", 0);

  /* "PETSc/Sys.pyx":141
 *     @classmethod
 *     def pushErrorHandler(cls, errhandler):
 *         cdef PetscErrorHandlerFunction handler = NULL             # <<<<<<<<<<<<<<
 *         if errhandler == "python":
 *             handler = <PetscErrorHandlerFunction> \
 */
  __pyx_v_handler = NULL;

  /* "PETSc/Sys.pyx":142
 *     def pushErrorHandler(cls, errhandler):
 *         cdef PetscErrorHandlerFunction handler = NULL
 *         if errhandler == "python":             # <<<<<<<<<<<<<<
 *             handler = <PetscErrorHandlerFunction> \
 *                       PetscPythonErrorHandler
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_errhandler, __pyx_n_s_python, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(25, 142, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/Sys.pyx":143
 *         cdef PetscErrorHandlerFunction handler = NULL
 *         if errhandler == "python":
 *             handler = <PetscErrorHandlerFunction> \             # <<<<<<<<<<<<<<
 *                       PetscPythonErrorHandler
 *         elif errhandler == "debugger":
 */
    __pyx_v_handler = ((PetscErrorHandlerFunction)__pyx_f_8petsc4py_5PETSc_PetscPythonErrorHandler);

    /* "PETSc/Sys.pyx":142
 *     def pushErrorHandler(cls, errhandler):
 *         cdef PetscErrorHandlerFunction handler = NULL
 *         if errhandler == "python":             # <<<<<<<<<<<<<<
 *             handler = <PetscErrorHandlerFunction> \
 *                       PetscPythonErrorHandler
 */
    goto __pyx_L3;
  }

  /* "PETSc/Sys.pyx":145
 *             handler = <PetscErrorHandlerFunction> \
 *                       PetscPythonErrorHandler
 *         elif errhandler == "debugger":             # <<<<<<<<<<<<<<
 *             handler = PetscAttachDebuggerErrorHandler
 *         elif errhandler == "emacs":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_errhandler, __pyx_n_s_debugger, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(25, 145, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/Sys.pyx":146
 *                       PetscPythonErrorHandler
 *         elif errhandler == "debugger":
 *             handler = PetscAttachDebuggerErrorHandler             # <<<<<<<<<<<<<<
 *         elif errhandler == "emacs":
 *             handler = PetscEmacsClientErrorHandler
 */
    __pyx_v_handler = PetscAttachDebuggerErrorHandler;

    /* "PETSc/Sys.pyx":145
 *             handler = <PetscErrorHandlerFunction> \
 *                       PetscPythonErrorHandler
 *         elif errhandler == "debugger":             # <<<<<<<<<<<<<<
 *             handler = PetscAttachDebuggerErrorHandler
 *         elif errhandler == "emacs":
 */
    goto __pyx_L3;
  }

  /* "PETSc/Sys.pyx":147
 *         elif errhandler == "debugger":
 *             handler = PetscAttachDebuggerErrorHandler
 *         elif errhandler == "emacs":             # <<<<<<<<<<<<<<
 *             handler = PetscEmacsClientErrorHandler
 *         elif errhandler == "traceback":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_errhandler, __pyx_n_s_emacs, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(25, 147, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/Sys.pyx":148
 *             handler = PetscAttachDebuggerErrorHandler
 *         elif errhandler == "emacs":
 *             handler = PetscEmacsClientErrorHandler             # <<<<<<<<<<<<<<
 *         elif errhandler == "traceback":
 *             handler = PetscTraceBackErrorHandler
 */
    __pyx_v_handler = PetscEmacsClientErrorHandler;

    /* "PETSc/Sys.pyx":147
 *         elif errhandler == "debugger":
 *             handler = PetscAttachDebuggerErrorHandler
 *         elif errhandler == "emacs":             # <<<<<<<<<<<<<<
 *             handler = PetscEmacsClientErrorHandler
 *         elif errhandler == "traceback":
 */
    goto __pyx_L3;
  }

  /* "PETSc/Sys.pyx":149
 *         elif errhandler == "emacs":
 *             handler = PetscEmacsClientErrorHandler
 *         elif errhandler == "traceback":             # <<<<<<<<<<<<<<
 *             handler = PetscTraceBackErrorHandler
 *         elif errhandler == "ignore":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_errhandler, __pyx_n_s_traceback_2, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(25, 149, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/Sys.pyx":150
 *             handler = PetscEmacsClientErrorHandler
 *         elif errhandler == "traceback":
 *             handler = PetscTraceBackErrorHandler             # <<<<<<<<<<<<<<
 *         elif errhandler == "ignore":
 *             handler = PetscIgnoreErrorHandler
 */
    __pyx_v_handler = PetscTraceBackErrorHandler;

    /* "PETSc/Sys.pyx":149
 *         elif errhandler == "emacs":
 *             handler = PetscEmacsClientErrorHandler
 *         elif errhandler == "traceback":             # <<<<<<<<<<<<<<
 *             handler = PetscTraceBackErrorHandler
 *         elif errhandler == "ignore":
 */
    goto __pyx_L3;
  }

  /* "PETSc/Sys.pyx":151
 *         elif errhandler == "traceback":
 *             handler = PetscTraceBackErrorHandler
 *         elif errhandler == "ignore":             # <<<<<<<<<<<<<<
 *             handler = PetscIgnoreErrorHandler
 *         elif errhandler == "mpiabort":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_errhandler, __pyx_n_s_ignore, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(25, 151, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/Sys.pyx":152
 *             handler = PetscTraceBackErrorHandler
 *         elif errhandler == "ignore":
 *             handler = PetscIgnoreErrorHandler             # <<<<<<<<<<<<<<
 *         elif errhandler == "mpiabort":
 *             handler = PetscMPIAbortErrorHandler
 */
    __pyx_v_handler = PetscIgnoreErrorHandler;

    /* "PETSc/Sys.pyx":151
 *         elif errhandler == "traceback":
 *             handler = PetscTraceBackErrorHandler
 *         elif errhandler == "ignore":             # <<<<<<<<<<<<<<
 *             handler = PetscIgnoreErrorHandler
 *         elif errhandler == "mpiabort":
 */
    goto __pyx_L3;
  }

  /* "PETSc/Sys.pyx":153
 *         elif errhandler == "ignore":
 *             handler = PetscIgnoreErrorHandler
 *         elif errhandler == "mpiabort":             # <<<<<<<<<<<<<<
 *             handler = PetscMPIAbortErrorHandler
 *         elif errhandler == "abort":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_errhandler, __pyx_n_s_mpiabort, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(25, 153, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/Sys.pyx":154
 *             handler = PetscIgnoreErrorHandler
 *         elif errhandler == "mpiabort":
 *             handler = PetscMPIAbortErrorHandler             # <<<<<<<<<<<<<<
 *         elif errhandler == "abort":
 *             handler = PetscAbortErrorHandler
 */
    __pyx_v_handler = PetscMPIAbortErrorHandler;

    /* "PETSc/Sys.pyx":153
 *         elif errhandler == "ignore":
 *             handler = PetscIgnoreErrorHandler
 *         elif errhandler == "mpiabort":             # <<<<<<<<<<<<<<
 *             handler = PetscMPIAbortErrorHandler
 *         elif errhandler == "abort":
 */
    goto __pyx_L3;
  }

  /* "PETSc/Sys.pyx":155
 *         elif errhandler == "mpiabort":
 *             handler = PetscMPIAbortErrorHandler
 *         elif errhandler == "abort":             # <<<<<<<<<<<<<<
 *             handler = PetscAbortErrorHandler
 *         else:
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_errhandler, __pyx_n_s_abort, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(25, 155, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/Sys.pyx":156
 *             handler = PetscMPIAbortErrorHandler
 *         elif errhandler == "abort":
 *             handler = PetscAbortErrorHandler             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError(
 */
    __pyx_v_handler = PetscAbortErrorHandler;

    /* "PETSc/Sys.pyx":155
 *         elif errhandler == "mpiabort":
 *             handler = PetscMPIAbortErrorHandler
 *         elif errhandler == "abort":             # <<<<<<<<<<<<<<
 *             handler = PetscAbortErrorHandler
 *         else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Sys.pyx":158
 *             handler = PetscAbortErrorHandler
 *         else:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 "unknown error handler: %s" % errhandler)
 *         CHKERR( PetscPushErrorHandler(handler, NULL) )
 */
  /*else*/ {

    /* "PETSc/Sys.pyx":159
 *         else:
 *             raise ValueError(
 *                 "unknown error handler: %s" % errhandler)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPushErrorHandler(handler, NULL) )
 * 
 */
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_unknown_error_handler_s, __pyx_v_errhandler); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 159, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "PETSc/Sys.pyx":158
 *             handler = PetscAbortErrorHandler
 *         else:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 "unknown error handler: %s" % errhandler)
 *         CHKERR( PetscPushErrorHandler(handler, NULL) )
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 158, __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_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(25, 158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(25, 158, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/Sys.pyx":160
 *             raise ValueError(
 *                 "unknown error handler: %s" % errhandler)
 *         CHKERR( PetscPushErrorHandler(handler, NULL) )             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPushErrorHandler(__pyx_v_handler, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(25, 160, __pyx_L1_error)

  /* "PETSc/Sys.pyx":140
 * 
 *     @classmethod
 *     def pushErrorHandler(cls, errhandler):             # <<<<<<<<<<<<<<
 *         cdef PetscErrorHandlerFunction handler = NULL
 *         if errhandler == "python":
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.pushErrorHandler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":164
 * 
 *     @classmethod
 *     def popErrorHandler(cls):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPopErrorHandler() )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_25popErrorHandler(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_24popErrorHandler[] = "Sys.popErrorHandler(type cls)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_25popErrorHandler(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("popErrorHandler (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("popErrorHandler", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "popErrorHandler", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_24popErrorHandler(((PyTypeObject*)__pyx_v_cls));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_24popErrorHandler(CYTHON_UNUSED PyTypeObject *__pyx_v_cls) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("popErrorHandler", 0);

  /* "PETSc/Sys.pyx":165
 *     @classmethod
 *     def popErrorHandler(cls):
 *         CHKERR( PetscPopErrorHandler() )             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPopErrorHandler()); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(25, 165, __pyx_L1_error)

  /* "PETSc/Sys.pyx":164
 * 
 *     @classmethod
 *     def popErrorHandler(cls):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPopErrorHandler() )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.popErrorHandler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":168
 * 
 *     @classmethod
 *     def infoAllow(cls, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_27infoAllow(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_26infoAllow[] = "Sys.infoAllow(type cls, flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_27infoAllow(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("infoAllow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "infoAllow") < 0)) __PYX_ERR(25, 168, __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_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("infoAllow", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(25, 168, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.infoAllow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_26infoAllow(((PyTypeObject*)__pyx_v_cls), __pyx_v_flag);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_26infoAllow(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_flag) {
  PetscBool __pyx_v_tval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("infoAllow", 0);

  /* "PETSc/Sys.pyx":169
 *     @classmethod
 *     def infoAllow(cls, flag):
 *         cdef PetscBool tval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if flag: tval = PETSC_TRUE
 *         CHKERR( PetscInfoAllow(tval, NULL) )
 */
  __pyx_v_tval = PETSC_FALSE;

  /* "PETSc/Sys.pyx":170
 *     def infoAllow(cls, flag):
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         CHKERR( PetscInfoAllow(tval, NULL) )
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(25, 170, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_v_tval = PETSC_TRUE;
  }

  /* "PETSc/Sys.pyx":171
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 *         CHKERR( PetscInfoAllow(tval, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscInfoAllow(__pyx_v_tval, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(25, 171, __pyx_L1_error)

  /* "PETSc/Sys.pyx":168
 * 
 *     @classmethod
 *     def infoAllow(cls, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.infoAllow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":174
 * 
 *     @classmethod
 *     def registerCitation(cls, citation):             # <<<<<<<<<<<<<<
 *         if not citation: raise ValueError("empty citation")
 *         cdef const_char *cit = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_29registerCitation(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Sys_28registerCitation[] = "Sys.registerCitation(type cls, citation)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Sys_29registerCitation(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_citation = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("registerCitation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_citation,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);
        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_citation)) != 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, "registerCitation") < 0)) __PYX_ERR(25, 174, __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_citation = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("registerCitation", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(25, 174, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.registerCitation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Sys_28registerCitation(((PyTypeObject*)__pyx_v_cls), __pyx_v_citation);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Sys_28registerCitation(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_citation) {
  const char *__pyx_v_cit;
  PetscBool __pyx_v_set;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("registerCitation", 0);
  __Pyx_INCREF(__pyx_v_citation);

  /* "PETSc/Sys.pyx":175
 *     @classmethod
 *     def registerCitation(cls, citation):
 *         if not citation: raise ValueError("empty citation")             # <<<<<<<<<<<<<<
 *         cdef const_char *cit = NULL
 *         citation = str2bytes(citation, &cit)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_citation); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(25, 175, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 175, __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(25, 175, __pyx_L1_error)
  }

  /* "PETSc/Sys.pyx":176
 *     def registerCitation(cls, citation):
 *         if not citation: raise ValueError("empty citation")
 *         cdef const_char *cit = NULL             # <<<<<<<<<<<<<<
 *         citation = str2bytes(citation, &cit)
 *         cdef PetscBool set = get_citation(citation)
 */
  __pyx_v_cit = NULL;

  /* "PETSc/Sys.pyx":177
 *         if not citation: raise ValueError("empty citation")
 *         cdef const_char *cit = NULL
 *         citation = str2bytes(citation, &cit)             # <<<<<<<<<<<<<<
 *         cdef PetscBool set = get_citation(citation)
 *         CHKERR( PetscCitationsRegister(cit, &set) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_citation, (&__pyx_v_cit)); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_citation, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Sys.pyx":178
 *         cdef const_char *cit = NULL
 *         citation = str2bytes(citation, &cit)
 *         cdef PetscBool set = get_citation(citation)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscCitationsRegister(cit, &set) )
 *         set_citation(citation, <bint>set)
 */
  __pyx_v_set = __pyx_f_8petsc4py_5PETSc_get_citation(__pyx_v_citation);

  /* "PETSc/Sys.pyx":179
 *         citation = str2bytes(citation, &cit)
 *         cdef PetscBool set = get_citation(citation)
 *         CHKERR( PetscCitationsRegister(cit, &set) )             # <<<<<<<<<<<<<<
 *         set_citation(citation, <bint>set)
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscCitationsRegister(__pyx_v_cit, (&__pyx_v_set))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(25, 179, __pyx_L1_error)

  /* "PETSc/Sys.pyx":180
 *         cdef PetscBool set = get_citation(citation)
 *         CHKERR( PetscCitationsRegister(cit, &set) )
 *         set_citation(citation, <bint>set)             # <<<<<<<<<<<<<<
 * 
 * cdef dict citations_registry = { }
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_set_citation(__pyx_v_citation, __pyx_v_set); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/Sys.pyx":174
 * 
 *     @classmethod
 *     def registerCitation(cls, citation):             # <<<<<<<<<<<<<<
 *         if not citation: raise ValueError("empty citation")
 *         cdef const_char *cit = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Sys.registerCitation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_citation);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":184
 * cdef dict citations_registry = { }
 * 
 * cdef PetscBool get_citation(object citation):             # <<<<<<<<<<<<<<
 *     cdef bint is_set = citations_registry.get(citation)
 *     return PETSC_TRUE if is_set else PETSC_FALSE
 */

static PetscBool __pyx_f_8petsc4py_5PETSc_get_citation(PyObject *__pyx_v_citation) {
  int __pyx_v_is_set;
  PetscBool __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PetscBool __pyx_t_3;
  __Pyx_RefNannySetupContext("get_citation", 0);

  /* "PETSc/Sys.pyx":185
 * 
 * cdef PetscBool get_citation(object citation):
 *     cdef bint is_set = citations_registry.get(citation)             # <<<<<<<<<<<<<<
 *     return PETSC_TRUE if is_set else PETSC_FALSE
 * 
 */
  if (unlikely(__pyx_v_8petsc4py_5PETSc_citations_registry == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get");
    __PYX_ERR(25, 185, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_8petsc4py_5PETSc_citations_registry, __pyx_v_citation, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(25, 185, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_is_set = __pyx_t_2;

  /* "PETSc/Sys.pyx":186
 * cdef PetscBool get_citation(object citation):
 *     cdef bint is_set = citations_registry.get(citation)
 *     return PETSC_TRUE if is_set else PETSC_FALSE             # <<<<<<<<<<<<<<
 * 
 * cdef set_citation(object citation, bint is_set):
 */
  if ((__pyx_v_is_set != 0)) {
    __pyx_t_3 = PETSC_TRUE;
  } else {
    __pyx_t_3 = PETSC_FALSE;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "PETSc/Sys.pyx":184
 * cdef dict citations_registry = { }
 * 
 * cdef PetscBool get_citation(object citation):             # <<<<<<<<<<<<<<
 *     cdef bint is_set = citations_registry.get(citation)
 *     return PETSC_TRUE if is_set else PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("petsc4py.PETSc.get_citation", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_r = (PetscBool) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Sys.pyx":188
 *     return PETSC_TRUE if is_set else PETSC_FALSE
 * 
 * cdef set_citation(object citation, bint is_set):             # <<<<<<<<<<<<<<
 *     citations_registry[citation] = is_set
 * 
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_set_citation(PyObject *__pyx_v_citation, int __pyx_v_is_set) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("set_citation", 0);

  /* "PETSc/Sys.pyx":189
 * 
 * cdef set_citation(object citation, bint is_set):
 *     citations_registry[citation] = is_set             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_is_set); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(__pyx_v_8petsc4py_5PETSc_citations_registry == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(25, 189, __pyx_L1_error)
  }
  if (unlikely(PyDict_SetItem(__pyx_v_8petsc4py_5PETSc_citations_registry, __pyx_v_citation, __pyx_t_1) < 0)) __PYX_ERR(25, 189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":188
 *     return PETSC_TRUE if is_set else PETSC_FALSE
 * 
 * cdef set_citation(object citation, bint is_set):             # <<<<<<<<<<<<<<
 *     citations_registry[citation] = is_set
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.set_citation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":6
 * 
 *     @classmethod
 *     def Stage(cls, name):             # <<<<<<<<<<<<<<
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_1Stage(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Log_Stage[] = "Log.Stage(type cls, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_1Stage(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Stage (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);
        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, "Stage") < 0)) __PYX_ERR(26, 6, __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("Stage", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 6, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Log.Stage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Log_Stage(((PyTypeObject*)__pyx_v_cls), __pyx_v_name);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_Stage(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_name) {
  const char *__pyx_v_cname;
  PetscLogStage __pyx_v_stageid;
  struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_stage = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("Stage", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Log.pyx":7
 *     @classmethod
 *     def Stage(cls, name):
 *         if not name: raise ValueError("empty name")             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(26, 7, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 7, __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(26, 7, __pyx_L1_error)
  }

  /* "PETSc/Log.pyx":8
 *     def Stage(cls, name):
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef PetscLogStage stageid = -1
 */
  __pyx_v_cname = NULL;

  /* "PETSc/Log.pyx":9
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscLogStage stageid = -1
 *         cdef LogStage stage = get_LogStage(name)
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Log.pyx":10
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef PetscLogStage stageid = -1             # <<<<<<<<<<<<<<
 *         cdef LogStage stage = get_LogStage(name)
 *         if stage is not None: return stage
 */
  __pyx_v_stageid = -1;

  /* "PETSc/Log.pyx":11
 *         name = str2bytes(name, &cname)
 *         cdef PetscLogStage stageid = -1
 *         cdef LogStage stage = get_LogStage(name)             # <<<<<<<<<<<<<<
 *         if stage is not None: return stage
 *         CHKERR( PetscLogStageFindId(cname, &stageid) )
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_get_LogStage(__pyx_v_name)); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_stage = ((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Log.pyx":12
 *         cdef PetscLogStage stageid = -1
 *         cdef LogStage stage = get_LogStage(name)
 *         if stage is not None: return stage             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStageFindId(cname, &stageid) )
 *         if stageid == -1:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_stage) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_stage));
    __pyx_r = ((PyObject *)__pyx_v_stage);
    goto __pyx_L0;
  }

  /* "PETSc/Log.pyx":13
 *         cdef LogStage stage = get_LogStage(name)
 *         if stage is not None: return stage
 *         CHKERR( PetscLogStageFindId(cname, &stageid) )             # <<<<<<<<<<<<<<
 *         if stageid == -1:
 *             CHKERR( PetscLogStageRegister(cname, &stageid) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogStageFindId(__pyx_v_cname, (&__pyx_v_stageid))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(26, 13, __pyx_L1_error)

  /* "PETSc/Log.pyx":14
 *         if stage is not None: return stage
 *         CHKERR( PetscLogStageFindId(cname, &stageid) )
 *         if stageid == -1:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscLogStageRegister(cname, &stageid) )
 *         stage = reg_LogStage(name, stageid)
 */
  __pyx_t_1 = ((__pyx_v_stageid == -1L) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Log.pyx":15
 *         CHKERR( PetscLogStageFindId(cname, &stageid) )
 *         if stageid == -1:
 *             CHKERR( PetscLogStageRegister(cname, &stageid) )             # <<<<<<<<<<<<<<
 *         stage = reg_LogStage(name, stageid)
 *         return stage
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogStageRegister(__pyx_v_cname, (&__pyx_v_stageid))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(26, 15, __pyx_L1_error)

    /* "PETSc/Log.pyx":14
 *         if stage is not None: return stage
 *         CHKERR( PetscLogStageFindId(cname, &stageid) )
 *         if stageid == -1:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscLogStageRegister(cname, &stageid) )
 *         stage = reg_LogStage(name, stageid)
 */
  }

  /* "PETSc/Log.pyx":16
 *         if stageid == -1:
 *             CHKERR( PetscLogStageRegister(cname, &stageid) )
 *         stage = reg_LogStage(name, stageid)             # <<<<<<<<<<<<<<
 *         return stage
 * 
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_reg_LogStage(__pyx_v_name, __pyx_v_stageid)); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_stage, ((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_t_3));
  __pyx_t_3 = 0;

  /* "PETSc/Log.pyx":17
 *             CHKERR( PetscLogStageRegister(cname, &stageid) )
 *         stage = reg_LogStage(name, stageid)
 *         return stage             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_stage));
  __pyx_r = ((PyObject *)__pyx_v_stage);
  goto __pyx_L0;

  /* "PETSc/Log.pyx":6
 * 
 *     @classmethod
 *     def Stage(cls, name):             # <<<<<<<<<<<<<<
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Log.Stage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_stage);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":20
 * 
 *     @classmethod
 *     def Class(cls, name):             # <<<<<<<<<<<<<<
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_3Class(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Log_2Class[] = "Log.Class(type cls, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_3Class(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Class (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);
        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, "Class") < 0)) __PYX_ERR(26, 20, __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("Class", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 20, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Log.Class", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Log_2Class(((PyTypeObject*)__pyx_v_cls), __pyx_v_name);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_2Class(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_name) {
  const char *__pyx_v_cname;
  PetscClassId __pyx_v_classid;
  struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_klass = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("Class", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Log.pyx":21
 *     @classmethod
 *     def Class(cls, name):
 *         if not name: raise ValueError("empty name")             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(26, 21, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 21, __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(26, 21, __pyx_L1_error)
  }

  /* "PETSc/Log.pyx":22
 *     def Class(cls, name):
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef PetscLogClass classid = -1
 */
  __pyx_v_cname = NULL;

  /* "PETSc/Log.pyx":23
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscLogClass classid = -1
 *         cdef LogClass klass = get_LogClass(name)
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Log.pyx":24
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef PetscLogClass classid = -1             # <<<<<<<<<<<<<<
 *         cdef LogClass klass = get_LogClass(name)
 *         if klass is not None: return klass
 */
  __pyx_v_classid = -1;

  /* "PETSc/Log.pyx":25
 *         name = str2bytes(name, &cname)
 *         cdef PetscLogClass classid = -1
 *         cdef LogClass klass = get_LogClass(name)             # <<<<<<<<<<<<<<
 *         if klass is not None: return klass
 *         CHKERR( PetscLogClassFindId(cname, &classid) )
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_get_LogClass(__pyx_v_name)); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_klass = ((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Log.pyx":26
 *         cdef PetscLogClass classid = -1
 *         cdef LogClass klass = get_LogClass(name)
 *         if klass is not None: return klass             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogClassFindId(cname, &classid) )
 *         if classid == -1:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_klass) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_klass));
    __pyx_r = ((PyObject *)__pyx_v_klass);
    goto __pyx_L0;
  }

  /* "PETSc/Log.pyx":27
 *         cdef LogClass klass = get_LogClass(name)
 *         if klass is not None: return klass
 *         CHKERR( PetscLogClassFindId(cname, &classid) )             # <<<<<<<<<<<<<<
 *         if classid == -1:
 *             CHKERR( PetscLogClassRegister(cname, &classid) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogClassFindId(__pyx_v_cname, (&__pyx_v_classid))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(26, 27, __pyx_L1_error)

  /* "PETSc/Log.pyx":28
 *         if klass is not None: return klass
 *         CHKERR( PetscLogClassFindId(cname, &classid) )
 *         if classid == -1:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscLogClassRegister(cname, &classid) )
 *         klass = reg_LogClass(name, classid)
 */
  __pyx_t_1 = ((__pyx_v_classid == -1L) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Log.pyx":29
 *         CHKERR( PetscLogClassFindId(cname, &classid) )
 *         if classid == -1:
 *             CHKERR( PetscLogClassRegister(cname, &classid) )             # <<<<<<<<<<<<<<
 *         klass = reg_LogClass(name, classid)
 *         return klass
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscClassIdRegister(__pyx_v_cname, (&__pyx_v_classid))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(26, 29, __pyx_L1_error)

    /* "PETSc/Log.pyx":28
 *         if klass is not None: return klass
 *         CHKERR( PetscLogClassFindId(cname, &classid) )
 *         if classid == -1:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscLogClassRegister(cname, &classid) )
 *         klass = reg_LogClass(name, classid)
 */
  }

  /* "PETSc/Log.pyx":30
 *         if classid == -1:
 *             CHKERR( PetscLogClassRegister(cname, &classid) )
 *         klass = reg_LogClass(name, classid)             # <<<<<<<<<<<<<<
 *         return klass
 * 
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_reg_LogClass(__pyx_v_name, __pyx_v_classid)); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_klass, ((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_t_3));
  __pyx_t_3 = 0;

  /* "PETSc/Log.pyx":31
 *             CHKERR( PetscLogClassRegister(cname, &classid) )
 *         klass = reg_LogClass(name, classid)
 *         return klass             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_klass));
  __pyx_r = ((PyObject *)__pyx_v_klass);
  goto __pyx_L0;

  /* "PETSc/Log.pyx":20
 * 
 *     @classmethod
 *     def Class(cls, name):             # <<<<<<<<<<<<<<
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Log.Class", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_klass);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":34
 * 
 *     @classmethod
 *     def Event(cls, name, klass=None):             # <<<<<<<<<<<<<<
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_5Event(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Log_4Event[] = "Log.Event(type cls, name, klass=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_5Event(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_klass = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Event (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_klass,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_klass);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Event") < 0)) __PYX_ERR(26, 34, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_klass = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Event", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 34, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Log.Event", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Log_4Event(((PyTypeObject*)__pyx_v_cls), __pyx_v_name, __pyx_v_klass);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_4Event(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_name, PyObject *__pyx_v_klass) {
  const char *__pyx_v_cname;
  PetscClassId __pyx_v_classid;
  PetscLogEvent __pyx_v_eventid;
  struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_event = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PetscClassId __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("Event", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Log.pyx":35
 *     @classmethod
 *     def Event(cls, name, klass=None):
 *         if not name: raise ValueError("empty name")             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(26, 35, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 35, __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(26, 35, __pyx_L1_error)
  }

  /* "PETSc/Log.pyx":36
 *     def Event(cls, name, klass=None):
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef PetscLogClass classid = PETSC_OBJECT_CLASSID
 */
  __pyx_v_cname = NULL;

  /* "PETSc/Log.pyx":37
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscLogClass classid = PETSC_OBJECT_CLASSID
 *         cdef PetscLogEvent eventid = -1
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Log.pyx":38
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef PetscLogClass classid = PETSC_OBJECT_CLASSID             # <<<<<<<<<<<<<<
 *         cdef PetscLogEvent eventid = -1
 *         if klass is not None: classid = klass
 */
  __pyx_v_classid = PETSC_OBJECT_CLASSID;

  /* "PETSc/Log.pyx":39
 *         name = str2bytes(name, &cname)
 *         cdef PetscLogClass classid = PETSC_OBJECT_CLASSID
 *         cdef PetscLogEvent eventid = -1             # <<<<<<<<<<<<<<
 *         if klass is not None: classid = klass
 *         cdef LogEvent event = get_LogEvent(name)
 */
  __pyx_v_eventid = -1;

  /* "PETSc/Log.pyx":40
 *         cdef PetscLogClass classid = PETSC_OBJECT_CLASSID
 *         cdef PetscLogEvent eventid = -1
 *         if klass is not None: classid = klass             # <<<<<<<<<<<<<<
 *         cdef LogEvent event = get_LogEvent(name)
 *         if event is not None: return event
 */
  __pyx_t_2 = (__pyx_v_klass != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyInt_As_PetscClassId(__pyx_v_klass); if (unlikely((__pyx_t_4 == (PetscClassId)-1) && PyErr_Occurred())) __PYX_ERR(26, 40, __pyx_L1_error)
    __pyx_v_classid = __pyx_t_4;
  }

  /* "PETSc/Log.pyx":41
 *         cdef PetscLogEvent eventid = -1
 *         if klass is not None: classid = klass
 *         cdef LogEvent event = get_LogEvent(name)             # <<<<<<<<<<<<<<
 *         if event is not None: return event
 *         CHKERR( PetscLogEventFindId(cname, &eventid) )
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_get_LogEvent(__pyx_v_name)); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_event = ((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Log.pyx":42
 *         if klass is not None: classid = klass
 *         cdef LogEvent event = get_LogEvent(name)
 *         if event is not None: return event             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogEventFindId(cname, &eventid) )
 *         if eventid == -1:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_event) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_event));
    __pyx_r = ((PyObject *)__pyx_v_event);
    goto __pyx_L0;
  }

  /* "PETSc/Log.pyx":43
 *         cdef LogEvent event = get_LogEvent(name)
 *         if event is not None: return event
 *         CHKERR( PetscLogEventFindId(cname, &eventid) )             # <<<<<<<<<<<<<<
 *         if eventid == -1:
 *             CHKERR( PetscLogEventRegister(cname, classid, &eventid) )
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventFindId(__pyx_v_cname, (&__pyx_v_eventid))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(26, 43, __pyx_L1_error)

  /* "PETSc/Log.pyx":44
 *         if event is not None: return event
 *         CHKERR( PetscLogEventFindId(cname, &eventid) )
 *         if eventid == -1:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscLogEventRegister(cname, classid, &eventid) )
 *         event = reg_LogEvent(name, eventid)
 */
  __pyx_t_2 = ((__pyx_v_eventid == -1L) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Log.pyx":45
 *         CHKERR( PetscLogEventFindId(cname, &eventid) )
 *         if eventid == -1:
 *             CHKERR( PetscLogEventRegister(cname, classid, &eventid) )             # <<<<<<<<<<<<<<
 *         event = reg_LogEvent(name, eventid)
 *         return event
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventRegister(__pyx_v_cname, __pyx_v_classid, (&__pyx_v_eventid))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(26, 45, __pyx_L1_error)

    /* "PETSc/Log.pyx":44
 *         if event is not None: return event
 *         CHKERR( PetscLogEventFindId(cname, &eventid) )
 *         if eventid == -1:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscLogEventRegister(cname, classid, &eventid) )
 *         event = reg_LogEvent(name, eventid)
 */
  }

  /* "PETSc/Log.pyx":46
 *         if eventid == -1:
 *             CHKERR( PetscLogEventRegister(cname, classid, &eventid) )
 *         event = reg_LogEvent(name, eventid)             # <<<<<<<<<<<<<<
 *         return event
 * 
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_reg_LogEvent(__pyx_v_name, __pyx_v_eventid)); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_event, ((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_t_3));
  __pyx_t_3 = 0;

  /* "PETSc/Log.pyx":47
 *             CHKERR( PetscLogEventRegister(cname, classid, &eventid) )
 *         event = reg_LogEvent(name, eventid)
 *         return event             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_event));
  __pyx_r = ((PyObject *)__pyx_v_event);
  goto __pyx_L0;

  /* "PETSc/Log.pyx":34
 * 
 *     @classmethod
 *     def Event(cls, name, klass=None):             # <<<<<<<<<<<<<<
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Log.Event", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_event);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":50
 * 
 *     @classmethod
 *     def begin(cls, all=False):             # <<<<<<<<<<<<<<
 *         if all: CHKERR( PetscLogAllBegin() )
 *         else:   CHKERR( PetscLogDefaultBegin() )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_7begin(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Log_6begin[] = "Log.begin(type cls, all=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_7begin(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_all = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("begin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_all,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_all);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "begin") < 0)) __PYX_ERR(26, 50, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_all = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("begin", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 50, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Log.begin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Log_6begin(((PyTypeObject*)__pyx_v_cls), __pyx_v_all);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_6begin(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_all) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("begin", 0);

  /* "PETSc/Log.pyx":51
 *     @classmethod
 *     def begin(cls, all=False):
 *         if all: CHKERR( PetscLogAllBegin() )             # <<<<<<<<<<<<<<
 *         else:   CHKERR( PetscLogDefaultBegin() )
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_all); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(26, 51, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogAllBegin()); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(26, 51, __pyx_L1_error)
    goto __pyx_L3;
  }

  /* "PETSc/Log.pyx":52
 *     def begin(cls, all=False):
 *         if all: CHKERR( PetscLogAllBegin() )
 *         else:   CHKERR( PetscLogDefaultBegin() )             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  /*else*/ {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogDefaultBegin()); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(26, 52, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/Log.pyx":50
 * 
 *     @classmethod
 *     def begin(cls, all=False):             # <<<<<<<<<<<<<<
 *         if all: CHKERR( PetscLogAllBegin() )
 *         else:   CHKERR( PetscLogDefaultBegin() )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Log.begin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":55
 * 
 *     @classmethod
 *     def view(cls, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_9view(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Log_8view[] = "Log.view(type cls, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_9view(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(26, 55, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 55, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Log.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(26, 55, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Log_8view(((PyTypeObject*)__pyx_v_cls), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_8view(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/Log.pyx":56
 *     @classmethod
 *     def view(cls, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         if vwr == NULL: vwr = PETSC_VIEWER_STDOUT_WORLD
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/Log.pyx":57
 *     def view(cls, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         if vwr == NULL: vwr = PETSC_VIEWER_STDOUT_WORLD
 *         CHKERR( PetscLogView(vwr) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/Log.pyx":58
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         if vwr == NULL: vwr = PETSC_VIEWER_STDOUT_WORLD             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogView(vwr) )
 * 
 */
  __pyx_t_2 = ((__pyx_v_vwr == NULL) != 0);
  if (__pyx_t_2) {
    __pyx_v_vwr = PETSC_VIEWER_STDOUT_WORLD;
  }

  /* "PETSc/Log.pyx":59
 *         if viewer is not None: vwr = viewer.vwr
 *         if vwr == NULL: vwr = PETSC_VIEWER_STDOUT_WORLD
 *         CHKERR( PetscLogView(vwr) )             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogView(__pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(26, 59, __pyx_L1_error)

  /* "PETSc/Log.pyx":55
 * 
 *     @classmethod
 *     def view(cls, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Log.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":62
 * 
 *     @classmethod
 *     def destroy(cls):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogDestroy() )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_11destroy(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Log_10destroy[] = "Log.destroy(type cls)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_11destroy(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Log_10destroy(((PyTypeObject*)__pyx_v_cls));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_10destroy(CYTHON_UNUSED PyTypeObject *__pyx_v_cls) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/Log.pyx":63
 *     @classmethod
 *     def destroy(cls):
 *         CHKERR( PetscLogDestroy() )             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogDestroy()); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 63, __pyx_L1_error)

  /* "PETSc/Log.pyx":62
 * 
 *     @classmethod
 *     def destroy(cls):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogDestroy() )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Log.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":66
 * 
 *     @classmethod
 *     def logFlops(cls, flops):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble cflops=flops
 *         CHKERR( PetscLogFlops(cflops) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_13logFlops(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Log_12logFlops[] = "Log.logFlops(type cls, flops)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_13logFlops(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flops = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("logFlops (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flops,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);
        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_flops)) != 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, "logFlops") < 0)) __PYX_ERR(26, 66, __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_flops = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("logFlops", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 66, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Log.logFlops", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Log_12logFlops(((PyTypeObject*)__pyx_v_cls), __pyx_v_flops);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_12logFlops(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_flops) {
  PetscLogDouble __pyx_v_cflops;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscLogDouble __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("logFlops", 0);

  /* "PETSc/Log.pyx":67
 *     @classmethod
 *     def logFlops(cls, flops):
 *         cdef PetscLogDouble cflops=flops             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogFlops(cflops) )
 * 
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_flops); if (unlikely((__pyx_t_1 == (PetscLogDouble)-1) && PyErr_Occurred())) __PYX_ERR(26, 67, __pyx_L1_error)
  __pyx_v_cflops = __pyx_t_1;

  /* "PETSc/Log.pyx":68
 *     def logFlops(cls, flops):
 *         cdef PetscLogDouble cflops=flops
 *         CHKERR( PetscLogFlops(cflops) )             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogFlops(__pyx_v_cflops)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(26, 68, __pyx_L1_error)

  /* "PETSc/Log.pyx":66
 * 
 *     @classmethod
 *     def logFlops(cls, flops):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble cflops=flops
 *         CHKERR( PetscLogFlops(cflops) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Log.logFlops", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":71
 * 
 *     @classmethod
 *     def addFlops(cls, flops):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble cflops=flops
 *         CHKERR( PetscLogFlops(cflops) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_15addFlops(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Log_14addFlops[] = "Log.addFlops(type cls, flops)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_15addFlops(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flops = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addFlops (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flops,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);
        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_flops)) != 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, "addFlops") < 0)) __PYX_ERR(26, 71, __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_flops = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addFlops", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 71, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Log.addFlops", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Log_14addFlops(((PyTypeObject*)__pyx_v_cls), __pyx_v_flops);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_14addFlops(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_flops) {
  PetscLogDouble __pyx_v_cflops;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscLogDouble __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("addFlops", 0);

  /* "PETSc/Log.pyx":72
 *     @classmethod
 *     def addFlops(cls, flops):
 *         cdef PetscLogDouble cflops=flops             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogFlops(cflops) )
 * 
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_flops); if (unlikely((__pyx_t_1 == (PetscLogDouble)-1) && PyErr_Occurred())) __PYX_ERR(26, 72, __pyx_L1_error)
  __pyx_v_cflops = __pyx_t_1;

  /* "PETSc/Log.pyx":73
 *     def addFlops(cls, flops):
 *         cdef PetscLogDouble cflops=flops
 *         CHKERR( PetscLogFlops(cflops) )             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogFlops(__pyx_v_cflops)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(26, 73, __pyx_L1_error)

  /* "PETSc/Log.pyx":71
 * 
 *     @classmethod
 *     def addFlops(cls, flops):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble cflops=flops
 *         CHKERR( PetscLogFlops(cflops) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Log.addFlops", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":76
 * 
 *     @classmethod
 *     def getFlops(cls):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble cflops=0
 *         CHKERR( PetscGetFlops(&cflops) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_17getFlops(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Log_16getFlops[] = "Log.getFlops(type cls)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_17getFlops(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFlops (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getFlops", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getFlops", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Log_16getFlops(((PyTypeObject*)__pyx_v_cls));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_16getFlops(CYTHON_UNUSED PyTypeObject *__pyx_v_cls) {
  PetscLogDouble __pyx_v_cflops;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getFlops", 0);

  /* "PETSc/Log.pyx":77
 *     @classmethod
 *     def getFlops(cls):
 *         cdef PetscLogDouble cflops=0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscGetFlops(&cflops) )
 *         return cflops
 */
  __pyx_v_cflops = 0.0;

  /* "PETSc/Log.pyx":78
 *     def getFlops(cls):
 *         cdef PetscLogDouble cflops=0
 *         CHKERR( PetscGetFlops(&cflops) )             # <<<<<<<<<<<<<<
 *         return cflops
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscGetFlops((&__pyx_v_cflops))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 78, __pyx_L1_error)

  /* "PETSc/Log.pyx":79
 *         cdef PetscLogDouble cflops=0
 *         CHKERR( PetscGetFlops(&cflops) )
 *         return cflops             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_cflops); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":76
 * 
 *     @classmethod
 *     def getFlops(cls):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble cflops=0
 *         CHKERR( PetscGetFlops(&cflops) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Log.getFlops", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":82
 * 
 *     @classmethod
 *     def getTime(cls):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble wctime=0
 *         CHKERR( PetscTime(&wctime) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_19getTime(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Log_18getTime[] = "Log.getTime(type cls)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_19getTime(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTime (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getTime", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getTime", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Log_18getTime(((PyTypeObject*)__pyx_v_cls));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_18getTime(CYTHON_UNUSED PyTypeObject *__pyx_v_cls) {
  PetscLogDouble __pyx_v_wctime;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getTime", 0);

  /* "PETSc/Log.pyx":83
 *     @classmethod
 *     def getTime(cls):
 *         cdef PetscLogDouble wctime=0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscTime(&wctime) )
 *         return wctime
 */
  __pyx_v_wctime = 0.0;

  /* "PETSc/Log.pyx":84
 *     def getTime(cls):
 *         cdef PetscLogDouble wctime=0
 *         CHKERR( PetscTime(&wctime) )             # <<<<<<<<<<<<<<
 *         return wctime
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscTime((&__pyx_v_wctime))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 84, __pyx_L1_error)

  /* "PETSc/Log.pyx":85
 *         cdef PetscLogDouble wctime=0
 *         CHKERR( PetscTime(&wctime) )
 *         return wctime             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_wctime); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":82
 * 
 *     @classmethod
 *     def getTime(cls):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble wctime=0
 *         CHKERR( PetscTime(&wctime) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Log.getTime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":88
 * 
 *     @classmethod
 *     def getCPUTime(cls):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble cputime=0
 *         CHKERR( PetscGetCPUTime(&cputime) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_21getCPUTime(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Log_20getCPUTime[] = "Log.getCPUTime(type cls)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Log_21getCPUTime(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCPUTime (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getCPUTime", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getCPUTime", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Log_20getCPUTime(((PyTypeObject*)__pyx_v_cls));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Log_20getCPUTime(CYTHON_UNUSED PyTypeObject *__pyx_v_cls) {
  PetscLogDouble __pyx_v_cputime;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getCPUTime", 0);

  /* "PETSc/Log.pyx":89
 *     @classmethod
 *     def getCPUTime(cls):
 *         cdef PetscLogDouble cputime=0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscGetCPUTime(&cputime) )
 *         return cputime
 */
  __pyx_v_cputime = 0.0;

  /* "PETSc/Log.pyx":90
 *     def getCPUTime(cls):
 *         cdef PetscLogDouble cputime=0
 *         CHKERR( PetscGetCPUTime(&cputime) )             # <<<<<<<<<<<<<<
 *         return cputime
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscGetCPUTime((&__pyx_v_cputime))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 90, __pyx_L1_error)

  /* "PETSc/Log.pyx":91
 *         cdef PetscLogDouble cputime=0
 *         CHKERR( PetscGetCPUTime(&cputime) )
 *         return cputime             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_cputime); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":88
 * 
 *     @classmethod
 *     def getCPUTime(cls):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble cputime=0
 *         CHKERR( PetscGetCPUTime(&cputime) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Log.getCPUTime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":99
 *     cdef readonly PetscLogStage id
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.id = 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_8LogStage_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_8LogStage_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage___cinit__(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_8LogStage___cinit__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Log.pyx":100
 * 
 *     def __cinit__(self):
 *         self.id = 0             # <<<<<<<<<<<<<<
 * 
 *     def __int__(self):
 */
  __pyx_v_self->id = 0;

  /* "PETSc/Log.pyx":99
 *     cdef readonly PetscLogStage id
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.id = 0
 * 
 */

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

/* "PETSc/Log.pyx":102
 *         self.id = 0
 * 
 *     def __int__(self):             # <<<<<<<<<<<<<<
 *         return <int> self.id
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_3__int__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_3__int__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__int__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_2__int__(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_2__int__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__int__", 0);

  /* "PETSc/Log.pyx":103
 * 
 *     def __int__(self):
 *         return <int> self.id             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(((int)__pyx_v_self->id)); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":102
 *         self.id = 0
 * 
 *     def __int__(self):             # <<<<<<<<<<<<<<
 *         return <int> self.id
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.__int__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":105
 *         return <int> self.id
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self.push()
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_5__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogStage_4__enter__[] = "LogStage.__enter__(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_5__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_4__enter__(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_4__enter__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__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("__enter__", 0);

  /* "PETSc/Log.pyx":106
 * 
 *     def __enter__(self):
 *         self.push()             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_push); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(26, 106, __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(26, 106, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":107
 *     def __enter__(self):
 *         self.push()
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *exc):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Log.pyx":105
 *         return <int> self.id
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self.push()
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":109
 *         return self
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         self.pop()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_7__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogStage_6__exit__[] = "LogStage.__exit__(self, *exc)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_7__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_exc = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_6__exit__(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self), __pyx_v_exc);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_6__exit__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "PETSc/Log.pyx":110
 * 
 *     def __exit__(self, *exc):
 *         self.pop()             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":109
 *         return self
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         self.pop()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":114
 *     #
 * 
 *     def push(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStagePush(self.id) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_9push(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogStage_8push[] = "LogStage.push(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_9push(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("push (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("push", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "push", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_8push(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_8push(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("push", 0);

  /* "PETSc/Log.pyx":115
 * 
 *     def push(self):
 *         CHKERR( PetscLogStagePush(self.id) )             # <<<<<<<<<<<<<<
 * 
 *     def pop(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogStagePush(__pyx_v_self->id)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 115, __pyx_L1_error)

  /* "PETSc/Log.pyx":114
 *     #
 * 
 *     def push(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStagePush(self.id) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":117
 *         CHKERR( PetscLogStagePush(self.id) )
 * 
 *     def pop(self):             # <<<<<<<<<<<<<<
 *         <void>self # unused
 *         CHKERR( PetscLogStagePop() )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_11pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogStage_10pop[] = "LogStage.pop(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_11pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pop (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("pop", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "pop", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_10pop(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_10pop(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("pop", 0);

  /* "PETSc/Log.pyx":118
 * 
 *     def pop(self):
 *         <void>self # unused             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStagePop() )
 * 
 */
  ((void)__pyx_v_self);

  /* "PETSc/Log.pyx":119
 *     def pop(self):
 *         <void>self # unused
 *         CHKERR( PetscLogStagePop() )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogStagePop()); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 119, __pyx_L1_error)

  /* "PETSc/Log.pyx":117
 *         CHKERR( PetscLogStagePush(self.id) )
 * 
 *     def pop(self):             # <<<<<<<<<<<<<<
 *         <void>self # unused
 *         CHKERR( PetscLogStagePop() )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":123
 *     #
 * 
 *     def getName(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscLogStageFindName(self.id, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_13getName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogStage_12getName[] = "LogStage.getName(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_13getName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getName (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getName", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getName", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_12getName(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_12getName(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getName", 0);

  /* "PETSc/Log.pyx":124
 * 
 *     def getName(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStageFindName(self.id, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Log.pyx":125
 *     def getName(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscLogStageFindName(self.id, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogStageFindName(__pyx_v_self->id, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 125, __pyx_L1_error)

  /* "PETSc/Log.pyx":126
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscLogStageFindName(self.id, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":123
 *     #
 * 
 *     def getName(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscLogStageFindName(self.id, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.getName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":129
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getName()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_4name___get__(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_4name___get__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__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);

  /* "PETSc/Log.pyx":130
 *     property name:
 *         def __get__(self):
 *             return self.getName()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             <void>self; <void>value; # unused
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getName); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(26, 130, __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(26, 130, __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;

  /* "PETSc/Log.pyx":129
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getName()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":131
 *         def __get__(self):
 *             return self.getName()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             <void>self; <void>value; # unused
 *             raise TypeError("readonly attribute")
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_8LogStage_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_8LogStage_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_4name_2__set__(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_8LogStage_4name_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Log.pyx":132
 *             return self.getName()
 *         def __set__(self, value):
 *             <void>self; <void>value; # unused             # <<<<<<<<<<<<<<
 *             raise TypeError("readonly attribute")
 * 
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_value);

  /* "PETSc/Log.pyx":133
 *         def __set__(self, value):
 *             <void>self; <void>value; # unused
 *             raise TypeError("readonly attribute")             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 133, __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(26, 133, __pyx_L1_error)

  /* "PETSc/Log.pyx":131
 *         def __get__(self):
 *             return self.getName()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             <void>self; <void>value; # unused
 *             raise TypeError("readonly attribute")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":137
 *     #
 * 
 *     def activate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStageSetActive(self.id, PETSC_TRUE) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_15activate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogStage_14activate[] = "LogStage.activate(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_15activate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("activate (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("activate", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "activate", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_14activate(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_14activate(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("activate", 0);

  /* "PETSc/Log.pyx":138
 * 
 *     def activate(self):
 *         CHKERR( PetscLogStageSetActive(self.id, PETSC_TRUE) )             # <<<<<<<<<<<<<<
 * 
 *     def deactivate(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogStageSetActive(__pyx_v_self->id, PETSC_TRUE)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 138, __pyx_L1_error)

  /* "PETSc/Log.pyx":137
 *     #
 * 
 *     def activate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStageSetActive(self.id, PETSC_TRUE) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.activate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":140
 *         CHKERR( PetscLogStageSetActive(self.id, PETSC_TRUE) )
 * 
 *     def deactivate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStageSetActive(self.id, PETSC_FALSE) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_17deactivate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogStage_16deactivate[] = "LogStage.deactivate(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_17deactivate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deactivate (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("deactivate", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "deactivate", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_16deactivate(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_16deactivate(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("deactivate", 0);

  /* "PETSc/Log.pyx":141
 * 
 *     def deactivate(self):
 *         CHKERR( PetscLogStageSetActive(self.id, PETSC_FALSE) )             # <<<<<<<<<<<<<<
 * 
 *     def getActive(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogStageSetActive(__pyx_v_self->id, PETSC_FALSE)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 141, __pyx_L1_error)

  /* "PETSc/Log.pyx":140
 *         CHKERR( PetscLogStageSetActive(self.id, PETSC_TRUE) )
 * 
 *     def deactivate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStageSetActive(self.id, PETSC_FALSE) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.deactivate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":143
 *         CHKERR( PetscLogStageSetActive(self.id, PETSC_FALSE) )
 * 
 *     def getActive(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         CHKERR( PetscLogStageGetActive(self.id, &tval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_19getActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogStage_18getActive[] = "LogStage.getActive(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_19getActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getActive (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getActive", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getActive", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_18getActive(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_18getActive(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self) {
  PetscBool __pyx_v_tval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getActive", 0);

  /* "PETSc/Log.pyx":144
 * 
 *     def getActive(self):
 *         cdef PetscBool tval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStageGetActive(self.id, &tval) )
 *         return <bint> tval
 */
  __pyx_v_tval = PETSC_FALSE;

  /* "PETSc/Log.pyx":145
 *     def getActive(self):
 *         cdef PetscBool tval = PETSC_FALSE
 *         CHKERR( PetscLogStageGetActive(self.id, &tval) )             # <<<<<<<<<<<<<<
 *         return <bint> tval
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogStageGetActive(__pyx_v_self->id, (&__pyx_v_tval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 145, __pyx_L1_error)

  /* "PETSc/Log.pyx":146
 *         cdef PetscBool tval = PETSC_FALSE
 *         CHKERR( PetscLogStageGetActive(self.id, &tval) )
 *         return <bint> tval             # <<<<<<<<<<<<<<
 * 
 *     def setActive(self, flag):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_tval); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":143
 *         CHKERR( PetscLogStageSetActive(self.id, PETSC_FALSE) )
 * 
 *     def getActive(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         CHKERR( PetscLogStageGetActive(self.id, &tval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.getActive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":148
 *         return <bint> tval
 * 
 *     def setActive(self, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_21setActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogStage_20setActive[] = "LogStage.setActive(self, flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_21setActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setActive (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setActive") < 0)) __PYX_ERR(26, 148, __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_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setActive", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 148, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.setActive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_20setActive(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self), __pyx_v_flag);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_20setActive(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self, PyObject *__pyx_v_flag) {
  PetscBool __pyx_v_tval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setActive", 0);

  /* "PETSc/Log.pyx":149
 * 
 *     def setActive(self, flag):
 *         cdef PetscBool tval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if flag: tval = PETSC_TRUE
 *         CHKERR( PetscLogStageSetActive(self.id, tval) )
 */
  __pyx_v_tval = PETSC_FALSE;

  /* "PETSc/Log.pyx":150
 *     def setActive(self, flag):
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStageSetActive(self.id, tval) )
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(26, 150, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_v_tval = PETSC_TRUE;
  }

  /* "PETSc/Log.pyx":151
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 *         CHKERR( PetscLogStageSetActive(self.id, tval) )             # <<<<<<<<<<<<<<
 * 
 *     property active:
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogStageSetActive(__pyx_v_self->id, __pyx_v_tval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(26, 151, __pyx_L1_error)

  /* "PETSc/Log.pyx":148
 *         return <bint> tval
 * 
 *     def setActive(self, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.setActive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":154
 * 
 *     property active:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getActive()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_6active_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_6active_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_6active___get__(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_6active___get__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__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);

  /* "PETSc/Log.pyx":155
 *     property active:
 *         def __get__(self):
 *             return self.getActive()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setActive(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getActive); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(26, 155, __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(26, 155, __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;

  /* "PETSc/Log.pyx":154
 * 
 *     property active:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getActive()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":156
 *         def __get__(self):
 *             return self.getActive()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setActive(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_8LogStage_6active_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_8LogStage_6active_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_6active_2__set__(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_8LogStage_6active_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Log.pyx":157
 *             return self.getActive()
 *         def __set__(self, value):
 *             self.setActive(value)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setActive); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(26, 157, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 157, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":156
 *         def __get__(self):
 *             return self.getActive()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setActive(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.active.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":161
 *     #
 * 
 *     def getVisible(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         CHKERR( PetscLogStageGetVisible(self.id, &tval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_23getVisible(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogStage_22getVisible[] = "LogStage.getVisible(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_23getVisible(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getVisible (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getVisible", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getVisible", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_22getVisible(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_22getVisible(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self) {
  PetscBool __pyx_v_tval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getVisible", 0);

  /* "PETSc/Log.pyx":162
 * 
 *     def getVisible(self):
 *         cdef PetscBool tval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStageGetVisible(self.id, &tval) )
 *         return <bint> tval
 */
  __pyx_v_tval = PETSC_FALSE;

  /* "PETSc/Log.pyx":163
 *     def getVisible(self):
 *         cdef PetscBool tval = PETSC_FALSE
 *         CHKERR( PetscLogStageGetVisible(self.id, &tval) )             # <<<<<<<<<<<<<<
 *         return <bint> tval
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogStageGetVisible(__pyx_v_self->id, (&__pyx_v_tval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 163, __pyx_L1_error)

  /* "PETSc/Log.pyx":164
 *         cdef PetscBool tval = PETSC_FALSE
 *         CHKERR( PetscLogStageGetVisible(self.id, &tval) )
 *         return <bint> tval             # <<<<<<<<<<<<<<
 * 
 *     def setVisible(self, flag):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_tval); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":161
 *     #
 * 
 *     def getVisible(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         CHKERR( PetscLogStageGetVisible(self.id, &tval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.getVisible", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":166
 *         return <bint> tval
 * 
 *     def setVisible(self, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_25setVisible(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogStage_24setVisible[] = "LogStage.setVisible(self, flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_25setVisible(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setVisible (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setVisible") < 0)) __PYX_ERR(26, 166, __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_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setVisible", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 166, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.setVisible", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_24setVisible(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self), __pyx_v_flag);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_24setVisible(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self, PyObject *__pyx_v_flag) {
  PetscBool __pyx_v_tval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setVisible", 0);

  /* "PETSc/Log.pyx":167
 * 
 *     def setVisible(self, flag):
 *         cdef PetscBool tval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if flag: tval = PETSC_TRUE
 *         CHKERR( PetscLogStageSetVisible(self.id, tval) )
 */
  __pyx_v_tval = PETSC_FALSE;

  /* "PETSc/Log.pyx":168
 *     def setVisible(self, flag):
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogStageSetVisible(self.id, tval) )
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(26, 168, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_v_tval = PETSC_TRUE;
  }

  /* "PETSc/Log.pyx":169
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 *         CHKERR( PetscLogStageSetVisible(self.id, tval) )             # <<<<<<<<<<<<<<
 * 
 *     property visible:
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogStageSetVisible(__pyx_v_self->id, __pyx_v_tval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(26, 169, __pyx_L1_error)

  /* "PETSc/Log.pyx":166
 *         return <bint> tval
 * 
 *     def setVisible(self, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.setVisible", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":172
 * 
 *     property visible:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getVisible()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_7visible_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_7visible_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_7visible___get__(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_7visible___get__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__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);

  /* "PETSc/Log.pyx":173
 *     property visible:
 *         def __get__(self):
 *             return self.getVisible()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setVisible(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getVisible); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(26, 173, __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(26, 173, __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;

  /* "PETSc/Log.pyx":172
 * 
 *     property visible:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getVisible()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.visible.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":174
 *         def __get__(self):
 *             return self.getVisible()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setVisible(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_8LogStage_7visible_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_8LogStage_7visible_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_7visible_2__set__(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_8LogStage_7visible_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Log.pyx":175
 *             return self.getVisible()
 *         def __set__(self, value):
 *             self.setVisible(value)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setVisible); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(26, 175, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 175, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":174
 *         def __get__(self):
 *             return self.getVisible()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setVisible(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.visible.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":97
 * cdef class LogStage:
 * 
 *     cdef readonly PetscLogStage id             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogStage_2id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogStage_2id___get__(((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogStage_2id___get__(struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_PetscLogStage(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LogStage.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":180
 * cdef dict stage_registry = { }
 * 
 * cdef LogStage get_LogStage(object name):             # <<<<<<<<<<<<<<
 *     return stage_registry.get(name)
 * 
 */

static struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_f_8petsc4py_5PETSc_get_LogStage(PyObject *__pyx_v_name) {
  struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_LogStage", 0);

  /* "PETSc/Log.pyx":181
 * 
 * cdef LogStage get_LogStage(object name):
 *     return stage_registry.get(name)             # <<<<<<<<<<<<<<
 * 
 * cdef LogStage reg_LogStage(object name, PetscLogStage stageid):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  if (unlikely(__pyx_v_8petsc4py_5PETSc_stage_registry == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get");
    __PYX_ERR(26, 181, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_8petsc4py_5PETSc_stage_registry, __pyx_v_name, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_LogStage))))) __PYX_ERR(26, 181, __pyx_L1_error)
  __pyx_r = ((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":180
 * cdef dict stage_registry = { }
 * 
 * cdef LogStage get_LogStage(object name):             # <<<<<<<<<<<<<<
 *     return stage_registry.get(name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.get_LogStage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":183
 *     return stage_registry.get(name)
 * 
 * cdef LogStage reg_LogStage(object name, PetscLogStage stageid):             # <<<<<<<<<<<<<<
 *     cdef LogStage stage = LogStage()
 *     stage.id = stageid
 */

static struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_f_8petsc4py_5PETSc_reg_LogStage(PyObject *__pyx_v_name, PetscLogStage __pyx_v_stageid) {
  struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_v_stage = 0;
  struct __pyx_obj_8petsc4py_5PETSc_LogStage *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("reg_LogStage", 0);

  /* "PETSc/Log.pyx":184
 * 
 * cdef LogStage reg_LogStage(object name, PetscLogStage stageid):
 *     cdef LogStage stage = LogStage()             # <<<<<<<<<<<<<<
 *     stage.id = stageid
 *     stage_registry[name] = stage
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_LogStage), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_stage = ((struct __pyx_obj_8petsc4py_5PETSc_LogStage *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":185
 * cdef LogStage reg_LogStage(object name, PetscLogStage stageid):
 *     cdef LogStage stage = LogStage()
 *     stage.id = stageid             # <<<<<<<<<<<<<<
 *     stage_registry[name] = stage
 *     return stage
 */
  __pyx_v_stage->id = __pyx_v_stageid;

  /* "PETSc/Log.pyx":186
 *     cdef LogStage stage = LogStage()
 *     stage.id = stageid
 *     stage_registry[name] = stage             # <<<<<<<<<<<<<<
 *     return stage
 * 
 */
  if (unlikely(__pyx_v_8petsc4py_5PETSc_stage_registry == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(26, 186, __pyx_L1_error)
  }
  if (unlikely(PyDict_SetItem(__pyx_v_8petsc4py_5PETSc_stage_registry, __pyx_v_name, ((PyObject *)__pyx_v_stage)) < 0)) __PYX_ERR(26, 186, __pyx_L1_error)

  /* "PETSc/Log.pyx":187
 *     stage.id = stageid
 *     stage_registry[name] = stage
 *     return stage             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_stage));
  __pyx_r = __pyx_v_stage;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":183
 *     return stage_registry.get(name)
 * 
 * cdef LogStage reg_LogStage(object name, PetscLogStage stageid):             # <<<<<<<<<<<<<<
 *     cdef LogStage stage = LogStage()
 *     stage.id = stageid
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.reg_LogStage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_stage);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":195
 *     cdef readonly PetscLogClass id
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.id = PETSC_OBJECT_CLASSID
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_8LogClass_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_8LogClass_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogClass___cinit__(((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_8LogClass___cinit__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Log.pyx":196
 * 
 *     def __cinit__(self):
 *         self.id = PETSC_OBJECT_CLASSID             # <<<<<<<<<<<<<<
 * 
 *     def __int__(self):
 */
  __pyx_v_self->id = PETSC_OBJECT_CLASSID;

  /* "PETSc/Log.pyx":195
 *     cdef readonly PetscLogClass id
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.id = PETSC_OBJECT_CLASSID
 * 
 */

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

/* "PETSc/Log.pyx":198
 *         self.id = PETSC_OBJECT_CLASSID
 * 
 *     def __int__(self):             # <<<<<<<<<<<<<<
 *         return <int> self.id
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_3__int__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_3__int__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__int__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogClass_2__int__(((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_2__int__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__int__", 0);

  /* "PETSc/Log.pyx":199
 * 
 *     def __int__(self):
 *         return <int> self.id             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(((int)__pyx_v_self->id)); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":198
 *         self.id = PETSC_OBJECT_CLASSID
 * 
 *     def __int__(self):             # <<<<<<<<<<<<<<
 *         return <int> self.id
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LogClass.__int__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":203
 *     #
 * 
 *     def getName(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscLogClassFindName(self.id, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_5getName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogClass_4getName[] = "LogClass.getName(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_5getName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getName (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getName", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getName", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogClass_4getName(((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_4getName(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getName", 0);

  /* "PETSc/Log.pyx":204
 * 
 *     def getName(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogClassFindName(self.id, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Log.pyx":205
 *     def getName(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscLogClassFindName(self.id, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogClassFindName(__pyx_v_self->id, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 205, __pyx_L1_error)

  /* "PETSc/Log.pyx":206
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscLogClassFindName(self.id, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":203
 *     #
 * 
 *     def getName(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscLogClassFindName(self.id, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.LogClass.getName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":209
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getName()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogClass_4name___get__(((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_4name___get__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__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);

  /* "PETSc/Log.pyx":210
 *     property name:
 *         def __get__(self):
 *             return self.getName()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             <void>self; <void>value; # unused
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getName); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(26, 210, __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(26, 210, __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;

  /* "PETSc/Log.pyx":209
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getName()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LogClass.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":211
 *         def __get__(self):
 *             return self.getName()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             <void>self; <void>value; # unused
 *             raise TypeError("readonly attribute")
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_8LogClass_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_8LogClass_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogClass_4name_2__set__(((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_8LogClass_4name_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Log.pyx":212
 *             return self.getName()
 *         def __set__(self, value):
 *             <void>self; <void>value; # unused             # <<<<<<<<<<<<<<
 *             raise TypeError("readonly attribute")
 * 
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_value);

  /* "PETSc/Log.pyx":213
 *         def __set__(self, value):
 *             <void>self; <void>value; # unused
 *             raise TypeError("readonly attribute")             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 213, __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(26, 213, __pyx_L1_error)

  /* "PETSc/Log.pyx":211
 *         def __get__(self):
 *             return self.getName()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             <void>self; <void>value; # unused
 *             raise TypeError("readonly attribute")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LogClass.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":217
 *     #
 * 
 *     def activate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogClassActivate(self.id) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_7activate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogClass_6activate[] = "LogClass.activate(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_7activate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("activate (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("activate", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "activate", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogClass_6activate(((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_6activate(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("activate", 0);

  /* "PETSc/Log.pyx":218
 * 
 *     def activate(self):
 *         CHKERR( PetscLogClassActivate(self.id) )             # <<<<<<<<<<<<<<
 * 
 *     def deactivate(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventActivateClass(__pyx_v_self->id)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 218, __pyx_L1_error)

  /* "PETSc/Log.pyx":217
 *     #
 * 
 *     def activate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogClassActivate(self.id) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogClass.activate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":220
 *         CHKERR( PetscLogClassActivate(self.id) )
 * 
 *     def deactivate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogClassDeactivate(self.id) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_9deactivate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogClass_8deactivate[] = "LogClass.deactivate(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_9deactivate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deactivate (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("deactivate", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "deactivate", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogClass_8deactivate(((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_8deactivate(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("deactivate", 0);

  /* "PETSc/Log.pyx":221
 * 
 *     def deactivate(self):
 *         CHKERR( PetscLogClassDeactivate(self.id) )             # <<<<<<<<<<<<<<
 * 
 *     def getActive(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventDeactivateClass(__pyx_v_self->id)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 221, __pyx_L1_error)

  /* "PETSc/Log.pyx":220
 *         CHKERR( PetscLogClassActivate(self.id) )
 * 
 *     def deactivate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogClassDeactivate(self.id) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogClass.deactivate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":223
 *         CHKERR( PetscLogClassDeactivate(self.id) )
 * 
 *     def getActive(self):             # <<<<<<<<<<<<<<
 *         <void>self # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_11getActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogClass_10getActive[] = "LogClass.getActive(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_11getActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getActive (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getActive", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getActive", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogClass_10getActive(((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_10getActive(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getActive", 0);

  /* "PETSc/Log.pyx":224
 * 
 *     def getActive(self):
 *         <void>self # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  ((void)__pyx_v_self);

  /* "PETSc/Log.pyx":225
 *     def getActive(self):
 *         <void>self # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def setActive(self, flag):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(26, 225, __pyx_L1_error)

  /* "PETSc/Log.pyx":223
 *         CHKERR( PetscLogClassDeactivate(self.id) )
 * 
 *     def getActive(self):             # <<<<<<<<<<<<<<
 *         <void>self # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogClass.getActive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":227
 *         raise NotImplementedError
 * 
 *     def setActive(self, flag):             # <<<<<<<<<<<<<<
 *         if flag:
 *             CHKERR( PetscLogClassActivate(self.id) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_13setActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogClass_12setActive[] = "LogClass.setActive(self, flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_13setActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setActive (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setActive") < 0)) __PYX_ERR(26, 227, __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_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setActive", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 227, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogClass.setActive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogClass_12setActive(((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_v_self), __pyx_v_flag);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_12setActive(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self, PyObject *__pyx_v_flag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setActive", 0);

  /* "PETSc/Log.pyx":228
 * 
 *     def setActive(self, flag):
 *         if flag:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscLogClassActivate(self.id) )
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(26, 228, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/Log.pyx":229
 *     def setActive(self, flag):
 *         if flag:
 *             CHKERR( PetscLogClassActivate(self.id) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( PetscLogClassDeactivate(self.id) )
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventActivateClass(__pyx_v_self->id)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(26, 229, __pyx_L1_error)

    /* "PETSc/Log.pyx":228
 * 
 *     def setActive(self, flag):
 *         if flag:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscLogClassActivate(self.id) )
 *         else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Log.pyx":231
 *             CHKERR( PetscLogClassActivate(self.id) )
 *         else:
 *             CHKERR( PetscLogClassDeactivate(self.id) )             # <<<<<<<<<<<<<<
 * 
 *     property active:
 */
  /*else*/ {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventDeactivateClass(__pyx_v_self->id)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(26, 231, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/Log.pyx":227
 *         raise NotImplementedError
 * 
 *     def setActive(self, flag):             # <<<<<<<<<<<<<<
 *         if flag:
 *             CHKERR( PetscLogClassActivate(self.id) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogClass.setActive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":234
 * 
 *     property active:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getActive()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_6active_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_6active_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogClass_6active___get__(((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_6active___get__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__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);

  /* "PETSc/Log.pyx":235
 *     property active:
 *         def __get__(self):
 *             return self.getActive()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setActive(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getActive); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(26, 235, __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(26, 235, __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;

  /* "PETSc/Log.pyx":234
 * 
 *     property active:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getActive()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LogClass.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":236
 *         def __get__(self):
 *             return self.getActive()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setActive(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_8LogClass_6active_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_8LogClass_6active_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogClass_6active_2__set__(((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_8LogClass_6active_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Log.pyx":237
 *             return self.getActive()
 *         def __set__(self, value):
 *             self.setActive(value)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setActive); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(26, 237, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 237, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":236
 *         def __get__(self):
 *             return self.getActive()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setActive(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.LogClass.active.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":193
 * cdef class LogClass:
 * 
 *     cdef readonly PetscLogClass id             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogClass_2id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogClass_2id___get__(((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogClass_2id___get__(struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_PetscClassId(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LogClass.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":242
 * cdef dict class_registry = { }
 * 
 * cdef LogClass get_LogClass(object name):             # <<<<<<<<<<<<<<
 *     return class_registry.get(name)
 * 
 */

static struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_f_8petsc4py_5PETSc_get_LogClass(PyObject *__pyx_v_name) {
  struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_LogClass", 0);

  /* "PETSc/Log.pyx":243
 * 
 * cdef LogClass get_LogClass(object name):
 *     return class_registry.get(name)             # <<<<<<<<<<<<<<
 * 
 * cdef LogClass reg_LogClass(object name, PetscLogClass classid):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  if (unlikely(__pyx_v_8petsc4py_5PETSc_class_registry == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get");
    __PYX_ERR(26, 243, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_8petsc4py_5PETSc_class_registry, __pyx_v_name, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_LogClass))))) __PYX_ERR(26, 243, __pyx_L1_error)
  __pyx_r = ((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":242
 * cdef dict class_registry = { }
 * 
 * cdef LogClass get_LogClass(object name):             # <<<<<<<<<<<<<<
 *     return class_registry.get(name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.get_LogClass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":245
 *     return class_registry.get(name)
 * 
 * cdef LogClass reg_LogClass(object name, PetscLogClass classid):             # <<<<<<<<<<<<<<
 *     cdef LogClass klass = LogClass()
 *     klass.id = classid
 */

static struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_f_8petsc4py_5PETSc_reg_LogClass(PyObject *__pyx_v_name, PetscClassId __pyx_v_classid) {
  struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_v_klass = 0;
  struct __pyx_obj_8petsc4py_5PETSc_LogClass *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("reg_LogClass", 0);

  /* "PETSc/Log.pyx":246
 * 
 * cdef LogClass reg_LogClass(object name, PetscLogClass classid):
 *     cdef LogClass klass = LogClass()             # <<<<<<<<<<<<<<
 *     klass.id = classid
 *     class_registry[name] = klass
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_LogClass), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_klass = ((struct __pyx_obj_8petsc4py_5PETSc_LogClass *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":247
 * cdef LogClass reg_LogClass(object name, PetscLogClass classid):
 *     cdef LogClass klass = LogClass()
 *     klass.id = classid             # <<<<<<<<<<<<<<
 *     class_registry[name] = klass
 *     return klass
 */
  __pyx_v_klass->id = __pyx_v_classid;

  /* "PETSc/Log.pyx":248
 *     cdef LogClass klass = LogClass()
 *     klass.id = classid
 *     class_registry[name] = klass             # <<<<<<<<<<<<<<
 *     return klass
 * 
 */
  if (unlikely(__pyx_v_8petsc4py_5PETSc_class_registry == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(26, 248, __pyx_L1_error)
  }
  if (unlikely(PyDict_SetItem(__pyx_v_8petsc4py_5PETSc_class_registry, __pyx_v_name, ((PyObject *)__pyx_v_klass)) < 0)) __PYX_ERR(26, 248, __pyx_L1_error)

  /* "PETSc/Log.pyx":249
 *     klass.id = classid
 *     class_registry[name] = klass
 *     return klass             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_klass));
  __pyx_r = __pyx_v_klass;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":245
 *     return class_registry.get(name)
 * 
 * cdef LogClass reg_LogClass(object name, PetscLogClass classid):             # <<<<<<<<<<<<<<
 *     cdef LogClass klass = LogClass()
 *     klass.id = classid
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.reg_LogClass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_klass);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":257
 *     cdef readonly PetscLogEvent id
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.id = 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_8LogEvent_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_8LogEvent_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent___cinit__(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_8LogEvent___cinit__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Log.pyx":258
 * 
 *     def __cinit__(self):
 *         self.id = 0             # <<<<<<<<<<<<<<
 * 
 *     def __int__(self):
 */
  __pyx_v_self->id = 0;

  /* "PETSc/Log.pyx":257
 *     cdef readonly PetscLogEvent id
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.id = 0
 * 
 */

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

/* "PETSc/Log.pyx":260
 *         self.id = 0
 * 
 *     def __int__(self):             # <<<<<<<<<<<<<<
 *         return <int> self.id
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_3__int__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_3__int__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__int__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_2__int__(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_2__int__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__int__", 0);

  /* "PETSc/Log.pyx":261
 * 
 *     def __int__(self):
 *         return <int> self.id             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(((int)__pyx_v_self->id)); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":260
 *         self.id = 0
 * 
 *     def __int__(self):             # <<<<<<<<<<<<<<
 *         return <int> self.id
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.__int__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":263
 *         return <int> self.id
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self.begin()
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_5__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_4__enter__[] = "LogEvent.__enter__(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_5__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_4__enter__(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_4__enter__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__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("__enter__", 0);

  /* "PETSc/Log.pyx":264
 * 
 *     def __enter__(self):
 *         self.begin()             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_begin); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(26, 264, __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(26, 264, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":265
 *     def __enter__(self):
 *         self.begin()
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *exc):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Log.pyx":263
 *         return <int> self.id
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self.begin()
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":267
 *         return self
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         self.end()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_7__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_6__exit__[] = "LogEvent.__exit__(self, *exc)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_7__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_exc = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_6__exit__(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self), __pyx_v_exc);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_6__exit__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "PETSc/Log.pyx":268
 * 
 *     def __exit__(self, *exc):
 *         self.end()             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_end); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(26, 268, __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(26, 268, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":267
 *         return self
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         self.end()
 * 
 */

  /* 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":272
 *     #
 * 
 *     def begin(self, *objs):             # <<<<<<<<<<<<<<
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_9begin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_8begin[] = "LogEvent.begin(self, *objs)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_9begin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_objs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("begin (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "begin", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_objs = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_8begin(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self), __pyx_v_objs);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_8begin(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_objs) {
  PetscObject __pyx_v_o[4];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("begin", 0);

  /* "PETSc/Log.pyx":274
 *     def begin(self, *objs):
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogEventBegin(self.id, o[0], o[1], o[2], o[3]) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_event_args2objs(__pyx_v_objs, __pyx_v_o); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 274, __pyx_L1_error)

  /* "PETSc/Log.pyx":275
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)
 *         CHKERR( PetscLogEventBegin(self.id, o[0], o[1], o[2], o[3]) )             # <<<<<<<<<<<<<<
 * 
 *     def end(self, *objs):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventBegin(__pyx_v_self->id, (__pyx_v_o[0]), (__pyx_v_o[1]), (__pyx_v_o[2]), (__pyx_v_o[3]))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 275, __pyx_L1_error)

  /* "PETSc/Log.pyx":272
 *     #
 * 
 *     def begin(self, *objs):             # <<<<<<<<<<<<<<
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.begin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":277
 *         CHKERR( PetscLogEventBegin(self.id, o[0], o[1], o[2], o[3]) )
 * 
 *     def end(self, *objs):             # <<<<<<<<<<<<<<
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_11end(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_10end[] = "LogEvent.end(self, *objs)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_11end(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_objs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("end (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "end", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_objs = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_10end(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self), __pyx_v_objs);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_10end(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_objs) {
  PetscObject __pyx_v_o[4];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("end", 0);

  /* "PETSc/Log.pyx":279
 *     def end(self, *objs):
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogEventEnd(self.id, o[0], o[1], o[2], o[3]) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_event_args2objs(__pyx_v_objs, __pyx_v_o); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 279, __pyx_L1_error)

  /* "PETSc/Log.pyx":280
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)
 *         CHKERR( PetscLogEventEnd(self.id, o[0], o[1], o[2], o[3]) )             # <<<<<<<<<<<<<<
 * 
 *     def barrierBegin(self, Comm comm=None, *objs):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventEnd(__pyx_v_self->id, (__pyx_v_o[0]), (__pyx_v_o[1]), (__pyx_v_o[2]), (__pyx_v_o[3]))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 280, __pyx_L1_error)

  /* "PETSc/Log.pyx":277
 *         CHKERR( PetscLogEventBegin(self.id, o[0], o[1], o[2], o[3]) )
 * 
 *     def end(self, *objs):             # <<<<<<<<<<<<<<
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":282
 *         CHKERR( PetscLogEventEnd(self.id, o[0], o[1], o[2], o[3]) )
 * 
 *     def barrierBegin(self, Comm comm=None, *objs):             # <<<<<<<<<<<<<<
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_13barrierBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_12barrierBegin[] = "LogEvent.barrierBegin(self, Comm comm=None, *objs)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_13barrierBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscCommObject *__pyx_v_comm = 0;
  PyObject *__pyx_v_objs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("barrierBegin (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_objs = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_objs)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_objs);
  } else {
    __pyx_v_objs = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscCommObject *)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) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "barrierBegin") < 0)) __PYX_ERR(26, 282, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
    }
    __pyx_v_comm = ((struct PyPetscCommObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_objs); __pyx_v_objs = 0;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.barrierBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_comm), __pyx_ptype_8petsc4py_5PETSc_Comm, 1, "comm", 0))) __PYX_ERR(26, 282, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_12barrierBegin(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self), __pyx_v_comm, __pyx_v_objs);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_12barrierBegin(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, struct PyPetscCommObject *__pyx_v_comm, PyObject *__pyx_v_objs) {
  PetscObject __pyx_v_o[4];
  MPI_Comm __pyx_v_ccomm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  MPI_Comm __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("barrierBegin", 0);

  /* "PETSc/Log.pyx":284
 *     def barrierBegin(self, Comm comm=None, *objs):
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         if ccomm == MPI_COMM_NULL: ccomm = PETSC_COMM_DEFAULT
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_event_args2objs(__pyx_v_objs, __pyx_v_o); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 284, __pyx_L1_error)

  /* "PETSc/Log.pyx":285
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         if ccomm == MPI_COMM_NULL: ccomm = PETSC_COMM_DEFAULT
 *         CHKERR( PetscLogEventBarrierBegin(self.id, o[0], o[1], o[2], o[3], ccomm) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_def_Comm(((PyObject *)__pyx_v_comm), __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(26, 285, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_2;

  /* "PETSc/Log.pyx":286
 *         event_args2objs(objs, o)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         if ccomm == MPI_COMM_NULL: ccomm = PETSC_COMM_DEFAULT             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogEventBarrierBegin(self.id, o[0], o[1], o[2], o[3], ccomm) )
 * 
 */
  __pyx_t_3 = ((__pyx_v_ccomm == MPI_COMM_NULL) != 0);
  if (__pyx_t_3) {
    __pyx_v_ccomm = __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT;
  }

  /* "PETSc/Log.pyx":287
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         if ccomm == MPI_COMM_NULL: ccomm = PETSC_COMM_DEFAULT
 *         CHKERR( PetscLogEventBarrierBegin(self.id, o[0], o[1], o[2], o[3], ccomm) )             # <<<<<<<<<<<<<<
 * 
 *     def barrierEnd(self, Comm comm=None, *objs):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventBarrierBegin(__pyx_v_self->id, (__pyx_v_o[0]), (__pyx_v_o[1]), (__pyx_v_o[2]), (__pyx_v_o[3]), __pyx_v_ccomm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 287, __pyx_L1_error)

  /* "PETSc/Log.pyx":282
 *         CHKERR( PetscLogEventEnd(self.id, o[0], o[1], o[2], o[3]) )
 * 
 *     def barrierBegin(self, Comm comm=None, *objs):             # <<<<<<<<<<<<<<
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.barrierBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":289
 *         CHKERR( PetscLogEventBarrierBegin(self.id, o[0], o[1], o[2], o[3], ccomm) )
 * 
 *     def barrierEnd(self, Comm comm=None, *objs):             # <<<<<<<<<<<<<<
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_15barrierEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_14barrierEnd[] = "LogEvent.barrierEnd(self, Comm comm=None, *objs)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_15barrierEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscCommObject *__pyx_v_comm = 0;
  PyObject *__pyx_v_objs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("barrierEnd (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_objs = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_objs)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_objs);
  } else {
    __pyx_v_objs = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscCommObject *)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) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "barrierEnd") < 0)) __PYX_ERR(26, 289, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
    }
    __pyx_v_comm = ((struct PyPetscCommObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_objs); __pyx_v_objs = 0;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.barrierEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_comm), __pyx_ptype_8petsc4py_5PETSc_Comm, 1, "comm", 0))) __PYX_ERR(26, 289, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_14barrierEnd(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self), __pyx_v_comm, __pyx_v_objs);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_14barrierEnd(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, struct PyPetscCommObject *__pyx_v_comm, PyObject *__pyx_v_objs) {
  PetscObject __pyx_v_o[4];
  MPI_Comm __pyx_v_ccomm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  MPI_Comm __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("barrierEnd", 0);

  /* "PETSc/Log.pyx":291
 *     def barrierEnd(self, Comm comm=None, *objs):
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         if ccomm == MPI_COMM_NULL: ccomm = PETSC_COMM_DEFAULT
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_event_args2objs(__pyx_v_objs, __pyx_v_o); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 291, __pyx_L1_error)

  /* "PETSc/Log.pyx":292
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         if ccomm == MPI_COMM_NULL: ccomm = PETSC_COMM_DEFAULT
 *         CHKERR( PetscLogEventBarrierEnd(self.id, o[0], o[1], o[2], o[3], ccomm) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_def_Comm(((PyObject *)__pyx_v_comm), __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(26, 292, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_2;

  /* "PETSc/Log.pyx":293
 *         event_args2objs(objs, o)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         if ccomm == MPI_COMM_NULL: ccomm = PETSC_COMM_DEFAULT             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogEventBarrierEnd(self.id, o[0], o[1], o[2], o[3], ccomm) )
 * 
 */
  __pyx_t_3 = ((__pyx_v_ccomm == MPI_COMM_NULL) != 0);
  if (__pyx_t_3) {
    __pyx_v_ccomm = __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT;
  }

  /* "PETSc/Log.pyx":294
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         if ccomm == MPI_COMM_NULL: ccomm = PETSC_COMM_DEFAULT
 *         CHKERR( PetscLogEventBarrierEnd(self.id, o[0], o[1], o[2], o[3], ccomm) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventBarrierEnd(__pyx_v_self->id, (__pyx_v_o[0]), (__pyx_v_o[1]), (__pyx_v_o[2]), (__pyx_v_o[3]), __pyx_v_ccomm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 294, __pyx_L1_error)

  /* "PETSc/Log.pyx":289
 *         CHKERR( PetscLogEventBarrierBegin(self.id, o[0], o[1], o[2], o[3], ccomm) )
 * 
 *     def barrierEnd(self, Comm comm=None, *objs):             # <<<<<<<<<<<<<<
 *         cdef PetscObject o[4]
 *         event_args2objs(objs, o)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.barrierEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":298
 *     #
 * 
 *     def getName(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscLogEventFindName(self.id, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_17getName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_16getName[] = "LogEvent.getName(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_17getName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getName (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getName", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getName", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_16getName(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_16getName(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getName", 0);

  /* "PETSc/Log.pyx":299
 * 
 *     def getName(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogEventFindName(self.id, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Log.pyx":300
 *     def getName(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscLogEventFindName(self.id, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventFindName(__pyx_v_self->id, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 300, __pyx_L1_error)

  /* "PETSc/Log.pyx":301
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscLogEventFindName(self.id, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":298
 *     #
 * 
 *     def getName(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscLogEventFindName(self.id, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.getName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":304
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getName()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_4name___get__(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_4name___get__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__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);

  /* "PETSc/Log.pyx":305
 *     property name:
 *         def __get__(self):
 *             return self.getName()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             <void>self; <void>value; # unused
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getName); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(26, 305, __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(26, 305, __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;

  /* "PETSc/Log.pyx":304
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getName()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":306
 *         def __get__(self):
 *             return self.getName()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             <void>self; <void>value; # unused
 *             raise TypeError("readonly attribute")
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_8LogEvent_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_8LogEvent_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_4name_2__set__(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_8LogEvent_4name_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Log.pyx":307
 *             return self.getName()
 *         def __set__(self, value):
 *             <void>self; <void>value; # unused             # <<<<<<<<<<<<<<
 *             raise TypeError("readonly attribute")
 * 
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_value);

  /* "PETSc/Log.pyx":308
 *         def __set__(self, value):
 *             <void>self; <void>value; # unused
 *             raise TypeError("readonly attribute")             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 308, __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(26, 308, __pyx_L1_error)

  /* "PETSc/Log.pyx":306
 *         def __get__(self):
 *             return self.getName()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             <void>self; <void>value; # unused
 *             raise TypeError("readonly attribute")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":312
 *     #
 * 
 *     def activate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogEventActivate(self.id) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_19activate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_18activate[] = "LogEvent.activate(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_19activate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("activate (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("activate", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "activate", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_18activate(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_18activate(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("activate", 0);

  /* "PETSc/Log.pyx":313
 * 
 *     def activate(self):
 *         CHKERR( PetscLogEventActivate(self.id) )             # <<<<<<<<<<<<<<
 * 
 *     def deactivate(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventActivate(__pyx_v_self->id)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 313, __pyx_L1_error)

  /* "PETSc/Log.pyx":312
 *     #
 * 
 *     def activate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogEventActivate(self.id) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.activate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":315
 *         CHKERR( PetscLogEventActivate(self.id) )
 * 
 *     def deactivate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogEventDeactivate(self.id) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_21deactivate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_20deactivate[] = "LogEvent.deactivate(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_21deactivate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deactivate (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("deactivate", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "deactivate", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_20deactivate(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_20deactivate(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("deactivate", 0);

  /* "PETSc/Log.pyx":316
 * 
 *     def deactivate(self):
 *         CHKERR( PetscLogEventDeactivate(self.id) )             # <<<<<<<<<<<<<<
 * 
 *     def getActive(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventDeactivate(__pyx_v_self->id)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(26, 316, __pyx_L1_error)

  /* "PETSc/Log.pyx":315
 *         CHKERR( PetscLogEventActivate(self.id) )
 * 
 *     def deactivate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogEventDeactivate(self.id) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.deactivate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":318
 *         CHKERR( PetscLogEventDeactivate(self.id) )
 * 
 *     def getActive(self):             # <<<<<<<<<<<<<<
 *         <void>self # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_23getActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_22getActive[] = "LogEvent.getActive(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_23getActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getActive (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getActive", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getActive", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_22getActive(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_22getActive(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getActive", 0);

  /* "PETSc/Log.pyx":319
 * 
 *     def getActive(self):
 *         <void>self # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  ((void)__pyx_v_self);

  /* "PETSc/Log.pyx":320
 *     def getActive(self):
 *         <void>self # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def setActive(self, flag):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(26, 320, __pyx_L1_error)

  /* "PETSc/Log.pyx":318
 *         CHKERR( PetscLogEventDeactivate(self.id) )
 * 
 *     def getActive(self):             # <<<<<<<<<<<<<<
 *         <void>self # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.getActive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":322
 *         raise NotImplementedError
 * 
 *     def setActive(self, flag):             # <<<<<<<<<<<<<<
 *         if flag:
 *             CHKERR( PetscLogEventActivate(self.id) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_25setActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_24setActive[] = "LogEvent.setActive(self, flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_25setActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setActive (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setActive") < 0)) __PYX_ERR(26, 322, __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_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setActive", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 322, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.setActive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_24setActive(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self), __pyx_v_flag);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_24setActive(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_flag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setActive", 0);

  /* "PETSc/Log.pyx":323
 * 
 *     def setActive(self, flag):
 *         if flag:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscLogEventActivate(self.id) )
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(26, 323, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/Log.pyx":324
 *     def setActive(self, flag):
 *         if flag:
 *             CHKERR( PetscLogEventActivate(self.id) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( PetscLogEventDeactivate(self.id) )
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventActivate(__pyx_v_self->id)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(26, 324, __pyx_L1_error)

    /* "PETSc/Log.pyx":323
 * 
 *     def setActive(self, flag):
 *         if flag:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscLogEventActivate(self.id) )
 *         else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Log.pyx":326
 *             CHKERR( PetscLogEventActivate(self.id) )
 *         else:
 *             CHKERR( PetscLogEventDeactivate(self.id) )             # <<<<<<<<<<<<<<
 * 
 *     property active:
 */
  /*else*/ {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventDeactivate(__pyx_v_self->id)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(26, 326, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/Log.pyx":322
 *         raise NotImplementedError
 * 
 *     def setActive(self, flag):             # <<<<<<<<<<<<<<
 *         if flag:
 *             CHKERR( PetscLogEventActivate(self.id) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.setActive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":329
 * 
 *     property active:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getActive()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_6active_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_6active_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_6active___get__(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_6active___get__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__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);

  /* "PETSc/Log.pyx":330
 *     property active:
 *         def __get__(self):
 *             return self.getActive()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setActive(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getActive); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(26, 330, __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(26, 330, __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;

  /* "PETSc/Log.pyx":329
 * 
 *     property active:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getActive()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":331
 *         def __get__(self):
 *             return self.getActive()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setActive(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_8LogEvent_6active_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_8LogEvent_6active_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_6active_2__set__(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_8LogEvent_6active_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Log.pyx":332
 *             return self.getActive()
 *         def __set__(self, value):
 *             self.setActive(value)             # <<<<<<<<<<<<<<
 * 
 *     def getActiveAll(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setActive); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 332, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(26, 332, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 332, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":331
 *         def __get__(self):
 *             return self.getActive()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setActive(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.active.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":334
 *             self.setActive(value)
 * 
 *     def getActiveAll(self):             # <<<<<<<<<<<<<<
 *         <void>self # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_27getActiveAll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_26getActiveAll[] = "LogEvent.getActiveAll(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_27getActiveAll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getActiveAll (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getActiveAll", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getActiveAll", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_26getActiveAll(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_26getActiveAll(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getActiveAll", 0);

  /* "PETSc/Log.pyx":335
 * 
 *     def getActiveAll(self):
 *         <void>self # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  ((void)__pyx_v_self);

  /* "PETSc/Log.pyx":336
 *     def getActiveAll(self):
 *         <void>self # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def setActiveAll(self, flag):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(26, 336, __pyx_L1_error)

  /* "PETSc/Log.pyx":334
 *             self.setActive(value)
 * 
 *     def getActiveAll(self):             # <<<<<<<<<<<<<<
 *         <void>self # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.getActiveAll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":338
 *         raise NotImplementedError
 * 
 *     def setActiveAll(self, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_29setActiveAll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_28setActiveAll[] = "LogEvent.setActiveAll(self, flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_29setActiveAll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setActiveAll (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setActiveAll") < 0)) __PYX_ERR(26, 338, __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_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setActiveAll", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 338, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.setActiveAll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_28setActiveAll(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self), __pyx_v_flag);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_28setActiveAll(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_flag) {
  PetscBool __pyx_v_tval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setActiveAll", 0);

  /* "PETSc/Log.pyx":339
 * 
 *     def setActiveAll(self, flag):
 *         cdef PetscBool tval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if flag: tval = PETSC_TRUE
 *         CHKERR( PetscLogEventSetActiveAll(self.id, tval) )
 */
  __pyx_v_tval = PETSC_FALSE;

  /* "PETSc/Log.pyx":340
 *     def setActiveAll(self, flag):
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogEventSetActiveAll(self.id, tval) )
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(26, 340, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_v_tval = PETSC_TRUE;
  }

  /* "PETSc/Log.pyx":341
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 *         CHKERR( PetscLogEventSetActiveAll(self.id, tval) )             # <<<<<<<<<<<<<<
 * 
 *     property active_all:
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventSetActiveAll(__pyx_v_self->id, __pyx_v_tval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(26, 341, __pyx_L1_error)

  /* "PETSc/Log.pyx":338
 *         raise NotImplementedError
 * 
 *     def setActiveAll(self, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.setActiveAll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":344
 * 
 *     property active_all:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.getActiveAll()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_10active_all_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_10active_all_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_10active_all___get__(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_10active_all___get__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__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);

  /* "PETSc/Log.pyx":345
 *     property active_all:
 *         def __get__(self):
 *             self.getActiveAll()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setActiveAll(value)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getActiveAll); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(26, 345, __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(26, 345, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":344
 * 
 *     property active_all:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.getActiveAll()
 *         def __set__(self, value):
 */

  /* 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.active_all.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":346
 *         def __get__(self):
 *             self.getActiveAll()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setActiveAll(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_8LogEvent_10active_all_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_8LogEvent_10active_all_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_10active_all_2__set__(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_8LogEvent_10active_all_2__set__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Log.pyx":347
 *             self.getActiveAll()
 *         def __set__(self, value):
 *             self.setActiveAll(value)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setActiveAll); if (unlikely(!__pyx_t_2)) __PYX_ERR(26, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(26, 347, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 347, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":346
 *         def __get__(self):
 *             self.getActiveAll()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setActiveAll(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.active_all.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":351
 *     #
 * 
 *     def getPerfInfo(self, stage=None):             # <<<<<<<<<<<<<<
 *         cdef PetscEventPerfInfo info
 *         cdef PetscInt cstage = PETSC_DETERMINE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_31getPerfInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_8LogEvent_30getPerfInfo[] = "LogEvent.getPerfInfo(self, stage=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_31getPerfInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_stage = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPerfInfo (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stage,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stage);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getPerfInfo") < 0)) __PYX_ERR(26, 351, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_stage = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getPerfInfo", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(26, 351, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.getPerfInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_30getPerfInfo(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self), __pyx_v_stage);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_30getPerfInfo(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self, PyObject *__pyx_v_stage) {
  PetscEventPerfInfo __pyx_v_info;
  PetscInt __pyx_v_cstage;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscInt __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getPerfInfo", 0);

  /* "PETSc/Log.pyx":353
 *     def getPerfInfo(self, stage=None):
 *         cdef PetscEventPerfInfo info
 *         cdef PetscInt cstage = PETSC_DETERMINE             # <<<<<<<<<<<<<<
 *         if stage is not None: cstage = asInt(stage)
 *         CHKERR( PetscLogEventGetPerfInfo(cstage, self.id, &info) )
 */
  __pyx_v_cstage = PETSC_DETERMINE;

  /* "PETSc/Log.pyx":354
 *         cdef PetscEventPerfInfo info
 *         cdef PetscInt cstage = PETSC_DETERMINE
 *         if stage is not None: cstage = asInt(stage)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogEventGetPerfInfo(cstage, self.id, &info) )
 *         return info
 */
  __pyx_t_1 = (__pyx_v_stage != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_stage); if (unlikely(__pyx_t_3 == -1L && PyErr_Occurred())) __PYX_ERR(26, 354, __pyx_L1_error)
    __pyx_v_cstage = __pyx_t_3;
  }

  /* "PETSc/Log.pyx":355
 *         cdef PetscInt cstage = PETSC_DETERMINE
 *         if stage is not None: cstage = asInt(stage)
 *         CHKERR( PetscLogEventGetPerfInfo(cstage, self.id, &info) )             # <<<<<<<<<<<<<<
 *         return info
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscLogEventGetPerfInfo(__pyx_v_cstage, __pyx_v_self->id, (&__pyx_v_info))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(26, 355, __pyx_L1_error)

  /* "PETSc/Log.pyx":356
 *         if stage is not None: cstage = asInt(stage)
 *         CHKERR( PetscLogEventGetPerfInfo(cstage, self.id, &info) )
 *         return info             # <<<<<<<<<<<<<<
 * 
 * cdef dict event_registry = { }
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_convert__to_py_PetscEventPerfInfo(__pyx_v_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(26, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":351
 *     #
 * 
 *     def getPerfInfo(self, stage=None):             # <<<<<<<<<<<<<<
 *         cdef PetscEventPerfInfo info
 *         cdef PetscInt cstage = PETSC_DETERMINE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.getPerfInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":255
 * cdef class LogEvent:
 * 
 *     cdef readonly PetscLogEvent id             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_8LogEvent_2id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_8LogEvent_2id___get__(((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_8LogEvent_2id___get__(struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_PetscLogEvent(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LogEvent.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":360
 * cdef dict event_registry = { }
 * 
 * cdef LogEvent get_LogEvent(object name):             # <<<<<<<<<<<<<<
 *     return event_registry.get(name)
 * 
 */

static struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_f_8petsc4py_5PETSc_get_LogEvent(PyObject *__pyx_v_name) {
  struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_LogEvent", 0);

  /* "PETSc/Log.pyx":361
 * 
 * cdef LogEvent get_LogEvent(object name):
 *     return event_registry.get(name)             # <<<<<<<<<<<<<<
 * 
 * cdef LogEvent reg_LogEvent(object name, PetscLogEvent eventid):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  if (unlikely(__pyx_v_8petsc4py_5PETSc_event_registry == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get");
    __PYX_ERR(26, 361, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_8petsc4py_5PETSc_event_registry, __pyx_v_name, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_LogEvent))))) __PYX_ERR(26, 361, __pyx_L1_error)
  __pyx_r = ((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":360
 * cdef dict event_registry = { }
 * 
 * cdef LogEvent get_LogEvent(object name):             # <<<<<<<<<<<<<<
 *     return event_registry.get(name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.get_LogEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Log.pyx":363
 *     return event_registry.get(name)
 * 
 * cdef LogEvent reg_LogEvent(object name, PetscLogEvent eventid):             # <<<<<<<<<<<<<<
 *     cdef LogEvent event = LogEvent()
 *     event.id = eventid
 */

static struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_f_8petsc4py_5PETSc_reg_LogEvent(PyObject *__pyx_v_name, PetscLogEvent __pyx_v_eventid) {
  struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_v_event = 0;
  struct __pyx_obj_8petsc4py_5PETSc_LogEvent *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("reg_LogEvent", 0);

  /* "PETSc/Log.pyx":364
 * 
 * cdef LogEvent reg_LogEvent(object name, PetscLogEvent eventid):
 *     cdef LogEvent event = LogEvent()             # <<<<<<<<<<<<<<
 *     event.id = eventid
 *     event_registry[name] = event
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_LogEvent), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_event = ((struct __pyx_obj_8petsc4py_5PETSc_LogEvent *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":365
 * cdef LogEvent reg_LogEvent(object name, PetscLogEvent eventid):
 *     cdef LogEvent event = LogEvent()
 *     event.id = eventid             # <<<<<<<<<<<<<<
 *     event_registry[name] = event
 *     return event
 */
  __pyx_v_event->id = __pyx_v_eventid;

  /* "PETSc/Log.pyx":366
 *     cdef LogEvent event = LogEvent()
 *     event.id = eventid
 *     event_registry[name] = event             # <<<<<<<<<<<<<<
 *     return event
 * 
 */
  if (unlikely(__pyx_v_8petsc4py_5PETSc_event_registry == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(26, 366, __pyx_L1_error)
  }
  if (unlikely(PyDict_SetItem(__pyx_v_8petsc4py_5PETSc_event_registry, __pyx_v_name, ((PyObject *)__pyx_v_event)) < 0)) __PYX_ERR(26, 366, __pyx_L1_error)

  /* "PETSc/Log.pyx":367
 *     event.id = eventid
 *     event_registry[name] = event
 *     return event             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_event));
  __pyx_r = __pyx_v_event;
  goto __pyx_L0;

  /* "PETSc/Log.pyx":363
 *     return event_registry.get(name)
 * 
 * cdef LogEvent reg_LogEvent(object name, PetscLogEvent eventid):             # <<<<<<<<<<<<<<
 *     cdef LogEvent event = LogEvent()
 *     event.id = eventid
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.reg_LogEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_event);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":7
 *     #
 * 
 *     def __cinit__(self, comm=None):             # <<<<<<<<<<<<<<
 *         self.comm = def_Comm(comm, MPI_COMM_NULL)
 *         self.isdup = 0
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4Comm_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4Comm_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(9, 7, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(9, 7, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Comm.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4Comm___cinit__(((struct PyPetscCommObject *)__pyx_v_self), __pyx_v_comm);

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

static int __pyx_pf_8petsc4py_5PETSc_4Comm___cinit__(struct PyPetscCommObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Comm.pyx":8
 * 
 *     def __cinit__(self, comm=None):
 *         self.comm = def_Comm(comm, MPI_COMM_NULL)             # <<<<<<<<<<<<<<
 *         self.isdup = 0
 *         if self.comm != MPI_COMM_NULL:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, MPI_COMM_NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 8, __pyx_L1_error)
  __pyx_v_self->comm = __pyx_t_1;

  /* "PETSc/Comm.pyx":9
 *     def __cinit__(self, comm=None):
 *         self.comm = def_Comm(comm, MPI_COMM_NULL)
 *         self.isdup = 0             # <<<<<<<<<<<<<<
 *         if self.comm != MPI_COMM_NULL:
 *             self.base = comm
 */
  __pyx_v_self->isdup = 0;

  /* "PETSc/Comm.pyx":10
 *         self.comm = def_Comm(comm, MPI_COMM_NULL)
 *         self.isdup = 0
 *         if self.comm != MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             self.base = comm
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_self->comm != MPI_COMM_NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Comm.pyx":11
 *         self.isdup = 0
 *         if self.comm != MPI_COMM_NULL:
 *             self.base = comm             # <<<<<<<<<<<<<<
 *         else:
 *             self.base = None
 */
    __Pyx_INCREF(__pyx_v_comm);
    __Pyx_GIVEREF(__pyx_v_comm);
    __Pyx_GOTREF(__pyx_v_self->base);
    __Pyx_DECREF(__pyx_v_self->base);
    __pyx_v_self->base = __pyx_v_comm;

    /* "PETSc/Comm.pyx":10
 *         self.comm = def_Comm(comm, MPI_COMM_NULL)
 *         self.isdup = 0
 *         if self.comm != MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             self.base = comm
 *         else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Comm.pyx":13
 *             self.base = comm
 *         else:
 *             self.base = None             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->base);
    __Pyx_DECREF(__pyx_v_self->base);
    __pyx_v_self->base = Py_None;
  }
  __pyx_L3:;

  /* "PETSc/Comm.pyx":7
 *     #
 * 
 *     def __cinit__(self, comm=None):             # <<<<<<<<<<<<<<
 *         self.comm = def_Comm(comm, MPI_COMM_NULL)
 *         self.isdup = 0
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Comm.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":15
 *             self.base = None
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.isdup:
 *             CHKERR( PetscCommDEALLOC(&self.comm) )
 */

/* Python wrapper */
static void __pyx_pw_8petsc4py_5PETSc_4Comm_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8petsc4py_5PETSc_4Comm_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8petsc4py_5PETSc_4Comm_2__dealloc__(((struct PyPetscCommObject *)__pyx_v_self));

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

static void __pyx_pf_8petsc4py_5PETSc_4Comm_2__dealloc__(struct PyPetscCommObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "PETSc/Comm.pyx":16
 * 
 *     def __dealloc__(self):
 *         if self.isdup:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscCommDEALLOC(&self.comm) )
 *         self.comm = MPI_COMM_NULL
 */
  __pyx_t_1 = (__pyx_v_self->isdup != 0);
  if (__pyx_t_1) {

    /* "PETSc/Comm.pyx":17
 *     def __dealloc__(self):
 *         if self.isdup:
 *             CHKERR( PetscCommDEALLOC(&self.comm) )             # <<<<<<<<<<<<<<
 *         self.comm = MPI_COMM_NULL
 *         self.isdup = 0
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_PetscCommDEALLOC((&__pyx_v_self->comm))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(9, 17, __pyx_L1_error)

    /* "PETSc/Comm.pyx":16
 * 
 *     def __dealloc__(self):
 *         if self.isdup:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscCommDEALLOC(&self.comm) )
 *         self.comm = MPI_COMM_NULL
 */
  }

  /* "PETSc/Comm.pyx":18
 *         if self.isdup:
 *             CHKERR( PetscCommDEALLOC(&self.comm) )
 *         self.comm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         self.isdup = 0
 *         self.base = None
 */
  __pyx_v_self->comm = MPI_COMM_NULL;

  /* "PETSc/Comm.pyx":19
 *             CHKERR( PetscCommDEALLOC(&self.comm) )
 *         self.comm = MPI_COMM_NULL
 *         self.isdup = 0             # <<<<<<<<<<<<<<
 *         self.base = None
 * 
 */
  __pyx_v_self->isdup = 0;

  /* "PETSc/Comm.pyx":20
 *         self.comm = MPI_COMM_NULL
 *         self.isdup = 0
 *         self.base = None             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, int op):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->base);
  __Pyx_DECREF(__pyx_v_self->base);
  __pyx_v_self->base = Py_None;

  /* "PETSc/Comm.pyx":15
 *             self.base = None
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.isdup:
 *             CHKERR( PetscCommDEALLOC(&self.comm) )
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("petsc4py.PETSc.Comm.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PETSc/Comm.pyx":22
 *         self.base = None
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         if not isinstance(self,  Comm): return NotImplemented
 *         if not isinstance(other, Comm): return NotImplemented
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_5__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_5__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4Comm_4__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_4__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  struct PyPetscCommObject *__pyx_v_s = 0;
  struct PyPetscCommObject *__pyx_v_o = 0;
  int __pyx_v_eq;
  MPI_Comm __pyx_v_comm1;
  MPI_Comm __pyx_v_comm2;
  int __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  MPI_Comm __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "PETSc/Comm.pyx":23
 * 
 *     def __richcmp__(self, other, int op):
 *         if not isinstance(self,  Comm): return NotImplemented             # <<<<<<<<<<<<<<
 *         if not isinstance(other, Comm): return NotImplemented
 *         if op!=2 and op!=3: raise TypeError("only '==' and '!='")
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Comm); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }

  /* "PETSc/Comm.pyx":24
 *     def __richcmp__(self, other, int op):
 *         if not isinstance(self,  Comm): return NotImplemented
 *         if not isinstance(other, Comm): return NotImplemented             # <<<<<<<<<<<<<<
 *         if op!=2 and op!=3: raise TypeError("only '==' and '!='")
 *         cdef Comm s = self
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Comm); 
  __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }

  /* "PETSc/Comm.pyx":25
 *         if not isinstance(self,  Comm): return NotImplemented
 *         if not isinstance(other, Comm): return NotImplemented
 *         if op!=2 and op!=3: raise TypeError("only '==' and '!='")             # <<<<<<<<<<<<<<
 *         cdef Comm s = self
 *         cdef Comm o = other
 */
  switch (__pyx_v_op) {
    case 2:
    case 3:
    __pyx_t_1 = 0;
    break;
    default:
    __pyx_t_1 = 1;
    break;
  }
  if (__pyx_t_1) {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 25, __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(9, 25, __pyx_L1_error)
  }

  /* "PETSc/Comm.pyx":26
 *         if not isinstance(other, Comm): return NotImplemented
 *         if op!=2 and op!=3: raise TypeError("only '==' and '!='")
 *         cdef Comm s = self             # <<<<<<<<<<<<<<
 *         cdef Comm o = other
 *         cdef int eq = (op == 2)
 */
  if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Comm))))) __PYX_ERR(9, 26, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_self;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_s = ((struct PyPetscCommObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Comm.pyx":27
 *         if op!=2 and op!=3: raise TypeError("only '==' and '!='")
 *         cdef Comm s = self
 *         cdef Comm o = other             # <<<<<<<<<<<<<<
 *         cdef int eq = (op == 2)
 *         cdef MPI_Comm comm1 = s.comm
 */
  if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Comm))))) __PYX_ERR(9, 27, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_other;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_o = ((struct PyPetscCommObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Comm.pyx":28
 *         cdef Comm s = self
 *         cdef Comm o = other
 *         cdef int eq = (op == 2)             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm1 = s.comm
 *         cdef MPI_Comm comm2 = o.comm
 */
  __pyx_v_eq = (__pyx_v_op == 2);

  /* "PETSc/Comm.pyx":29
 *         cdef Comm o = other
 *         cdef int eq = (op == 2)
 *         cdef MPI_Comm comm1 = s.comm             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm2 = o.comm
 *         cdef int flag = 0
 */
  __pyx_t_4 = __pyx_v_s->comm;
  __pyx_v_comm1 = __pyx_t_4;

  /* "PETSc/Comm.pyx":30
 *         cdef int eq = (op == 2)
 *         cdef MPI_Comm comm1 = s.comm
 *         cdef MPI_Comm comm2 = o.comm             # <<<<<<<<<<<<<<
 *         cdef int flag = 0
 *         if comm1 != MPI_COMM_NULL and comm2 != MPI_COMM_NULL:
 */
  __pyx_t_4 = __pyx_v_o->comm;
  __pyx_v_comm2 = __pyx_t_4;

  /* "PETSc/Comm.pyx":31
 *         cdef MPI_Comm comm1 = s.comm
 *         cdef MPI_Comm comm2 = o.comm
 *         cdef int flag = 0             # <<<<<<<<<<<<<<
 *         if comm1 != MPI_COMM_NULL and comm2 != MPI_COMM_NULL:
 *             CHKERR( MPI_Comm_compare(comm1, comm2, &flag) )
 */
  __pyx_v_flag = 0;

  /* "PETSc/Comm.pyx":32
 *         cdef MPI_Comm comm2 = o.comm
 *         cdef int flag = 0
 *         if comm1 != MPI_COMM_NULL and comm2 != MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MPI_Comm_compare(comm1, comm2, &flag) )
 *             if eq: return (flag==<int>MPI_IDENT or  flag==<int>MPI_CONGRUENT)
 */
  __pyx_t_2 = ((__pyx_v_comm1 != MPI_COMM_NULL) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_comm2 != MPI_COMM_NULL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PETSc/Comm.pyx":33
 *         cdef int flag = 0
 *         if comm1 != MPI_COMM_NULL and comm2 != MPI_COMM_NULL:
 *             CHKERR( MPI_Comm_compare(comm1, comm2, &flag) )             # <<<<<<<<<<<<<<
 *             if eq: return (flag==<int>MPI_IDENT or  flag==<int>MPI_CONGRUENT)
 *             else:  return (flag!=<int>MPI_IDENT and flag!=<int>MPI_CONGRUENT)
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MPI_Comm_compare(__pyx_v_comm1, __pyx_v_comm2, (&__pyx_v_flag))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(9, 33, __pyx_L1_error)

    /* "PETSc/Comm.pyx":34
 *         if comm1 != MPI_COMM_NULL and comm2 != MPI_COMM_NULL:
 *             CHKERR( MPI_Comm_compare(comm1, comm2, &flag) )
 *             if eq: return (flag==<int>MPI_IDENT or  flag==<int>MPI_CONGRUENT)             # <<<<<<<<<<<<<<
 *             else:  return (flag!=<int>MPI_IDENT and flag!=<int>MPI_CONGRUENT)
 *         else:
 */
    __pyx_t_1 = (__pyx_v_eq != 0);
    if (__pyx_t_1) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = (__pyx_v_flag == ((int)MPI_IDENT));
      if (!__pyx_t_1) {
      } else {
        __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 34, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_1 = (__pyx_v_flag == ((int)MPI_CONGRUENT));
      __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 34, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_L10_bool_binop_done:;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }

    /* "PETSc/Comm.pyx":35
 *             CHKERR( MPI_Comm_compare(comm1, comm2, &flag) )
 *             if eq: return (flag==<int>MPI_IDENT or  flag==<int>MPI_CONGRUENT)
 *             else:  return (flag!=<int>MPI_IDENT and flag!=<int>MPI_CONGRUENT)             # <<<<<<<<<<<<<<
 *         else:
 *             if eq: return (comm1 == comm2)
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = (__pyx_v_flag != ((int)MPI_IDENT));
      if (__pyx_t_1) {
      } else {
        __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 35, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L12_bool_binop_done;
      }
      __pyx_t_1 = (__pyx_v_flag != ((int)MPI_CONGRUENT));
      __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 35, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_L12_bool_binop_done:;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }

    /* "PETSc/Comm.pyx":32
 *         cdef MPI_Comm comm2 = o.comm
 *         cdef int flag = 0
 *         if comm1 != MPI_COMM_NULL and comm2 != MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MPI_Comm_compare(comm1, comm2, &flag) )
 *             if eq: return (flag==<int>MPI_IDENT or  flag==<int>MPI_CONGRUENT)
 */
  }

  /* "PETSc/Comm.pyx":37
 *             else:  return (flag!=<int>MPI_IDENT and flag!=<int>MPI_CONGRUENT)
 *         else:
 *             if eq: return (comm1 == comm2)             # <<<<<<<<<<<<<<
 *             else:  return (comm1 != comm2)
 * 
 */
  /*else*/ {
    __pyx_t_1 = (__pyx_v_eq != 0);
    if (__pyx_t_1) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyBool_FromLong((__pyx_v_comm1 == __pyx_v_comm2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 37, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }

    /* "PETSc/Comm.pyx":38
 *         else:
 *             if eq: return (comm1 == comm2)
 *             else:  return (comm1 != comm2)             # <<<<<<<<<<<<<<
 * 
 *     def __nonzero__(self):
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyBool_FromLong((__pyx_v_comm1 != __pyx_v_comm2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 38, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }
  }

  /* "PETSc/Comm.pyx":22
 *         self.base = None
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         if not isinstance(self,  Comm): return NotImplemented
 *         if not isinstance(other, Comm): return NotImplemented
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.Comm.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_s);
  __Pyx_XDECREF((PyObject *)__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":40
 *             else:  return (comm1 != comm2)
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         return self.comm != MPI_COMM_NULL
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4Comm_7__nonzero__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4Comm_7__nonzero__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4Comm_6__nonzero__(((struct PyPetscCommObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_4Comm_6__nonzero__(struct PyPetscCommObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__nonzero__", 0);

  /* "PETSc/Comm.pyx":41
 * 
 *     def __nonzero__(self):
 *         return self.comm != MPI_COMM_NULL             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_r = (__pyx_v_self->comm != MPI_COMM_NULL);
  goto __pyx_L0;

  /* "PETSc/Comm.pyx":40
 *             else:  return (comm1 != comm2)
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         return self.comm != MPI_COMM_NULL
 * 
 */

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

/* "PETSc/Comm.pyx":45
 *     #
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         if self.comm == MPI_COMM_NULL: return
 *         if not self.isdup:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_9destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4Comm_8destroy[] = "Comm.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_9destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4Comm_8destroy(((struct PyPetscCommObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_8destroy(struct PyPetscCommObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/Comm.pyx":46
 * 
 *     def destroy(self):
 *         if self.comm == MPI_COMM_NULL: return             # <<<<<<<<<<<<<<
 *         if not self.isdup:
 *             raise ValueError("communicator not owned")
 */
  __pyx_t_1 = ((__pyx_v_self->comm == MPI_COMM_NULL) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "PETSc/Comm.pyx":47
 *     def destroy(self):
 *         if self.comm == MPI_COMM_NULL: return
 *         if not self.isdup:             # <<<<<<<<<<<<<<
 *             raise ValueError("communicator not owned")
 *         CHKERR( PetscCommDestroy(&self.comm) )
 */
  __pyx_t_1 = ((!(__pyx_v_self->isdup != 0)) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Comm.pyx":48
 *         if self.comm == MPI_COMM_NULL: return
 *         if not self.isdup:
 *             raise ValueError("communicator not owned")             # <<<<<<<<<<<<<<
 *         CHKERR( PetscCommDestroy(&self.comm) )
 *         self.comm = MPI_COMM_NULL
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 48, __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(9, 48, __pyx_L1_error)

    /* "PETSc/Comm.pyx":47
 *     def destroy(self):
 *         if self.comm == MPI_COMM_NULL: return
 *         if not self.isdup:             # <<<<<<<<<<<<<<
 *             raise ValueError("communicator not owned")
 *         CHKERR( PetscCommDestroy(&self.comm) )
 */
  }

  /* "PETSc/Comm.pyx":49
 *         if not self.isdup:
 *             raise ValueError("communicator not owned")
 *         CHKERR( PetscCommDestroy(&self.comm) )             # <<<<<<<<<<<<<<
 *         self.comm = MPI_COMM_NULL
 *         self.isdup = 0
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscCommDestroy((&__pyx_v_self->comm))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(9, 49, __pyx_L1_error)

  /* "PETSc/Comm.pyx":50
 *             raise ValueError("communicator not owned")
 *         CHKERR( PetscCommDestroy(&self.comm) )
 *         self.comm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         self.isdup = 0
 *         self.base = None
 */
  __pyx_v_self->comm = MPI_COMM_NULL;

  /* "PETSc/Comm.pyx":51
 *         CHKERR( PetscCommDestroy(&self.comm) )
 *         self.comm = MPI_COMM_NULL
 *         self.isdup = 0             # <<<<<<<<<<<<<<
 *         self.base = None
 * 
 */
  __pyx_v_self->isdup = 0;

  /* "PETSc/Comm.pyx":52
 *         self.comm = MPI_COMM_NULL
 *         self.isdup = 0
 *         self.base = None             # <<<<<<<<<<<<<<
 * 
 *     def duplicate(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->base);
  __Pyx_DECREF(__pyx_v_self->base);
  __pyx_v_self->base = Py_None;

  /* "PETSc/Comm.pyx":45
 *     #
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         if self.comm == MPI_COMM_NULL: return
 *         if not self.isdup:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Comm.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":54
 *         self.base = None
 * 
 *     def duplicate(self):             # <<<<<<<<<<<<<<
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_11duplicate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4Comm_10duplicate[] = "Comm.duplicate(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_11duplicate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("duplicate (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("duplicate", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "duplicate", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4Comm_10duplicate(((struct PyPetscCommObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_10duplicate(struct PyPetscCommObject *__pyx_v_self) {
  MPI_Comm __pyx_v_newcomm;
  struct PyPetscCommObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("duplicate", 0);

  /* "PETSc/Comm.pyx":55
 * 
 *     def duplicate(self):
 *         if self.comm == MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("null communicator")
 *         cdef MPI_Comm newcomm = MPI_COMM_NULL
 */
  __pyx_t_1 = ((__pyx_v_self->comm == MPI_COMM_NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Comm.pyx":56
 *     def duplicate(self):
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm newcomm = MPI_COMM_NULL
 *         CHKERR( PetscCommDuplicate(self.comm, &newcomm, NULL) )
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 56, __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(9, 56, __pyx_L1_error)

    /* "PETSc/Comm.pyx":55
 * 
 *     def duplicate(self):
 *         if self.comm == MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("null communicator")
 *         cdef MPI_Comm newcomm = MPI_COMM_NULL
 */
  }

  /* "PETSc/Comm.pyx":57
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 *         cdef MPI_Comm newcomm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscCommDuplicate(self.comm, &newcomm, NULL) )
 *         cdef Comm comm = type(self)()
 */
  __pyx_v_newcomm = MPI_COMM_NULL;

  /* "PETSc/Comm.pyx":58
 *             raise ValueError("null communicator")
 *         cdef MPI_Comm newcomm = MPI_COMM_NULL
 *         CHKERR( PetscCommDuplicate(self.comm, &newcomm, NULL) )             # <<<<<<<<<<<<<<
 *         cdef Comm comm = type(self)()
 *         comm.comm  = newcomm
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscCommDuplicate(__pyx_v_self->comm, (&__pyx_v_newcomm), NULL)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(9, 58, __pyx_L1_error)

  /* "PETSc/Comm.pyx":59
 *         cdef MPI_Comm newcomm = MPI_COMM_NULL
 *         CHKERR( PetscCommDuplicate(self.comm, &newcomm, NULL) )
 *         cdef Comm comm = type(self)()             # <<<<<<<<<<<<<<
 *         comm.comm  = newcomm
 *         comm.isdup = 1
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __pyx_t_4 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 59, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 59, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_Comm))))) __PYX_ERR(9, 59, __pyx_L1_error)
  __pyx_v_comm = ((struct PyPetscCommObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Comm.pyx":60
 *         CHKERR( PetscCommDuplicate(self.comm, &newcomm, NULL) )
 *         cdef Comm comm = type(self)()
 *         comm.comm  = newcomm             # <<<<<<<<<<<<<<
 *         comm.isdup = 1
 *         comm.base = self.base
 */
  __pyx_v_comm->comm = __pyx_v_newcomm;

  /* "PETSc/Comm.pyx":61
 *         cdef Comm comm = type(self)()
 *         comm.comm  = newcomm
 *         comm.isdup = 1             # <<<<<<<<<<<<<<
 *         comm.base = self.base
 *         return comm
 */
  __pyx_v_comm->isdup = 1;

  /* "PETSc/Comm.pyx":62
 *         comm.comm  = newcomm
 *         comm.isdup = 1
 *         comm.base = self.base             # <<<<<<<<<<<<<<
 *         return comm
 * 
 */
  __pyx_t_2 = __pyx_v_self->base;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_comm->base);
  __Pyx_DECREF(__pyx_v_comm->base);
  __pyx_v_comm->base = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/Comm.pyx":63
 *         comm.isdup = 1
 *         comm.base = self.base
 *         return comm             # <<<<<<<<<<<<<<
 * 
 *     def getSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_comm));
  __pyx_r = ((PyObject *)__pyx_v_comm);
  goto __pyx_L0;

  /* "PETSc/Comm.pyx":54
 *         self.base = None
 * 
 *     def duplicate(self):             # <<<<<<<<<<<<<<
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Comm.duplicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_comm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":65
 *         return comm
 * 
 *     def getSize(self):             # <<<<<<<<<<<<<<
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_13getSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4Comm_12getSize[] = "Comm.getSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_13getSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4Comm_12getSize(((struct PyPetscCommObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_12getSize(struct PyPetscCommObject *__pyx_v_self) {
  int __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getSize", 0);

  /* "PETSc/Comm.pyx":66
 * 
 *     def getSize(self):
 *         if self.comm == MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("null communicator")
 *         cdef int size=0
 */
  __pyx_t_1 = ((__pyx_v_self->comm == MPI_COMM_NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Comm.pyx":67
 *     def getSize(self):
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *         cdef int size=0
 *         MPI_Comm_size(self.comm, &size)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 67, __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(9, 67, __pyx_L1_error)

    /* "PETSc/Comm.pyx":66
 * 
 *     def getSize(self):
 *         if self.comm == MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("null communicator")
 *         cdef int size=0
 */
  }

  /* "PETSc/Comm.pyx":68
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 *         cdef int size=0             # <<<<<<<<<<<<<<
 *         MPI_Comm_size(self.comm, &size)
 *         return size
 */
  __pyx_v_size = 0;

  /* "PETSc/Comm.pyx":69
 *             raise ValueError("null communicator")
 *         cdef int size=0
 *         MPI_Comm_size(self.comm, &size)             # <<<<<<<<<<<<<<
 *         return size
 * 
 */
  MPI_Comm_size(__pyx_v_self->comm, (&__pyx_v_size));

  /* "PETSc/Comm.pyx":70
 *         cdef int size=0
 *         MPI_Comm_size(self.comm, &size)
 *         return size             # <<<<<<<<<<<<<<
 * 
 *     def getRank(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Comm.pyx":65
 *         return comm
 * 
 *     def getSize(self):             # <<<<<<<<<<<<<<
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Comm.getSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":72
 *         return size
 * 
 *     def getRank(self):             # <<<<<<<<<<<<<<
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_15getRank(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4Comm_14getRank[] = "Comm.getRank(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_15getRank(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRank (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getRank", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getRank", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4Comm_14getRank(((struct PyPetscCommObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_14getRank(struct PyPetscCommObject *__pyx_v_self) {
  int __pyx_v_rank;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getRank", 0);

  /* "PETSc/Comm.pyx":73
 * 
 *     def getRank(self):
 *         if self.comm == MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("null communicator")
 *         cdef int rank=0
 */
  __pyx_t_1 = ((__pyx_v_self->comm == MPI_COMM_NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Comm.pyx":74
 *     def getRank(self):
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *         cdef int rank=0
 *         MPI_Comm_rank(self.comm, &rank)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 74, __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(9, 74, __pyx_L1_error)

    /* "PETSc/Comm.pyx":73
 * 
 *     def getRank(self):
 *         if self.comm == MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("null communicator")
 *         cdef int rank=0
 */
  }

  /* "PETSc/Comm.pyx":75
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 *         cdef int rank=0             # <<<<<<<<<<<<<<
 *         MPI_Comm_rank(self.comm, &rank)
 *         return rank
 */
  __pyx_v_rank = 0;

  /* "PETSc/Comm.pyx":76
 *             raise ValueError("null communicator")
 *         cdef int rank=0
 *         MPI_Comm_rank(self.comm, &rank)             # <<<<<<<<<<<<<<
 *         return rank
 * 
 */
  MPI_Comm_rank(__pyx_v_self->comm, (&__pyx_v_rank));

  /* "PETSc/Comm.pyx":77
 *         cdef int rank=0
 *         MPI_Comm_rank(self.comm, &rank)
 *         return rank             # <<<<<<<<<<<<<<
 * 
 *     def barrier(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rank); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Comm.pyx":72
 *         return size
 * 
 *     def getRank(self):             # <<<<<<<<<<<<<<
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Comm.getRank", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":79
 *         return rank
 * 
 *     def barrier(self):             # <<<<<<<<<<<<<<
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_17barrier(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4Comm_16barrier[] = "Comm.barrier(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_17barrier(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("barrier (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("barrier", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "barrier", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4Comm_16barrier(((struct PyPetscCommObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_16barrier(struct PyPetscCommObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("barrier", 0);

  /* "PETSc/Comm.pyx":80
 * 
 *     def barrier(self):
 *         if self.comm == MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("null communicator")
 *         MPI_Barrier(self.comm)
 */
  __pyx_t_1 = ((__pyx_v_self->comm == MPI_COMM_NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Comm.pyx":81
 *     def barrier(self):
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *         MPI_Barrier(self.comm)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 81, __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(9, 81, __pyx_L1_error)

    /* "PETSc/Comm.pyx":80
 * 
 *     def barrier(self):
 *         if self.comm == MPI_COMM_NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("null communicator")
 *         MPI_Barrier(self.comm)
 */
  }

  /* "PETSc/Comm.pyx":82
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 *         MPI_Barrier(self.comm)             # <<<<<<<<<<<<<<
 * 
 *     # --- properties ---
 */
  MPI_Barrier(__pyx_v_self->comm);

  /* "PETSc/Comm.pyx":79
 *         return rank
 * 
 *     def barrier(self):             # <<<<<<<<<<<<<<
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Comm.barrier", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":87
 * 
 *     property size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSize()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_4size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4Comm_4size___get__(((struct PyPetscCommObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_4size___get__(struct PyPetscCommObject *__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);

  /* "PETSc/Comm.pyx":88
 *     property size:
 *         def __get__(self):
 *             return self.getSize()             # <<<<<<<<<<<<<<
 * 
 *     property rank:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(9, 88, __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(9, 88, __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;

  /* "PETSc/Comm.pyx":87
 * 
 *     property size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSize()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Comm.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":91
 * 
 *     property rank:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getRank()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_4rank_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_4rank_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4Comm_4rank___get__(((struct PyPetscCommObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_4rank___get__(struct PyPetscCommObject *__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);

  /* "PETSc/Comm.pyx":92
 *     property rank:
 *         def __get__(self):
 *             return self.getRank()             # <<<<<<<<<<<<<<
 * 
 *     # --- Fortran support ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getRank); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(9, 92, __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(9, 92, __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;

  /* "PETSc/Comm.pyx":91
 * 
 *     property rank:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getRank()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Comm.rank.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":97
 * 
 *     property fortran:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef MPI_Comm comm = self.comm
 *             return MPI_Comm_c2f(comm)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_7fortran_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_7fortran_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4Comm_7fortran___get__(((struct PyPetscCommObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_7fortran___get__(struct PyPetscCommObject *__pyx_v_self) {
  MPI_Comm __pyx_v_comm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/Comm.pyx":98
 *     property fortran:
 *         def __get__(self):
 *             cdef MPI_Comm comm = self.comm             # <<<<<<<<<<<<<<
 *             return MPI_Comm_c2f(comm)
 * 
 */
  __pyx_t_1 = __pyx_v_self->comm;
  __pyx_v_comm = __pyx_t_1;

  /* "PETSc/Comm.pyx":99
 *         def __get__(self):
 *             cdef MPI_Comm comm = self.comm
 *             return MPI_Comm_c2f(comm)             # <<<<<<<<<<<<<<
 * 
 *     # --- mpi4py support ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_MPI_Fint(MPI_Comm_c2f(__pyx_v_comm)); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Comm.pyx":97
 * 
 *     property fortran:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef MPI_Comm comm = self.comm
 *             return MPI_Comm_c2f(comm)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Comm.fortran.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":103
 *     # --- mpi4py support ---
 * 
 *     def tompi4py(self):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm = self.comm
 *         return mpi4py_Comm_New(comm)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_19tompi4py(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4Comm_18tompi4py[] = "Comm.tompi4py(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4Comm_19tompi4py(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tompi4py (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("tompi4py", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "tompi4py", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4Comm_18tompi4py(((struct PyPetscCommObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_4Comm_18tompi4py(struct PyPetscCommObject *__pyx_v_self) {
  MPI_Comm __pyx_v_comm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("tompi4py", 0);

  /* "PETSc/Comm.pyx":104
 * 
 *     def tompi4py(self):
 *         cdef MPI_Comm comm = self.comm             # <<<<<<<<<<<<<<
 *         return mpi4py_Comm_New(comm)
 * 
 */
  __pyx_t_1 = __pyx_v_self->comm;
  __pyx_v_comm = __pyx_t_1;

  /* "PETSc/Comm.pyx":105
 *     def tompi4py(self):
 *         cdef MPI_Comm comm = self.comm
 *         return mpi4py_Comm_New(comm)             # <<<<<<<<<<<<<<
 * 
 *     # --- mpi4py compatibility API ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_mpi4py_Comm_New(__pyx_v_comm); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Comm.pyx":103
 *     # --- mpi4py support ---
 * 
 *     def tompi4py(self):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm = self.comm
 *         return mpi4py_Comm_New(comm)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Comm.tompi4py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":130
 * cdef MPI_Comm PETSC_COMM_DEFAULT = MPI_COMM_NULL
 * 
 * cdef MPI_Comm GetComm(object comm, MPI_Comm defv) except *:             # <<<<<<<<<<<<<<
 *      return def_Comm(comm, defv)
 * 
 */

static MPI_Comm __pyx_f_8petsc4py_5PETSc_GetComm(PyObject *__pyx_v_comm, MPI_Comm __pyx_v_defv) {
  MPI_Comm __pyx_r;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  __Pyx_RefNannySetupContext("GetComm", 0);

  /* "PETSc/Comm.pyx":131
 * 
 * cdef MPI_Comm GetComm(object comm, MPI_Comm defv) except *:
 *      return def_Comm(comm, defv)             # <<<<<<<<<<<<<<
 * 
 * cdef MPI_Comm GetCommDefault():
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_defv); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 131, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "PETSc/Comm.pyx":130
 * cdef MPI_Comm PETSC_COMM_DEFAULT = MPI_COMM_NULL
 * 
 * cdef MPI_Comm GetComm(object comm, MPI_Comm defv) except *:             # <<<<<<<<<<<<<<
 *      return def_Comm(comm, defv)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.GetComm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Comm.pyx":133
 *      return def_Comm(comm, defv)
 * 
 * cdef MPI_Comm GetCommDefault():             # <<<<<<<<<<<<<<
 *      return PETSC_COMM_DEFAULT
 * 
 */

static MPI_Comm __pyx_f_8petsc4py_5PETSc_GetCommDefault(void) {
  MPI_Comm __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetCommDefault", 0);

  /* "PETSc/Comm.pyx":134
 * 
 * cdef MPI_Comm GetCommDefault():
 *      return PETSC_COMM_DEFAULT             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_r = __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT;
  goto __pyx_L0;

  /* "PETSc/Comm.pyx":133
 *      return def_Comm(comm, defv)
 * 
 * cdef MPI_Comm GetCommDefault():             # <<<<<<<<<<<<<<
 *      return PETSC_COMM_DEFAULT
 * 
 */

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

/* "PETSc/Object.pyx":7
 *     # --- special methods ---
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.oval = NULL
 *         self.obj = &self.oval
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_6Object_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_6Object_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object___cinit__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_6Object___cinit__(struct PyPetscObjectObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Object.pyx":8
 * 
 *     def __cinit__(self):
 *         self.oval = NULL             # <<<<<<<<<<<<<<
 *         self.obj = &self.oval
 * 
 */
  __pyx_v_self->oval = NULL;

  /* "PETSc/Object.pyx":9
 *     def __cinit__(self):
 *         self.oval = NULL
 *         self.obj = &self.oval             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->obj = (&__pyx_v_self->oval);

  /* "PETSc/Object.pyx":7
 *     # --- special methods ---
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.oval = NULL
 *         self.obj = &self.oval
 */

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

/* "PETSc/Object.pyx":11
 *         self.obj = &self.oval
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscDEALLOC(&self.obj[0]) )
 *         self.obj = NULL
 */

/* Python wrapper */
static void __pyx_pw_8petsc4py_5PETSc_6Object_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8petsc4py_5PETSc_6Object_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8petsc4py_5PETSc_6Object_2__dealloc__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static void __pyx_pf_8petsc4py_5PETSc_6Object_2__dealloc__(struct PyPetscObjectObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "PETSc/Object.pyx":12
 * 
 *     def __dealloc__(self):
 *         CHKERR( PetscDEALLOC(&self.obj[0]) )             # <<<<<<<<<<<<<<
 *         self.obj = NULL
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_PetscDEALLOC((&(__pyx_v_self->obj[0])))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(10, 12, __pyx_L1_error)

  /* "PETSc/Object.pyx":13
 *     def __dealloc__(self):
 *         CHKERR( PetscDEALLOC(&self.obj[0]) )
 *         self.obj = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, int op):
 */
  __pyx_v_self->obj = NULL;

  /* "PETSc/Object.pyx":11
 *         self.obj = &self.oval
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscDEALLOC(&self.obj[0]) )
 *         self.obj = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("petsc4py.PETSc.Object.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PETSc/Object.pyx":15
 *         self.obj = NULL
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         if not isinstance(self,  Object): return NotImplemented
 *         if not isinstance(other, Object): return NotImplemented
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_5__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_5__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_4__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_4__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  struct PyPetscObjectObject *__pyx_v_s = 0;
  struct PyPetscObjectObject *__pyx_v_o = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "PETSc/Object.pyx":16
 * 
 *     def __richcmp__(self, other, int op):
 *         if not isinstance(self,  Object): return NotImplemented             # <<<<<<<<<<<<<<
 *         if not isinstance(other, Object): return NotImplemented
 *         cdef Object s = self, o = other
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Object); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }

  /* "PETSc/Object.pyx":17
 *     def __richcmp__(self, other, int op):
 *         if not isinstance(self,  Object): return NotImplemented
 *         if not isinstance(other, Object): return NotImplemented             # <<<<<<<<<<<<<<
 *         cdef Object s = self, o = other
 *         if   op == 2: return (s.obj[0] == o.obj[0])
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Object); 
  __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }

  /* "PETSc/Object.pyx":18
 *         if not isinstance(self,  Object): return NotImplemented
 *         if not isinstance(other, Object): return NotImplemented
 *         cdef Object s = self, o = other             # <<<<<<<<<<<<<<
 *         if   op == 2: return (s.obj[0] == o.obj[0])
 *         elif op == 3: return (s.obj[0] != o.obj[0])
 */
  if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Object))))) __PYX_ERR(10, 18, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_self;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_s = ((struct PyPetscObjectObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Object))))) __PYX_ERR(10, 18, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_other;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_o = ((struct PyPetscObjectObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Object.pyx":19
 *         if not isinstance(other, Object): return NotImplemented
 *         cdef Object s = self, o = other
 *         if   op == 2: return (s.obj[0] == o.obj[0])             # <<<<<<<<<<<<<<
 *         elif op == 3: return (s.obj[0] != o.obj[0])
 *         else: raise TypeError("only '==' and '!='")
 */
  switch (__pyx_v_op) {
    case 2:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong(((__pyx_v_s->obj[0]) == (__pyx_v_o->obj[0]))); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 19, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "PETSc/Object.pyx":20
 *         cdef Object s = self, o = other
 *         if   op == 2: return (s.obj[0] == o.obj[0])
 *         elif op == 3: return (s.obj[0] != o.obj[0])             # <<<<<<<<<<<<<<
 *         else: raise TypeError("only '==' and '!='")
 * 
 */
    case 3:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong(((__pyx_v_s->obj[0]) != (__pyx_v_o->obj[0]))); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "PETSc/Object.pyx":21
 *         if   op == 2: return (s.obj[0] == o.obj[0])
 *         elif op == 3: return (s.obj[0] != o.obj[0])
 *         else: raise TypeError("only '==' and '!='")             # <<<<<<<<<<<<<<
 * 
 *     def __nonzero__(self):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21, __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(10, 21, __pyx_L1_error)
    break;
  }

  /* "PETSc/Object.pyx":15
 *         self.obj = NULL
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         if not isinstance(self,  Object): return NotImplemented
 *         if not isinstance(other, Object): return NotImplemented
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_s);
  __Pyx_XDECREF((PyObject *)__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":23
 *         else: raise TypeError("only '==' and '!='")
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         return self.obj[0] != NULL
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_6Object_7__nonzero__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_6Object_7__nonzero__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_6__nonzero__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_6Object_6__nonzero__(struct PyPetscObjectObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__nonzero__", 0);

  /* "PETSc/Object.pyx":24
 * 
 *     def __nonzero__(self):
 *         return self.obj[0] != NULL             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __pyx_r = ((__pyx_v_self->obj[0]) != NULL);
  goto __pyx_L0;

  /* "PETSc/Object.pyx":23
 *         else: raise TypeError("only '==' and '!='")
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         return self.obj[0] != NULL
 * 
 */

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

/* "PETSc/Object.pyx":26
 *         return self.obj[0] != NULL
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         cdef Object obj = type(self)()
 *         cdef PetscObject o = self.obj[0]
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_9__copy__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_8__copy__[] = "Object.__copy__(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_9__copy__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__copy__", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_8__copy__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_8__copy__(struct PyPetscObjectObject *__pyx_v_self) {
  struct PyPetscObjectObject *__pyx_v_obj = 0;
  PetscObject __pyx_v_o;
  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;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("__copy__", 0);

  /* "PETSc/Object.pyx":27
 * 
 *     def __copy__(self):
 *         cdef Object obj = type(self)()             # <<<<<<<<<<<<<<
 *         cdef PetscObject o = self.obj[0]
 *         if o != NULL:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __pyx_t_2 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27, __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(10, 27, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_Object))))) __PYX_ERR(10, 27, __pyx_L1_error)
  __pyx_v_obj = ((struct PyPetscObjectObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":28
 *     def __copy__(self):
 *         cdef Object obj = type(self)()
 *         cdef PetscObject o = self.obj[0]             # <<<<<<<<<<<<<<
 *         if o != NULL:
 *             CHKERR( PetscObjectReference(o) )
 */
  __pyx_v_o = (__pyx_v_self->obj[0]);

  /* "PETSc/Object.pyx":29
 *         cdef Object obj = type(self)()
 *         cdef PetscObject o = self.obj[0]
 *         if o != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectReference(o) )
 *         obj.obj[0] = o
 */
  __pyx_t_4 = ((__pyx_v_o != NULL) != 0);
  if (__pyx_t_4) {

    /* "PETSc/Object.pyx":30
 *         cdef PetscObject o = self.obj[0]
 *         if o != NULL:
 *             CHKERR( PetscObjectReference(o) )             # <<<<<<<<<<<<<<
 *         obj.obj[0] = o
 *         return obj
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectReference(__pyx_v_o)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(10, 30, __pyx_L1_error)

    /* "PETSc/Object.pyx":29
 *         cdef Object obj = type(self)()
 *         cdef PetscObject o = self.obj[0]
 *         if o != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectReference(o) )
 *         obj.obj[0] = o
 */
  }

  /* "PETSc/Object.pyx":31
 *         if o != NULL:
 *             CHKERR( PetscObjectReference(o) )
 *         obj.obj[0] = o             # <<<<<<<<<<<<<<
 *         return obj
 * 
 */
  (__pyx_v_obj->obj[0]) = __pyx_v_o;

  /* "PETSc/Object.pyx":32
 *             CHKERR( PetscObjectReference(o) )
 *         obj.obj[0] = o
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, dict memo not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_obj));
  __pyx_r = ((PyObject *)__pyx_v_obj);
  goto __pyx_L0;

  /* "PETSc/Object.pyx":26
 *         return self.obj[0] != NULL
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         cdef Object obj = type(self)()
 *         cdef PetscObject o = self.obj[0]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":34
 *         return obj
 * 
 *     def __deepcopy__(self, dict memo not None):             # <<<<<<<<<<<<<<
 *         cdef object obj_copy = None
 *         try:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_11__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_10__deepcopy__[] = "Object.__deepcopy__(self, dict memo)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_11__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_memo = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memo,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);
        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_memo)) != 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, "__deepcopy__") < 0)) __PYX_ERR(10, 34, __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_memo = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 34, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_memo), (&PyDict_Type), 0, "memo", 1))) __PYX_ERR(10, 34, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_10__deepcopy__(((struct PyPetscObjectObject *)__pyx_v_self), __pyx_v_memo);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_10__deepcopy__(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_memo) {
  PyObject *__pyx_v_obj_copy = 0;
  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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__deepcopy__", 0);

  /* "PETSc/Object.pyx":35
 * 
 *     def __deepcopy__(self, dict memo not None):
 *         cdef object obj_copy = None             # <<<<<<<<<<<<<<
 *         try:
 *             obj_copy = self.copy
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_obj_copy = Py_None;

  /* "PETSc/Object.pyx":36
 *     def __deepcopy__(self, dict memo not None):
 *         cdef object obj_copy = None
 *         try:             # <<<<<<<<<<<<<<
 *             obj_copy = self.copy
 *         except AttributeError:
 */
  {
    __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:*/ {

      /* "PETSc/Object.pyx":37
 *         cdef object obj_copy = None
 *         try:
 *             obj_copy = self.copy             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             raise NotImplementedError
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 37, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_obj_copy, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "PETSc/Object.pyx":36
 *     def __deepcopy__(self, dict memo not None):
 *         cdef object obj_copy = None
 *         try:             # <<<<<<<<<<<<<<
 *             obj_copy = self.copy
 *         except AttributeError:
 */
    }
    __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_L10_try_end;
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/Object.pyx":38
 *         try:
 *             obj_copy = self.copy
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             raise NotImplementedError
 *         <void>memo # unused
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("petsc4py.PETSc.Object.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(10, 38, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "PETSc/Object.pyx":39
 *             obj_copy = self.copy
 *         except AttributeError:
 *             raise NotImplementedError             # <<<<<<<<<<<<<<
 *         <void>memo # unused
 *         return obj_copy()
 */
      __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
      __PYX_ERR(10, 39, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "PETSc/Object.pyx":36
 *     def __deepcopy__(self, dict memo not None):
 *         cdef object obj_copy = None
 *         try:             # <<<<<<<<<<<<<<
 *             obj_copy = self.copy
 *         except AttributeError:
 */
    __Pyx_PyThreadState_assign
    __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_L10_try_end:;
  }

  /* "PETSc/Object.pyx":40
 *         except AttributeError:
 *             raise NotImplementedError
 *         <void>memo # unused             # <<<<<<<<<<<<<<
 *         return obj_copy()
 * 
 */
  ((void)__pyx_v_memo);

  /* "PETSc/Object.pyx":41
 *             raise NotImplementedError
 *         <void>memo # unused
 *         return obj_copy()             # <<<<<<<<<<<<<<
 * 
 *     # --- attribute management ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj_copy);
  __pyx_t_6 = __pyx_v_obj_copy; __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 41, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 41, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":34
 *         return obj
 * 
 *     def __deepcopy__(self, dict memo not None):             # <<<<<<<<<<<<<<
 *         cdef object obj_copy = None
 *         try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obj_copy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":45
 *     # --- attribute management ---
 * 
 *     cdef object get_attr(self, char name[]):             # <<<<<<<<<<<<<<
 *         return PetscGetPyObj(self.obj[0], name)
 * 
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_6Object_get_attr(struct PyPetscObjectObject *__pyx_v_self, char *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_attr", 0);

  /* "PETSc/Object.pyx":46
 * 
 *     cdef object get_attr(self, char name[]):
 *         return PetscGetPyObj(self.obj[0], name)             # <<<<<<<<<<<<<<
 * 
 *     cdef object set_attr(self, char name[], object attr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_PetscGetPyObj((__pyx_v_self->obj[0]), __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":45
 *     # --- attribute management ---
 * 
 *     cdef object get_attr(self, char name[]):             # <<<<<<<<<<<<<<
 *         return PetscGetPyObj(self.obj[0], name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.get_attr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":48
 *         return PetscGetPyObj(self.obj[0], name)
 * 
 *     cdef object set_attr(self, char name[], object attr):             # <<<<<<<<<<<<<<
 *         return PetscSetPyObj(self.obj[0], name, attr)
 * 
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_6Object_set_attr(struct PyPetscObjectObject *__pyx_v_self, char *__pyx_v_name, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("set_attr", 0);

  /* "PETSc/Object.pyx":49
 * 
 *     cdef object set_attr(self, char name[], object attr):
 *         return PetscSetPyObj(self.obj[0], name, attr)             # <<<<<<<<<<<<<<
 * 
 *     cdef object get_dict(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_PetscSetPyObj((__pyx_v_self->obj[0]), __pyx_v_name, __pyx_v_attr); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":48
 *         return PetscGetPyObj(self.obj[0], name)
 * 
 *     cdef object set_attr(self, char name[], object attr):             # <<<<<<<<<<<<<<
 *         return PetscSetPyObj(self.obj[0], name, attr)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.set_attr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":51
 *         return PetscSetPyObj(self.obj[0], name, attr)
 * 
 *     cdef object get_dict(self):             # <<<<<<<<<<<<<<
 *         return PetscGetPyDict(self.obj[0], True)
 * 
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_6Object_get_dict(struct PyPetscObjectObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_dict", 0);

  /* "PETSc/Object.pyx":52
 * 
 *     cdef object get_dict(self):
 *         return PetscGetPyDict(self.obj[0], True)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_PetscGetPyDict((__pyx_v_self->obj[0]), 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":51
 *         return PetscSetPyObj(self.obj[0], name, attr)
 * 
 *     cdef object get_dict(self):             # <<<<<<<<<<<<<<
 *         return PetscGetPyDict(self.obj[0], True)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.get_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":56
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_13view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_12view[] = "Object.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_13view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(10, 56, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 56, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(10, 56, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_12view(((struct PyPetscObjectObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_12view(struct PyPetscObjectObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/Object.pyx":57
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PetscObjectView(self.obj[0], vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/Object.pyx":58
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectView(self.obj[0], vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/Object.pyx":59
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PetscObjectView(self.obj[0], vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectView((__pyx_v_self->obj[0]), __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(10, 59, __pyx_L1_error)

  /* "PETSc/Object.pyx":56
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":61
 *         CHKERR( PetscObjectView(self.obj[0], vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectDestroy(&self.obj[0]) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_15destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_14destroy[] = "Object.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_15destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_14destroy(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_14destroy(struct PyPetscObjectObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/Object.pyx":62
 * 
 *     def destroy(self):
 *         CHKERR( PetscObjectDestroy(&self.obj[0]) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectDestroy((&(__pyx_v_self->obj[0])))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(10, 62, __pyx_L1_error)

  /* "PETSc/Object.pyx":63
 *     def destroy(self):
 *         CHKERR( PetscObjectDestroy(&self.obj[0]) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Object.pyx":61
 *         CHKERR( PetscObjectView(self.obj[0], vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectDestroy(&self.obj[0]) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":65
 *         return self
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetType(self.obj[0], &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_17getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_16getType[] = "Object.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_17getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_16getType(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_16getType(struct PyPetscObjectObject *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/Object.pyx":66
 * 
 *     def getType(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetType(self.obj[0], &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Object.pyx":67
 *     def getType(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetType(self.obj[0], &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetType((__pyx_v_self->obj[0]), (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(10, 67, __pyx_L1_error)

  /* "PETSc/Object.pyx":68
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetType(self.obj[0], &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":65
 *         return self
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetType(self.obj[0], &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":72
 *     #
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_19setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_18setOptionsPrefix[] = "Object.setOptionsPrefix(self, prefix)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_19setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOptionsPrefix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,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);
        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_prefix)) != 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, "setOptionsPrefix") < 0)) __PYX_ERR(10, 72, __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_prefix = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOptionsPrefix", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 72, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_18setOptionsPrefix(((struct PyPetscObjectObject *)__pyx_v_self), __pyx_v_prefix);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_18setOptionsPrefix(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setOptionsPrefix", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "PETSc/Object.pyx":73
 * 
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( PetscObjectSetOptionsPrefix(self.obj[0], cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Object.pyx":74
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectSetOptionsPrefix(self.obj[0], cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_prefix, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":75
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( PetscObjectSetOptionsPrefix(self.obj[0], cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getOptionsPrefix(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectSetOptionsPrefix((__pyx_v_self->obj[0]), __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(10, 75, __pyx_L1_error)

  /* "PETSc/Object.pyx":72
 *     #
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":77
 *         CHKERR( PetscObjectSetOptionsPrefix(self.obj[0], cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetOptionsPrefix(self.obj[0], &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_21getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_20getOptionsPrefix[] = "Object.getOptionsPrefix(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_21getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOptionsPrefix (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOptionsPrefix", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOptionsPrefix", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_20getOptionsPrefix(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_20getOptionsPrefix(struct PyPetscObjectObject *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getOptionsPrefix", 0);

  /* "PETSc/Object.pyx":78
 * 
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetOptionsPrefix(self.obj[0], &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Object.pyx":79
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetOptionsPrefix(self.obj[0], &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetOptionsPrefix((__pyx_v_self->obj[0]), (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(10, 79, __pyx_L1_error)

  /* "PETSc/Object.pyx":80
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetOptionsPrefix(self.obj[0], &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":77
 *         CHKERR( PetscObjectSetOptionsPrefix(self.obj[0], cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetOptionsPrefix(self.obj[0], &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.getOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":82
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectSetFromOptions(self.obj[0]) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_23setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_22setFromOptions[] = "Object.setFromOptions(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_23setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_22setFromOptions(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_22setFromOptions(struct PyPetscObjectObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/Object.pyx":83
 * 
 *     def setFromOptions(self):
 *         CHKERR( PetscObjectSetFromOptions(self.obj[0]) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectSetFromOptions((__pyx_v_self->obj[0]))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(10, 83, __pyx_L1_error)

  /* "PETSc/Object.pyx":82
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectSetFromOptions(self.obj[0]) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":87
 *     #
 * 
 *     def getComm(self):             # <<<<<<<<<<<<<<
 *         cdef Comm comm = Comm()
 *         CHKERR( PetscObjectGetComm(self.obj[0], &comm.comm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_25getComm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_24getComm[] = "Object.getComm(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_25getComm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getComm (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getComm", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getComm", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_24getComm(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_24getComm(struct PyPetscObjectObject *__pyx_v_self) {
  struct PyPetscCommObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getComm", 0);

  /* "PETSc/Object.pyx":88
 * 
 *     def getComm(self):
 *         cdef Comm comm = Comm()             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetComm(self.obj[0], &comm.comm) )
 *         return comm
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_comm = ((struct PyPetscCommObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":89
 *     def getComm(self):
 *         cdef Comm comm = Comm()
 *         CHKERR( PetscObjectGetComm(self.obj[0], &comm.comm) )             # <<<<<<<<<<<<<<
 *         return comm
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetComm((__pyx_v_self->obj[0]), (&__pyx_v_comm->comm))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(10, 89, __pyx_L1_error)

  /* "PETSc/Object.pyx":90
 *         cdef Comm comm = Comm()
 *         CHKERR( PetscObjectGetComm(self.obj[0], &comm.comm) )
 *         return comm             # <<<<<<<<<<<<<<
 * 
 *     def getName(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_comm));
  __pyx_r = ((PyObject *)__pyx_v_comm);
  goto __pyx_L0;

  /* "PETSc/Object.pyx":87
 *     #
 * 
 *     def getComm(self):             # <<<<<<<<<<<<<<
 *         cdef Comm comm = Comm()
 *         CHKERR( PetscObjectGetComm(self.obj[0], &comm.comm) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.getComm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_comm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":92
 *         return comm
 * 
 *     def getName(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetName(self.obj[0], &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_27getName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_26getName[] = "Object.getName(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_27getName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getName (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getName", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getName", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_26getName(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_26getName(struct PyPetscObjectObject *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getName", 0);

  /* "PETSc/Object.pyx":93
 * 
 *     def getName(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetName(self.obj[0], &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Object.pyx":94
 *     def getName(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetName(self.obj[0], &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetName((__pyx_v_self->obj[0]), (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(10, 94, __pyx_L1_error)

  /* "PETSc/Object.pyx":95
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetName(self.obj[0], &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setName(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":92
 *         return comm
 * 
 *     def getName(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetName(self.obj[0], &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.getName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":97
 *         return bytes2str(cval)
 * 
 *     def setName(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_29setName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_28setName[] = "Object.setName(self, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_29setName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setName (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);
        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, "setName") < 0)) __PYX_ERR(10, 97, __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("setName", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 97, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.setName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_28setName(((struct PyPetscObjectObject *)__pyx_v_self), __pyx_v_name);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_28setName(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_name) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setName", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Object.pyx":98
 * 
 *     def setName(self, name):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cval)
 *         CHKERR( PetscObjectSetName(self.obj[0], cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Object.pyx":99
 *     def setName(self, name):
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectSetName(self.obj[0], cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":100
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 *         CHKERR( PetscObjectSetName(self.obj[0], cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getClassId(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectSetName((__pyx_v_self->obj[0]), __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(10, 100, __pyx_L1_error)

  /* "PETSc/Object.pyx":97
 *         return bytes2str(cval)
 * 
 *     def setName(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.setName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":102
 *         CHKERR( PetscObjectSetName(self.obj[0], cval) )
 * 
 *     def getClassId(self):             # <<<<<<<<<<<<<<
 *         cdef PetscClassId classid = 0
 *         CHKERR( PetscObjectGetClassId(self.obj[0], &classid) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_31getClassId(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_30getClassId[] = "Object.getClassId(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_31getClassId(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getClassId (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getClassId", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getClassId", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_30getClassId(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_30getClassId(struct PyPetscObjectObject *__pyx_v_self) {
  PetscClassId __pyx_v_classid;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getClassId", 0);

  /* "PETSc/Object.pyx":103
 * 
 *     def getClassId(self):
 *         cdef PetscClassId classid = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetClassId(self.obj[0], &classid) )
 *         return <long>classid
 */
  __pyx_v_classid = 0;

  /* "PETSc/Object.pyx":104
 *     def getClassId(self):
 *         cdef PetscClassId classid = 0
 *         CHKERR( PetscObjectGetClassId(self.obj[0], &classid) )             # <<<<<<<<<<<<<<
 *         return <long>classid
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetClassId((__pyx_v_self->obj[0]), (&__pyx_v_classid))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(10, 104, __pyx_L1_error)

  /* "PETSc/Object.pyx":105
 *         cdef PetscClassId classid = 0
 *         CHKERR( PetscObjectGetClassId(self.obj[0], &classid) )
 *         return <long>classid             # <<<<<<<<<<<<<<
 * 
 *     def getClassName(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(((long)__pyx_v_classid)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":102
 *         CHKERR( PetscObjectSetName(self.obj[0], cval) )
 * 
 *     def getClassId(self):             # <<<<<<<<<<<<<<
 *         cdef PetscClassId classid = 0
 *         CHKERR( PetscObjectGetClassId(self.obj[0], &classid) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.getClassId", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":107
 *         return <long>classid
 * 
 *     def getClassName(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetClassName(self.obj[0], &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_33getClassName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_32getClassName[] = "Object.getClassName(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_33getClassName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getClassName (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getClassName", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getClassName", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_32getClassName(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_32getClassName(struct PyPetscObjectObject *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getClassName", 0);

  /* "PETSc/Object.pyx":108
 * 
 *     def getClassName(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetClassName(self.obj[0], &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Object.pyx":109
 *     def getClassName(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetClassName(self.obj[0], &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetClassName((__pyx_v_self->obj[0]), (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(10, 109, __pyx_L1_error)

  /* "PETSc/Object.pyx":110
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetClassName(self.obj[0], &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def getRefCount(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":107
 *         return <long>classid
 * 
 *     def getClassName(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscObjectGetClassName(self.obj[0], &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.getClassName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":112
 *         return bytes2str(cval)
 * 
 *     def getRefCount(self):             # <<<<<<<<<<<<<<
 *         if self.obj[0] == NULL: return 0
 *         cdef PetscInt refcnt = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_35getRefCount(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_34getRefCount[] = "Object.getRefCount(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_35getRefCount(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRefCount (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getRefCount", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getRefCount", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_34getRefCount(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_34getRefCount(struct PyPetscObjectObject *__pyx_v_self) {
  PetscInt __pyx_v_refcnt;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getRefCount", 0);

  /* "PETSc/Object.pyx":113
 * 
 *     def getRefCount(self):
 *         if self.obj[0] == NULL: return 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt refcnt = 0
 *         CHKERR( PetscObjectGetReference(self.obj[0], &refcnt) )
 */
  __pyx_t_1 = (((__pyx_v_self->obj[0]) == NULL) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
  }

  /* "PETSc/Object.pyx":114
 *     def getRefCount(self):
 *         if self.obj[0] == NULL: return 0
 *         cdef PetscInt refcnt = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetReference(self.obj[0], &refcnt) )
 *         return toInt(refcnt)
 */
  __pyx_v_refcnt = 0;

  /* "PETSc/Object.pyx":115
 *         if self.obj[0] == NULL: return 0
 *         cdef PetscInt refcnt = 0
 *         CHKERR( PetscObjectGetReference(self.obj[0], &refcnt) )             # <<<<<<<<<<<<<<
 *         return toInt(refcnt)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetReference((__pyx_v_self->obj[0]), (&__pyx_v_refcnt))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(10, 115, __pyx_L1_error)

  /* "PETSc/Object.pyx":116
 *         cdef PetscInt refcnt = 0
 *         CHKERR( PetscObjectGetReference(self.obj[0], &refcnt) )
 *         return toInt(refcnt)             # <<<<<<<<<<<<<<
 * 
 *     # --- general support ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_refcnt); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":112
 *         return bytes2str(cval)
 * 
 *     def getRefCount(self):             # <<<<<<<<<<<<<<
 *         if self.obj[0] == NULL: return 0
 *         cdef PetscInt refcnt = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.getRefCount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":120
 *     # --- general support ---
 * 
 *     def compose(self, name, Object obj):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         cdef PetscObject cobj = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_37compose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_36compose[] = "Object.compose(self, name, Object obj)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_37compose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  struct PyPetscObjectObject *__pyx_v_obj = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("compose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_obj,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compose", 1, 2, 2, 1); __PYX_ERR(10, 120, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compose") < 0)) __PYX_ERR(10, 120, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_name = values[0];
    __pyx_v_obj = ((struct PyPetscObjectObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("compose", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 120, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.compose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obj), __pyx_ptype_8petsc4py_5PETSc_Object, 1, "obj", 0))) __PYX_ERR(10, 120, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_36compose(((struct PyPetscObjectObject *)__pyx_v_self), __pyx_v_name, __pyx_v_obj);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_36compose(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_name, struct PyPetscObjectObject *__pyx_v_obj) {
  const char *__pyx_v_cval;
  PetscObject __pyx_v_cobj;
  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("compose", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Object.pyx":121
 * 
 *     def compose(self, name, Object obj):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscObject cobj = NULL
 *         name = str2bytes(name, &cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Object.pyx":122
 *     def compose(self, name, Object obj):
 *         cdef const_char *cval = NULL
 *         cdef PetscObject cobj = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cval)
 *         if obj is not None: cobj = obj.obj[0]
 */
  __pyx_v_cobj = NULL;

  /* "PETSc/Object.pyx":123
 *         cdef const_char *cval = NULL
 *         cdef PetscObject cobj = NULL
 *         name = str2bytes(name, &cval)             # <<<<<<<<<<<<<<
 *         if obj is not None: cobj = obj.obj[0]
 *         CHKERR( PetscObjectCompose(self.obj[0], cval, cobj) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":124
 *         cdef PetscObject cobj = NULL
 *         name = str2bytes(name, &cval)
 *         if obj is not None: cobj = obj.obj[0]             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectCompose(self.obj[0], cval, cobj) )
 * 
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_obj) != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_v_cobj = (__pyx_v_obj->obj[0]);
  }

  /* "PETSc/Object.pyx":125
 *         name = str2bytes(name, &cval)
 *         if obj is not None: cobj = obj.obj[0]
 *         CHKERR( PetscObjectCompose(self.obj[0], cval, cobj) )             # <<<<<<<<<<<<<<
 * 
 *     def query(self, name):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectCompose((__pyx_v_self->obj[0]), __pyx_v_cval, __pyx_v_cobj)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(10, 125, __pyx_L1_error)

  /* "PETSc/Object.pyx":120
 *     # --- general support ---
 * 
 *     def compose(self, name, Object obj):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         cdef PetscObject cobj = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.compose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":127
 *         CHKERR( PetscObjectCompose(self.obj[0], cval, cobj) )
 * 
 *     def query(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         cdef PetscObject cobj = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_39query(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_38query[] = "Object.query(self, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_39query(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("query (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);
        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, "query") < 0)) __PYX_ERR(10, 127, __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("query", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 127, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.query", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_38query(((struct PyPetscObjectObject *)__pyx_v_self), __pyx_v_name);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_38query(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_name) {
  const char *__pyx_v_cval;
  PetscObject __pyx_v_cobj;
  struct PyPetscObjectObject *__pyx_v_obj = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("query", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Object.pyx":128
 * 
 *     def query(self, name):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscObject cobj = NULL
 *         name = str2bytes(name, &cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Object.pyx":129
 *     def query(self, name):
 *         cdef const_char *cval = NULL
 *         cdef PetscObject cobj = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cval)
 *         CHKERR( PetscObjectQuery(self.obj[0], cval, &cobj) )
 */
  __pyx_v_cobj = NULL;

  /* "PETSc/Object.pyx":130
 *         cdef const_char *cval = NULL
 *         cdef PetscObject cobj = NULL
 *         name = str2bytes(name, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectQuery(self.obj[0], cval, &cobj) )
 *         if cobj == NULL: return None
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":131
 *         cdef PetscObject cobj = NULL
 *         name = str2bytes(name, &cval)
 *         CHKERR( PetscObjectQuery(self.obj[0], cval, &cobj) )             # <<<<<<<<<<<<<<
 *         if cobj == NULL: return None
 *         cdef Object obj = subtype_Object(cobj)()
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectQuery((__pyx_v_self->obj[0]), __pyx_v_cval, (&__pyx_v_cobj))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(10, 131, __pyx_L1_error)

  /* "PETSc/Object.pyx":132
 *         name = str2bytes(name, &cval)
 *         CHKERR( PetscObjectQuery(self.obj[0], cval, &cobj) )
 *         if cobj == NULL: return None             # <<<<<<<<<<<<<<
 *         cdef Object obj = subtype_Object(cobj)()
 *         obj.obj[0] = cobj
 */
  __pyx_t_3 = ((__pyx_v_cobj == NULL) != 0);
  if (__pyx_t_3) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "PETSc/Object.pyx":133
 *         CHKERR( PetscObjectQuery(self.obj[0], cval, &cobj) )
 *         if cobj == NULL: return None
 *         cdef Object obj = subtype_Object(cobj)()             # <<<<<<<<<<<<<<
 *         obj.obj[0] = cobj
 *         PetscINCREF(obj.obj)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_Object(__pyx_v_cobj)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_8petsc4py_5PETSc_Object))))) __PYX_ERR(10, 133, __pyx_L1_error)
  __pyx_v_obj = ((struct PyPetscObjectObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/Object.pyx":134
 *         if cobj == NULL: return None
 *         cdef Object obj = subtype_Object(cobj)()
 *         obj.obj[0] = cobj             # <<<<<<<<<<<<<<
 *         PetscINCREF(obj.obj)
 *         return obj
 */
  (__pyx_v_obj->obj[0]) = __pyx_v_cobj;

  /* "PETSc/Object.pyx":135
 *         cdef Object obj = subtype_Object(cobj)()
 *         obj.obj[0] = cobj
 *         PetscINCREF(obj.obj)             # <<<<<<<<<<<<<<
 *         return obj
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_obj->obj);

  /* "PETSc/Object.pyx":136
 *         obj.obj[0] = cobj
 *         PetscINCREF(obj.obj)
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     def incRef(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_obj));
  __pyx_r = ((PyObject *)__pyx_v_obj);
  goto __pyx_L0;

  /* "PETSc/Object.pyx":127
 *         CHKERR( PetscObjectCompose(self.obj[0], cval, cobj) )
 * 
 *     def query(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         cdef PetscObject cobj = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.query", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":138
 *         return obj
 * 
 *     def incRef(self):             # <<<<<<<<<<<<<<
 *         cdef PetscObject obj = self.obj[0]
 *         cdef PetscInt refct = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_41incRef(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_40incRef[] = "Object.incRef(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_41incRef(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("incRef (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("incRef", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "incRef", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_40incRef(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_40incRef(struct PyPetscObjectObject *__pyx_v_self) {
  PetscObject __pyx_v_obj;
  PetscInt __pyx_v_refct;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("incRef", 0);

  /* "PETSc/Object.pyx":139
 * 
 *     def incRef(self):
 *         cdef PetscObject obj = self.obj[0]             # <<<<<<<<<<<<<<
 *         cdef PetscInt refct = 0
 *         if obj != NULL:
 */
  __pyx_v_obj = (__pyx_v_self->obj[0]);

  /* "PETSc/Object.pyx":140
 *     def incRef(self):
 *         cdef PetscObject obj = self.obj[0]
 *         cdef PetscInt refct = 0             # <<<<<<<<<<<<<<
 *         if obj != NULL:
 *             CHKERR( PetscObjectReference(obj) )
 */
  __pyx_v_refct = 0;

  /* "PETSc/Object.pyx":141
 *         cdef PetscObject obj = self.obj[0]
 *         cdef PetscInt refct = 0
 *         if obj != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectReference(obj) )
 *             CHKERR( PetscObjectGetReference(obj, &refct) )
 */
  __pyx_t_1 = ((__pyx_v_obj != NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Object.pyx":142
 *         cdef PetscInt refct = 0
 *         if obj != NULL:
 *             CHKERR( PetscObjectReference(obj) )             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetReference(obj, &refct) )
 *         return (<long>refct)
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectReference(__pyx_v_obj)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(10, 142, __pyx_L1_error)

    /* "PETSc/Object.pyx":143
 *         if obj != NULL:
 *             CHKERR( PetscObjectReference(obj) )
 *             CHKERR( PetscObjectGetReference(obj, &refct) )             # <<<<<<<<<<<<<<
 *         return (<long>refct)
 * 
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetReference(__pyx_v_obj, (&__pyx_v_refct))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(10, 143, __pyx_L1_error)

    /* "PETSc/Object.pyx":141
 *         cdef PetscObject obj = self.obj[0]
 *         cdef PetscInt refct = 0
 *         if obj != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectReference(obj) )
 *             CHKERR( PetscObjectGetReference(obj, &refct) )
 */
  }

  /* "PETSc/Object.pyx":144
 *             CHKERR( PetscObjectReference(obj) )
 *             CHKERR( PetscObjectGetReference(obj, &refct) )
 *         return (<long>refct)             # <<<<<<<<<<<<<<
 * 
 *     def decRef(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(((long)__pyx_v_refct)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":138
 *         return obj
 * 
 *     def incRef(self):             # <<<<<<<<<<<<<<
 *         cdef PetscObject obj = self.obj[0]
 *         cdef PetscInt refct = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.incRef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":146
 *         return (<long>refct)
 * 
 *     def decRef(self):             # <<<<<<<<<<<<<<
 *         cdef PetscObject obj = self.obj[0]
 *         cdef PetscInt refct = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_43decRef(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_42decRef[] = "Object.decRef(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_43decRef(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("decRef (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("decRef", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "decRef", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_42decRef(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_42decRef(struct PyPetscObjectObject *__pyx_v_self) {
  PetscObject __pyx_v_obj;
  PetscInt __pyx_v_refct;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("decRef", 0);

  /* "PETSc/Object.pyx":147
 * 
 *     def decRef(self):
 *         cdef PetscObject obj = self.obj[0]             # <<<<<<<<<<<<<<
 *         cdef PetscInt refct = 0
 *         if obj != NULL:
 */
  __pyx_v_obj = (__pyx_v_self->obj[0]);

  /* "PETSc/Object.pyx":148
 *     def decRef(self):
 *         cdef PetscObject obj = self.obj[0]
 *         cdef PetscInt refct = 0             # <<<<<<<<<<<<<<
 *         if obj != NULL:
 *             CHKERR( PetscObjectGetReference(obj, &refct) )
 */
  __pyx_v_refct = 0;

  /* "PETSc/Object.pyx":149
 *         cdef PetscObject obj = self.obj[0]
 *         cdef PetscInt refct = 0
 *         if obj != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetReference(obj, &refct) )
 *             CHKERR( PetscObjectDereference(obj) )
 */
  __pyx_t_1 = ((__pyx_v_obj != NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Object.pyx":150
 *         cdef PetscInt refct = 0
 *         if obj != NULL:
 *             CHKERR( PetscObjectGetReference(obj, &refct) )             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectDereference(obj) )
 *             if refct == 1: self.obj[0] = NULL
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetReference(__pyx_v_obj, (&__pyx_v_refct))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(10, 150, __pyx_L1_error)

    /* "PETSc/Object.pyx":151
 *         if obj != NULL:
 *             CHKERR( PetscObjectGetReference(obj, &refct) )
 *             CHKERR( PetscObjectDereference(obj) )             # <<<<<<<<<<<<<<
 *             if refct == 1: self.obj[0] = NULL
 *             refct -= 1
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectDereference(__pyx_v_obj)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(10, 151, __pyx_L1_error)

    /* "PETSc/Object.pyx":152
 *             CHKERR( PetscObjectGetReference(obj, &refct) )
 *             CHKERR( PetscObjectDereference(obj) )
 *             if refct == 1: self.obj[0] = NULL             # <<<<<<<<<<<<<<
 *             refct -= 1
 *         return (<long>refct)
 */
    __pyx_t_1 = ((__pyx_v_refct == 1) != 0);
    if (__pyx_t_1) {
      (__pyx_v_self->obj[0]) = NULL;
    }

    /* "PETSc/Object.pyx":153
 *             CHKERR( PetscObjectDereference(obj) )
 *             if refct == 1: self.obj[0] = NULL
 *             refct -= 1             # <<<<<<<<<<<<<<
 *         return (<long>refct)
 * 
 */
    __pyx_v_refct = (__pyx_v_refct - 1);

    /* "PETSc/Object.pyx":149
 *         cdef PetscObject obj = self.obj[0]
 *         cdef PetscInt refct = 0
 *         if obj != NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetReference(obj, &refct) )
 *             CHKERR( PetscObjectDereference(obj) )
 */
  }

  /* "PETSc/Object.pyx":154
 *             if refct == 1: self.obj[0] = NULL
 *             refct -= 1
 *         return (<long>refct)             # <<<<<<<<<<<<<<
 * 
 *     def getAttr(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(((long)__pyx_v_refct)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":146
 *         return (<long>refct)
 * 
 *     def decRef(self):             # <<<<<<<<<<<<<<
 *         cdef PetscObject obj = self.obj[0]
 *         cdef PetscInt refct = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.decRef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":156
 *         return (<long>refct)
 * 
 *     def getAttr(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_45getAttr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_44getAttr[] = "Object.getAttr(self, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_45getAttr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getAttr (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);
        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, "getAttr") < 0)) __PYX_ERR(10, 156, __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("getAttr", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 156, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.getAttr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_44getAttr(((struct PyPetscObjectObject *)__pyx_v_self), __pyx_v_name);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_44getAttr(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_name) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getAttr", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Object.pyx":157
 * 
 *     def getAttr(self, name):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cval)
 *         return self.get_attr(<char*>cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Object.pyx":158
 *     def getAttr(self, name):
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)             # <<<<<<<<<<<<<<
 *         return self.get_attr(<char*>cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":159
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 *         return self.get_attr(<char*>cval)             # <<<<<<<<<<<<<<
 * 
 *     def setAttr(self, name, attr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Object *)__pyx_v_self->__pyx_vtab)->get_attr(__pyx_v_self, ((char *)__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":156
 *         return (<long>refct)
 * 
 *     def getAttr(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.getAttr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":161
 *         return self.get_attr(<char*>cval)
 * 
 *     def setAttr(self, name, attr):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_47setAttr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_46setAttr[] = "Object.setAttr(self, name, attr)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_47setAttr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_attr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setAttr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_attr,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_attr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setAttr", 1, 2, 2, 1); __PYX_ERR(10, 161, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setAttr") < 0)) __PYX_ERR(10, 161, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_name = values[0];
    __pyx_v_attr = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setAttr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 161, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.setAttr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_46setAttr(((struct PyPetscObjectObject *)__pyx_v_self), __pyx_v_name, __pyx_v_attr);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_46setAttr(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_attr) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setAttr", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Object.pyx":162
 * 
 *     def setAttr(self, name, attr):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cval)
 *         self.set_attr(<char*>cval, attr)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Object.pyx":163
 *     def setAttr(self, name, attr):
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)             # <<<<<<<<<<<<<<
 *         self.set_attr(<char*>cval, attr)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":164
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 *         self.set_attr(<char*>cval, attr)             # <<<<<<<<<<<<<<
 * 
 *     def getDict(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Object *)__pyx_v_self->__pyx_vtab)->set_attr(__pyx_v_self, ((char *)__pyx_v_cval), __pyx_v_attr); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":161
 *         return self.get_attr(<char*>cval)
 * 
 *     def setAttr(self, name, attr):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.setAttr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":166
 *         self.set_attr(<char*>cval, attr)
 * 
 *     def getDict(self):             # <<<<<<<<<<<<<<
 *         return self.get_dict()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_49getDict(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_48getDict[] = "Object.getDict(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_49getDict(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDict (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDict", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDict", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_48getDict(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_48getDict(struct PyPetscObjectObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getDict", 0);

  /* "PETSc/Object.pyx":167
 * 
 *     def getDict(self):
 *         return self.get_dict()             # <<<<<<<<<<<<<<
 * 
 *     def stateIncrease(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Object *)__pyx_v_self->__pyx_vtab)->get_dict(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":166
 *         self.set_attr(<char*>cval, attr)
 * 
 *     def getDict(self):             # <<<<<<<<<<<<<<
 *         return self.get_dict()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.getDict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":169
 *         return self.get_dict()
 * 
 *     def stateIncrease(self):             # <<<<<<<<<<<<<<
 *         PetscINCSTATE(self.obj)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_51stateIncrease(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_50stateIncrease[] = "Object.stateIncrease(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_51stateIncrease(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stateIncrease (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("stateIncrease", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "stateIncrease", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_50stateIncrease(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_50stateIncrease(struct PyPetscObjectObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stateIncrease", 0);

  /* "PETSc/Object.pyx":170
 * 
 *     def stateIncrease(self):
 *         PetscINCSTATE(self.obj)             # <<<<<<<<<<<<<<
 * 
 *     # --- tab level ---
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCSTATE(__pyx_v_self->obj);

  /* "PETSc/Object.pyx":169
 *         return self.get_dict()
 * 
 *     def stateIncrease(self):             # <<<<<<<<<<<<<<
 *         PetscINCSTATE(self.obj)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":174
 *     # --- tab level ---
 * 
 *     def incrementTabLevel(self, tab, Object parent=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ctab = asInt(tab)
 *         cdef PetscObject cobj = <PetscObject> NULL if parent is None else parent.obj[0]
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_53incrementTabLevel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_52incrementTabLevel[] = "Object.incrementTabLevel(self, tab, Object parent=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_53incrementTabLevel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tab = 0;
  struct PyPetscObjectObject *__pyx_v_parent = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("incrementTabLevel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tab,&__pyx_n_s_parent,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct PyPetscObjectObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_tab)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parent);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "incrementTabLevel") < 0)) __PYX_ERR(10, 174, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tab = values[0];
    __pyx_v_parent = ((struct PyPetscObjectObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("incrementTabLevel", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 174, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.incrementTabLevel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_8petsc4py_5PETSc_Object, 1, "parent", 0))) __PYX_ERR(10, 174, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_52incrementTabLevel(((struct PyPetscObjectObject *)__pyx_v_self), __pyx_v_tab, __pyx_v_parent);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_52incrementTabLevel(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_tab, struct PyPetscObjectObject *__pyx_v_parent) {
  PetscInt __pyx_v_ctab;
  PetscObject __pyx_v_cobj;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscObject __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("incrementTabLevel", 0);

  /* "PETSc/Object.pyx":175
 * 
 *     def incrementTabLevel(self, tab, Object parent=None):
 *         cdef PetscInt ctab = asInt(tab)             # <<<<<<<<<<<<<<
 *         cdef PetscObject cobj = <PetscObject> NULL if parent is None else parent.obj[0]
 *         CHKERR( PetscObjectIncrementTabLevel(self.obj[0], cobj, ctab) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_tab); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(10, 175, __pyx_L1_error)
  __pyx_v_ctab = __pyx_t_1;

  /* "PETSc/Object.pyx":176
 *     def incrementTabLevel(self, tab, Object parent=None):
 *         cdef PetscInt ctab = asInt(tab)
 *         cdef PetscObject cobj = <PetscObject> NULL if parent is None else parent.obj[0]             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectIncrementTabLevel(self.obj[0], cobj, ctab) )
 * 
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_parent) == Py_None);
  if ((__pyx_t_3 != 0)) {
    __pyx_t_2 = ((PetscObject)NULL);
  } else {
    __pyx_t_2 = (__pyx_v_parent->obj[0]);
  }
  __pyx_v_cobj = __pyx_t_2;

  /* "PETSc/Object.pyx":177
 *         cdef PetscInt ctab = asInt(tab)
 *         cdef PetscObject cobj = <PetscObject> NULL if parent is None else parent.obj[0]
 *         CHKERR( PetscObjectIncrementTabLevel(self.obj[0], cobj, ctab) )             # <<<<<<<<<<<<<<
 * 
 *     def setTabLevel(self, level):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectIncrementTabLevel((__pyx_v_self->obj[0]), __pyx_v_cobj, __pyx_v_ctab)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(10, 177, __pyx_L1_error)

  /* "PETSc/Object.pyx":174
 *     # --- tab level ---
 * 
 *     def incrementTabLevel(self, tab, Object parent=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ctab = asInt(tab)
 *         cdef PetscObject cobj = <PetscObject> NULL if parent is None else parent.obj[0]
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.incrementTabLevel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":179
 *         CHKERR( PetscObjectIncrementTabLevel(self.obj[0], cobj, ctab) )
 * 
 *     def setTabLevel(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PetscObjectSetTabLevel(self.obj[0], clevel) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_55setTabLevel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_54setTabLevel[] = "Object.setTabLevel(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_55setTabLevel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTabLevel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "setTabLevel") < 0)) __PYX_ERR(10, 179, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTabLevel", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 179, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.setTabLevel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_54setTabLevel(((struct PyPetscObjectObject *)__pyx_v_self), __pyx_v_level);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_54setTabLevel(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setTabLevel", 0);

  /* "PETSc/Object.pyx":180
 * 
 *     def setTabLevel(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectSetTabLevel(self.obj[0], clevel) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(10, 180, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/Object.pyx":181
 *     def setTabLevel(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PetscObjectSetTabLevel(self.obj[0], clevel) )             # <<<<<<<<<<<<<<
 * 
 *     def getTabLevel(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectSetTabLevel((__pyx_v_self->obj[0]), __pyx_v_clevel)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(10, 181, __pyx_L1_error)

  /* "PETSc/Object.pyx":179
 *         CHKERR( PetscObjectIncrementTabLevel(self.obj[0], cobj, ctab) )
 * 
 *     def setTabLevel(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PetscObjectSetTabLevel(self.obj[0], clevel) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Object.setTabLevel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":183
 *         CHKERR( PetscObjectSetTabLevel(self.obj[0], clevel) )
 * 
 *     def getTabLevel(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = 0
 *         CHKERR( PetscObjectGetTabLevel(self.obj[0], &clevel) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_57getTabLevel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Object_56getTabLevel[] = "Object.getTabLevel(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_57getTabLevel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTabLevel (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getTabLevel", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getTabLevel", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_56getTabLevel(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_56getTabLevel(struct PyPetscObjectObject *__pyx_v_self) {
  PetscInt __pyx_v_clevel;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getTabLevel", 0);

  /* "PETSc/Object.pyx":184
 * 
 *     def getTabLevel(self):
 *         cdef PetscInt clevel = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetTabLevel(self.obj[0], &clevel) )
 *         return toInt(clevel)
 */
  __pyx_v_clevel = 0;

  /* "PETSc/Object.pyx":185
 *     def getTabLevel(self):
 *         cdef PetscInt clevel = 0
 *         CHKERR( PetscObjectGetTabLevel(self.obj[0], &clevel) )             # <<<<<<<<<<<<<<
 *         return toInt(clevel)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetTabLevel((__pyx_v_self->obj[0]), (&__pyx_v_clevel))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(10, 185, __pyx_L1_error)

  /* "PETSc/Object.pyx":186
 *         cdef PetscInt clevel = 0
 *         CHKERR( PetscObjectGetTabLevel(self.obj[0], &clevel) )
 *         return toInt(clevel)             # <<<<<<<<<<<<<<
 * 
 *     # --- properties ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_clevel); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":183
 *         CHKERR( PetscObjectSetTabLevel(self.obj[0], clevel) )
 * 
 *     def getTabLevel(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = 0
 *         CHKERR( PetscObjectGetTabLevel(self.obj[0], &clevel) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.getTabLevel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":191
 * 
 *     property type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getType()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_4type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_4type___get__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_4type___get__(struct PyPetscObjectObject *__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);

  /* "PETSc/Object.pyx":192
 *     property type:
 *         def __get__(self):
 *             return self.getType()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setType(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getType); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(10, 192, __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(10, 192, __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;

  /* "PETSc/Object.pyx":191
 * 
 *     property type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getType()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":193
 *         def __get__(self):
 *             return self.getType()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setType(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_6Object_4type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_6Object_4type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_4type_2__set__(((struct PyPetscObjectObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_6Object_4type_2__set__(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Object.pyx":194
 *             return self.getType()
 *         def __set__(self, value):
 *             self.setType(value)             # <<<<<<<<<<<<<<
 * 
 *     property prefix:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setType); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 194, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 194, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 194, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":193
 *         def __get__(self):
 *             return self.getType()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setType(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.type.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":197
 * 
 *     property prefix:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOptionsPrefix()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_6prefix_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_6prefix_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_6prefix___get__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_6prefix___get__(struct PyPetscObjectObject *__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);

  /* "PETSc/Object.pyx":198
 *     property prefix:
 *         def __get__(self):
 *             return self.getOptionsPrefix()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setOptionsPrefix(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getOptionsPrefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(10, 198, __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(10, 198, __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;

  /* "PETSc/Object.pyx":197
 * 
 *     property prefix:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOptionsPrefix()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.prefix.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":199
 *         def __get__(self):
 *             return self.getOptionsPrefix()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setOptionsPrefix(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_6Object_6prefix_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_6Object_6prefix_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_6prefix_2__set__(((struct PyPetscObjectObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_6Object_6prefix_2__set__(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Object.pyx":200
 *             return self.getOptionsPrefix()
 *         def __set__(self, value):
 *             self.setOptionsPrefix(value)             # <<<<<<<<<<<<<<
 * 
 *     property comm:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setOptionsPrefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 200, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 200, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":199
 *         def __get__(self):
 *             return self.getOptionsPrefix()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setOptionsPrefix(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.prefix.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":203
 * 
 *     property comm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getComm()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_4comm_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_4comm_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_4comm___get__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_4comm___get__(struct PyPetscObjectObject *__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);

  /* "PETSc/Object.pyx":204
 *     property comm:
 *         def __get__(self):
 *             return self.getComm()             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getComm); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(10, 204, __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(10, 204, __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;

  /* "PETSc/Object.pyx":203
 * 
 *     property comm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getComm()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.comm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":207
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getName()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_4name___get__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_4name___get__(struct PyPetscObjectObject *__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);

  /* "PETSc/Object.pyx":208
 *     property name:
 *         def __get__(self):
 *             return self.getName()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setName(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getName); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(10, 208, __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(10, 208, __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;

  /* "PETSc/Object.pyx":207
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getName()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":209
 *         def __get__(self):
 *             return self.getName()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setName(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_6Object_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_6Object_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_4name_2__set__(((struct PyPetscObjectObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_6Object_4name_2__set__(struct PyPetscObjectObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Object.pyx":210
 *             return self.getName()
 *         def __set__(self, value):
 *             self.setName(value)             # <<<<<<<<<<<<<<
 * 
 *     property classid:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setName); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 210, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 210, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 210, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":209
 *         def __get__(self):
 *             return self.getName()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setName(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":213
 * 
 *     property classid:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getClassId()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_7classid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_7classid_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_7classid___get__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_7classid___get__(struct PyPetscObjectObject *__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);

  /* "PETSc/Object.pyx":214
 *     property classid:
 *         def __get__(self):
 *             return self.getClassId()             # <<<<<<<<<<<<<<
 * 
 *     property klass:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getClassId); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(10, 214, __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(10, 214, __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;

  /* "PETSc/Object.pyx":213
 * 
 *     property classid:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getClassId()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.classid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":217
 * 
 *     property klass:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getClassName()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_5klass_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_5klass_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_5klass___get__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_5klass___get__(struct PyPetscObjectObject *__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);

  /* "PETSc/Object.pyx":218
 *     property klass:
 *         def __get__(self):
 *             return self.getClassName()             # <<<<<<<<<<<<<<
 * 
 *     property refcount:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getClassName); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(10, 218, __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(10, 218, __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;

  /* "PETSc/Object.pyx":217
 * 
 *     property klass:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getClassName()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.klass.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":221
 * 
 *     property refcount:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getRefCount()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_8refcount_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_8refcount_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_8refcount___get__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_8refcount___get__(struct PyPetscObjectObject *__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);

  /* "PETSc/Object.pyx":222
 *     property refcount:
 *         def __get__(self):
 *             return self.getRefCount()             # <<<<<<<<<<<<<<
 * 
 *     # --- ctypes support  ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getRefCount); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(10, 222, __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(10, 222, __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;

  /* "PETSc/Object.pyx":221
 * 
 *     property refcount:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getRefCount()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.refcount.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":227
 * 
 *     property handle:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef PetscObject obj = self.obj[0]
 *             return PyLong_FromVoidPtr(<void*>obj)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_6handle_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_6handle_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_6handle___get__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_6handle___get__(struct PyPetscObjectObject *__pyx_v_self) {
  PetscObject __pyx_v_obj;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/Object.pyx":228
 *     property handle:
 *         def __get__(self):
 *             cdef PetscObject obj = self.obj[0]             # <<<<<<<<<<<<<<
 *             return PyLong_FromVoidPtr(<void*>obj)
 * 
 */
  __pyx_v_obj = (__pyx_v_self->obj[0]);

  /* "PETSc/Object.pyx":229
 *         def __get__(self):
 *             cdef PetscObject obj = self.obj[0]
 *             return PyLong_FromVoidPtr(<void*>obj)             # <<<<<<<<<<<<<<
 * 
 *     # --- Fortran support  ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromVoidPtr(((void *)__pyx_v_obj)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":227
 * 
 *     property handle:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef PetscObject obj = self.obj[0]
 *             return PyLong_FromVoidPtr(<void*>obj)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.handle.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":234
 * 
 *     property fortran:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef PetscObject obj = self.obj[0]
 *             return Object_toFortran(obj)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_7fortran_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Object_7fortran_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Object_7fortran___get__(((struct PyPetscObjectObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Object_7fortran___get__(struct PyPetscObjectObject *__pyx_v_self) {
  PetscObject __pyx_v_obj;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/Object.pyx":235
 *     property fortran:
 *         def __get__(self):
 *             cdef PetscObject obj = self.obj[0]             # <<<<<<<<<<<<<<
 *             return Object_toFortran(obj)
 * 
 */
  __pyx_v_obj = (__pyx_v_self->obj[0]);

  /* "PETSc/Object.pyx":236
 *         def __get__(self):
 *             cdef PetscObject obj = self.obj[0]
 *             return Object_toFortran(obj)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_f_8petsc4py_5PETSc_Object_toFortran(__pyx_v_obj)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":234
 * 
 *     property fortran:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef PetscObject obj = self.obj[0]
 *             return Object_toFortran(obj)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Object.fortran.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/cyclicgc.pxi":21
 *     PyGC_Head *_Py_AS_GC(PyObject*)
 * 
 * cdef int tp_traverse(PyObject *o, visitproc visit, void *arg):             # <<<<<<<<<<<<<<
 *     ## printf("%s.tp_traverse(%p)\n", Py_TYPE(o).tp_name, <void*>o)
 *     cdef PetscObject p = (<Object>o).obj[0]
 */

static int __pyx_f_8petsc4py_5PETSc_tp_traverse(PyObject *__pyx_v_o, visitproc __pyx_v_visit, void *__pyx_v_arg) {
  PetscObject __pyx_v_p;
  PyObject *__pyx_v_d;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("tp_traverse", 0);

  /* "PETSc/cyclicgc.pxi":23
 * cdef int tp_traverse(PyObject *o, visitproc visit, void *arg):
 *     ## printf("%s.tp_traverse(%p)\n", Py_TYPE(o).tp_name, <void*>o)
 *     cdef PetscObject p = (<Object>o).obj[0]             # <<<<<<<<<<<<<<
 *     if p == NULL: return 0
 *     cdef PyObject *d = <PyObject*>p.python_context
 */
  __pyx_v_p = (((struct PyPetscObjectObject *)__pyx_v_o)->obj[0]);

  /* "PETSc/cyclicgc.pxi":24
 *     ## printf("%s.tp_traverse(%p)\n", Py_TYPE(o).tp_name, <void*>o)
 *     cdef PetscObject p = (<Object>o).obj[0]
 *     if p == NULL: return 0             # <<<<<<<<<<<<<<
 *     cdef PyObject *d = <PyObject*>p.python_context
 *     if d == NULL: return 0
 */
  __pyx_t_1 = ((__pyx_v_p == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/cyclicgc.pxi":25
 *     cdef PetscObject p = (<Object>o).obj[0]
 *     if p == NULL: return 0
 *     cdef PyObject *d = <PyObject*>p.python_context             # <<<<<<<<<<<<<<
 *     if d == NULL: return 0
 *     if arg == NULL and _Py_AS_GC(d).gc_refs == 0:
 */
  __pyx_v_d = ((PyObject *)__pyx_v_p->python_context);

  /* "PETSc/cyclicgc.pxi":26
 *     if p == NULL: return 0
 *     cdef PyObject *d = <PyObject*>p.python_context
 *     if d == NULL: return 0             # <<<<<<<<<<<<<<
 *     if arg == NULL and _Py_AS_GC(d).gc_refs == 0:
 *         _Py_AS_GC(d).gc_refs = 1
 */
  __pyx_t_1 = ((__pyx_v_d == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/cyclicgc.pxi":27
 *     cdef PyObject *d = <PyObject*>p.python_context
 *     if d == NULL: return 0
 *     if arg == NULL and _Py_AS_GC(d).gc_refs == 0:             # <<<<<<<<<<<<<<
 *         _Py_AS_GC(d).gc_refs = 1
 *     return visit(d, arg)
 */
  __pyx_t_2 = ((__pyx_v_arg == NULL) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_2 = ((_Py_AS_GC(__pyx_v_d)->gc.gc_refs == 0) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PETSc/cyclicgc.pxi":28
 *     if d == NULL: return 0
 *     if arg == NULL and _Py_AS_GC(d).gc_refs == 0:
 *         _Py_AS_GC(d).gc_refs = 1             # <<<<<<<<<<<<<<
 *     return visit(d, arg)
 * 
 */
    _Py_AS_GC(__pyx_v_d)->gc.gc_refs = 1;

    /* "PETSc/cyclicgc.pxi":27
 *     cdef PyObject *d = <PyObject*>p.python_context
 *     if d == NULL: return 0
 *     if arg == NULL and _Py_AS_GC(d).gc_refs == 0:             # <<<<<<<<<<<<<<
 *         _Py_AS_GC(d).gc_refs = 1
 *     return visit(d, arg)
 */
  }

  /* "PETSc/cyclicgc.pxi":29
 *     if arg == NULL and _Py_AS_GC(d).gc_refs == 0:
 *         _Py_AS_GC(d).gc_refs = 1
 *     return visit(d, arg)             # <<<<<<<<<<<<<<
 * 
 * cdef int tp_clear(PyObject *o):
 */
  __pyx_r = __pyx_v_visit(__pyx_v_d, __pyx_v_arg);
  goto __pyx_L0;

  /* "PETSc/cyclicgc.pxi":21
 *     PyGC_Head *_Py_AS_GC(PyObject*)
 * 
 * cdef int tp_traverse(PyObject *o, visitproc visit, void *arg):             # <<<<<<<<<<<<<<
 *     ## printf("%s.tp_traverse(%p)\n", Py_TYPE(o).tp_name, <void*>o)
 *     cdef PetscObject p = (<Object>o).obj[0]
 */

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

/* "PETSc/cyclicgc.pxi":31
 *     return visit(d, arg)
 * 
 * cdef int tp_clear(PyObject *o):             # <<<<<<<<<<<<<<
 *     ## printf("%s.tp_clear(%p)\n", Py_TYPE(o).tp_name, <void*>o)
 *     cdef PetscObject *p = (<Object>o).obj
 */

static int __pyx_f_8petsc4py_5PETSc_tp_clear(PyObject *__pyx_v_o) {
  PetscObject *__pyx_v_p;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PetscObject *__pyx_t_1;
  __Pyx_RefNannySetupContext("tp_clear", 0);

  /* "PETSc/cyclicgc.pxi":33
 * cdef int tp_clear(PyObject *o):
 *     ## printf("%s.tp_clear(%p)\n", Py_TYPE(o).tp_name, <void*>o)
 *     cdef PetscObject *p = (<Object>o).obj             # <<<<<<<<<<<<<<
 *     PetscDEALLOC(p)
 *     return 0
 */
  __pyx_t_1 = ((struct PyPetscObjectObject *)__pyx_v_o)->obj;
  __pyx_v_p = __pyx_t_1;

  /* "PETSc/cyclicgc.pxi":34
 *     ## printf("%s.tp_clear(%p)\n", Py_TYPE(o).tp_name, <void*>o)
 *     cdef PetscObject *p = (<Object>o).obj
 *     PetscDEALLOC(p)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscDEALLOC(__pyx_v_p);

  /* "PETSc/cyclicgc.pxi":35
 *     cdef PetscObject *p = (<Object>o).obj
 *     PetscDEALLOC(p)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline void TypeEnableGC(PyTypeObject *t):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/cyclicgc.pxi":31
 *     return visit(d, arg)
 * 
 * cdef int tp_clear(PyObject *o):             # <<<<<<<<<<<<<<
 *     ## printf("%s.tp_clear(%p)\n", Py_TYPE(o).tp_name, <void*>o)
 *     cdef PetscObject *p = (<Object>o).obj
 */

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

/* "PETSc/cyclicgc.pxi":37
 *     return 0
 * 
 * cdef inline void TypeEnableGC(PyTypeObject *t):             # <<<<<<<<<<<<<<
 *     ## printf("%s: enforcing GC support\n", t.tp_name)
 *     t.tp_traverse = tp_traverse
 */

static CYTHON_INLINE void __pyx_f_8petsc4py_5PETSc_TypeEnableGC(PyTypeObject *__pyx_v_t) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("TypeEnableGC", 0);

  /* "PETSc/cyclicgc.pxi":39
 * cdef inline void TypeEnableGC(PyTypeObject *t):
 *     ## printf("%s: enforcing GC support\n", t.tp_name)
 *     t.tp_traverse = tp_traverse             # <<<<<<<<<<<<<<
 *     t.tp_clear    = tp_clear
 * 
 */
  __pyx_v_t->tp_traverse = __pyx_f_8petsc4py_5PETSc_tp_traverse;

  /* "PETSc/cyclicgc.pxi":40
 *     ## printf("%s: enforcing GC support\n", t.tp_name)
 *     t.tp_traverse = tp_traverse
 *     t.tp_clear    = tp_clear             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_v_t->tp_clear = __pyx_f_8petsc4py_5PETSc_tp_clear;

  /* "PETSc/cyclicgc.pxi":37
 *     return 0
 * 
 * cdef inline void TypeEnableGC(PyTypeObject *t):             # <<<<<<<<<<<<<<
 *     ## printf("%s: enforcing GC support\n", t.tp_name)
 *     t.tp_traverse = tp_traverse
 */

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

/* "PETSc/Object.pyx":245
 * __type_registry__ = type_registry
 * 
 * cdef int PyPetscType_Register(int classid, type cls) except -1:             # <<<<<<<<<<<<<<
 *     global type_registry
 *     cdef object key = <long>classid
 */

static int __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(int __pyx_v_classid, PyTypeObject *__pyx_v_cls) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  const char *__pyx_v_dummy;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("PyPetscType_Register", 0);

  /* "PETSc/Object.pyx":247
 * cdef int PyPetscType_Register(int classid, type cls) except -1:
 *     global type_registry
 *     cdef object key = <long>classid             # <<<<<<<<<<<<<<
 *     cdef object value = cls
 *     cdef const_char *dummy = NULL
 */
  __pyx_t_1 = __Pyx_PyInt_From_long(((long)__pyx_v_classid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_key = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":248
 *     global type_registry
 *     cdef object key = <long>classid
 *     cdef object value = cls             # <<<<<<<<<<<<<<
 *     cdef const_char *dummy = NULL
 *     if key not in type_registry:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_cls));
  __pyx_v_value = ((PyObject *)__pyx_v_cls);

  /* "PETSc/Object.pyx":249
 *     cdef object key = <long>classid
 *     cdef object value = cls
 *     cdef const_char *dummy = NULL             # <<<<<<<<<<<<<<
 *     if key not in type_registry:
 *         type_registry[key] = cls
 */
  __pyx_v_dummy = NULL;

  /* "PETSc/Object.pyx":250
 *     cdef object value = cls
 *     cdef const_char *dummy = NULL
 *     if key not in type_registry:             # <<<<<<<<<<<<<<
 *         type_registry[key] = cls
 *         reg_LogClass(str2bytes(cls.__name__, &dummy),
 */
  if (unlikely(__pyx_v_8petsc4py_5PETSc_type_registry == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(10, 250, __pyx_L1_error)
  }
  __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_key, __pyx_v_8petsc4py_5PETSc_type_registry, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(10, 250, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Object.pyx":251
 *     cdef const_char *dummy = NULL
 *     if key not in type_registry:
 *         type_registry[key] = cls             # <<<<<<<<<<<<<<
 *         reg_LogClass(str2bytes(cls.__name__, &dummy),
 *                      <PetscLogClass>classid)
 */
    if (unlikely(__pyx_v_8petsc4py_5PETSc_type_registry == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(10, 251, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_8petsc4py_5PETSc_type_registry, __pyx_v_key, ((PyObject *)__pyx_v_cls)) < 0)) __PYX_ERR(10, 251, __pyx_L1_error)

    /* "PETSc/Object.pyx":252
 *     if key not in type_registry:
 *         type_registry[key] = cls
 *         reg_LogClass(str2bytes(cls.__name__, &dummy),             # <<<<<<<<<<<<<<
 *                      <PetscLogClass>classid)
 *         TypeEnableGC(<PyTypeObject*>cls)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_cls), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_t_1, (&__pyx_v_dummy)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PETSc/Object.pyx":253
 *         type_registry[key] = cls
 *         reg_LogClass(str2bytes(cls.__name__, &dummy),
 *                      <PetscLogClass>classid)             # <<<<<<<<<<<<<<
 *         TypeEnableGC(<PyTypeObject*>cls)
 *     else:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_reg_LogClass(__pyx_t_4, ((PetscClassId)__pyx_v_classid))); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PETSc/Object.pyx":254
 *         reg_LogClass(str2bytes(cls.__name__, &dummy),
 *                      <PetscLogClass>classid)
 *         TypeEnableGC(<PyTypeObject*>cls)             # <<<<<<<<<<<<<<
 *     else:
 *         value = type_registry[key]
 */
    __pyx_f_8petsc4py_5PETSc_TypeEnableGC(((PyTypeObject *)__pyx_v_cls));

    /* "PETSc/Object.pyx":250
 *     cdef object value = cls
 *     cdef const_char *dummy = NULL
 *     if key not in type_registry:             # <<<<<<<<<<<<<<
 *         type_registry[key] = cls
 *         reg_LogClass(str2bytes(cls.__name__, &dummy),
 */
    goto __pyx_L3;
  }

  /* "PETSc/Object.pyx":256
 *         TypeEnableGC(<PyTypeObject*>cls)
 *     else:
 *         value = type_registry[key]             # <<<<<<<<<<<<<<
 *         if cls is not value:
 *             raise ValueError(
 */
  /*else*/ {
    if (unlikely(__pyx_v_8petsc4py_5PETSc_type_registry == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(10, 256, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_8petsc4py_5PETSc_type_registry, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "PETSc/Object.pyx":257
 *     else:
 *         value = type_registry[key]
 *         if cls is not value:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 "key: %d, cannot register: %s, " \
 */
    __pyx_t_3 = (__pyx_v_cls != ((PyTypeObject*)__pyx_v_value));
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "PETSc/Object.pyx":260
 *             raise ValueError(
 *                 "key: %d, cannot register: %s, " \
 *                 "already registered: %s" % (key, cls, value))             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_key);
      __Pyx_GIVEREF(__pyx_v_key);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_key);
      __Pyx_INCREF(((PyObject *)__pyx_v_cls));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_cls));
      PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_cls));
      __Pyx_INCREF(__pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_value);
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_key_d_cannot_register_s_already, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "PETSc/Object.pyx":258
 *         value = type_registry[key]
 *         if cls is not value:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 "key: %d, cannot register: %s, " \
 *                 "already registered: %s" % (key, cls, value))
 */
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 258, __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 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(10, 258, __pyx_L1_error)

      /* "PETSc/Object.pyx":257
 *     else:
 *         value = type_registry[key]
 *         if cls is not value:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 "key: %d, cannot register: %s, " \
 */
    }
  }
  __pyx_L3:;

  /* "PETSc/Object.pyx":261
 *                 "key: %d, cannot register: %s, " \
 *                 "already registered: %s" % (key, cls, value))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef type PyPetscType_Lookup(int classid):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":245
 * __type_registry__ = type_registry
 * 
 * cdef int PyPetscType_Register(int classid, type cls) except -1:             # <<<<<<<<<<<<<<
 *     global type_registry
 *     cdef object key = <long>classid
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscType_Register", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Object.pyx":263
 *     return 0
 * 
 * cdef type PyPetscType_Lookup(int classid):             # <<<<<<<<<<<<<<
 *     global type_registry
 *     cdef object key = <long>classid
 */

static PyTypeObject *__pyx_f_8petsc4py_5PETSc_PyPetscType_Lookup(int __pyx_v_classid) {
  PyObject *__pyx_v_key = 0;
  PyTypeObject *__pyx_v_cls = 0;
  PyTypeObject *__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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("PyPetscType_Lookup", 0);

  /* "PETSc/Object.pyx":265
 * cdef type PyPetscType_Lookup(int classid):
 *     global type_registry
 *     cdef object key = <long>classid             # <<<<<<<<<<<<<<
 *     cdef type cls = Object
 *     try:
 */
  __pyx_t_1 = __Pyx_PyInt_From_long(((long)__pyx_v_classid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_key = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":266
 *     global type_registry
 *     cdef object key = <long>classid
 *     cdef type cls = Object             # <<<<<<<<<<<<<<
 *     try:
 *         cls = type_registry[key]
 */
  __Pyx_INCREF(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Object));
  __pyx_v_cls = __pyx_ptype_8petsc4py_5PETSc_Object;

  /* "PETSc/Object.pyx":267
 *     cdef object key = <long>classid
 *     cdef type cls = Object
 *     try:             # <<<<<<<<<<<<<<
 *         cls = type_registry[key]
 *     except KeyError:
 */
  {
    __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:*/ {

      /* "PETSc/Object.pyx":268
 *     cdef type cls = Object
 *     try:
 *         cls = type_registry[key]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         cls = Object
 */
      if (unlikely(__pyx_v_8petsc4py_5PETSc_type_registry == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(10, 268, __pyx_L3_error)
      }
      __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_8petsc4py_5PETSc_type_registry, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 268, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(PyType_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "type", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(10, 268, __pyx_L3_error)
      __Pyx_DECREF_SET(__pyx_v_cls, ((PyTypeObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "PETSc/Object.pyx":267
 *     cdef object key = <long>classid
 *     cdef type cls = Object
 *     try:             # <<<<<<<<<<<<<<
 *         cls = type_registry[key]
 *     except KeyError:
 */
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PETSc/Object.pyx":269
 *     try:
 *         cls = type_registry[key]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         cls = Object
 *     return cls
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("petsc4py.PETSc.PyPetscType_Lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(10, 269, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "PETSc/Object.pyx":270
 *         cls = type_registry[key]
 *     except KeyError:
 *         cls = Object             # <<<<<<<<<<<<<<
 *     return cls
 * 
 */
      __Pyx_INCREF(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Object));
      __Pyx_DECREF_SET(__pyx_v_cls, __pyx_ptype_8petsc4py_5PETSc_Object);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "PETSc/Object.pyx":267
 *     cdef object key = <long>classid
 *     cdef type cls = Object
 *     try:             # <<<<<<<<<<<<<<
 *         cls = type_registry[key]
 *     except KeyError:
 */
    __Pyx_PyThreadState_assign
    __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_L4_exception_handled:;
    __Pyx_PyThreadState_assign
    __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);
    __pyx_L10_try_end:;
  }

  /* "PETSc/Object.pyx":271
 *     except KeyError:
 *         cls = Object
 *     return cls             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_cls));
  __pyx_r = __pyx_v_cls;
  goto __pyx_L0;

  /* "PETSc/Object.pyx":263
 *     return 0
 * 
 * cdef type PyPetscType_Lookup(int classid):             # <<<<<<<<<<<<<<
 *     global type_registry
 *     cdef object key = <long>classid
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscType_Lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_cls);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":83
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.vwr
 *         self.vwr = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_6Viewer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_6Viewer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer___cinit__(((struct PyPetscViewerObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_6Viewer___cinit__(struct PyPetscViewerObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Viewer.pyx":84
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.vwr             # <<<<<<<<<<<<<<
 *         self.vwr = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->vwr));

  /* "PETSc/Viewer.pyx":85
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.vwr
 *         self.vwr = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, Object obj):
 */
  __pyx_v_self->vwr = NULL;

  /* "PETSc/Viewer.pyx":83
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.vwr
 *         self.vwr = NULL
 */

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

/* "PETSc/Viewer.pyx":87
 *         self.vwr = NULL
 * 
 *     def __call__(self, Object obj):             # <<<<<<<<<<<<<<
 *         assert obj.obj != NULL
 *         CHKERR( PetscObjectView(obj.obj[0], self.vwr) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscObjectObject *__pyx_v_obj = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,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);
        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;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(27, 87, __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_obj = ((struct PyPetscObjectObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 87, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obj), __pyx_ptype_8petsc4py_5PETSc_Object, 1, "obj", 0))) __PYX_ERR(27, 87, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_2__call__(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_obj);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_2__call__(struct PyPetscViewerObject *__pyx_v_self, struct PyPetscObjectObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "PETSc/Viewer.pyx":88
 * 
 *     def __call__(self, Object obj):
 *         assert obj.obj != NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectView(obj.obj[0], self.vwr) )
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_obj->obj != NULL) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(27, 88, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/Viewer.pyx":89
 *     def __call__(self, Object obj):
 *         assert obj.obj != NULL
 *         CHKERR( PetscObjectView(obj.obj[0], self.vwr) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectView((__pyx_v_obj->obj[0]), __pyx_v_self->vwr)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 89, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":87
 *         self.vwr = NULL
 * 
 *     def __call__(self, Object obj):             # <<<<<<<<<<<<<<
 *         assert obj.obj != NULL
 *         CHKERR( PetscObjectView(obj.obj[0], self.vwr) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":93
 *     #
 * 
 *     def view(self, obj=None):             # <<<<<<<<<<<<<<
 *         if obj is None:
 *             CHKERR( PetscViewerView(self.vwr, NULL) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_4view[] = "Viewer.view(self, obj=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_obj);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(27, 93, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obj = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 93, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_4view(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_obj);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_4view(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/Viewer.pyx":94
 * 
 *     def view(self, obj=None):
 *         if obj is None:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscViewerView(self.vwr, NULL) )
 *         elif isinstance(obj, Viewer):
 */
  __pyx_t_1 = (__pyx_v_obj == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Viewer.pyx":95
 *     def view(self, obj=None):
 *         if obj is None:
 *             CHKERR( PetscViewerView(self.vwr, NULL) )             # <<<<<<<<<<<<<<
 *         elif isinstance(obj, Viewer):
 *             CHKERR( PetscViewerView(self.vwr, (<Viewer?>obj).vwr) )
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerView(__pyx_v_self->vwr, NULL)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(27, 95, __pyx_L1_error)

    /* "PETSc/Viewer.pyx":94
 * 
 *     def view(self, obj=None):
 *         if obj is None:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscViewerView(self.vwr, NULL) )
 *         elif isinstance(obj, Viewer):
 */
    goto __pyx_L3;
  }

  /* "PETSc/Viewer.pyx":96
 *         if obj is None:
 *             CHKERR( PetscViewerView(self.vwr, NULL) )
 *         elif isinstance(obj, Viewer):             # <<<<<<<<<<<<<<
 *             CHKERR( PetscViewerView(self.vwr, (<Viewer?>obj).vwr) )
 *         else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_ptype_8petsc4py_5PETSc_Viewer); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/Viewer.pyx":97
 *             CHKERR( PetscViewerView(self.vwr, NULL) )
 *         elif isinstance(obj, Viewer):
 *             CHKERR( PetscViewerView(self.vwr, (<Viewer?>obj).vwr) )             # <<<<<<<<<<<<<<
 *         else:
 *             assert (<Object?>obj).obj != NULL
 */
    if (!(likely(__Pyx_TypeTest(__pyx_v_obj, __pyx_ptype_8petsc4py_5PETSc_Viewer)))) __PYX_ERR(27, 97, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerView(__pyx_v_self->vwr, ((struct PyPetscViewerObject *)__pyx_v_obj)->vwr)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(27, 97, __pyx_L1_error)

    /* "PETSc/Viewer.pyx":96
 *         if obj is None:
 *             CHKERR( PetscViewerView(self.vwr, NULL) )
 *         elif isinstance(obj, Viewer):             # <<<<<<<<<<<<<<
 *             CHKERR( PetscViewerView(self.vwr, (<Viewer?>obj).vwr) )
 *         else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Viewer.pyx":99
 *             CHKERR( PetscViewerView(self.vwr, (<Viewer?>obj).vwr) )
 *         else:
 *             assert (<Object?>obj).obj != NULL             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectView((<Object?>obj).obj[0], self.vwr) )
 * 
 */
  /*else*/ {
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (!(likely(__Pyx_TypeTest(__pyx_v_obj, __pyx_ptype_8petsc4py_5PETSc_Object)))) __PYX_ERR(27, 99, __pyx_L1_error)
      if (unlikely(!((((struct PyPetscObjectObject *)__pyx_v_obj)->obj != NULL) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(27, 99, __pyx_L1_error)
      }
    }
    #endif

    /* "PETSc/Viewer.pyx":100
 *         else:
 *             assert (<Object?>obj).obj != NULL
 *             CHKERR( PetscObjectView((<Object?>obj).obj[0], self.vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
    if (!(likely(__Pyx_TypeTest(__pyx_v_obj, __pyx_ptype_8petsc4py_5PETSc_Object)))) __PYX_ERR(27, 100, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectView((((struct PyPetscObjectObject *)__pyx_v_obj)->obj[0]), __pyx_v_self->vwr)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(27, 100, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/Viewer.pyx":93
 *     #
 * 
 *     def view(self, obj=None):             # <<<<<<<<<<<<<<
 *         if obj is None:
 *             CHKERR( PetscViewerView(self.vwr, NULL) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":102
 *             CHKERR( PetscObjectView((<Object?>obj).obj[0], self.vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerDestroy(&self.vwr) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_6destroy[] = "Viewer.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_6destroy(((struct PyPetscViewerObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_6destroy(struct PyPetscViewerObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/Viewer.pyx":103
 * 
 *     def destroy(self):
 *         CHKERR( PetscViewerDestroy(&self.vwr) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerDestroy((&__pyx_v_self->vwr))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 103, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":104
 *     def destroy(self):
 *         CHKERR( PetscViewerDestroy(&self.vwr) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":102
 *             CHKERR( PetscObjectView((<Object?>obj).obj[0], self.vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerDestroy(&self.vwr) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":106
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscViewer newvwr = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_8create[] = "Viewer.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(27, 106, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 106, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_8create(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_8create(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscViewer __pyx_v_newvwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/Viewer.pyx":107
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 107, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":108
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscViewer newvwr = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 */
  __pyx_v_newvwr = NULL;

  /* "PETSc/Viewer.pyx":109
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerCreate(__pyx_v_ccomm, (&__pyx_v_newvwr))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(27, 109, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":110
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vwr = __pyx_v_newvwr;

  /* "PETSc/Viewer.pyx":111
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createASCII(self, name, mode=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":106
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscViewer newvwr = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":113
 *         return self
 * 
 *     def createASCII(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_11createASCII(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_10createASCII[] = "Viewer.createASCII(self, name, mode=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_11createASCII(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createASCII (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_mode,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createASCII") < 0)) __PYX_ERR(27, 113, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_mode = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createASCII", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 113, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createASCII", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_10createASCII(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_name, __pyx_v_mode, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_10createASCII(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  const char *__pyx_v_cname;
  PetscFileMode __pyx_v_cmode;
  PetscViewer __pyx_v_newvwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PetscFileMode __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("createASCII", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Viewer.pyx":114
 * 
 *     def createASCII(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 114, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":115
 *     def createASCII(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = PETSC_FILE_MODE_WRITE
 */
  __pyx_v_cname = NULL;

  /* "PETSc/Viewer.pyx":116
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscFileMode cmode = PETSC_FILE_MODE_WRITE
 *         if mode is not None: filemode(mode)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":117
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = PETSC_FILE_MODE_WRITE             # <<<<<<<<<<<<<<
 *         if mode is not None: filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 */
  __pyx_v_cmode = FILE_MODE_WRITE;

  /* "PETSc/Viewer.pyx":118
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = PETSC_FILE_MODE_WRITE
 *         if mode is not None: filemode(mode)             # <<<<<<<<<<<<<<
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 */
  __pyx_t_3 = (__pyx_v_mode != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_filemode(__pyx_v_mode); if (unlikely(__pyx_t_5 == ((PetscFileMode)-1L))) __PYX_ERR(27, 118, __pyx_L1_error)
  }

  /* "PETSc/Viewer.pyx":119
 *         cdef PetscFileMode cmode = PETSC_FILE_MODE_WRITE
 *         if mode is not None: filemode(mode)
 *         cdef PetscViewer newvwr = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 */
  __pyx_v_newvwr = NULL;

  /* "PETSc/Viewer.pyx":120
 *         if mode is not None: filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERASCII) )
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerCreate(__pyx_v_ccomm, (&__pyx_v_newvwr))); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(27, 120, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":121
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERASCII) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vwr = __pyx_v_newvwr;

  /* "PETSc/Viewer.pyx":122
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERASCII) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerSetType(__pyx_v_self->vwr, PETSCVIEWERASCII)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(27, 122, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":123
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERASCII) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 *         return self
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetMode(__pyx_v_self->vwr, __pyx_v_cmode)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(27, 123, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":124
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERASCII) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetName(__pyx_v_self->vwr, __pyx_v_cname)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(27, 124, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":125
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createBinary(self, name, mode=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":113
 *         return self
 * 
 *     def createASCII(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createASCII", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":127
 *         return self
 * 
 *     def createBinary(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_13createBinary(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_12createBinary[] = "Viewer.createBinary(self, name, mode=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_13createBinary(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createBinary (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_mode,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createBinary") < 0)) __PYX_ERR(27, 127, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_mode = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createBinary", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 127, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createBinary", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_12createBinary(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_name, __pyx_v_mode, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_12createBinary(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  const char *__pyx_v_cname;
  PetscFileMode __pyx_v_cmode;
  PetscViewer __pyx_v_newvwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscFileMode __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createBinary", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Viewer.pyx":128
 * 
 *     def createBinary(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 128, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":129
 *     def createBinary(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)
 */
  __pyx_v_cname = NULL;

  /* "PETSc/Viewer.pyx":130
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":131
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)             # <<<<<<<<<<<<<<
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerBinaryOpen(ccomm, cname, cmode, &newvwr) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_filemode(__pyx_v_mode); if (unlikely(__pyx_t_3 == ((PetscFileMode)-1L))) __PYX_ERR(27, 131, __pyx_L1_error)
  __pyx_v_cmode = __pyx_t_3;

  /* "PETSc/Viewer.pyx":132
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerBinaryOpen(ccomm, cname, cmode, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 */
  __pyx_v_newvwr = NULL;

  /* "PETSc/Viewer.pyx":133
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerBinaryOpen(ccomm, cname, cmode, &newvwr) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerBinaryOpen(__pyx_v_ccomm, __pyx_v_cname, __pyx_v_cmode, (&__pyx_v_newvwr))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 133, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":134
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerBinaryOpen(ccomm, cname, cmode, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vwr = __pyx_v_newvwr;

  /* "PETSc/Viewer.pyx":135
 *         CHKERR( PetscViewerBinaryOpen(ccomm, cname, cmode, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createMPIIO(self, name, mode=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":127
 *         return self
 * 
 *     def createBinary(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createBinary", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":137
 *         return self
 * 
 *     def createMPIIO(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_15createMPIIO(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_14createMPIIO[] = "Viewer.createMPIIO(self, name, mode=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_15createMPIIO(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createMPIIO (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_mode,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createMPIIO") < 0)) __PYX_ERR(27, 137, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_mode = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createMPIIO", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 137, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createMPIIO", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_14createMPIIO(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_name, __pyx_v_mode, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_14createMPIIO(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  const char *__pyx_v_cname;
  PetscFileMode __pyx_v_cmode;
  PetscViewer __pyx_v_newvwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscFileMode __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createMPIIO", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Viewer.pyx":138
 * 
 *     def createMPIIO(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 138, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":139
 *     def createMPIIO(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)
 */
  __pyx_v_cname = NULL;

  /* "PETSc/Viewer.pyx":140
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":141
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)             # <<<<<<<<<<<<<<
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_filemode(__pyx_v_mode); if (unlikely(__pyx_t_3 == ((PetscFileMode)-1L))) __PYX_ERR(27, 141, __pyx_L1_error)
  __pyx_v_cmode = __pyx_t_3;

  /* "PETSc/Viewer.pyx":142
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 */
  __pyx_v_newvwr = NULL;

  /* "PETSc/Viewer.pyx":143
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERBINARY) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerCreate(__pyx_v_ccomm, (&__pyx_v_newvwr))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 143, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":144
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERBINARY) )
 *         CHKERR( PetscViewerBinarySetUseMPIIO(self.vwr, PETSC_TRUE) )
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vwr = __pyx_v_newvwr;

  /* "PETSc/Viewer.pyx":145
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERBINARY) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerBinarySetUseMPIIO(self.vwr, PETSC_TRUE) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerSetType(__pyx_v_self->vwr, PETSCVIEWERBINARY)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 145, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":146
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERBINARY) )
 *         CHKERR( PetscViewerBinarySetUseMPIIO(self.vwr, PETSC_TRUE) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerBinarySetUseMPIIO(__pyx_v_self->vwr, PETSC_TRUE)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 146, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":147
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERBINARY) )
 *         CHKERR( PetscViewerBinarySetUseMPIIO(self.vwr, PETSC_TRUE) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetMode(__pyx_v_self->vwr, __pyx_v_cmode)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 147, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":148
 *         CHKERR( PetscViewerBinarySetUseMPIIO(self.vwr, PETSC_TRUE) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetName(__pyx_v_self->vwr, __pyx_v_cname)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 148, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":149
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createVTK(self, name, mode=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":137
 *         return self
 * 
 *     def createMPIIO(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createMPIIO", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":151
 *         return self
 * 
 *     def createVTK(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_17createVTK(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_16createVTK[] = "Viewer.createVTK(self, name, mode=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_17createVTK(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createVTK (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_mode,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createVTK") < 0)) __PYX_ERR(27, 151, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_mode = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createVTK", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 151, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createVTK", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_16createVTK(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_name, __pyx_v_mode, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_16createVTK(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  const char *__pyx_v_cname;
  PetscFileMode __pyx_v_cmode;
  PetscViewer __pyx_v_newvwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscFileMode __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createVTK", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Viewer.pyx":152
 * 
 *     def createVTK(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 152, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":153
 *     def createVTK(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)
 */
  __pyx_v_cname = NULL;

  /* "PETSc/Viewer.pyx":154
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":155
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)             # <<<<<<<<<<<<<<
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_filemode(__pyx_v_mode); if (unlikely(__pyx_t_3 == ((PetscFileMode)-1L))) __PYX_ERR(27, 155, __pyx_L1_error)
  __pyx_v_cmode = __pyx_t_3;

  /* "PETSc/Viewer.pyx":156
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 */
  __pyx_v_newvwr = NULL;

  /* "PETSc/Viewer.pyx":157
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERVTK) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerCreate(__pyx_v_ccomm, (&__pyx_v_newvwr))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 157, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":158
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERVTK) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vwr = __pyx_v_newvwr;

  /* "PETSc/Viewer.pyx":159
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERVTK) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerSetType(__pyx_v_self->vwr, PETSCVIEWERVTK)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 159, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":160
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERVTK) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetMode(__pyx_v_self->vwr, __pyx_v_cmode)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 160, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":161
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERVTK) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetName(__pyx_v_self->vwr, __pyx_v_cname)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 161, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":162
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createHDF5(self, name, mode=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":151
 *         return self
 * 
 *     def createVTK(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createVTK", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":164
 *         return self
 * 
 *     def createHDF5(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_19createHDF5(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_18createHDF5[] = "Viewer.createHDF5(self, name, mode=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_19createHDF5(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createHDF5 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_mode,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createHDF5") < 0)) __PYX_ERR(27, 164, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_mode = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createHDF5", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 164, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createHDF5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_18createHDF5(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_name, __pyx_v_mode, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_18createHDF5(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  const char *__pyx_v_cname;
  PetscFileMode __pyx_v_cmode;
  PetscViewer __pyx_v_newvwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscFileMode __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createHDF5", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Viewer.pyx":165
 * 
 *     def createHDF5(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 165, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":166
 *     def createHDF5(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)
 */
  __pyx_v_cname = NULL;

  /* "PETSc/Viewer.pyx":167
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":168
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)             # <<<<<<<<<<<<<<
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_filemode(__pyx_v_mode); if (unlikely(__pyx_t_3 == ((PetscFileMode)-1L))) __PYX_ERR(27, 168, __pyx_L1_error)
  __pyx_v_cmode = __pyx_t_3;

  /* "PETSc/Viewer.pyx":169
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 */
  __pyx_v_newvwr = NULL;

  /* "PETSc/Viewer.pyx":170
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERHDF5) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerCreate(__pyx_v_ccomm, (&__pyx_v_newvwr))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 170, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":171
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERHDF5) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vwr = __pyx_v_newvwr;

  /* "PETSc/Viewer.pyx":172
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERHDF5) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerSetType(__pyx_v_self->vwr, PETSCVIEWERHDF5)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 172, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":173
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERHDF5) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetMode(__pyx_v_self->vwr, __pyx_v_cmode)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 173, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":174
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERHDF5) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetName(__pyx_v_self->vwr, __pyx_v_cname)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 174, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":175
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createNetCDF(self, name, mode=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":164
 *         return self
 * 
 *     def createHDF5(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createHDF5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":177
 *         return self
 * 
 *     def createNetCDF(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_21createNetCDF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_20createNetCDF[] = "Viewer.createNetCDF(self, name, mode=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_21createNetCDF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createNetCDF (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_mode,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createNetCDF") < 0)) __PYX_ERR(27, 177, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_mode = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createNetCDF", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 177, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createNetCDF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_20createNetCDF(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_name, __pyx_v_mode, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_20createNetCDF(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  const char *__pyx_v_cname;
  PetscFileMode __pyx_v_cmode;
  PetscViewer __pyx_v_newvwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscFileMode __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createNetCDF", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Viewer.pyx":178
 * 
 *     def createNetCDF(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 178, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":179
 *     def createNetCDF(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)
 */
  __pyx_v_cname = NULL;

  /* "PETSc/Viewer.pyx":180
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":181
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)             # <<<<<<<<<<<<<<
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_filemode(__pyx_v_mode); if (unlikely(__pyx_t_3 == ((PetscFileMode)-1L))) __PYX_ERR(27, 181, __pyx_L1_error)
  __pyx_v_cmode = __pyx_t_3;

  /* "PETSc/Viewer.pyx":182
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 */
  __pyx_v_newvwr = NULL;

  /* "PETSc/Viewer.pyx":183
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERNETCDF) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerCreate(__pyx_v_ccomm, (&__pyx_v_newvwr))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 183, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":184
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERNETCDF) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vwr = __pyx_v_newvwr;

  /* "PETSc/Viewer.pyx":185
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERNETCDF) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerSetType(__pyx_v_self->vwr, PETSCVIEWERNETCDF)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 185, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":186
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERNETCDF) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetMode(__pyx_v_self->vwr, __pyx_v_cmode)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 186, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":187
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERNETCDF) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetName(__pyx_v_self->vwr, __pyx_v_cname)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 187, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":188
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createDraw(self, display=None, title=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":177
 *         return self
 * 
 *     def createNetCDF(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createNetCDF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":190
 *         return self
 * 
 *     def createDraw(self, display=None, title=None,             # <<<<<<<<<<<<<<
 *                    position=None, size=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_23createDraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_22createDraw[] = "Viewer.createDraw(self, display=None, title=None, position=None, size=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_23createDraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_display = 0;
  PyObject *__pyx_v_title = 0;
  PyObject *__pyx_v_position = 0;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createDraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_display,&__pyx_n_s_title,&__pyx_n_s_position,&__pyx_n_s_size,&__pyx_n_s_comm,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);

    /* "PETSc/Viewer.pyx":191
 * 
 *     def createDraw(self, display=None, title=None,
 *                    position=None, size=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cdisplay = NULL
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_display);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_title);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_position);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createDraw") < 0)) __PYX_ERR(27, 190, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_display = values[0];
    __pyx_v_title = values[1];
    __pyx_v_position = values[2];
    __pyx_v_size = values[3];
    __pyx_v_comm = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createDraw", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 190, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createDraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_22createDraw(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_display, __pyx_v_title, __pyx_v_position, __pyx_v_size, __pyx_v_comm);

  /* "PETSc/Viewer.pyx":190
 *         return self
 * 
 *     def createDraw(self, display=None, title=None,             # <<<<<<<<<<<<<<
 *                    position=None, size=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_22createDraw(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_display, PyObject *__pyx_v_title, PyObject *__pyx_v_position, PyObject *__pyx_v_size, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  const char *__pyx_v_cdisplay;
  const char *__pyx_v_ctitle;
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_h;
  int __pyx_v_w;
  PetscViewer __pyx_v_newvwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("createDraw", 0);
  __Pyx_INCREF(__pyx_v_display);
  __Pyx_INCREF(__pyx_v_title);

  /* "PETSc/Viewer.pyx":192
 *     def createDraw(self, display=None, title=None,
 *                    position=None, size=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef const_char *cdisplay = NULL
 *         cdef const_char *ctitle = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 192, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":193
 *                    position=None, size=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cdisplay = NULL             # <<<<<<<<<<<<<<
 *         cdef const_char *ctitle = NULL
 *         display = str2bytes(display, &cdisplay)
 */
  __pyx_v_cdisplay = NULL;

  /* "PETSc/Viewer.pyx":194
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cdisplay = NULL
 *         cdef const_char *ctitle = NULL             # <<<<<<<<<<<<<<
 *         display = str2bytes(display, &cdisplay)
 *         title = str2bytes(title, &ctitle)
 */
  __pyx_v_ctitle = NULL;

  /* "PETSc/Viewer.pyx":195
 *         cdef const_char *cdisplay = NULL
 *         cdef const_char *ctitle = NULL
 *         display = str2bytes(display, &cdisplay)             # <<<<<<<<<<<<<<
 *         title = str2bytes(title, &ctitle)
 *         cdef int x, y, h, w
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_display, (&__pyx_v_cdisplay)); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_display, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":196
 *         cdef const_char *ctitle = NULL
 *         display = str2bytes(display, &cdisplay)
 *         title = str2bytes(title, &ctitle)             # <<<<<<<<<<<<<<
 *         cdef int x, y, h, w
 *         x = y = h = w = PETSC_DECIDE
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_title, (&__pyx_v_ctitle)); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_title, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":198
 *         title = str2bytes(title, &ctitle)
 *         cdef int x, y, h, w
 *         x = y = h = w = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         if position not in (None, PETSC_DECIDE):
 *             x, y = position
 */
  __pyx_v_x = PETSC_DECIDE;
  __pyx_v_y = PETSC_DECIDE;
  __pyx_v_h = PETSC_DECIDE;
  __pyx_v_w = PETSC_DECIDE;

  /* "PETSc/Viewer.pyx":199
 *         cdef int x, y, h, w
 *         x = y = h = w = PETSC_DECIDE
 *         if position not in (None, PETSC_DECIDE):             # <<<<<<<<<<<<<<
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):
 */
  __Pyx_INCREF(__pyx_v_position);
  __pyx_t_2 = __pyx_v_position;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(27, 199, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(27, 199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyInt_From_int(PETSC_DECIDE); if (unlikely(!__pyx_t_4)) __PYX_ERR(27, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(27, 199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(27, 199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = (__pyx_t_3 != 0);
  if (__pyx_t_5) {

    /* "PETSc/Viewer.pyx":200
 *         x = y = h = w = PETSC_DECIDE
 *         if position not in (None, PETSC_DECIDE):
 *             x, y = position             # <<<<<<<<<<<<<<
 *         if size not in (None, PETSC_DECIDE):
 *             try:
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_position))) || (PyList_CheckExact(__pyx_v_position))) {
      PyObject* sequence = __pyx_v_position;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(27, 200, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(27, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_v_position); if (unlikely(!__pyx_t_4)) __PYX_ERR(27, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_6 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_4), 2) < 0) __PYX_ERR(27, 200, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(27, 200, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(27, 200, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(27, 200, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_x = __pyx_t_8;
    __pyx_v_y = __pyx_t_9;

    /* "PETSc/Viewer.pyx":199
 *         cdef int x, y, h, w
 *         x = y = h = w = PETSC_DECIDE
 *         if position not in (None, PETSC_DECIDE):             # <<<<<<<<<<<<<<
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):
 */
  }

  /* "PETSc/Viewer.pyx":201
 *         if position not in (None, PETSC_DECIDE):
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):             # <<<<<<<<<<<<<<
 *             try:
 *                 w, h = size
 */
  __Pyx_INCREF(__pyx_v_size);
  __pyx_t_6 = __pyx_v_size;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 201, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(27, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_5 = __pyx_t_3;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyInt_From_int(PETSC_DECIDE); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(27, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(27, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __pyx_t_3;
  __pyx_L9_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = (__pyx_t_5 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Viewer.pyx":202
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):
 *             try:             # <<<<<<<<<<<<<<
 *                 w, h = size
 *             except TypeError:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      /*try:*/ {

        /* "PETSc/Viewer.pyx":203
 *         if size not in (None, PETSC_DECIDE):
 *             try:
 *                 w, h = size             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 w = h = size
 */
        if ((likely(PyTuple_CheckExact(__pyx_v_size))) || (PyList_CheckExact(__pyx_v_size))) {
          PyObject* sequence = __pyx_v_size;
          #if CYTHON_COMPILING_IN_CPYTHON
          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(27, 203, __pyx_L11_error)
          }
          #if CYTHON_COMPILING_IN_CPYTHON
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_4);
          #else
          __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(27, 203, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(27, 203, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          Py_ssize_t index = -1;
          __pyx_t_2 = PyObject_GetIter(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 203, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext;
          index = 0; __pyx_t_6 = __pyx_t_7(__pyx_t_2); if (unlikely(!__pyx_t_6)) goto __pyx_L19_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_6);
          index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_2); if (unlikely(!__pyx_t_4)) goto __pyx_L19_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_4);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_2), 2) < 0) __PYX_ERR(27, 203, __pyx_L11_error)
          __pyx_t_7 = NULL;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L20_unpacking_done;
          __pyx_L19_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_7 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(27, 203, __pyx_L11_error)
          __pyx_L20_unpacking_done:;
        }
        __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(27, 203, __pyx_L11_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(27, 203, __pyx_L11_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_w = __pyx_t_9;
        __pyx_v_h = __pyx_t_8;

        /* "PETSc/Viewer.pyx":202
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):
 *             try:             # <<<<<<<<<<<<<<
 *                 w, h = size
 *             except TypeError:
 */
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L18_try_end;
      __pyx_L11_error:;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "PETSc/Viewer.pyx":204
 *             try:
 *                 w, h = size
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 w = h = size
 *         cdef PetscViewer newvwr = NULL
 */
      __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
      if (__pyx_t_8) {
        __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createDraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_2) < 0) __PYX_ERR(27, 204, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_2);

        /* "PETSc/Viewer.pyx":205
 *                 w, h = size
 *             except TypeError:
 *                 w = h = size             # <<<<<<<<<<<<<<
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerDrawOpen(ccomm, cdisplay, ctitle,
 */
        __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(27, 205, __pyx_L13_except_error)
        __pyx_v_w = __pyx_t_8;
        __pyx_v_h = __pyx_t_8;
        __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;
        goto __pyx_L12_exception_handled;
      }
      goto __pyx_L13_except_error;
      __pyx_L13_except_error:;

      /* "PETSc/Viewer.pyx":202
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):
 *             try:             # <<<<<<<<<<<<<<
 *                 w, h = size
 *             except TypeError:
 */
      __Pyx_PyThreadState_assign
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      goto __pyx_L1_error;
      __pyx_L12_exception_handled:;
      __Pyx_PyThreadState_assign
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_L18_try_end:;
    }

    /* "PETSc/Viewer.pyx":201
 *         if position not in (None, PETSC_DECIDE):
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):             # <<<<<<<<<<<<<<
 *             try:
 *                 w, h = size
 */
  }

  /* "PETSc/Viewer.pyx":206
 *             except TypeError:
 *                 w = h = size
 *         cdef PetscViewer newvwr = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerDrawOpen(ccomm, cdisplay, ctitle,
 *                                     x, y, w, h, &newvwr) )
 */
  __pyx_v_newvwr = NULL;

  /* "PETSc/Viewer.pyx":207
 *                 w = h = size
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerDrawOpen(ccomm, cdisplay, ctitle,             # <<<<<<<<<<<<<<
 *                                     x, y, w, h, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerDrawOpen(__pyx_v_ccomm, __pyx_v_cdisplay, __pyx_v_ctitle, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h, (&__pyx_v_newvwr))); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(27, 207, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":209
 *         CHKERR( PetscViewerDrawOpen(ccomm, cdisplay, ctitle,
 *                                     x, y, w, h, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vwr = __pyx_v_newvwr;

  /* "PETSc/Viewer.pyx":210
 *                                     x, y, w, h, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, vwr_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":190
 *         return self
 * 
 *     def createDraw(self, display=None, title=None,             # <<<<<<<<<<<<<<
 *                    position=None, size=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.createDraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_display);
  __Pyx_XDECREF(__pyx_v_title);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":212
 *         return self
 * 
 *     def setType(self, vwr_type):             # <<<<<<<<<<<<<<
 *         cdef PetscViewerType cval = NULL
 *         vwr_type = str2bytes(vwr_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_25setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_24setType[] = "Viewer.setType(self, vwr_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_25setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vwr_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vwr_type,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);
        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_vwr_type)) != 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, "setType") < 0)) __PYX_ERR(27, 212, __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_vwr_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 212, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_24setType(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_vwr_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_24setType(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_vwr_type) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_vwr_type);

  /* "PETSc/Viewer.pyx":213
 * 
 *     def setType(self, vwr_type):
 *         cdef PetscViewerType cval = NULL             # <<<<<<<<<<<<<<
 *         vwr_type = str2bytes(vwr_type, &cval)
 *         CHKERR( PetscViewerSetType(self.vwr, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Viewer.pyx":214
 *     def setType(self, vwr_type):
 *         cdef PetscViewerType cval = NULL
 *         vwr_type = str2bytes(vwr_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerSetType(self.vwr, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_vwr_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_vwr_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Viewer.pyx":215
 *         cdef PetscViewerType cval = NULL
 *         vwr_type = str2bytes(vwr_type, &cval)
 *         CHKERR( PetscViewerSetType(self.vwr, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerSetType(__pyx_v_self->vwr, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(27, 215, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":212
 *         return self
 * 
 *     def setType(self, vwr_type):             # <<<<<<<<<<<<<<
 *         cdef PetscViewerType cval = NULL
 *         vwr_type = str2bytes(vwr_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_vwr_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":217
 *         CHKERR( PetscViewerSetType(self.vwr, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscViewerType cval = NULL
 *         CHKERR( PetscViewerGetType(self.vwr, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_27getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_26getType[] = "Viewer.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_27getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_26getType(((struct PyPetscViewerObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_26getType(struct PyPetscViewerObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/Viewer.pyx":218
 * 
 *     def getType(self):
 *         cdef PetscViewerType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerGetType(self.vwr, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Viewer.pyx":219
 *     def getType(self):
 *         cdef PetscViewerType cval = NULL
 *         CHKERR( PetscViewerGetType(self.vwr, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerGetType(__pyx_v_self->vwr, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 219, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":220
 *         cdef PetscViewerType cval = NULL
 *         CHKERR( PetscViewerGetType(self.vwr, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def getFormat(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":217
 *         CHKERR( PetscViewerSetType(self.vwr, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscViewerType cval = NULL
 *         CHKERR( PetscViewerGetType(self.vwr, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":222
 *         return bytes2str(cval)
 * 
 *     def getFormat(self):             # <<<<<<<<<<<<<<
 *         cdef PetscViewerFormat format = PETSC_VIEWER_DEFAULT
 *         CHKERR( PetscViewerGetFormat(self.vwr, &format) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_29getFormat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_28getFormat[] = "Viewer.getFormat(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_29getFormat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFormat (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getFormat", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getFormat", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_28getFormat(((struct PyPetscViewerObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_28getFormat(struct PyPetscViewerObject *__pyx_v_self) {
  PetscViewerFormat __pyx_v_format;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getFormat", 0);

  /* "PETSc/Viewer.pyx":223
 * 
 *     def getFormat(self):
 *         cdef PetscViewerFormat format = PETSC_VIEWER_DEFAULT             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerGetFormat(self.vwr, &format) )
 *         return format
 */
  __pyx_v_format = PETSC_VIEWER_DEFAULT;

  /* "PETSc/Viewer.pyx":224
 *     def getFormat(self):
 *         cdef PetscViewerFormat format = PETSC_VIEWER_DEFAULT
 *         CHKERR( PetscViewerGetFormat(self.vwr, &format) )             # <<<<<<<<<<<<<<
 *         return format
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerGetFormat(__pyx_v_self->vwr, (&__pyx_v_format))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 224, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":225
 *         cdef PetscViewerFormat format = PETSC_VIEWER_DEFAULT
 *         CHKERR( PetscViewerGetFormat(self.vwr, &format) )
 *         return format             # <<<<<<<<<<<<<<
 * 
 *     def pushFormat(self, format):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscViewerFormat(__pyx_v_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":222
 *         return bytes2str(cval)
 * 
 *     def getFormat(self):             # <<<<<<<<<<<<<<
 *         cdef PetscViewerFormat format = PETSC_VIEWER_DEFAULT
 *         CHKERR( PetscViewerGetFormat(self.vwr, &format) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.getFormat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":227
 *         return format
 * 
 *     def pushFormat(self, format):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerPushFormat(self.vwr, format) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_31pushFormat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_30pushFormat[] = "Viewer.pushFormat(self, format)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_31pushFormat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_format = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pushFormat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_format,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);
        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_format)) != 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, "pushFormat") < 0)) __PYX_ERR(27, 227, __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_format = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pushFormat", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 227, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.pushFormat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_30pushFormat(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_format);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_30pushFormat(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_format) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscViewerFormat __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("pushFormat", 0);

  /* "PETSc/Viewer.pyx":228
 * 
 *     def pushFormat(self, format):
 *         CHKERR( PetscViewerPushFormat(self.vwr, format) )             # <<<<<<<<<<<<<<
 * 
 *     def popFormat(self):
 */
  __pyx_t_1 = ((PetscViewerFormat)__Pyx_PyInt_As_PetscViewerFormat(__pyx_v_format)); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 228, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerPushFormat(__pyx_v_self->vwr, __pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(27, 228, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":227
 *         return format
 * 
 *     def pushFormat(self, format):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerPushFormat(self.vwr, format) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.pushFormat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":230
 *         CHKERR( PetscViewerPushFormat(self.vwr, format) )
 * 
 *     def popFormat(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerPopFormat(self.vwr) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_33popFormat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_32popFormat[] = "Viewer.popFormat(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_33popFormat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("popFormat (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("popFormat", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "popFormat", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_32popFormat(((struct PyPetscViewerObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_32popFormat(struct PyPetscViewerObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("popFormat", 0);

  /* "PETSc/Viewer.pyx":231
 * 
 *     def popFormat(self):
 *         CHKERR( PetscViewerPopFormat(self.vwr) )             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerPopFormat(__pyx_v_self->vwr)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 231, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":230
 *         CHKERR( PetscViewerPushFormat(self.vwr, format) )
 * 
 *     def popFormat(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerPopFormat(self.vwr) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.popFormat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":234
 * 
 *     @classmethod
 *     def STDOUT(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_35STDOUT(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_34STDOUT[] = "Viewer.STDOUT(type cls, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_35STDOUT(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("STDOUT (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "STDOUT") < 0)) __PYX_ERR(27, 234, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("STDOUT", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 234, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.STDOUT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_34STDOUT(((PyTypeObject*)__pyx_v_cls), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_34STDOUT(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscViewer __pyx_t_3;
  __Pyx_RefNannySetupContext("STDOUT", 0);

  /* "PETSc/Viewer.pyx":235
 *     @classmethod
 *     def STDOUT(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef Viewer viewer = Viewer()
 *         viewer.vwr = PETSC_VIEWER_STDOUT_(ccomm)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 235, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":236
 *     def STDOUT(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()             # <<<<<<<<<<<<<<
 *         viewer.vwr = PETSC_VIEWER_STDOUT_(ccomm)
 *         PetscINCREF(viewer.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_viewer = ((struct PyPetscViewerObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":237
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 *         viewer.vwr = PETSC_VIEWER_STDOUT_(ccomm)             # <<<<<<<<<<<<<<
 *         PetscINCREF(viewer.obj)
 *         return viewer
 */
  __pyx_t_3 = PETSC_VIEWER_STDOUT_(__pyx_v_ccomm); if (unlikely(__pyx_t_3 == NULL && PyErr_Occurred())) __PYX_ERR(27, 237, __pyx_L1_error)
  __pyx_v_viewer->vwr = __pyx_t_3;

  /* "PETSc/Viewer.pyx":238
 *         cdef Viewer viewer = Viewer()
 *         viewer.vwr = PETSC_VIEWER_STDOUT_(ccomm)
 *         PetscINCREF(viewer.obj)             # <<<<<<<<<<<<<<
 *         return viewer
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_viewer->__pyx_base.obj);

  /* "PETSc/Viewer.pyx":239
 *         viewer.vwr = PETSC_VIEWER_STDOUT_(ccomm)
 *         PetscINCREF(viewer.obj)
 *         return viewer             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_viewer));
  __pyx_r = ((PyObject *)__pyx_v_viewer);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":234
 * 
 *     @classmethod
 *     def STDOUT(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.STDOUT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_viewer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":242
 * 
 *     @classmethod
 *     def STDERR(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_37STDERR(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_36STDERR[] = "Viewer.STDERR(type cls, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_37STDERR(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("STDERR (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "STDERR") < 0)) __PYX_ERR(27, 242, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("STDERR", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 242, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.STDERR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_36STDERR(((PyTypeObject*)__pyx_v_cls), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_36STDERR(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscViewer __pyx_t_3;
  __Pyx_RefNannySetupContext("STDERR", 0);

  /* "PETSc/Viewer.pyx":243
 *     @classmethod
 *     def STDERR(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef Viewer viewer = Viewer()
 *         viewer.vwr = PETSC_VIEWER_STDERR_(ccomm)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 243, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":244
 *     def STDERR(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()             # <<<<<<<<<<<<<<
 *         viewer.vwr = PETSC_VIEWER_STDERR_(ccomm)
 *         PetscINCREF(viewer.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_viewer = ((struct PyPetscViewerObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":245
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 *         viewer.vwr = PETSC_VIEWER_STDERR_(ccomm)             # <<<<<<<<<<<<<<
 *         PetscINCREF(viewer.obj)
 *         return viewer
 */
  __pyx_t_3 = PETSC_VIEWER_STDERR_(__pyx_v_ccomm); if (unlikely(__pyx_t_3 == NULL && PyErr_Occurred())) __PYX_ERR(27, 245, __pyx_L1_error)
  __pyx_v_viewer->vwr = __pyx_t_3;

  /* "PETSc/Viewer.pyx":246
 *         cdef Viewer viewer = Viewer()
 *         viewer.vwr = PETSC_VIEWER_STDERR_(ccomm)
 *         PetscINCREF(viewer.obj)             # <<<<<<<<<<<<<<
 *         return viewer
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_viewer->__pyx_base.obj);

  /* "PETSc/Viewer.pyx":247
 *         viewer.vwr = PETSC_VIEWER_STDERR_(ccomm)
 *         PetscINCREF(viewer.obj)
 *         return viewer             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_viewer));
  __pyx_r = ((PyObject *)__pyx_v_viewer);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":242
 * 
 *     @classmethod
 *     def STDERR(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.STDERR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_viewer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":250
 * 
 *     @classmethod
 *     def ASCII(cls, name, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_39ASCII(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_38ASCII[] = "Viewer.ASCII(type cls, name, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_39ASCII(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ASCII (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_comm,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ASCII") < 0)) __PYX_ERR(27, 250, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_comm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ASCII", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 250, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.ASCII", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_38ASCII(((PyTypeObject*)__pyx_v_cls), __pyx_v_name, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_38ASCII(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_name, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  const char *__pyx_v_cname;
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("ASCII", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Viewer.pyx":251
 *     @classmethod
 *     def ASCII(cls, name, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 251, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":252
 *     def ASCII(cls, name, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef Viewer viewer = Viewer()
 */
  __pyx_v_cname = NULL;

  /* "PETSc/Viewer.pyx":253
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef Viewer viewer = Viewer()
 *         CHKERR( PetscViewerASCIIOpen(ccomm, cname, &viewer.vwr) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":254
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef Viewer viewer = Viewer()             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerASCIIOpen(ccomm, cname, &viewer.vwr) )
 *         return viewer
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_viewer = ((struct PyPetscViewerObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":255
 *         name = str2bytes(name, &cname)
 *         cdef Viewer viewer = Viewer()
 *         CHKERR( PetscViewerASCIIOpen(ccomm, cname, &viewer.vwr) )             # <<<<<<<<<<<<<<
 *         return viewer
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerASCIIOpen(__pyx_v_ccomm, __pyx_v_cname, (&__pyx_v_viewer->vwr))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(27, 255, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":256
 *         cdef Viewer viewer = Viewer()
 *         CHKERR( PetscViewerASCIIOpen(ccomm, cname, &viewer.vwr) )
 *         return viewer             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_viewer));
  __pyx_r = ((PyObject *)__pyx_v_viewer);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":250
 * 
 *     @classmethod
 *     def ASCII(cls, name, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.ASCII", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_viewer);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":259
 * 
 *     @classmethod
 *     def BINARY(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_41BINARY(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_40BINARY[] = "Viewer.BINARY(type cls, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_41BINARY(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("BINARY (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "BINARY") < 0)) __PYX_ERR(27, 259, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("BINARY", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 259, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.BINARY", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_40BINARY(((PyTypeObject*)__pyx_v_cls), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_40BINARY(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscViewer __pyx_t_3;
  __Pyx_RefNannySetupContext("BINARY", 0);

  /* "PETSc/Viewer.pyx":260
 *     @classmethod
 *     def BINARY(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef Viewer viewer = Viewer()
 *         viewer.vwr = PETSC_VIEWER_BINARY_(ccomm)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 260, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":261
 *     def BINARY(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()             # <<<<<<<<<<<<<<
 *         viewer.vwr = PETSC_VIEWER_BINARY_(ccomm)
 *         PetscINCREF(viewer.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_viewer = ((struct PyPetscViewerObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":262
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 *         viewer.vwr = PETSC_VIEWER_BINARY_(ccomm)             # <<<<<<<<<<<<<<
 *         PetscINCREF(viewer.obj)
 *         return viewer
 */
  __pyx_t_3 = PETSC_VIEWER_BINARY_(__pyx_v_ccomm); if (unlikely(__pyx_t_3 == NULL && PyErr_Occurred())) __PYX_ERR(27, 262, __pyx_L1_error)
  __pyx_v_viewer->vwr = __pyx_t_3;

  /* "PETSc/Viewer.pyx":263
 *         cdef Viewer viewer = Viewer()
 *         viewer.vwr = PETSC_VIEWER_BINARY_(ccomm)
 *         PetscINCREF(viewer.obj)             # <<<<<<<<<<<<<<
 *         return viewer
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_viewer->__pyx_base.obj);

  /* "PETSc/Viewer.pyx":264
 *         viewer.vwr = PETSC_VIEWER_BINARY_(ccomm)
 *         PetscINCREF(viewer.obj)
 *         return viewer             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_viewer));
  __pyx_r = ((PyObject *)__pyx_v_viewer);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":259
 * 
 *     @classmethod
 *     def BINARY(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.BINARY", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_viewer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":267
 * 
 *     @classmethod
 *     def DRAW(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_43DRAW(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_42DRAW[] = "Viewer.DRAW(type cls, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_43DRAW(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("DRAW (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "DRAW") < 0)) __PYX_ERR(27, 267, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("DRAW", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 267, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.DRAW", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_42DRAW(((PyTypeObject*)__pyx_v_cls), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_42DRAW(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscViewer __pyx_t_3;
  __Pyx_RefNannySetupContext("DRAW", 0);

  /* "PETSc/Viewer.pyx":268
 *     @classmethod
 *     def DRAW(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef Viewer viewer = Viewer()
 *         viewer.vwr = PETSC_VIEWER_DRAW_(ccomm)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 268, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":269
 *     def DRAW(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()             # <<<<<<<<<<<<<<
 *         viewer.vwr = PETSC_VIEWER_DRAW_(ccomm)
 *         PetscINCREF(viewer.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_viewer = ((struct PyPetscViewerObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":270
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 *         viewer.vwr = PETSC_VIEWER_DRAW_(ccomm)             # <<<<<<<<<<<<<<
 *         PetscINCREF(viewer.obj)
 *         return viewer
 */
  __pyx_t_3 = PETSC_VIEWER_DRAW_(__pyx_v_ccomm); if (unlikely(__pyx_t_3 == NULL && PyErr_Occurred())) __PYX_ERR(27, 270, __pyx_L1_error)
  __pyx_v_viewer->vwr = __pyx_t_3;

  /* "PETSc/Viewer.pyx":271
 *         cdef Viewer viewer = Viewer()
 *         viewer.vwr = PETSC_VIEWER_DRAW_(ccomm)
 *         PetscINCREF(viewer.obj)             # <<<<<<<<<<<<<<
 *         return viewer
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_viewer->__pyx_base.obj);

  /* "PETSc/Viewer.pyx":272
 *         viewer.vwr = PETSC_VIEWER_DRAW_(ccomm)
 *         PetscINCREF(viewer.obj)
 *         return viewer             # <<<<<<<<<<<<<<
 * 
 *     # --- methods specific to file viewers ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_viewer));
  __pyx_r = ((PyObject *)__pyx_v_viewer);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":267
 * 
 *     @classmethod
 *     def DRAW(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.DRAW", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_viewer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":276
 *     # --- methods specific to file viewers ---
 * 
 *     def flush(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFlush(self.vwr) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_45flush(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_44flush[] = "Viewer.flush(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_45flush(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flush (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("flush", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "flush", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_44flush(((struct PyPetscViewerObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_44flush(struct PyPetscViewerObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("flush", 0);

  /* "PETSc/Viewer.pyx":277
 * 
 *     def flush(self):
 *         CHKERR( PetscViewerFlush(self.vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def setFileMode(self, mode):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFlush(__pyx_v_self->vwr)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 277, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":276
 *     # --- methods specific to file viewers ---
 * 
 *     def flush(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFlush(self.vwr) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":279
 *         CHKERR( PetscViewerFlush(self.vwr) )
 * 
 *     def setFileMode(self, mode):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetMode(self.vwr, filemode(mode)) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_47setFileMode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_46setFileMode[] = "Viewer.setFileMode(self, mode)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_47setFileMode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFileMode (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mode,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);
        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_mode)) != 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, "setFileMode") < 0)) __PYX_ERR(27, 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_mode = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFileMode", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 279, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.setFileMode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_46setFileMode(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_mode);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_46setFileMode(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_mode) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscFileMode __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFileMode", 0);

  /* "PETSc/Viewer.pyx":280
 * 
 *     def setFileMode(self, mode):
 *         CHKERR( PetscViewerFileSetMode(self.vwr, filemode(mode)) )             # <<<<<<<<<<<<<<
 * 
 *     def getFileMode(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_filemode(__pyx_v_mode); if (unlikely(__pyx_t_1 == ((PetscFileMode)-1L))) __PYX_ERR(27, 280, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetMode(__pyx_v_self->vwr, __pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(27, 280, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":279
 *         CHKERR( PetscViewerFlush(self.vwr) )
 * 
 *     def setFileMode(self, mode):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetMode(self.vwr, filemode(mode)) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.setFileMode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":282
 *         CHKERR( PetscViewerFileSetMode(self.vwr, filemode(mode)) )
 * 
 *     def getFileMode(self):             # <<<<<<<<<<<<<<
 *         cdef PetscFileMode mode = PETSC_FILE_MODE_READ
 *         CHKERR( PetscViewerFileGetMode(self.vwr, &mode) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_49getFileMode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_48getFileMode[] = "Viewer.getFileMode(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_49getFileMode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFileMode (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getFileMode", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getFileMode", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_48getFileMode(((struct PyPetscViewerObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_48getFileMode(struct PyPetscViewerObject *__pyx_v_self) {
  PetscFileMode __pyx_v_mode;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getFileMode", 0);

  /* "PETSc/Viewer.pyx":283
 * 
 *     def getFileMode(self):
 *         cdef PetscFileMode mode = PETSC_FILE_MODE_READ             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileGetMode(self.vwr, &mode) )
 *         return mode
 */
  __pyx_v_mode = FILE_MODE_READ;

  /* "PETSc/Viewer.pyx":284
 *     def getFileMode(self):
 *         cdef PetscFileMode mode = PETSC_FILE_MODE_READ
 *         CHKERR( PetscViewerFileGetMode(self.vwr, &mode) )             # <<<<<<<<<<<<<<
 *         return mode
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileGetMode(__pyx_v_self->vwr, (&__pyx_v_mode))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 284, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":285
 *         cdef PetscFileMode mode = PETSC_FILE_MODE_READ
 *         CHKERR( PetscViewerFileGetMode(self.vwr, &mode) )
 *         return mode             # <<<<<<<<<<<<<<
 * 
 *     def setFileName(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscFileMode(__pyx_v_mode); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":282
 *         CHKERR( PetscViewerFileSetMode(self.vwr, filemode(mode)) )
 * 
 *     def getFileMode(self):             # <<<<<<<<<<<<<<
 *         cdef PetscFileMode mode = PETSC_FILE_MODE_READ
 *         CHKERR( PetscViewerFileGetMode(self.vwr, &mode) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.getFileMode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":287
 *         return mode
 * 
 *     def setFileName(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_51setFileName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_50setFileName[] = "Viewer.setFileName(self, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_51setFileName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFileName (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);
        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, "setFileName") < 0)) __PYX_ERR(27, 287, __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("setFileName", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 287, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.setFileName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_50setFileName(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_name);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_50setFileName(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_name) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFileName", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Viewer.pyx":288
 * 
 *     def setFileName(self, name):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cval)
 *         CHKERR( PetscViewerFileSetName(self.vwr, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Viewer.pyx":289
 *     def setFileName(self, name):
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetName(self.vwr, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Viewer.pyx":290
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 *         CHKERR( PetscViewerFileSetName(self.vwr, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getFileName(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetName(__pyx_v_self->vwr, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(27, 290, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":287
 *         return mode
 * 
 *     def setFileName(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.setFileName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":292
 *         CHKERR( PetscViewerFileSetName(self.vwr, cval) )
 * 
 *     def getFileName(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscViewerFileGetName(self.vwr, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_53getFileName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_52getFileName[] = "Viewer.getFileName(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_53getFileName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFileName (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getFileName", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getFileName", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_52getFileName(((struct PyPetscViewerObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_52getFileName(struct PyPetscViewerObject *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getFileName", 0);

  /* "PETSc/Viewer.pyx":293
 * 
 *     def getFileName(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileGetName(self.vwr, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Viewer.pyx":294
 *     def getFileName(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscViewerFileGetName(self.vwr, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileGetName(__pyx_v_self->vwr, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 294, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":295
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscViewerFileGetName(self.vwr, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     # --- methods specific to draw viewers ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":292
 *         CHKERR( PetscViewerFileSetName(self.vwr, cval) )
 * 
 *     def getFileName(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PetscViewerFileGetName(self.vwr, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.getFileName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":299
 *     # --- methods specific to draw viewers ---
 * 
 *     def setDrawInfo(self,  display=None, title=None, position=None, size=None):             # <<<<<<<<<<<<<<
 *         cdef const_char *cdisplay = NULL
 *         cdef const_char *ctitle = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_55setDrawInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_54setDrawInfo[] = "Viewer.setDrawInfo(self, display=None, title=None, position=None, size=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_55setDrawInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_display = 0;
  PyObject *__pyx_v_title = 0;
  PyObject *__pyx_v_position = 0;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDrawInfo (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_display,&__pyx_n_s_title,&__pyx_n_s_position,&__pyx_n_s_size,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_display);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_title);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_position);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setDrawInfo") < 0)) __PYX_ERR(27, 299, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_display = values[0];
    __pyx_v_title = values[1];
    __pyx_v_position = values[2];
    __pyx_v_size = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDrawInfo", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 299, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.setDrawInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_54setDrawInfo(((struct PyPetscViewerObject *)__pyx_v_self), __pyx_v_display, __pyx_v_title, __pyx_v_position, __pyx_v_size);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_54setDrawInfo(struct PyPetscViewerObject *__pyx_v_self, PyObject *__pyx_v_display, PyObject *__pyx_v_title, PyObject *__pyx_v_position, PyObject *__pyx_v_size) {
  const char *__pyx_v_cdisplay;
  const char *__pyx_v_ctitle;
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_h;
  int __pyx_v_w;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  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;
  __Pyx_RefNannySetupContext("setDrawInfo", 0);
  __Pyx_INCREF(__pyx_v_display);
  __Pyx_INCREF(__pyx_v_title);

  /* "PETSc/Viewer.pyx":300
 * 
 *     def setDrawInfo(self,  display=None, title=None, position=None, size=None):
 *         cdef const_char *cdisplay = NULL             # <<<<<<<<<<<<<<
 *         cdef const_char *ctitle = NULL
 *         display = str2bytes(display, &cdisplay)
 */
  __pyx_v_cdisplay = NULL;

  /* "PETSc/Viewer.pyx":301
 *     def setDrawInfo(self,  display=None, title=None, position=None, size=None):
 *         cdef const_char *cdisplay = NULL
 *         cdef const_char *ctitle = NULL             # <<<<<<<<<<<<<<
 *         display = str2bytes(display, &cdisplay)
 *         title = str2bytes(title, &ctitle)
 */
  __pyx_v_ctitle = NULL;

  /* "PETSc/Viewer.pyx":302
 *         cdef const_char *cdisplay = NULL
 *         cdef const_char *ctitle = NULL
 *         display = str2bytes(display, &cdisplay)             # <<<<<<<<<<<<<<
 *         title = str2bytes(title, &ctitle)
 *         cdef int x, y, h, w
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_display, (&__pyx_v_cdisplay)); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_display, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Viewer.pyx":303
 *         cdef const_char *ctitle = NULL
 *         display = str2bytes(display, &cdisplay)
 *         title = str2bytes(title, &ctitle)             # <<<<<<<<<<<<<<
 *         cdef int x, y, h, w
 *         x = y = h = w = PETSC_DECIDE
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_title, (&__pyx_v_ctitle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_title, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Viewer.pyx":305
 *         title = str2bytes(title, &ctitle)
 *         cdef int x, y, h, w
 *         x = y = h = w = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         if position not in (None, PETSC_DECIDE):
 *             x, y = position
 */
  __pyx_v_x = PETSC_DECIDE;
  __pyx_v_y = PETSC_DECIDE;
  __pyx_v_h = PETSC_DECIDE;
  __pyx_v_w = PETSC_DECIDE;

  /* "PETSc/Viewer.pyx":306
 *         cdef int x, y, h, w
 *         x = y = h = w = PETSC_DECIDE
 *         if position not in (None, PETSC_DECIDE):             # <<<<<<<<<<<<<<
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):
 */
  __Pyx_INCREF(__pyx_v_position);
  __pyx_t_1 = __pyx_v_position;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 306, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(27, 306, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyInt_From_int(PETSC_DECIDE); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 306, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(27, 306, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {

    /* "PETSc/Viewer.pyx":307
 *         x = y = h = w = PETSC_DECIDE
 *         if position not in (None, PETSC_DECIDE):
 *             x, y = position             # <<<<<<<<<<<<<<
 *         if size not in (None, PETSC_DECIDE):
 *             try:
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_position))) || (PyList_CheckExact(__pyx_v_position))) {
      PyObject* sequence = __pyx_v_position;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(27, 307, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_v_position); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(27, 307, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(27, 307, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(27, 307, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(27, 307, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_x = __pyx_t_7;
    __pyx_v_y = __pyx_t_8;

    /* "PETSc/Viewer.pyx":306
 *         cdef int x, y, h, w
 *         x = y = h = w = PETSC_DECIDE
 *         if position not in (None, PETSC_DECIDE):             # <<<<<<<<<<<<<<
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):
 */
  }

  /* "PETSc/Viewer.pyx":308
 *         if position not in (None, PETSC_DECIDE):
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):             # <<<<<<<<<<<<<<
 *             try:
 *                 w, h = size
 */
  __Pyx_INCREF(__pyx_v_size);
  __pyx_t_5 = __pyx_v_size;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 308, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(27, 308, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
  } else {
    __pyx_t_4 = __pyx_t_2;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyInt_From_int(PETSC_DECIDE); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 308, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(27, 308, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __pyx_t_2;
  __pyx_L9_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = (__pyx_t_4 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Viewer.pyx":309
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):
 *             try:             # <<<<<<<<<<<<<<
 *                 w, h = size
 *             except TypeError:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      /*try:*/ {

        /* "PETSc/Viewer.pyx":310
 *         if size not in (None, PETSC_DECIDE):
 *             try:
 *                 w, h = size             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 w = h = size
 */
        if ((likely(PyTuple_CheckExact(__pyx_v_size))) || (PyList_CheckExact(__pyx_v_size))) {
          PyObject* sequence = __pyx_v_size;
          #if CYTHON_COMPILING_IN_CPYTHON
          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(27, 310, __pyx_L11_error)
          }
          #if CYTHON_COMPILING_IN_CPYTHON
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_3);
          #else
          __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 310, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 310, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          Py_ssize_t index = -1;
          __pyx_t_1 = PyObject_GetIter(__pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 310, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
          index = 0; __pyx_t_5 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_5)) goto __pyx_L19_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_5);
          index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L19_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_3);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_1), 2) < 0) __PYX_ERR(27, 310, __pyx_L11_error)
          __pyx_t_6 = NULL;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          goto __pyx_L20_unpacking_done;
          __pyx_L19_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_6 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(27, 310, __pyx_L11_error)
          __pyx_L20_unpacking_done:;
        }
        __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(27, 310, __pyx_L11_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(27, 310, __pyx_L11_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_w = __pyx_t_8;
        __pyx_v_h = __pyx_t_7;

        /* "PETSc/Viewer.pyx":309
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):
 *             try:             # <<<<<<<<<<<<<<
 *                 w, h = size
 *             except TypeError:
 */
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L18_try_end;
      __pyx_L11_error:;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "PETSc/Viewer.pyx":311
 *             try:
 *                 w, h = size
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 w = h = size
 *         CHKERR( PetscViewerDrawSetInfo(self.vwr,
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("petsc4py.PETSc.Viewer.setDrawInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(27, 311, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_1);

        /* "PETSc/Viewer.pyx":312
 *                 w, h = size
 *             except TypeError:
 *                 w = h = size             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerDrawSetInfo(self.vwr,
 *                                        cdisplay, ctitle,
 */
        __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(27, 312, __pyx_L13_except_error)
        __pyx_v_w = __pyx_t_7;
        __pyx_v_h = __pyx_t_7;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L12_exception_handled;
      }
      goto __pyx_L13_except_error;
      __pyx_L13_except_error:;

      /* "PETSc/Viewer.pyx":309
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):
 *             try:             # <<<<<<<<<<<<<<
 *                 w, h = size
 *             except TypeError:
 */
      __Pyx_PyThreadState_assign
      __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);
      goto __pyx_L1_error;
      __pyx_L12_exception_handled:;
      __Pyx_PyThreadState_assign
      __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_L18_try_end:;
    }

    /* "PETSc/Viewer.pyx":308
 *         if position not in (None, PETSC_DECIDE):
 *             x, y = position
 *         if size not in (None, PETSC_DECIDE):             # <<<<<<<<<<<<<<
 *             try:
 *                 w, h = size
 */
  }

  /* "PETSc/Viewer.pyx":313
 *             except TypeError:
 *                 w = h = size
 *         CHKERR( PetscViewerDrawSetInfo(self.vwr,             # <<<<<<<<<<<<<<
 *                                        cdisplay, ctitle,
 *                                        x, y, w, h) )
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerDrawSetInfo(__pyx_v_self->vwr, __pyx_v_cdisplay, __pyx_v_ctitle, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(27, 313, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":299
 *     # --- methods specific to draw viewers ---
 * 
 *     def setDrawInfo(self,  display=None, title=None, position=None, size=None):             # <<<<<<<<<<<<<<
 *         cdef const_char *cdisplay = NULL
 *         cdef const_char *ctitle = NULL
 */

  /* 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_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.setDrawInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_display);
  __Pyx_XDECREF(__pyx_v_title);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":317
 *                                        x, y, w, h) )
 * 
 *     def clearDraw(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerDrawClear(self.vwr) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_57clearDraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Viewer_56clearDraw[] = "Viewer.clearDraw(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Viewer_57clearDraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clearDraw (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("clearDraw", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clearDraw", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Viewer_56clearDraw(((struct PyPetscViewerObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Viewer_56clearDraw(struct PyPetscViewerObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("clearDraw", 0);

  /* "PETSc/Viewer.pyx":318
 * 
 *     def clearDraw(self):
 *         CHKERR( PetscViewerDrawClear(self.vwr) )             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerDrawClear(__pyx_v_self->vwr)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 318, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":317
 *                                        x, y, w, h) )
 * 
 *     def clearDraw(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerDrawClear(self.vwr) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Viewer.clearDraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":324
 * cdef class ViewerHDF5(Viewer):
 * 
 *     def create(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_1create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_create[] = "ViewerHDF5.create(self, name, mode=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_1create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_mode,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(27, 324, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_mode = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 324, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.ViewerHDF5.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_create(((struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *)__pyx_v_self), __pyx_v_name, __pyx_v_mode, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_create(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  const char *__pyx_v_cname;
  PetscFileMode __pyx_v_cmode;
  PetscViewer __pyx_v_newvwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscFileMode __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("create", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/Viewer.pyx":325
 * 
 *     def create(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(27, 325, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Viewer.pyx":326
 *     def create(self, name, mode=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)
 */
  __pyx_v_cname = NULL;

  /* "PETSc/Viewer.pyx":327
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Viewer.pyx":328
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)             # <<<<<<<<<<<<<<
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_filemode(__pyx_v_mode); if (unlikely(__pyx_t_3 == ((PetscFileMode)-1L))) __PYX_ERR(27, 328, __pyx_L1_error)
  __pyx_v_cmode = __pyx_t_3;

  /* "PETSc/Viewer.pyx":329
 *         name = str2bytes(name, &cname)
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 */
  __pyx_v_newvwr = NULL;

  /* "PETSc/Viewer.pyx":330
 *         cdef PetscFileMode cmode = filemode(mode)
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERHDF5) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerCreate(__pyx_v_ccomm, (&__pyx_v_newvwr))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 330, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":331
 *         cdef PetscViewer newvwr = NULL
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERHDF5) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.vwr = __pyx_v_newvwr;

  /* "PETSc/Viewer.pyx":332
 *         CHKERR( PetscViewerCreate(ccomm, &newvwr) )
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERHDF5) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerSetType(__pyx_v_self->__pyx_base.vwr, PETSCVIEWERHDF5)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 332, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":333
 *         PetscCLEAR(self.obj); self.vwr = newvwr
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERHDF5) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetMode(__pyx_v_self->__pyx_base.vwr, __pyx_v_cmode)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 333, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":334
 *         CHKERR( PetscViewerSetType(self.vwr, PETSCVIEWERHDF5) )
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerFileSetName(__pyx_v_self->__pyx_base.vwr, __pyx_v_cname)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(27, 334, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":335
 *         CHKERR( PetscViewerFileSetMode(self.vwr, cmode) )
 *         CHKERR( PetscViewerFileSetName(self.vwr, cname) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def getTimestep(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":324
 * cdef class ViewerHDF5(Viewer):
 * 
 *     def create(self, name, mode=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.ViewerHDF5.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":337
 *         return self
 * 
 *     def getTimestep(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ctimestep = 0
 *         CHKERR( PetscViewerHDF5GetTimestep(self.vwr, &ctimestep) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_3getTimestep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_2getTimestep[] = "ViewerHDF5.getTimestep(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_3getTimestep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTimestep (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getTimestep", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getTimestep", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_2getTimestep(((struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_2getTimestep(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self) {
  PetscInt __pyx_v_ctimestep;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getTimestep", 0);

  /* "PETSc/Viewer.pyx":338
 * 
 *     def getTimestep(self):
 *         cdef PetscInt ctimestep = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerHDF5GetTimestep(self.vwr, &ctimestep) )
 *         return toInt(ctimestep)
 */
  __pyx_v_ctimestep = 0;

  /* "PETSc/Viewer.pyx":339
 *     def getTimestep(self):
 *         cdef PetscInt ctimestep = 0
 *         CHKERR( PetscViewerHDF5GetTimestep(self.vwr, &ctimestep) )             # <<<<<<<<<<<<<<
 *         return toInt(ctimestep)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerHDF5GetTimestep(__pyx_v_self->__pyx_base.vwr, (&__pyx_v_ctimestep))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 339, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":340
 *         cdef PetscInt ctimestep = 0
 *         CHKERR( PetscViewerHDF5GetTimestep(self.vwr, &ctimestep) )
 *         return toInt(ctimestep)             # <<<<<<<<<<<<<<
 * 
 *     def setTimestep(self, timestep):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ctimestep); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":337
 *         return self
 * 
 *     def getTimestep(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ctimestep = 0
 *         CHKERR( PetscViewerHDF5GetTimestep(self.vwr, &ctimestep) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.ViewerHDF5.getTimestep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":342
 *         return toInt(ctimestep)
 * 
 *     def setTimestep(self, timestep):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerHDF5SetTimestep(self.vwr, asInt(timestep)) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_5setTimestep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_4setTimestep[] = "ViewerHDF5.setTimestep(self, timestep)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_5setTimestep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_timestep = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTimestep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timestep,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);
        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_timestep)) != 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, "setTimestep") < 0)) __PYX_ERR(27, 342, __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_timestep = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTimestep", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 342, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.ViewerHDF5.setTimestep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_4setTimestep(((struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *)__pyx_v_self), __pyx_v_timestep);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_4setTimestep(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self, PyObject *__pyx_v_timestep) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setTimestep", 0);

  /* "PETSc/Viewer.pyx":343
 * 
 *     def setTimestep(self, timestep):
 *         CHKERR( PetscViewerHDF5SetTimestep(self.vwr, asInt(timestep)) )             # <<<<<<<<<<<<<<
 * 
 *     def incrementTimestep(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_timestep); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(27, 343, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerHDF5SetTimestep(__pyx_v_self->__pyx_base.vwr, __pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(27, 343, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":342
 *         return toInt(ctimestep)
 * 
 *     def setTimestep(self, timestep):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerHDF5SetTimestep(self.vwr, asInt(timestep)) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.ViewerHDF5.setTimestep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":345
 *         CHKERR( PetscViewerHDF5SetTimestep(self.vwr, asInt(timestep)) )
 * 
 *     def incrementTimestep(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerHDF5IncrementTimestep(self.vwr) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_7incrementTimestep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_6incrementTimestep[] = "ViewerHDF5.incrementTimestep(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_7incrementTimestep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("incrementTimestep (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("incrementTimestep", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "incrementTimestep", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_6incrementTimestep(((struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_6incrementTimestep(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("incrementTimestep", 0);

  /* "PETSc/Viewer.pyx":346
 * 
 *     def incrementTimestep(self):
 *         CHKERR( PetscViewerHDF5IncrementTimestep(self.vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def pushGroup(self, group):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerHDF5IncrementTimestep(__pyx_v_self->__pyx_base.vwr)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 346, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":345
 *         CHKERR( PetscViewerHDF5SetTimestep(self.vwr, asInt(timestep)) )
 * 
 *     def incrementTimestep(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerHDF5IncrementTimestep(self.vwr) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.ViewerHDF5.incrementTimestep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":348
 *         CHKERR( PetscViewerHDF5IncrementTimestep(self.vwr) )
 * 
 *     def pushGroup(self, group):             # <<<<<<<<<<<<<<
 *         cdef const_char *cgroup = NULL
 *         group = str2bytes(group, &cgroup)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_9pushGroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_8pushGroup[] = "ViewerHDF5.pushGroup(self, group)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_9pushGroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_group = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pushGroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_group,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);
        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_group)) != 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, "pushGroup") < 0)) __PYX_ERR(27, 348, __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_group = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pushGroup", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(27, 348, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.ViewerHDF5.pushGroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_8pushGroup(((struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *)__pyx_v_self), __pyx_v_group);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_8pushGroup(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self, PyObject *__pyx_v_group) {
  const char *__pyx_v_cgroup;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("pushGroup", 0);
  __Pyx_INCREF(__pyx_v_group);

  /* "PETSc/Viewer.pyx":349
 * 
 *     def pushGroup(self, group):
 *         cdef const_char *cgroup = NULL             # <<<<<<<<<<<<<<
 *         group = str2bytes(group, &cgroup)
 *         CHKERR( PetscViewerHDF5PushGroup(self.vwr, cgroup) )
 */
  __pyx_v_cgroup = NULL;

  /* "PETSc/Viewer.pyx":350
 *     def pushGroup(self, group):
 *         cdef const_char *cgroup = NULL
 *         group = str2bytes(group, &cgroup)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerHDF5PushGroup(self.vwr, cgroup) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_group, (&__pyx_v_cgroup)); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_group, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Viewer.pyx":351
 *         cdef const_char *cgroup = NULL
 *         group = str2bytes(group, &cgroup)
 *         CHKERR( PetscViewerHDF5PushGroup(self.vwr, cgroup) )             # <<<<<<<<<<<<<<
 * 
 *     def popGroup(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerHDF5PushGroup(__pyx_v_self->__pyx_base.vwr, __pyx_v_cgroup)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(27, 351, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":348
 *         CHKERR( PetscViewerHDF5IncrementTimestep(self.vwr) )
 * 
 *     def pushGroup(self, group):             # <<<<<<<<<<<<<<
 *         cdef const_char *cgroup = NULL
 *         group = str2bytes(group, &cgroup)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.ViewerHDF5.pushGroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_group);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":353
 *         CHKERR( PetscViewerHDF5PushGroup(self.vwr, cgroup) )
 * 
 *     def popGroup(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerHDF5PopGroup(self.vwr) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_11popGroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_10popGroup[] = "ViewerHDF5.popGroup(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_11popGroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("popGroup (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("popGroup", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "popGroup", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_10popGroup(((struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_10popGroup(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("popGroup", 0);

  /* "PETSc/Viewer.pyx":354
 * 
 *     def popGroup(self):
 *         CHKERR( PetscViewerHDF5PopGroup(self.vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def getGroup(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerHDF5PopGroup(__pyx_v_self->__pyx_base.vwr)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 354, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":353
 *         CHKERR( PetscViewerHDF5PushGroup(self.vwr, cgroup) )
 * 
 *     def popGroup(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerHDF5PopGroup(self.vwr) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.ViewerHDF5.popGroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Viewer.pyx":356
 *         CHKERR( PetscViewerHDF5PopGroup(self.vwr) )
 * 
 *     def getGroup(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cgroup = NULL
 *         CHKERR( PetscViewerHDF5GetGroup(self.vwr, &cgroup) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_13getGroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_12getGroup[] = "ViewerHDF5.getGroup(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_13getGroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getGroup (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getGroup", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getGroup", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_12getGroup(((struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_10ViewerHDF5_12getGroup(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *__pyx_v_self) {
  const char *__pyx_v_cgroup;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getGroup", 0);

  /* "PETSc/Viewer.pyx":357
 * 
 *     def getGroup(self):
 *         cdef const_char *cgroup = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscViewerHDF5GetGroup(self.vwr, &cgroup) )
 *         return bytes2str(cgroup)
 */
  __pyx_v_cgroup = NULL;

  /* "PETSc/Viewer.pyx":358
 *     def getGroup(self):
 *         cdef const_char *cgroup = NULL
 *         CHKERR( PetscViewerHDF5GetGroup(self.vwr, &cgroup) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cgroup)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscViewerHDF5GetGroup(__pyx_v_self->__pyx_base.vwr, (&__pyx_v_cgroup))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(27, 358, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":359
 *         cdef const_char *cgroup = NULL
 *         CHKERR( PetscViewerHDF5GetGroup(self.vwr, &cgroup) )
 *         return bytes2str(cgroup)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cgroup); if (unlikely(!__pyx_t_2)) __PYX_ERR(27, 359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Viewer.pyx":356
 *         CHKERR( PetscViewerHDF5PopGroup(self.vwr) )
 * 
 *     def getGroup(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cgroup = NULL
 *         CHKERR( PetscViewerHDF5GetGroup(self.vwr, &cgroup) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.ViewerHDF5.getGroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":15
 *     Type = RandomType
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.rnd
 *         self.rnd = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_6Random_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_6Random_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random___cinit__(((struct PyPetscRandomObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_6Random___cinit__(struct PyPetscRandomObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Random.pyx":16
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.rnd             # <<<<<<<<<<<<<<
 *         self.rnd = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->rnd));

  /* "PETSc/Random.pyx":17
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.rnd
 *         self.rnd = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self):
 */
  __pyx_v_self->rnd = NULL;

  /* "PETSc/Random.pyx":15
 *     Type = RandomType
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.rnd
 *         self.rnd = NULL
 */

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

/* "PETSc/Random.pyx":19
 *         self.rnd = NULL
 * 
 *     def __call__(self):             # <<<<<<<<<<<<<<
 *         return self.getValue()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__call__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_2__call__(((struct PyPetscRandomObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_2__call__(struct PyPetscRandomObject *__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("__call__", 0);

  /* "PETSc/Random.pyx":20
 * 
 *     def __call__(self):
 *         return self.getValue()             # <<<<<<<<<<<<<<
 * 
 *     def view(self, Viewer viewer=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getValue); if (unlikely(!__pyx_t_2)) __PYX_ERR(28, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(28, 20, __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(28, 20, __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;

  /* "PETSc/Random.pyx":19
 *         self.rnd = NULL
 * 
 *     def __call__(self):             # <<<<<<<<<<<<<<
 *         return self.getValue()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Random.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":22
 *         return self.getValue()
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         assert self.obj != NULL
 *         cdef PetscViewer vwr = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Random_4view[] = "Random.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(28, 22, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(28, 22, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Random.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(28, 22, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_4view(((struct PyPetscRandomObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_4view(struct PyPetscRandomObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/Random.pyx":23
 * 
 *     def view(self, Viewer viewer=None):
 *         assert self.obj != NULL             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->__pyx_base.obj != NULL) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(28, 23, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/Random.pyx":24
 *     def view(self, Viewer viewer=None):
 *         assert self.obj != NULL
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PetscRandomView(self.rnd, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/Random.pyx":25
 *         assert self.obj != NULL
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomView(self.rnd, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/Random.pyx":26
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PetscRandomView(self.rnd, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomView(__pyx_v_self->rnd, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(28, 26, __pyx_L1_error)

  /* "PETSc/Random.pyx":22
 *         return self.getValue()
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         assert self.obj != NULL
 *         cdef PetscViewer vwr = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Random.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":28
 *         CHKERR( PetscRandomView(self.rnd, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomDestroy(&self.rnd) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Random_6destroy[] = "Random.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_6destroy(((struct PyPetscRandomObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_6destroy(struct PyPetscRandomObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/Random.pyx":29
 * 
 *     def destroy(self):
 *         CHKERR( PetscRandomDestroy(&self.rnd) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomDestroy((&__pyx_v_self->rnd))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(28, 29, __pyx_L1_error)

  /* "PETSc/Random.pyx":30
 *     def destroy(self):
 *         CHKERR( PetscRandomDestroy(&self.rnd) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Random.pyx":28
 *         CHKERR( PetscRandomView(self.rnd, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomDestroy(&self.rnd) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Random.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":32
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         CHKERR( PetscRandomCreate(ccomm, &self.rnd) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Random_8create[] = "Random.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(28, 32, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(28, 32, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Random.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_8create(((struct PyPetscRandomObject *)__pyx_v_self), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_8create(struct PyPetscRandomObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/Random.pyx":33
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomCreate(ccomm, &self.rnd) )
 *         return self
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(28, 33, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Random.pyx":34
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         CHKERR( PetscRandomCreate(ccomm, &self.rnd) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomCreate(__pyx_v_ccomm, (&__pyx_v_self->rnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(28, 34, __pyx_L1_error)

  /* "PETSc/Random.pyx":35
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         CHKERR( PetscRandomCreate(ccomm, &self.rnd) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, rnd_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Random.pyx":32
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         CHKERR( PetscRandomCreate(ccomm, &self.rnd) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Random.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":37
 *         return self
 * 
 *     def setType(self, rnd_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         rnd_type = str2bytes(rnd_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_11setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Random_10setType[] = "Random.setType(self, rnd_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_11setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnd_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnd_type,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);
        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_rnd_type)) != 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, "setType") < 0)) __PYX_ERR(28, 37, __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_rnd_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(28, 37, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Random.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_10setType(((struct PyPetscRandomObject *)__pyx_v_self), __pyx_v_rnd_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_10setType(struct PyPetscRandomObject *__pyx_v_self, PyObject *__pyx_v_rnd_type) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_rnd_type);

  /* "PETSc/Random.pyx":38
 * 
 *     def setType(self, rnd_type):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         rnd_type = str2bytes(rnd_type, &cval)
 *         CHKERR( PetscRandomSetType(self.rnd, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Random.pyx":39
 *     def setType(self, rnd_type):
 *         cdef const_char *cval = NULL
 *         rnd_type = str2bytes(rnd_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomSetType(self.rnd, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_rnd_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(28, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnd_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Random.pyx":40
 *         cdef const_char *cval = NULL
 *         rnd_type = str2bytes(rnd_type, &cval)
 *         CHKERR( PetscRandomSetType(self.rnd, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomSetType(__pyx_v_self->rnd, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(28, 40, __pyx_L1_error)

  /* "PETSc/Random.pyx":37
 *         return self
 * 
 *     def setType(self, rnd_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         rnd_type = str2bytes(rnd_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Random.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnd_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":42
 *         CHKERR( PetscRandomSetType(self.rnd, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscRandomType cval = NULL
 *         CHKERR( PetscRandomGetType(self.rnd, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_13getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Random_12getType[] = "Random.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_13getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_12getType(((struct PyPetscRandomObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_12getType(struct PyPetscRandomObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/Random.pyx":43
 * 
 *     def getType(self):
 *         cdef PetscRandomType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomGetType(self.rnd, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Random.pyx":44
 *     def getType(self):
 *         cdef PetscRandomType cval = NULL
 *         CHKERR( PetscRandomGetType(self.rnd, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomGetType(__pyx_v_self->rnd, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(28, 44, __pyx_L1_error)

  /* "PETSc/Random.pyx":45
 *         cdef PetscRandomType cval = NULL
 *         CHKERR( PetscRandomGetType(self.rnd, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(28, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Random.pyx":42
 *         CHKERR( PetscRandomSetType(self.rnd, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscRandomType cval = NULL
 *         CHKERR( PetscRandomGetType(self.rnd, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Random.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":47
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomSetFromOptions(self.rnd) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_15setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Random_14setFromOptions[] = "Random.setFromOptions(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_15setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_14setFromOptions(((struct PyPetscRandomObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_14setFromOptions(struct PyPetscRandomObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/Random.pyx":48
 * 
 *     def setFromOptions(self):
 *         CHKERR( PetscRandomSetFromOptions(self.rnd) )             # <<<<<<<<<<<<<<
 * 
 *     def getValue(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomSetFromOptions(__pyx_v_self->rnd)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(28, 48, __pyx_L1_error)

  /* "PETSc/Random.pyx":47
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomSetFromOptions(self.rnd) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Random.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":50
 *         CHKERR( PetscRandomSetFromOptions(self.rnd) )
 * 
 *     def getValue(self):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( PetscRandomGetValue(self.rnd, &sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_17getValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Random_16getValue[] = "Random.getValue(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_17getValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getValue (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getValue", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getValue", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_16getValue(((struct PyPetscRandomObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_16getValue(struct PyPetscRandomObject *__pyx_v_self) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getValue", 0);

  /* "PETSc/Random.pyx":51
 * 
 *     def getValue(self):
 *         cdef PetscScalar sval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomGetValue(self.rnd, &sval) )
 *         return toScalar(sval)
 */
  __pyx_v_sval = 0.0;

  /* "PETSc/Random.pyx":52
 *     def getValue(self):
 *         cdef PetscScalar sval = 0
 *         CHKERR( PetscRandomGetValue(self.rnd, &sval) )             # <<<<<<<<<<<<<<
 *         return toScalar(sval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomGetValue(__pyx_v_self->rnd, (&__pyx_v_sval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(28, 52, __pyx_L1_error)

  /* "PETSc/Random.pyx":53
 *         cdef PetscScalar sval = 0
 *         CHKERR( PetscRandomGetValue(self.rnd, &sval) )
 *         return toScalar(sval)             # <<<<<<<<<<<<<<
 * 
 *     def getValueReal(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toScalar(__pyx_v_sval); if (unlikely(!__pyx_t_2)) __PYX_ERR(28, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Random.pyx":50
 *         CHKERR( PetscRandomSetFromOptions(self.rnd) )
 * 
 *     def getValue(self):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( PetscRandomGetValue(self.rnd, &sval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Random.getValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":55
 *         return toScalar(sval)
 * 
 *     def getValueReal(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( PetscRandomGetValueReal(self.rnd, &rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_19getValueReal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Random_18getValueReal[] = "Random.getValueReal(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_19getValueReal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getValueReal (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getValueReal", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getValueReal", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_18getValueReal(((struct PyPetscRandomObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_18getValueReal(struct PyPetscRandomObject *__pyx_v_self) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getValueReal", 0);

  /* "PETSc/Random.pyx":56
 * 
 *     def getValueReal(self):
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomGetValueReal(self.rnd, &rval) )
 *         return toReal(rval)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/Random.pyx":57
 *     def getValueReal(self):
 *         cdef PetscReal rval = 0
 *         CHKERR( PetscRandomGetValueReal(self.rnd, &rval) )             # <<<<<<<<<<<<<<
 *         return toReal(rval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomGetValueReal(__pyx_v_self->rnd, (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(28, 57, __pyx_L1_error)

  /* "PETSc/Random.pyx":58
 *         cdef PetscReal rval = 0
 *         CHKERR( PetscRandomGetValueReal(self.rnd, &rval) )
 *         return toReal(rval)             # <<<<<<<<<<<<<<
 * 
 *     def getSeed(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_2)) __PYX_ERR(28, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Random.pyx":55
 *         return toScalar(sval)
 * 
 *     def getValueReal(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( PetscRandomGetValueReal(self.rnd, &rval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Random.getValueReal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":60
 *         return toReal(rval)
 * 
 *     def getSeed(self):             # <<<<<<<<<<<<<<
 *         cdef unsigned long seed = 0
 *         CHKERR( PetscRandomGetSeed(self.rnd, &seed) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_21getSeed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Random_20getSeed[] = "Random.getSeed(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_21getSeed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSeed (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSeed", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSeed", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_20getSeed(((struct PyPetscRandomObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_20getSeed(struct PyPetscRandomObject *__pyx_v_self) {
  unsigned long __pyx_v_seed;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getSeed", 0);

  /* "PETSc/Random.pyx":61
 * 
 *     def getSeed(self):
 *         cdef unsigned long seed = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomGetSeed(self.rnd, &seed) )
 *         return seed
 */
  __pyx_v_seed = 0;

  /* "PETSc/Random.pyx":62
 *     def getSeed(self):
 *         cdef unsigned long seed = 0
 *         CHKERR( PetscRandomGetSeed(self.rnd, &seed) )             # <<<<<<<<<<<<<<
 *         return seed
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomGetSeed(__pyx_v_self->rnd, (&__pyx_v_seed))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(28, 62, __pyx_L1_error)

  /* "PETSc/Random.pyx":63
 *         cdef unsigned long seed = 0
 *         CHKERR( PetscRandomGetSeed(self.rnd, &seed) )
 *         return seed             # <<<<<<<<<<<<<<
 * 
 *     def setSeed(self, seed=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_unsigned_long(__pyx_v_seed); if (unlikely(!__pyx_t_2)) __PYX_ERR(28, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Random.pyx":60
 *         return toReal(rval)
 * 
 *     def getSeed(self):             # <<<<<<<<<<<<<<
 *         cdef unsigned long seed = 0
 *         CHKERR( PetscRandomGetSeed(self.rnd, &seed) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Random.getSeed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":65
 *         return seed
 * 
 *     def setSeed(self, seed=None):             # <<<<<<<<<<<<<<
 *         if seed is not None:
 *             CHKERR( PetscRandomSetSeed(self.rnd, seed) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_23setSeed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Random_22setSeed[] = "Random.setSeed(self, seed=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_23setSeed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_seed = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setSeed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_seed,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_seed);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSeed") < 0)) __PYX_ERR(28, 65, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_seed = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setSeed", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(28, 65, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Random.setSeed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_22setSeed(((struct PyPetscRandomObject *)__pyx_v_self), __pyx_v_seed);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_22setSeed(struct PyPetscRandomObject *__pyx_v_self, PyObject *__pyx_v_seed) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  unsigned long __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setSeed", 0);

  /* "PETSc/Random.pyx":66
 * 
 *     def setSeed(self, seed=None):
 *         if seed is not None:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscRandomSetSeed(self.rnd, seed) )
 *         CHKERR( PetscRandomSeed(self.rnd) )
 */
  __pyx_t_1 = (__pyx_v_seed != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Random.pyx":67
 *     def setSeed(self, seed=None):
 *         if seed is not None:
 *             CHKERR( PetscRandomSetSeed(self.rnd, seed) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomSeed(self.rnd) )
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_As_unsigned_long(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(28, 67, __pyx_L1_error)
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomSetSeed(__pyx_v_self->rnd, __pyx_t_3)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(28, 67, __pyx_L1_error)

    /* "PETSc/Random.pyx":66
 * 
 *     def setSeed(self, seed=None):
 *         if seed is not None:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscRandomSetSeed(self.rnd, seed) )
 *         CHKERR( PetscRandomSeed(self.rnd) )
 */
  }

  /* "PETSc/Random.pyx":68
 *         if seed is not None:
 *             CHKERR( PetscRandomSetSeed(self.rnd, seed) )
 *         CHKERR( PetscRandomSeed(self.rnd) )             # <<<<<<<<<<<<<<
 * 
 *     def getInterval(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomSeed(__pyx_v_self->rnd)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(28, 68, __pyx_L1_error)

  /* "PETSc/Random.pyx":65
 *         return seed
 * 
 *     def setSeed(self, seed=None):             # <<<<<<<<<<<<<<
 *         if seed is not None:
 *             CHKERR( PetscRandomSetSeed(self.rnd, seed) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Random.setSeed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":70
 *         CHKERR( PetscRandomSeed(self.rnd) )
 * 
 *     def getInterval(self):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval1 = 0
 *         cdef PetscScalar sval2 = 1
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_25getInterval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Random_24getInterval[] = "Random.getInterval(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_25getInterval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getInterval (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getInterval", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getInterval", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_24getInterval(((struct PyPetscRandomObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_24getInterval(struct PyPetscRandomObject *__pyx_v_self) {
  PetscScalar __pyx_v_sval1;
  PetscScalar __pyx_v_sval2;
  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;
  __Pyx_RefNannySetupContext("getInterval", 0);

  /* "PETSc/Random.pyx":71
 * 
 *     def getInterval(self):
 *         cdef PetscScalar sval1 = 0             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval2 = 1
 *         CHKERR( PetscRandomGetInterval(self.rnd, &sval1, &sval2) )
 */
  __pyx_v_sval1 = 0.0;

  /* "PETSc/Random.pyx":72
 *     def getInterval(self):
 *         cdef PetscScalar sval1 = 0
 *         cdef PetscScalar sval2 = 1             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomGetInterval(self.rnd, &sval1, &sval2) )
 *         return (toScalar(sval1), toScalar(sval2))
 */
  __pyx_v_sval2 = 1.0;

  /* "PETSc/Random.pyx":73
 *         cdef PetscScalar sval1 = 0
 *         cdef PetscScalar sval2 = 1
 *         CHKERR( PetscRandomGetInterval(self.rnd, &sval1, &sval2) )             # <<<<<<<<<<<<<<
 *         return (toScalar(sval1), toScalar(sval2))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomGetInterval(__pyx_v_self->rnd, (&__pyx_v_sval1), (&__pyx_v_sval2))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(28, 73, __pyx_L1_error)

  /* "PETSc/Random.pyx":74
 *         cdef PetscScalar sval2 = 1
 *         CHKERR( PetscRandomGetInterval(self.rnd, &sval1, &sval2) )
 *         return (toScalar(sval1), toScalar(sval2))             # <<<<<<<<<<<<<<
 * 
 *     def setInterval(self, interval):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toScalar(__pyx_v_sval1); if (unlikely(!__pyx_t_2)) __PYX_ERR(28, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toScalar(__pyx_v_sval2); if (unlikely(!__pyx_t_3)) __PYX_ERR(28, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(28, 74, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Random.pyx":70
 *         CHKERR( PetscRandomSeed(self.rnd) )
 * 
 *     def getInterval(self):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval1 = 0
 *         cdef PetscScalar sval2 = 1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Random.getInterval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":76
 *         return (toScalar(sval1), toScalar(sval2))
 * 
 *     def setInterval(self, interval):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval1 = 0
 *         cdef PetscScalar sval2 = 1
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_27setInterval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6Random_26setInterval[] = "Random.setInterval(self, interval)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_27setInterval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_interval = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setInterval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_interval,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);
        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_interval)) != 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, "setInterval") < 0)) __PYX_ERR(28, 76, __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_interval = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setInterval", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(28, 76, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Random.setInterval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_26setInterval(((struct PyPetscRandomObject *)__pyx_v_self), __pyx_v_interval);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_26setInterval(struct PyPetscRandomObject *__pyx_v_self, PyObject *__pyx_v_interval) {
  PetscScalar __pyx_v_sval1;
  PetscScalar __pyx_v_sval2;
  PyObject *__pyx_v_low = NULL;
  PyObject *__pyx_v_high = 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)(PyObject *);
  PetscScalar __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("setInterval", 0);

  /* "PETSc/Random.pyx":77
 * 
 *     def setInterval(self, interval):
 *         cdef PetscScalar sval1 = 0             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval2 = 1
 *         low, high = interval
 */
  __pyx_v_sval1 = 0.0;

  /* "PETSc/Random.pyx":78
 *     def setInterval(self, interval):
 *         cdef PetscScalar sval1 = 0
 *         cdef PetscScalar sval2 = 1             # <<<<<<<<<<<<<<
 *         low, high = interval
 *         sval1 = asScalar(low)
 */
  __pyx_v_sval2 = 1.0;

  /* "PETSc/Random.pyx":79
 *         cdef PetscScalar sval1 = 0
 *         cdef PetscScalar sval2 = 1
 *         low, high = interval             # <<<<<<<<<<<<<<
 *         sval1 = asScalar(low)
 *         sval2 = asScalar(high)
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_interval))) || (PyList_CheckExact(__pyx_v_interval))) {
    PyObject* sequence = __pyx_v_interval;
    #if CYTHON_COMPILING_IN_CPYTHON
    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(28, 79, __pyx_L1_error)
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(28, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(28, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_v_interval); if (unlikely(!__pyx_t_3)) __PYX_ERR(28, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(28, 79, __pyx_L1_error)
    __pyx_t_4 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(28, 79, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_low = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_high = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/Random.pyx":80
 *         cdef PetscScalar sval2 = 1
 *         low, high = interval
 *         sval1 = asScalar(low)             # <<<<<<<<<<<<<<
 *         sval2 = asScalar(high)
 *         CHKERR( PetscRandomSetInterval(self.rnd, sval1, sval2) )
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_low); if (unlikely(PyErr_Occurred())) __PYX_ERR(28, 80, __pyx_L1_error)
  __pyx_v_sval1 = __pyx_t_5;

  /* "PETSc/Random.pyx":81
 *         low, high = interval
 *         sval1 = asScalar(low)
 *         sval2 = asScalar(high)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscRandomSetInterval(self.rnd, sval1, sval2) )
 * 
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_high); if (unlikely(PyErr_Occurred())) __PYX_ERR(28, 81, __pyx_L1_error)
  __pyx_v_sval2 = __pyx_t_5;

  /* "PETSc/Random.pyx":82
 *         sval1 = asScalar(low)
 *         sval2 = asScalar(high)
 *         CHKERR( PetscRandomSetInterval(self.rnd, sval1, sval2) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscRandomSetInterval(__pyx_v_self->rnd, __pyx_v_sval1, __pyx_v_sval2)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(28, 82, __pyx_L1_error)

  /* "PETSc/Random.pyx":76
 *         return (toScalar(sval1), toScalar(sval2))
 * 
 *     def setInterval(self, interval):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval1 = 0
 *         cdef PetscScalar sval2 = 1
 */

  /* 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Random.setInterval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_low);
  __Pyx_XDECREF(__pyx_v_high);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":87
 * 
 *     property seed:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSeed()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_4seed_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_4seed_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_4seed___get__(((struct PyPetscRandomObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_4seed___get__(struct PyPetscRandomObject *__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);

  /* "PETSc/Random.pyx":88
 *     property seed:
 *         def __get__(self):
 *             return self.getSeed()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setSeed(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSeed); if (unlikely(!__pyx_t_2)) __PYX_ERR(28, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(28, 88, __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(28, 88, __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;

  /* "PETSc/Random.pyx":87
 * 
 *     property seed:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSeed()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Random.seed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":89
 *         def __get__(self):
 *             return self.getSeed()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setSeed(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_6Random_4seed_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_6Random_4seed_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_4seed_2__set__(((struct PyPetscRandomObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_6Random_4seed_2__set__(struct PyPetscRandomObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Random.pyx":90
 *             return self.getSeed()
 *         def __set__(self, value):
 *             self.setSeed(value)             # <<<<<<<<<<<<<<
 * 
 *     property interval:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setSeed); if (unlikely(!__pyx_t_2)) __PYX_ERR(28, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(28, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(28, 90, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(28, 90, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Random.pyx":89
 *         def __get__(self):
 *             return self.getSeed()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setSeed(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Random.seed.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":93
 * 
 *     property interval:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getInterval()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_8interval_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_6Random_8interval_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_8interval___get__(((struct PyPetscRandomObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_6Random_8interval___get__(struct PyPetscRandomObject *__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);

  /* "PETSc/Random.pyx":94
 *     property interval:
 *         def __get__(self):
 *             return self.getInterval()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setInterval(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getInterval); if (unlikely(!__pyx_t_2)) __PYX_ERR(28, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(28, 94, __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(28, 94, __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;

  /* "PETSc/Random.pyx":93
 * 
 *     property interval:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getInterval()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Random.interval.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Random.pyx":95
 *         def __get__(self):
 *             return self.getInterval()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setInterval(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_6Random_8interval_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_6Random_8interval_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6Random_8interval_2__set__(((struct PyPetscRandomObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_6Random_8interval_2__set__(struct PyPetscRandomObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Random.pyx":96
 *             return self.getInterval()
 *         def __set__(self, value):
 *             self.setInterval(value)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setInterval); if (unlikely(!__pyx_t_2)) __PYX_ERR(28, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(28, 96, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(28, 96, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(28, 96, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Random.pyx":95
 *         def __get__(self):
 *             return self.getInterval()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setInterval(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Random.interval.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":16
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.iset
 *         self.iset = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2IS_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2IS_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS___cinit__(((struct PyPetscISObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_2IS___cinit__(struct PyPetscISObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/IS.pyx":17
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.iset             # <<<<<<<<<<<<<<
 *         self.iset = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->iset));

  /* "PETSc/IS.pyx":18
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.iset
 *         self.iset = NULL             # <<<<<<<<<<<<<<
 * 
 *     # buffer interface (PEP 3118)
 */
  __pyx_v_self->iset = NULL;

  /* "PETSc/IS.pyx":16
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.iset
 *         self.iset = NULL
 */

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

/* "PETSc/IS.pyx":22
 *     # buffer interface (PEP 3118)
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):             # <<<<<<<<<<<<<<
 *         cdef _IS_buffer buf = _IS_buffer(self)
 *         buf.acquirebuffer(view, flags)
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_8petsc4py_5PETSc_2IS_3__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_8petsc4py_5PETSc_2IS_3__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_2__getbuffer__(((struct PyPetscISObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_view), ((int)__pyx_v_flags));

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

static int __pyx_pf_8petsc4py_5PETSc_2IS_2__getbuffer__(struct PyPetscISObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) {
  struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_buf = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_view != NULL) {
    __pyx_v_view->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_view->obj);
  }

  /* "PETSc/IS.pyx":23
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):
 *         cdef _IS_buffer buf = _IS_buffer(self)             # <<<<<<<<<<<<<<
 *         buf.acquirebuffer(view, flags)
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc__IS_buffer), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/IS.pyx":24
 *     def __getbuffer__(self, Py_buffer *view, int flags):
 *         cdef _IS_buffer buf = _IS_buffer(self)
 *         buf.acquirebuffer(view, flags)             # <<<<<<<<<<<<<<
 * 
 *     def __releasebuffer__(self, Py_buffer *view):
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_buf->__pyx_vtab)->acquirebuffer(__pyx_v_buf, __pyx_v_view, __pyx_v_flags); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(29, 24, __pyx_L1_error)

  /* "PETSc/IS.pyx":22
 *     # buffer interface (PEP 3118)
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):             # <<<<<<<<<<<<<<
 *         cdef _IS_buffer buf = _IS_buffer(self)
 *         buf.acquirebuffer(view, flags)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_view != NULL && __pyx_v_view->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_view->obj);
    __Pyx_DECREF(__pyx_v_view->obj); __pyx_v_view->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_view != NULL && __pyx_v_view->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_view->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":26
 *         buf.acquirebuffer(view, flags)
 * 
 *     def __releasebuffer__(self, Py_buffer *view):             # <<<<<<<<<<<<<<
 *         cdef _IS_buffer buf = <_IS_buffer>(view.obj)
 *         buf.releasebuffer(view)
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_8petsc4py_5PETSc_2IS_5__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view); /*proto*/
static CYTHON_UNUSED void __pyx_pw_8petsc4py_5PETSc_2IS_5__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_8petsc4py_5PETSc_2IS_4__releasebuffer__(((struct PyPetscISObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_view));

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

static void __pyx_pf_8petsc4py_5PETSc_2IS_4__releasebuffer__(struct PyPetscISObject *__pyx_v_self, Py_buffer *__pyx_v_view) {
  struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_buf = 0;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "PETSc/IS.pyx":27
 * 
 *     def __releasebuffer__(self, Py_buffer *view):
 *         cdef _IS_buffer buf = <_IS_buffer>(view.obj)             # <<<<<<<<<<<<<<
 *         buf.releasebuffer(view)
 *         <void>self # unused
 */
  __pyx_t_1 = __pyx_v_view->obj;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":28
 *     def __releasebuffer__(self, Py_buffer *view):
 *         cdef _IS_buffer buf = <_IS_buffer>(view.obj)
 *         buf.releasebuffer(view)             # <<<<<<<<<<<<<<
 *         <void>self # unused
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_buf->__pyx_vtab)->releasebuffer(__pyx_v_buf, __pyx_v_view); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 28, __pyx_L1_error)

  /* "PETSc/IS.pyx":29
 *         cdef _IS_buffer buf = <_IS_buffer>(view.obj)
 *         buf.releasebuffer(view)
 *         <void>self # unused             # <<<<<<<<<<<<<<
 * 
 * 
 */
  ((void)__pyx_v_self);

  /* "PETSc/IS.pyx":26
 *         buf.acquirebuffer(view, flags)
 * 
 *     def __releasebuffer__(self, Py_buffer *view):             # <<<<<<<<<<<<<<
 *         cdef _IS_buffer buf = <_IS_buffer>(view.obj)
 *         buf.releasebuffer(view)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("petsc4py.PETSc.IS.__releasebuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_RefNannyFinishContext();
}

/* "PETSc/IS.pyx":34
 *     # 'with' statement (PEP 343)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         cdef _IS_buffer buf = _IS_buffer(self)
 *         self.set_attr('__buffer__', buf)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_7__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_6__enter__[] = "IS.__enter__(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_7__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_6__enter__(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_6__enter__(struct PyPetscISObject *__pyx_v_self) {
  struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "PETSc/IS.pyx":35
 * 
 *     def __enter__(self):
 *         cdef _IS_buffer buf = _IS_buffer(self)             # <<<<<<<<<<<<<<
 *         self.set_attr('__buffer__', buf)
 *         return buf.enter()
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc__IS_buffer), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/IS.pyx":36
 *     def __enter__(self):
 *         cdef _IS_buffer buf = _IS_buffer(self)
 *         self.set_attr('__buffer__', buf)             # <<<<<<<<<<<<<<
 *         return buf.enter()
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_IS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__buffer__"), ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/IS.pyx":37
 *         cdef _IS_buffer buf = _IS_buffer(self)
 *         self.set_attr('__buffer__', buf)
 *         return buf.enter()             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *exc):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_buf->__pyx_vtab)->enter(__pyx_v_buf); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":34
 *     # 'with' statement (PEP 343)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         cdef _IS_buffer buf = _IS_buffer(self)
 *         self.set_attr('__buffer__', buf)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":39
 *         return buf.enter()
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         cdef _IS_buffer buf = self.get_attr('__buffer__')
 *         self.set_attr('__buffer__', None)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_9__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_8__exit__[] = "IS.__exit__(self, *exc)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_9__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_exc = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_8__exit__(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_exc);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_8__exit__(struct PyPetscISObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "PETSc/IS.pyx":40
 * 
 *     def __exit__(self, *exc):
 *         cdef _IS_buffer buf = self.get_attr('__buffer__')             # <<<<<<<<<<<<<<
 *         self.set_attr('__buffer__', None)
 *         return buf.exit()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_IS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__buffer__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc__IS_buffer))))) __PYX_ERR(29, 40, __pyx_L1_error)
  __pyx_v_buf = ((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":41
 *     def __exit__(self, *exc):
 *         cdef _IS_buffer buf = self.get_attr('__buffer__')
 *         self.set_attr('__buffer__', None)             # <<<<<<<<<<<<<<
 *         return buf.exit()
 *     #
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_IS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__buffer__"), Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":42
 *         cdef _IS_buffer buf = self.get_attr('__buffer__')
 *         self.set_attr('__buffer__', None)
 *         return buf.exit()             # <<<<<<<<<<<<<<
 *     #
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__IS_buffer *)__pyx_v_buf->__pyx_vtab)->exit(__pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":39
 *         return buf.enter()
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         cdef _IS_buffer buf = self.get_attr('__buffer__')
 *         self.set_attr('__buffer__', None)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":45
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_11view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_10view[] = "IS.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_11view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(29, 45, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 45, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(29, 45, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_10view(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_10view(struct PyPetscISObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_cviewer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/IS.pyx":46
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer cviewer = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: cviewer = viewer.vwr
 *         CHKERR( ISView(self.iset, cviewer) )
 */
  __pyx_v_cviewer = NULL;

  /* "PETSc/IS.pyx":47
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( ISView(self.iset, cviewer) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_cviewer = __pyx_t_3;
  }

  /* "PETSc/IS.pyx":48
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 *         CHKERR( ISView(self.iset, cviewer) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISView(__pyx_v_self->iset, __pyx_v_cviewer)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(29, 48, __pyx_L1_error)

  /* "PETSc/IS.pyx":45
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":50
 *         CHKERR( ISView(self.iset, cviewer) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( ISDestroy(&self.iset) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_13destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_12destroy[] = "IS.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_13destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_12destroy(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_12destroy(struct PyPetscISObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/IS.pyx":51
 * 
 *     def destroy(self):
 *         CHKERR( ISDestroy(&self.iset) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISDestroy((&__pyx_v_self->iset))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 51, __pyx_L1_error)

  /* "PETSc/IS.pyx":52
 *     def destroy(self):
 *         CHKERR( ISDestroy(&self.iset) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":50
 *         CHKERR( ISView(self.iset, cviewer) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( ISDestroy(&self.iset) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":54
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscIS newiset = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_15create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_14create[] = "IS.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_15create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(29, 54, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 54, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_14create(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_14create(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  IS __pyx_v_newiset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/IS.pyx":55
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscIS newiset = NULL
 *         CHKERR( ISCreate(ccomm, &newiset) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(29, 55, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/IS.pyx":56
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscIS newiset = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( ISCreate(ccomm, &newiset) )
 *         PetscCLEAR(self.obj); self.iset = newiset
 */
  __pyx_v_newiset = NULL;

  /* "PETSc/IS.pyx":57
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscIS newiset = NULL
 *         CHKERR( ISCreate(ccomm, &newiset) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.iset = newiset
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISCreate(__pyx_v_ccomm, (&__pyx_v_newiset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 57, __pyx_L1_error)

  /* "PETSc/IS.pyx":58
 *         cdef PetscIS newiset = NULL
 *         CHKERR( ISCreate(ccomm, &newiset) )
 *         PetscCLEAR(self.obj); self.iset = newiset             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->iset = __pyx_v_newiset;

  /* "PETSc/IS.pyx":59
 *         CHKERR( ISCreate(ccomm, &newiset) )
 *         PetscCLEAR(self.obj); self.iset = newiset
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, is_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":54
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscIS newiset = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":61
 *         return self
 * 
 *     def setType(self, is_type):             # <<<<<<<<<<<<<<
 *         cdef PetscISType cval = NULL
 *         is_type = str2bytes(is_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_17setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_16setType[] = "IS.setType(self, is_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_17setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_is_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_is_type,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);
        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_is_type)) != 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, "setType") < 0)) __PYX_ERR(29, 61, __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_is_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 61, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_16setType(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_is_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_16setType(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_is_type) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_is_type);

  /* "PETSc/IS.pyx":62
 * 
 *     def setType(self, is_type):
 *         cdef PetscISType cval = NULL             # <<<<<<<<<<<<<<
 *         is_type = str2bytes(is_type, &cval)
 *         CHKERR( ISSetType(self.iset, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/IS.pyx":63
 *     def setType(self, is_type):
 *         cdef PetscISType cval = NULL
 *         is_type = str2bytes(is_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( ISSetType(self.iset, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_is_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_is_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":64
 *         cdef PetscISType cval = NULL
 *         is_type = str2bytes(is_type, &cval)
 *         CHKERR( ISSetType(self.iset, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISSetType(__pyx_v_self->iset, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 64, __pyx_L1_error)

  /* "PETSc/IS.pyx":61
 *         return self
 * 
 *     def setType(self, is_type):             # <<<<<<<<<<<<<<
 *         cdef PetscISType cval = NULL
 *         is_type = str2bytes(is_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_is_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":66
 *         CHKERR( ISSetType(self.iset, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscISType cval = NULL
 *         CHKERR( ISGetType(self.iset, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_19getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_18getType[] = "IS.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_19getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_18getType(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_18getType(struct PyPetscISObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/IS.pyx":67
 * 
 *     def getType(self):
 *         cdef PetscISType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( ISGetType(self.iset, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/IS.pyx":68
 *     def getType(self):
 *         cdef PetscISType cval = NULL
 *         CHKERR( ISGetType(self.iset, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetType(__pyx_v_self->iset, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 68, __pyx_L1_error)

  /* "PETSc/IS.pyx":69
 *         cdef PetscISType cval = NULL
 *         CHKERR( ISGetType(self.iset, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def createGeneral(self, indices, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":66
 *         CHKERR( ISSetType(self.iset, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscISType cval = NULL
 *         CHKERR( ISGetType(self.iset, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":71
 *         return bytes2str(cval)
 * 
 *     def createGeneral(self, indices, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt nidx = 0, *idx = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_21createGeneral(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_20createGeneral[] = "IS.createGeneral(self, indices, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_21createGeneral(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createGeneral (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_comm,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createGeneral") < 0)) __PYX_ERR(29, 71, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_indices = values[0];
    __pyx_v_comm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createGeneral", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 71, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.createGeneral", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_20createGeneral(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_indices, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_20createGeneral(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_nidx;
  PetscInt *__pyx_v_idx;
  PetscCopyMode __pyx_v_cm;
  IS __pyx_v_newiset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("createGeneral", 0);
  __Pyx_INCREF(__pyx_v_indices);

  /* "PETSc/IS.pyx":72
 * 
 *     def createGeneral(self, indices, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(29, 72, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/IS.pyx":73
 *     def createGeneral(self, indices, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt nidx = 0, *idx = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         cdef PetscIS newiset = NULL
 */
  __pyx_v_nidx = 0;
  __pyx_v_idx = NULL;

  /* "PETSc/IS.pyx":74
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES             # <<<<<<<<<<<<<<
 *         cdef PetscIS newiset = NULL
 *         indices = iarray_i(indices, &nidx, &idx)
 */
  __pyx_v_cm = PETSC_COPY_VALUES;

  /* "PETSc/IS.pyx":75
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         cdef PetscIS newiset = NULL             # <<<<<<<<<<<<<<
 *         indices = iarray_i(indices, &nidx, &idx)
 *         CHKERR( ISCreateGeneral(ccomm, nidx, idx, cm, &newiset) )
 */
  __pyx_v_newiset = NULL;

  /* "PETSc/IS.pyx":76
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         cdef PetscIS newiset = NULL
 *         indices = iarray_i(indices, &nidx, &idx)             # <<<<<<<<<<<<<<
 *         CHKERR( ISCreateGeneral(ccomm, nidx, idx, cm, &newiset) )
 *         PetscCLEAR(self.obj); self.iset = newiset
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_indices, (&__pyx_v_nidx), (&__pyx_v_idx))); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/IS.pyx":77
 *         cdef PetscIS newiset = NULL
 *         indices = iarray_i(indices, &nidx, &idx)
 *         CHKERR( ISCreateGeneral(ccomm, nidx, idx, cm, &newiset) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.iset = newiset
 *         return self
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISCreateGeneral(__pyx_v_ccomm, __pyx_v_nidx, __pyx_v_idx, __pyx_v_cm, (&__pyx_v_newiset))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(29, 77, __pyx_L1_error)

  /* "PETSc/IS.pyx":78
 *         indices = iarray_i(indices, &nidx, &idx)
 *         CHKERR( ISCreateGeneral(ccomm, nidx, idx, cm, &newiset) )
 *         PetscCLEAR(self.obj); self.iset = newiset             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->iset = __pyx_v_newiset;

  /* "PETSc/IS.pyx":79
 *         CHKERR( ISCreateGeneral(ccomm, nidx, idx, cm, &newiset) )
 *         PetscCLEAR(self.obj); self.iset = newiset
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createBlock(self, bsize, indices, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":71
 *         return bytes2str(cval)
 * 
 *     def createGeneral(self, indices, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt nidx = 0, *idx = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.createGeneral", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":81
 *         return self
 * 
 *     def createBlock(self, bsize, indices, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs = asInt(bsize)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_23createBlock(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_22createBlock[] = "IS.createBlock(self, bsize, indices, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_23createBlock(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createBlock (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bsize,&__pyx_n_s_indices,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_bsize)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createBlock", 0, 2, 3, 1); __PYX_ERR(29, 81, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createBlock") < 0)) __PYX_ERR(29, 81, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_bsize = values[0];
    __pyx_v_indices = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createBlock", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 81, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.createBlock", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_22createBlock(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_bsize, __pyx_v_indices, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_22createBlock(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_bsize, PyObject *__pyx_v_indices, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_nidx;
  PetscInt *__pyx_v_idx;
  PetscCopyMode __pyx_v_cm;
  IS __pyx_v_newiset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PetscInt __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createBlock", 0);
  __Pyx_INCREF(__pyx_v_indices);

  /* "PETSc/IS.pyx":82
 * 
 *     def createBlock(self, bsize, indices, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = asInt(bsize)
 *         cdef PetscInt nidx = 0, *idx = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(29, 82, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/IS.pyx":83
 *     def createBlock(self, bsize, indices, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs = asInt(bsize)             # <<<<<<<<<<<<<<
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_bsize); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(29, 83, __pyx_L1_error)
  __pyx_v_bs = __pyx_t_2;

  /* "PETSc/IS.pyx":84
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs = asInt(bsize)
 *         cdef PetscInt nidx = 0, *idx = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         cdef PetscIS newiset = NULL
 */
  __pyx_v_nidx = 0;
  __pyx_v_idx = NULL;

  /* "PETSc/IS.pyx":85
 *         cdef PetscInt bs = asInt(bsize)
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES             # <<<<<<<<<<<<<<
 *         cdef PetscIS newiset = NULL
 *         indices = iarray_i(indices, &nidx, &idx)
 */
  __pyx_v_cm = PETSC_COPY_VALUES;

  /* "PETSc/IS.pyx":86
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         cdef PetscIS newiset = NULL             # <<<<<<<<<<<<<<
 *         indices = iarray_i(indices, &nidx, &idx)
 *         CHKERR( ISCreateBlock(ccomm, bs, nidx, idx, cm, &newiset) )
 */
  __pyx_v_newiset = NULL;

  /* "PETSc/IS.pyx":87
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         cdef PetscIS newiset = NULL
 *         indices = iarray_i(indices, &nidx, &idx)             # <<<<<<<<<<<<<<
 *         CHKERR( ISCreateBlock(ccomm, bs, nidx, idx, cm, &newiset) )
 *         PetscCLEAR(self.obj); self.iset = newiset
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_indices, (&__pyx_v_nidx), (&__pyx_v_idx))); if (unlikely(!__pyx_t_3)) __PYX_ERR(29, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/IS.pyx":88
 *         cdef PetscIS newiset = NULL
 *         indices = iarray_i(indices, &nidx, &idx)
 *         CHKERR( ISCreateBlock(ccomm, bs, nidx, idx, cm, &newiset) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.iset = newiset
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISCreateBlock(__pyx_v_ccomm, __pyx_v_bs, __pyx_v_nidx, __pyx_v_idx, __pyx_v_cm, (&__pyx_v_newiset))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(29, 88, __pyx_L1_error)

  /* "PETSc/IS.pyx":89
 *         indices = iarray_i(indices, &nidx, &idx)
 *         CHKERR( ISCreateBlock(ccomm, bs, nidx, idx, cm, &newiset) )
 *         PetscCLEAR(self.obj); self.iset = newiset             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->iset = __pyx_v_newiset;

  /* "PETSc/IS.pyx":90
 *         CHKERR( ISCreateBlock(ccomm, bs, nidx, idx, cm, &newiset) )
 *         PetscCLEAR(self.obj); self.iset = newiset
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createStride(self, size, first=0, step=0, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":81
 *         return self
 * 
 *     def createBlock(self, bsize, indices, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs = asInt(bsize)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.createBlock", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":92
 *         return self
 * 
 *     def createStride(self, size, first=0, step=0, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt csize  = asInt(size)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_25createStride(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_24createStride[] = "IS.createStride(self, size, first=0, step=0, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_25createStride(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_first = 0;
  PyObject *__pyx_v_step = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createStride (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_first,&__pyx_n_s_step,&__pyx_n_s_comm,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)__pyx_int_0);
    values[2] = ((PyObject *)__pyx_int_0);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_first);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_step);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createStride") < 0)) __PYX_ERR(29, 92, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_size = values[0];
    __pyx_v_first = values[1];
    __pyx_v_step = values[2];
    __pyx_v_comm = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createStride", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 92, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.createStride", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_24createStride(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_size, __pyx_v_first, __pyx_v_step, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_24createStride(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_first, PyObject *__pyx_v_step, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_csize;
  PetscInt __pyx_v_cfirst;
  PetscInt __pyx_v_cstep;
  IS __pyx_v_newiset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PetscInt __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("createStride", 0);

  /* "PETSc/IS.pyx":93
 * 
 *     def createStride(self, size, first=0, step=0, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscInt csize  = asInt(size)
 *         cdef PetscInt cfirst = asInt(first)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(29, 93, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/IS.pyx":94
 *     def createStride(self, size, first=0, step=0, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt csize  = asInt(size)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfirst = asInt(first)
 *         cdef PetscInt cstep  = asInt(step)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_size); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(29, 94, __pyx_L1_error)
  __pyx_v_csize = __pyx_t_2;

  /* "PETSc/IS.pyx":95
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt csize  = asInt(size)
 *         cdef PetscInt cfirst = asInt(first)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cstep  = asInt(step)
 *         cdef PetscIS newiset = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_first); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(29, 95, __pyx_L1_error)
  __pyx_v_cfirst = __pyx_t_2;

  /* "PETSc/IS.pyx":96
 *         cdef PetscInt csize  = asInt(size)
 *         cdef PetscInt cfirst = asInt(first)
 *         cdef PetscInt cstep  = asInt(step)             # <<<<<<<<<<<<<<
 *         cdef PetscIS newiset = NULL
 *         CHKERR( ISCreateStride(ccomm, csize, cfirst, cstep, &newiset) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_step); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(29, 96, __pyx_L1_error)
  __pyx_v_cstep = __pyx_t_2;

  /* "PETSc/IS.pyx":97
 *         cdef PetscInt cfirst = asInt(first)
 *         cdef PetscInt cstep  = asInt(step)
 *         cdef PetscIS newiset = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( ISCreateStride(ccomm, csize, cfirst, cstep, &newiset) )
 *         PetscCLEAR(self.obj); self.iset = newiset
 */
  __pyx_v_newiset = NULL;

  /* "PETSc/IS.pyx":98
 *         cdef PetscInt cstep  = asInt(step)
 *         cdef PetscIS newiset = NULL
 *         CHKERR( ISCreateStride(ccomm, csize, cfirst, cstep, &newiset) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.iset = newiset
 *         return self
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISCreateStride(__pyx_v_ccomm, __pyx_v_csize, __pyx_v_cfirst, __pyx_v_cstep, (&__pyx_v_newiset))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(29, 98, __pyx_L1_error)

  /* "PETSc/IS.pyx":99
 *         cdef PetscIS newiset = NULL
 *         CHKERR( ISCreateStride(ccomm, csize, cfirst, cstep, &newiset) )
 *         PetscCLEAR(self.obj); self.iset = newiset             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->iset = __pyx_v_newiset;

  /* "PETSc/IS.pyx":100
 *         CHKERR( ISCreateStride(ccomm, csize, cfirst, cstep, &newiset) )
 *         PetscCLEAR(self.obj); self.iset = newiset
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def duplicate(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":92
 *         return self
 * 
 *     def createStride(self, size, first=0, step=0, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt csize  = asInt(size)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.createStride", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":102
 *         return self
 * 
 *     def duplicate(self):             # <<<<<<<<<<<<<<
 *         cdef IS iset = type(self)()
 *         CHKERR( ISDuplicate(self.iset, &iset.iset) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_27duplicate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_26duplicate[] = "IS.duplicate(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_27duplicate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("duplicate (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("duplicate", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "duplicate", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_26duplicate(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_26duplicate(struct PyPetscISObject *__pyx_v_self) {
  struct PyPetscISObject *__pyx_v_iset = 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;
  __Pyx_RefNannySetupContext("duplicate", 0);

  /* "PETSc/IS.pyx":103
 * 
 *     def duplicate(self):
 *         cdef IS iset = type(self)()             # <<<<<<<<<<<<<<
 *         CHKERR( ISDuplicate(self.iset, &iset.iset) )
 *         return iset
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __pyx_t_2 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 103, __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(29, 103, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_IS))))) __PYX_ERR(29, 103, __pyx_L1_error)
  __pyx_v_iset = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":104
 *     def duplicate(self):
 *         cdef IS iset = type(self)()
 *         CHKERR( ISDuplicate(self.iset, &iset.iset) )             # <<<<<<<<<<<<<<
 *         return iset
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISDuplicate(__pyx_v_self->iset, (&__pyx_v_iset->iset))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(29, 104, __pyx_L1_error)

  /* "PETSc/IS.pyx":105
 *         cdef IS iset = type(self)()
 *         CHKERR( ISDuplicate(self.iset, &iset.iset) )
 *         return iset             # <<<<<<<<<<<<<<
 * 
 *     def copy(self, IS result=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_iset));
  __pyx_r = ((PyObject *)__pyx_v_iset);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":102
 *         return self
 * 
 *     def duplicate(self):             # <<<<<<<<<<<<<<
 *         cdef IS iset = type(self)()
 *         CHKERR( ISDuplicate(self.iset, &iset.iset) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.duplicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_iset);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":107
 *         return iset
 * 
 *     def copy(self, IS result=None):             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = type(self)()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_29copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_28copy[] = "IS.copy(self, IS result=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_29copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_result = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_result,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscISObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy") < 0)) __PYX_ERR(29, 107, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_result = ((struct PyPetscISObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 107, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_8petsc4py_5PETSc_IS, 1, "result", 0))) __PYX_ERR(29, 107, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_28copy(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_result);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_28copy(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_result) {
  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;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_result);

  /* "PETSc/IS.pyx":108
 * 
 *     def copy(self, IS result=None):
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = type(self)()
 *         if result.iset == NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_result) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/IS.pyx":109
 *     def copy(self, IS result=None):
 *         if result is None:
 *             result = type(self)()             # <<<<<<<<<<<<<<
 *         if result.iset == NULL:
 *             CHKERR( ISDuplicate(self.iset, &result.iset) )
 */
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __pyx_t_4 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(29, 109, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(29, 109, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8petsc4py_5PETSc_IS))))) __PYX_ERR(29, 109, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_result, ((struct PyPetscISObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/IS.pyx":108
 * 
 *     def copy(self, IS result=None):
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = type(self)()
 *         if result.iset == NULL:
 */
  }

  /* "PETSc/IS.pyx":110
 *         if result is None:
 *             result = type(self)()
 *         if result.iset == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( ISDuplicate(self.iset, &result.iset) )
 *         CHKERR( ISCopy(self.iset, result.iset) )
 */
  __pyx_t_2 = ((__pyx_v_result->iset == NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/IS.pyx":111
 *             result = type(self)()
 *         if result.iset == NULL:
 *             CHKERR( ISDuplicate(self.iset, &result.iset) )             # <<<<<<<<<<<<<<
 *         CHKERR( ISCopy(self.iset, result.iset) )
 *         return result
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISDuplicate(__pyx_v_self->iset, (&__pyx_v_result->iset))); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(29, 111, __pyx_L1_error)

    /* "PETSc/IS.pyx":110
 *         if result is None:
 *             result = type(self)()
 *         if result.iset == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( ISDuplicate(self.iset, &result.iset) )
 *         CHKERR( ISCopy(self.iset, result.iset) )
 */
  }

  /* "PETSc/IS.pyx":112
 *         if result.iset == NULL:
 *             CHKERR( ISDuplicate(self.iset, &result.iset) )
 *         CHKERR( ISCopy(self.iset, result.iset) )             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISCopy(__pyx_v_self->iset, __pyx_v_result->iset)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(29, 112, __pyx_L1_error)

  /* "PETSc/IS.pyx":113
 *             CHKERR( ISDuplicate(self.iset, &result.iset) )
 *         CHKERR( ISCopy(self.iset, result.iset) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def load(self, Viewer viewer not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":107
 *         return iset
 * 
 *     def copy(self, IS result=None):             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = type(self)()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.copy", __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;
}

/* "PETSc/IS.pyx":115
 *         return result
 * 
 *     def load(self, Viewer viewer not None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_31load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_30load[] = "IS.load(self, Viewer viewer)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_31load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,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);
        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_viewer)) != 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, "load") < 0)) __PYX_ERR(29, 115, __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_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 115, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 0, "viewer", 0))) __PYX_ERR(29, 115, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_30load(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_30load(struct PyPetscISObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  MPI_Comm __pyx_v_comm;
  PetscObject __pyx_v_obj;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("load", 0);

  /* "PETSc/IS.pyx":116
 * 
 *     def load(self, Viewer viewer not None):
 *         cdef MPI_Comm comm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 *         if self.iset == NULL:
 */
  __pyx_v_comm = MPI_COMM_NULL;

  /* "PETSc/IS.pyx":117
 *     def load(self, Viewer viewer not None):
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)             # <<<<<<<<<<<<<<
 *         if self.iset == NULL:
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 */
  __pyx_v_obj = ((PetscObject)__pyx_v_viewer->vwr);

  /* "PETSc/IS.pyx":118
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 *         if self.iset == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 *             CHKERR( ISCreate(comm, &self.iset) )
 */
  __pyx_t_1 = ((__pyx_v_self->iset == NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/IS.pyx":119
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 *         if self.iset == NULL:
 *             CHKERR( PetscObjectGetComm(obj, &comm) )             # <<<<<<<<<<<<<<
 *             CHKERR( ISCreate(comm, &self.iset) )
 *         CHKERR( ISLoad(self.iset, viewer.vwr) )
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetComm(__pyx_v_obj, (&__pyx_v_comm))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 119, __pyx_L1_error)

    /* "PETSc/IS.pyx":120
 *         if self.iset == NULL:
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 *             CHKERR( ISCreate(comm, &self.iset) )             # <<<<<<<<<<<<<<
 *         CHKERR( ISLoad(self.iset, viewer.vwr) )
 *         return self
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISCreate(__pyx_v_comm, (&__pyx_v_self->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 120, __pyx_L1_error)

    /* "PETSc/IS.pyx":118
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 *         if self.iset == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 *             CHKERR( ISCreate(comm, &self.iset) )
 */
  }

  /* "PETSc/IS.pyx":121
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 *             CHKERR( ISCreate(comm, &self.iset) )
 *         CHKERR( ISLoad(self.iset, viewer.vwr) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLoad(__pyx_v_self->iset, __pyx_v_viewer->vwr)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 121, __pyx_L1_error)

  /* "PETSc/IS.pyx":122
 *             CHKERR( ISCreate(comm, &self.iset) )
 *         CHKERR( ISLoad(self.iset, viewer.vwr) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def allGather(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":115
 *         return result
 * 
 *     def load(self, Viewer viewer not None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":124
 *         return self
 * 
 *     def allGather(self):             # <<<<<<<<<<<<<<
 *         cdef IS iset = IS()
 *         CHKERR( ISAllGather(self.iset, &iset.iset) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_33allGather(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_32allGather[] = "IS.allGather(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_33allGather(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("allGather (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("allGather", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "allGather", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_32allGather(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_32allGather(struct PyPetscISObject *__pyx_v_self) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("allGather", 0);

  /* "PETSc/IS.pyx":125
 * 
 *     def allGather(self):
 *         cdef IS iset = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( ISAllGather(self.iset, &iset.iset) )
 *         return iset
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_iset = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":126
 *     def allGather(self):
 *         cdef IS iset = IS()
 *         CHKERR( ISAllGather(self.iset, &iset.iset) )             # <<<<<<<<<<<<<<
 *         return iset
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISAllGather(__pyx_v_self->iset, (&__pyx_v_iset->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 126, __pyx_L1_error)

  /* "PETSc/IS.pyx":127
 *         cdef IS iset = IS()
 *         CHKERR( ISAllGather(self.iset, &iset.iset) )
 *         return iset             # <<<<<<<<<<<<<<
 * 
 *     def toGeneral(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_iset));
  __pyx_r = ((PyObject *)__pyx_v_iset);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":124
 *         return self
 * 
 *     def allGather(self):             # <<<<<<<<<<<<<<
 *         cdef IS iset = IS()
 *         CHKERR( ISAllGather(self.iset, &iset.iset) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.allGather", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_iset);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":129
 *         return iset
 * 
 *     def toGeneral(self):             # <<<<<<<<<<<<<<
 *         CHKERR( ISToGeneral(self.iset) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_35toGeneral(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_34toGeneral[] = "IS.toGeneral(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_35toGeneral(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("toGeneral (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("toGeneral", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "toGeneral", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_34toGeneral(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_34toGeneral(struct PyPetscISObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("toGeneral", 0);

  /* "PETSc/IS.pyx":130
 * 
 *     def toGeneral(self):
 *         CHKERR( ISToGeneral(self.iset) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISToGeneral(__pyx_v_self->iset)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 130, __pyx_L1_error)

  /* "PETSc/IS.pyx":131
 *     def toGeneral(self):
 *         CHKERR( ISToGeneral(self.iset) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def invertPermutation(self, nlocal=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":129
 *         return iset
 * 
 *     def toGeneral(self):             # <<<<<<<<<<<<<<
 *         CHKERR( ISToGeneral(self.iset) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.toGeneral", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":133
 *         return self
 * 
 *     def invertPermutation(self, nlocal=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnlocal = PETSC_DECIDE
 *         if nlocal is not None: cnlocal = asInt(nlocal)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_37invertPermutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_36invertPermutation[] = "IS.invertPermutation(self, nlocal=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_37invertPermutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nlocal = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("invertPermutation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nlocal,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nlocal);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "invertPermutation") < 0)) __PYX_ERR(29, 133, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_nlocal = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("invertPermutation", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 133, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.invertPermutation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_36invertPermutation(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_nlocal);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_36invertPermutation(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_nlocal) {
  PetscInt __pyx_v_cnlocal;
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("invertPermutation", 0);

  /* "PETSc/IS.pyx":134
 * 
 *     def invertPermutation(self, nlocal=None):
 *         cdef PetscInt cnlocal = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         if nlocal is not None: cnlocal = asInt(nlocal)
 *         cdef IS iset = IS()
 */
  __pyx_v_cnlocal = PETSC_DECIDE;

  /* "PETSc/IS.pyx":135
 *     def invertPermutation(self, nlocal=None):
 *         cdef PetscInt cnlocal = PETSC_DECIDE
 *         if nlocal is not None: cnlocal = asInt(nlocal)             # <<<<<<<<<<<<<<
 *         cdef IS iset = IS()
 *         CHKERR( ISInvertPermutation(self.iset, cnlocal, &iset.iset) )
 */
  __pyx_t_1 = (__pyx_v_nlocal != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_nlocal); if (unlikely(__pyx_t_3 == -1L && PyErr_Occurred())) __PYX_ERR(29, 135, __pyx_L1_error)
    __pyx_v_cnlocal = __pyx_t_3;
  }

  /* "PETSc/IS.pyx":136
 *         cdef PetscInt cnlocal = PETSC_DECIDE
 *         if nlocal is not None: cnlocal = asInt(nlocal)
 *         cdef IS iset = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( ISInvertPermutation(self.iset, cnlocal, &iset.iset) )
 *         return iset
 */
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(29, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_iset = ((struct PyPetscISObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/IS.pyx":137
 *         if nlocal is not None: cnlocal = asInt(nlocal)
 *         cdef IS iset = IS()
 *         CHKERR( ISInvertPermutation(self.iset, cnlocal, &iset.iset) )             # <<<<<<<<<<<<<<
 *         return iset
 * 
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISInvertPermutation(__pyx_v_self->iset, __pyx_v_cnlocal, (&__pyx_v_iset->iset))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(29, 137, __pyx_L1_error)

  /* "PETSc/IS.pyx":138
 *         cdef IS iset = IS()
 *         CHKERR( ISInvertPermutation(self.iset, cnlocal, &iset.iset) )
 *         return iset             # <<<<<<<<<<<<<<
 * 
 *     def getSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_iset));
  __pyx_r = ((PyObject *)__pyx_v_iset);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":133
 *         return self
 * 
 *     def invertPermutation(self, nlocal=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnlocal = PETSC_DECIDE
 *         if nlocal is not None: cnlocal = asInt(nlocal)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.invertPermutation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_iset);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":140
 *         return iset
 * 
 *     def getSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt N = 0
 *         CHKERR( ISGetSize(self.iset, &N) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_39getSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_38getSize[] = "IS.getSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_39getSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_38getSize(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_38getSize(struct PyPetscISObject *__pyx_v_self) {
  PetscInt __pyx_v_N;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getSize", 0);

  /* "PETSc/IS.pyx":141
 * 
 *     def getSize(self):
 *         cdef PetscInt N = 0             # <<<<<<<<<<<<<<
 *         CHKERR( ISGetSize(self.iset, &N) )
 *         return toInt(N)
 */
  __pyx_v_N = 0;

  /* "PETSc/IS.pyx":142
 *     def getSize(self):
 *         cdef PetscInt N = 0
 *         CHKERR( ISGetSize(self.iset, &N) )             # <<<<<<<<<<<<<<
 *         return toInt(N)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetSize(__pyx_v_self->iset, (&__pyx_v_N))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 142, __pyx_L1_error)

  /* "PETSc/IS.pyx":143
 *         cdef PetscInt N = 0
 *         CHKERR( ISGetSize(self.iset, &N) )
 *         return toInt(N)             # <<<<<<<<<<<<<<
 * 
 *     def getLocalSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":140
 *         return iset
 * 
 *     def getSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt N = 0
 *         CHKERR( ISGetSize(self.iset, &N) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.getSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":145
 *         return toInt(N)
 * 
 *     def getLocalSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( ISGetLocalSize(self.iset, &n) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_41getLocalSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_40getLocalSize[] = "IS.getLocalSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_41getLocalSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLocalSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getLocalSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getLocalSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_40getLocalSize(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_40getLocalSize(struct PyPetscISObject *__pyx_v_self) {
  PetscInt __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getLocalSize", 0);

  /* "PETSc/IS.pyx":146
 * 
 *     def getLocalSize(self):
 *         cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *         CHKERR( ISGetLocalSize(self.iset, &n) )
 *         return toInt(n)
 */
  __pyx_v_n = 0;

  /* "PETSc/IS.pyx":147
 *     def getLocalSize(self):
 *         cdef PetscInt n = 0
 *         CHKERR( ISGetLocalSize(self.iset, &n) )             # <<<<<<<<<<<<<<
 *         return toInt(n)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetLocalSize(__pyx_v_self->iset, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 147, __pyx_L1_error)

  /* "PETSc/IS.pyx":148
 *         cdef PetscInt n = 0
 *         CHKERR( ISGetLocalSize(self.iset, &n) )
 *         return toInt(n)             # <<<<<<<<<<<<<<
 * 
 *     def getSizes(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":145
 *         return toInt(N)
 * 
 *     def getLocalSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( ISGetLocalSize(self.iset, &n) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.getLocalSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":150
 *         return toInt(n)
 * 
 *     def getSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0, N = 0
 *         CHKERR( ISGetLocalSize(self.iset, &n) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_43getSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_42getSizes[] = "IS.getSizes(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_43getSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSizes (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSizes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSizes", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_42getSizes(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_42getSizes(struct PyPetscISObject *__pyx_v_self) {
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_N;
  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;
  __Pyx_RefNannySetupContext("getSizes", 0);

  /* "PETSc/IS.pyx":151
 * 
 *     def getSizes(self):
 *         cdef PetscInt n = 0, N = 0             # <<<<<<<<<<<<<<
 *         CHKERR( ISGetLocalSize(self.iset, &n) )
 *         CHKERR( ISGetSize(self.iset, &N) )
 */
  __pyx_v_n = 0;
  __pyx_v_N = 0;

  /* "PETSc/IS.pyx":152
 *     def getSizes(self):
 *         cdef PetscInt n = 0, N = 0
 *         CHKERR( ISGetLocalSize(self.iset, &n) )             # <<<<<<<<<<<<<<
 *         CHKERR( ISGetSize(self.iset, &N) )
 *         return (toInt(n), toInt(N))
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetLocalSize(__pyx_v_self->iset, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 152, __pyx_L1_error)

  /* "PETSc/IS.pyx":153
 *         cdef PetscInt n = 0, N = 0
 *         CHKERR( ISGetLocalSize(self.iset, &n) )
 *         CHKERR( ISGetSize(self.iset, &N) )             # <<<<<<<<<<<<<<
 *         return (toInt(n), toInt(N))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetSize(__pyx_v_self->iset, (&__pyx_v_N))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 153, __pyx_L1_error)

  /* "PETSc/IS.pyx":154
 *         CHKERR( ISGetLocalSize(self.iset, &n) )
 *         CHKERR( ISGetSize(self.iset, &N) )
 *         return (toInt(n), toInt(N))             # <<<<<<<<<<<<<<
 * 
 *     def getBlockSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_3)) __PYX_ERR(29, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(29, 154, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":150
 *         return toInt(n)
 * 
 *     def getSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0, N = 0
 *         CHKERR( ISGetLocalSize(self.iset, &n) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.getSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":156
 *         return (toInt(n), toInt(N))
 * 
 *     def getBlockSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = 1
 *         CHKERR( ISGetBlockSize(self.iset, &bs) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_45getBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_44getBlockSize[] = "IS.getBlockSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_45getBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBlockSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getBlockSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getBlockSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_44getBlockSize(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_44getBlockSize(struct PyPetscISObject *__pyx_v_self) {
  PetscInt __pyx_v_bs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getBlockSize", 0);

  /* "PETSc/IS.pyx":157
 * 
 *     def getBlockSize(self):
 *         cdef PetscInt bs = 1             # <<<<<<<<<<<<<<
 *         CHKERR( ISGetBlockSize(self.iset, &bs) )
 *         return toInt(bs)
 */
  __pyx_v_bs = 1;

  /* "PETSc/IS.pyx":158
 *     def getBlockSize(self):
 *         cdef PetscInt bs = 1
 *         CHKERR( ISGetBlockSize(self.iset, &bs) )             # <<<<<<<<<<<<<<
 *         return toInt(bs)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetBlockSize(__pyx_v_self->iset, (&__pyx_v_bs))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 158, __pyx_L1_error)

  /* "PETSc/IS.pyx":159
 *         cdef PetscInt bs = 1
 *         CHKERR( ISGetBlockSize(self.iset, &bs) )
 *         return toInt(bs)             # <<<<<<<<<<<<<<
 * 
 *     def setBlockSize(self, bs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_bs); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":156
 *         return (toInt(n), toInt(N))
 * 
 *     def getBlockSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = 1
 *         CHKERR( ISGetBlockSize(self.iset, &bs) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.getBlockSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":161
 *         return toInt(bs)
 * 
 *     def setBlockSize(self, bs):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cbs = asInt(bs)
 *         CHKERR( ISSetBlockSize(self.iset, cbs) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_47setBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_46setBlockSize[] = "IS.setBlockSize(self, bs)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_47setBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setBlockSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bs,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);
        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_bs)) != 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, "setBlockSize") < 0)) __PYX_ERR(29, 161, __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_bs = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setBlockSize", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 161, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.setBlockSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_46setBlockSize(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_bs);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_46setBlockSize(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_bs) {
  PetscInt __pyx_v_cbs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setBlockSize", 0);

  /* "PETSc/IS.pyx":162
 * 
 *     def setBlockSize(self, bs):
 *         cdef PetscInt cbs = asInt(bs)             # <<<<<<<<<<<<<<
 *         CHKERR( ISSetBlockSize(self.iset, cbs) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_bs); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(29, 162, __pyx_L1_error)
  __pyx_v_cbs = __pyx_t_1;

  /* "PETSc/IS.pyx":163
 *     def setBlockSize(self, bs):
 *         cdef PetscInt cbs = asInt(bs)
 *         CHKERR( ISSetBlockSize(self.iset, cbs) )             # <<<<<<<<<<<<<<
 * 
 *     def sort(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISSetBlockSize(__pyx_v_self->iset, __pyx_v_cbs)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 163, __pyx_L1_error)

  /* "PETSc/IS.pyx":161
 *         return toInt(bs)
 * 
 *     def setBlockSize(self, bs):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cbs = asInt(bs)
 *         CHKERR( ISSetBlockSize(self.iset, cbs) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.setBlockSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":165
 *         CHKERR( ISSetBlockSize(self.iset, cbs) )
 * 
 *     def sort(self):             # <<<<<<<<<<<<<<
 *         CHKERR( ISSort(self.iset) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_49sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_48sort[] = "IS.sort(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_49sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sort (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("sort", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "sort", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_48sort(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_48sort(struct PyPetscISObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("sort", 0);

  /* "PETSc/IS.pyx":166
 * 
 *     def sort(self):
 *         CHKERR( ISSort(self.iset) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISSort(__pyx_v_self->iset)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 166, __pyx_L1_error)

  /* "PETSc/IS.pyx":167
 *     def sort(self):
 *         CHKERR( ISSort(self.iset) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def isSorted(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":165
 *         CHKERR( ISSetBlockSize(self.iset, cbs) )
 * 
 *     def sort(self):             # <<<<<<<<<<<<<<
 *         CHKERR( ISSort(self.iset) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.sort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":169
 *         return self
 * 
 *     def isSorted(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISSorted(self.iset, &flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_51isSorted(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_50isSorted[] = "IS.isSorted(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_51isSorted(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isSorted (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("isSorted", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "isSorted", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_50isSorted(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_50isSorted(struct PyPetscISObject *__pyx_v_self) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("isSorted", 0);

  /* "PETSc/IS.pyx":170
 * 
 *     def isSorted(self):
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( ISSorted(self.iset, &flag) )
 *         return <bint> flag
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/IS.pyx":171
 *     def isSorted(self):
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISSorted(self.iset, &flag) )             # <<<<<<<<<<<<<<
 *         return <bint> flag
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISSorted(__pyx_v_self->iset, (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 171, __pyx_L1_error)

  /* "PETSc/IS.pyx":172
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISSorted(self.iset, &flag) )
 *         return <bint> flag             # <<<<<<<<<<<<<<
 * 
 *     def setPermutation(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":169
 *         return self
 * 
 *     def isSorted(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISSorted(self.iset, &flag) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.isSorted", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":174
 *         return <bint> flag
 * 
 *     def setPermutation(self):             # <<<<<<<<<<<<<<
 *         CHKERR( ISSetPermutation(self.iset) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_53setPermutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_52setPermutation[] = "IS.setPermutation(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_53setPermutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPermutation (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setPermutation", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setPermutation", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_52setPermutation(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_52setPermutation(struct PyPetscISObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setPermutation", 0);

  /* "PETSc/IS.pyx":175
 * 
 *     def setPermutation(self):
 *         CHKERR( ISSetPermutation(self.iset) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISSetPermutation(__pyx_v_self->iset)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 175, __pyx_L1_error)

  /* "PETSc/IS.pyx":176
 *     def setPermutation(self):
 *         CHKERR( ISSetPermutation(self.iset) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def isPermutation(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":174
 *         return <bint> flag
 * 
 *     def setPermutation(self):             # <<<<<<<<<<<<<<
 *         CHKERR( ISSetPermutation(self.iset) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.setPermutation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":178
 *         return self
 * 
 *     def isPermutation(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISPermutation(self.iset, &flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_55isPermutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_54isPermutation[] = "IS.isPermutation(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_55isPermutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isPermutation (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("isPermutation", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "isPermutation", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_54isPermutation(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_54isPermutation(struct PyPetscISObject *__pyx_v_self) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("isPermutation", 0);

  /* "PETSc/IS.pyx":179
 * 
 *     def isPermutation(self):
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( ISPermutation(self.iset, &flag) )
 *         return <bint> flag
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/IS.pyx":180
 *     def isPermutation(self):
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISPermutation(self.iset, &flag) )             # <<<<<<<<<<<<<<
 *         return <bint> flag
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISPermutation(__pyx_v_self->iset, (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 180, __pyx_L1_error)

  /* "PETSc/IS.pyx":181
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISPermutation(self.iset, &flag) )
 *         return <bint> flag             # <<<<<<<<<<<<<<
 * 
 *     def setIdentity(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":178
 *         return self
 * 
 *     def isPermutation(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISPermutation(self.iset, &flag) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.isPermutation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":183
 *         return <bint> flag
 * 
 *     def setIdentity(self):             # <<<<<<<<<<<<<<
 *         CHKERR( ISSetIdentity(self.iset) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_57setIdentity(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_56setIdentity[] = "IS.setIdentity(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_57setIdentity(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setIdentity (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setIdentity", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setIdentity", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_56setIdentity(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_56setIdentity(struct PyPetscISObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setIdentity", 0);

  /* "PETSc/IS.pyx":184
 * 
 *     def setIdentity(self):
 *         CHKERR( ISSetIdentity(self.iset) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISSetIdentity(__pyx_v_self->iset)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 184, __pyx_L1_error)

  /* "PETSc/IS.pyx":185
 *     def setIdentity(self):
 *         CHKERR( ISSetIdentity(self.iset) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def isIdentity(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":183
 *         return <bint> flag
 * 
 *     def setIdentity(self):             # <<<<<<<<<<<<<<
 *         CHKERR( ISSetIdentity(self.iset) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.setIdentity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":187
 *         return self
 * 
 *     def isIdentity(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISIdentity(self.iset, &flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_59isIdentity(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_58isIdentity[] = "IS.isIdentity(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_59isIdentity(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isIdentity (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("isIdentity", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "isIdentity", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_58isIdentity(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_58isIdentity(struct PyPetscISObject *__pyx_v_self) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("isIdentity", 0);

  /* "PETSc/IS.pyx":188
 * 
 *     def isIdentity(self):
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( ISIdentity(self.iset, &flag) )
 *         return <bint> flag
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/IS.pyx":189
 *     def isIdentity(self):
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISIdentity(self.iset, &flag) )             # <<<<<<<<<<<<<<
 *         return <bint> flag
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISIdentity(__pyx_v_self->iset, (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 189, __pyx_L1_error)

  /* "PETSc/IS.pyx":190
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISIdentity(self.iset, &flag) )
 *         return <bint> flag             # <<<<<<<<<<<<<<
 * 
 *     def equal(self, IS iset not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":187
 *         return self
 * 
 *     def isIdentity(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISIdentity(self.iset, &flag) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.isIdentity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":192
 *         return <bint> flag
 * 
 *     def equal(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISEqual(self.iset, iset.iset, &flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_61equal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_60equal[] = "IS.equal(self, IS iset)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_61equal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("equal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iset,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);
        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_iset)) != 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, "equal") < 0)) __PYX_ERR(29, 192, __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_iset = ((struct PyPetscISObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("equal", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 192, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iset), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iset", 0))) __PYX_ERR(29, 192, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_60equal(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_iset);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_60equal(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("equal", 0);

  /* "PETSc/IS.pyx":193
 * 
 *     def equal(self, IS iset not None):
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( ISEqual(self.iset, iset.iset, &flag) )
 *         return <bint> flag
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/IS.pyx":194
 *     def equal(self, IS iset not None):
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISEqual(self.iset, iset.iset, &flag) )             # <<<<<<<<<<<<<<
 *         return <bint> flag
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISEqual(__pyx_v_self->iset, __pyx_v_iset->iset, (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 194, __pyx_L1_error)

  /* "PETSc/IS.pyx":195
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISEqual(self.iset, iset.iset, &flag) )
 *         return <bint> flag             # <<<<<<<<<<<<<<
 * 
 *     def sum(self, IS iset not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":192
 *         return <bint> flag
 * 
 *     def equal(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( ISEqual(self.iset, iset.iset, &flag) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":197
 *         return <bint> flag
 * 
 *     def sum(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef IS out = IS()
 *         CHKERR( ISSum(self.iset, iset.iset, &out.iset) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_63sum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_62sum[] = "IS.sum(self, IS iset)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_63sum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iset,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);
        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_iset)) != 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, "sum") < 0)) __PYX_ERR(29, 197, __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_iset = ((struct PyPetscISObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sum", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 197, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iset), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iset", 0))) __PYX_ERR(29, 197, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_62sum(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_iset);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_62sum(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset) {
  struct PyPetscISObject *__pyx_v_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("sum", 0);

  /* "PETSc/IS.pyx":198
 * 
 *     def sum(self, IS iset not None):
 *         cdef IS out = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( ISSum(self.iset, iset.iset, &out.iset) )
 *         return out
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_out = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":199
 *     def sum(self, IS iset not None):
 *         cdef IS out = IS()
 *         CHKERR( ISSum(self.iset, iset.iset, &out.iset) )             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISSum(__pyx_v_self->iset, __pyx_v_iset->iset, (&__pyx_v_out->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 199, __pyx_L1_error)

  /* "PETSc/IS.pyx":200
 *         cdef IS out = IS()
 *         CHKERR( ISSum(self.iset, iset.iset, &out.iset) )
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def expand(self, IS iset not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":197
 *         return <bint> flag
 * 
 *     def sum(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef IS out = IS()
 *         CHKERR( ISSum(self.iset, iset.iset, &out.iset) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":202
 *         return out
 * 
 *     def expand(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef IS out = IS()
 *         CHKERR( ISExpand(self.iset, iset.iset, &out.iset) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_65expand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_64expand[] = "IS.expand(self, IS iset)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_65expand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("expand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iset,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);
        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_iset)) != 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, "expand") < 0)) __PYX_ERR(29, 202, __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_iset = ((struct PyPetscISObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("expand", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 202, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.expand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iset), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iset", 0))) __PYX_ERR(29, 202, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_64expand(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_iset);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_64expand(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset) {
  struct PyPetscISObject *__pyx_v_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("expand", 0);

  /* "PETSc/IS.pyx":203
 * 
 *     def expand(self, IS iset not None):
 *         cdef IS out = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( ISExpand(self.iset, iset.iset, &out.iset) )
 *         return out
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_out = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":204
 *     def expand(self, IS iset not None):
 *         cdef IS out = IS()
 *         CHKERR( ISExpand(self.iset, iset.iset, &out.iset) )             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISExpand(__pyx_v_self->iset, __pyx_v_iset->iset, (&__pyx_v_out->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 204, __pyx_L1_error)

  /* "PETSc/IS.pyx":205
 *         cdef IS out = IS()
 *         CHKERR( ISExpand(self.iset, iset.iset, &out.iset) )
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def union(self, IS iset not None): # XXX review this
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":202
 *         return out
 * 
 *     def expand(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef IS out = IS()
 *         CHKERR( ISExpand(self.iset, iset.iset, &out.iset) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.expand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":207
 *         return out
 * 
 *     def union(self, IS iset not None): # XXX review this             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag1=PETSC_FALSE, flag2=PETSC_FALSE
 *         CHKERR( ISSorted(self.iset, &flag1) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_67union(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_66union[] = "IS.union(self, IS iset)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_67union(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("union (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iset,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);
        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_iset)) != 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, "union") < 0)) __PYX_ERR(29, 207, __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_iset = ((struct PyPetscISObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("union", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 207, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.union", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iset), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iset", 0))) __PYX_ERR(29, 207, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_66union(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_iset);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_66union(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset) {
  PetscBool __pyx_v_flag1;
  PetscBool __pyx_v_flag2;
  struct PyPetscISObject *__pyx_v_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("union", 0);

  /* "PETSc/IS.pyx":208
 * 
 *     def union(self, IS iset not None): # XXX review this
 *         cdef PetscBool flag1=PETSC_FALSE, flag2=PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( ISSorted(self.iset, &flag1) )
 *         CHKERR( ISSorted(iset.iset, &flag2) )
 */
  __pyx_v_flag1 = PETSC_FALSE;
  __pyx_v_flag2 = PETSC_FALSE;

  /* "PETSc/IS.pyx":209
 *     def union(self, IS iset not None): # XXX review this
 *         cdef PetscBool flag1=PETSC_FALSE, flag2=PETSC_FALSE
 *         CHKERR( ISSorted(self.iset, &flag1) )             # <<<<<<<<<<<<<<
 *         CHKERR( ISSorted(iset.iset, &flag2) )
 *         cdef IS out = IS()
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISSorted(__pyx_v_self->iset, (&__pyx_v_flag1))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 209, __pyx_L1_error)

  /* "PETSc/IS.pyx":210
 *         cdef PetscBool flag1=PETSC_FALSE, flag2=PETSC_FALSE
 *         CHKERR( ISSorted(self.iset, &flag1) )
 *         CHKERR( ISSorted(iset.iset, &flag2) )             # <<<<<<<<<<<<<<
 *         cdef IS out = IS()
 *         if flag1==PETSC_TRUE and flag2==PETSC_TRUE:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISSorted(__pyx_v_iset->iset, (&__pyx_v_flag2))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 210, __pyx_L1_error)

  /* "PETSc/IS.pyx":211
 *         CHKERR( ISSorted(self.iset, &flag1) )
 *         CHKERR( ISSorted(iset.iset, &flag2) )
 *         cdef IS out = IS()             # <<<<<<<<<<<<<<
 *         if flag1==PETSC_TRUE and flag2==PETSC_TRUE:
 *             CHKERR( ISSum(self.iset, iset.iset, &out.iset) )
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_out = ((struct PyPetscISObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/IS.pyx":212
 *         CHKERR( ISSorted(iset.iset, &flag2) )
 *         cdef IS out = IS()
 *         if flag1==PETSC_TRUE and flag2==PETSC_TRUE:             # <<<<<<<<<<<<<<
 *             CHKERR( ISSum(self.iset, iset.iset, &out.iset) )
 *         else:
 */
  __pyx_t_4 = ((__pyx_v_flag1 == PETSC_TRUE) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_flag2 == PETSC_TRUE) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "PETSc/IS.pyx":213
 *         cdef IS out = IS()
 *         if flag1==PETSC_TRUE and flag2==PETSC_TRUE:
 *             CHKERR( ISSum(self.iset, iset.iset, &out.iset) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( ISExpand(self.iset, iset.iset, &out.iset) )
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISSum(__pyx_v_self->iset, __pyx_v_iset->iset, (&__pyx_v_out->iset))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 213, __pyx_L1_error)

    /* "PETSc/IS.pyx":212
 *         CHKERR( ISSorted(iset.iset, &flag2) )
 *         cdef IS out = IS()
 *         if flag1==PETSC_TRUE and flag2==PETSC_TRUE:             # <<<<<<<<<<<<<<
 *             CHKERR( ISSum(self.iset, iset.iset, &out.iset) )
 *         else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/IS.pyx":215
 *             CHKERR( ISSum(self.iset, iset.iset, &out.iset) )
 *         else:
 *             CHKERR( ISExpand(self.iset, iset.iset, &out.iset) )             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  /*else*/ {
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISExpand(__pyx_v_self->iset, __pyx_v_iset->iset, (&__pyx_v_out->iset))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 215, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/IS.pyx":216
 *         else:
 *             CHKERR( ISExpand(self.iset, iset.iset, &out.iset) )
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def difference(self, IS iset not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":207
 *         return out
 * 
 *     def union(self, IS iset not None): # XXX review this             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag1=PETSC_FALSE, flag2=PETSC_FALSE
 *         CHKERR( ISSorted(self.iset, &flag1) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.union", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":218
 *         return out
 * 
 *     def difference(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef IS out = IS()
 *         CHKERR( ISDifference(self.iset, iset.iset, &out.iset) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_69difference(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_68difference[] = "IS.difference(self, IS iset)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_69difference(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("difference (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iset,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);
        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_iset)) != 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, "difference") < 0)) __PYX_ERR(29, 218, __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_iset = ((struct PyPetscISObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("difference", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 218, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.difference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iset), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iset", 0))) __PYX_ERR(29, 218, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_68difference(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_iset);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_68difference(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset) {
  struct PyPetscISObject *__pyx_v_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("difference", 0);

  /* "PETSc/IS.pyx":219
 * 
 *     def difference(self, IS iset not None):
 *         cdef IS out = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( ISDifference(self.iset, iset.iset, &out.iset) )
 *         return out
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_out = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":220
 *     def difference(self, IS iset not None):
 *         cdef IS out = IS()
 *         CHKERR( ISDifference(self.iset, iset.iset, &out.iset) )             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISDifference(__pyx_v_self->iset, __pyx_v_iset->iset, (&__pyx_v_out->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 220, __pyx_L1_error)

  /* "PETSc/IS.pyx":221
 *         cdef IS out = IS()
 *         CHKERR( ISDifference(self.iset, iset.iset, &out.iset) )
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def complement(self, nmin, nmax):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":218
 *         return out
 * 
 *     def difference(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef IS out = IS()
 *         CHKERR( ISDifference(self.iset, iset.iset, &out.iset) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.difference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":223
 *         return out
 * 
 *     def complement(self, nmin, nmax):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnmin = asInt(nmin)
 *         cdef PetscInt cnmax = asInt(nmax)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_71complement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_70complement[] = "IS.complement(self, nmin, nmax)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_71complement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nmin = 0;
  PyObject *__pyx_v_nmax = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("complement (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nmin,&__pyx_n_s_nmax,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_nmin)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nmax)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("complement", 1, 2, 2, 1); __PYX_ERR(29, 223, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "complement") < 0)) __PYX_ERR(29, 223, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_nmin = values[0];
    __pyx_v_nmax = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("complement", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 223, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.complement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_70complement(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_nmin, __pyx_v_nmax);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_70complement(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_nmin, PyObject *__pyx_v_nmax) {
  PetscInt __pyx_v_cnmin;
  PetscInt __pyx_v_cnmax;
  struct PyPetscISObject *__pyx_v_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("complement", 0);

  /* "PETSc/IS.pyx":224
 * 
 *     def complement(self, nmin, nmax):
 *         cdef PetscInt cnmin = asInt(nmin)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnmax = asInt(nmax)
 *         cdef IS out = IS()
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_nmin); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(29, 224, __pyx_L1_error)
  __pyx_v_cnmin = __pyx_t_1;

  /* "PETSc/IS.pyx":225
 *     def complement(self, nmin, nmax):
 *         cdef PetscInt cnmin = asInt(nmin)
 *         cdef PetscInt cnmax = asInt(nmax)             # <<<<<<<<<<<<<<
 *         cdef IS out = IS()
 *         CHKERR( ISComplement(self.iset, cnmin, cnmax, &out.iset) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_nmax); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(29, 225, __pyx_L1_error)
  __pyx_v_cnmax = __pyx_t_1;

  /* "PETSc/IS.pyx":226
 *         cdef PetscInt cnmin = asInt(nmin)
 *         cdef PetscInt cnmax = asInt(nmax)
 *         cdef IS out = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( ISComplement(self.iset, cnmin, cnmax, &out.iset) )
 *         return out
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_out = ((struct PyPetscISObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/IS.pyx":227
 *         cdef PetscInt cnmax = asInt(nmax)
 *         cdef IS out = IS()
 *         CHKERR( ISComplement(self.iset, cnmin, cnmax, &out.iset) )             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISComplement(__pyx_v_self->iset, __pyx_v_cnmin, __pyx_v_cnmax, (&__pyx_v_out->iset))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(29, 227, __pyx_L1_error)

  /* "PETSc/IS.pyx":228
 *         cdef IS out = IS()
 *         CHKERR( ISComplement(self.iset, cnmin, cnmax, &out.iset) )
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def embed(self, IS iset not None, drop):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":223
 *         return out
 * 
 *     def complement(self, nmin, nmax):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnmin = asInt(nmin)
 *         cdef PetscInt cnmax = asInt(nmax)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.complement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":230
 *         return out
 * 
 *     def embed(self, IS iset not None, drop):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = drop
 *         cdef IS out = IS()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_73embed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_72embed[] = "IS.embed(self, IS iset, drop)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_73embed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_v_drop = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("embed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iset,&__pyx_n_s_drop,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_iset)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_drop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("embed", 1, 2, 2, 1); __PYX_ERR(29, 230, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "embed") < 0)) __PYX_ERR(29, 230, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_iset = ((struct PyPetscISObject *)values[0]);
    __pyx_v_drop = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("embed", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 230, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.embed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iset), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iset", 0))) __PYX_ERR(29, 230, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_72embed(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_iset, __pyx_v_drop);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_72embed(struct PyPetscISObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset, PyObject *__pyx_v_drop) {
  PetscBool __pyx_v_bval;
  struct PyPetscISObject *__pyx_v_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("embed", 0);

  /* "PETSc/IS.pyx":231
 * 
 *     def embed(self, IS iset not None, drop):
 *         cdef PetscBool bval = drop             # <<<<<<<<<<<<<<
 *         cdef IS out = IS()
 *         CHKERR( ISEmbed(self.iset, iset.iset, bval, &out.iset) )
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_drop)); if (unlikely(PyErr_Occurred())) __PYX_ERR(29, 231, __pyx_L1_error)
  __pyx_v_bval = __pyx_t_1;

  /* "PETSc/IS.pyx":232
 *     def embed(self, IS iset not None, drop):
 *         cdef PetscBool bval = drop
 *         cdef IS out = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( ISEmbed(self.iset, iset.iset, bval, &out.iset) )
 *         return out
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_out = ((struct PyPetscISObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/IS.pyx":233
 *         cdef PetscBool bval = drop
 *         cdef IS out = IS()
 *         CHKERR( ISEmbed(self.iset, iset.iset, bval, &out.iset) )             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISEmbed(__pyx_v_self->iset, __pyx_v_iset->iset, __pyx_v_bval, (&__pyx_v_out->iset))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(29, 233, __pyx_L1_error)

  /* "PETSc/IS.pyx":234
 *         cdef IS out = IS()
 *         CHKERR( ISEmbed(self.iset, iset.iset, bval, &out.iset) )
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":230
 *         return out
 * 
 *     def embed(self, IS iset not None, drop):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = drop
 *         cdef IS out = IS()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.embed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":238
 *     #
 * 
 *     def setIndices(self, indices):             # <<<<<<<<<<<<<<
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_75setIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_74setIndices[] = "IS.setIndices(self, indices)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_75setIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setIndices (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,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);
        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_indices)) != 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, "setIndices") < 0)) __PYX_ERR(29, 238, __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_indices = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setIndices", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 238, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.setIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_74setIndices(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_indices);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_74setIndices(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_indices) {
  PetscInt __pyx_v_nidx;
  PetscInt *__pyx_v_idx;
  PetscCopyMode __pyx_v_cm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setIndices", 0);
  __Pyx_INCREF(__pyx_v_indices);

  /* "PETSc/IS.pyx":239
 * 
 *     def setIndices(self, indices):
 *         cdef PetscInt nidx = 0, *idx = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         indices = iarray_i(indices, &nidx, &idx)
 */
  __pyx_v_nidx = 0;
  __pyx_v_idx = NULL;

  /* "PETSc/IS.pyx":240
 *     def setIndices(self, indices):
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES             # <<<<<<<<<<<<<<
 *         indices = iarray_i(indices, &nidx, &idx)
 *         CHKERR( ISGeneralSetIndices(self.iset, nidx, idx, cm) )
 */
  __pyx_v_cm = PETSC_COPY_VALUES;

  /* "PETSc/IS.pyx":241
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         indices = iarray_i(indices, &nidx, &idx)             # <<<<<<<<<<<<<<
 *         CHKERR( ISGeneralSetIndices(self.iset, nidx, idx, cm) )
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_indices, (&__pyx_v_nidx), (&__pyx_v_idx))); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":242
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         indices = iarray_i(indices, &nidx, &idx)
 *         CHKERR( ISGeneralSetIndices(self.iset, nidx, idx, cm) )             # <<<<<<<<<<<<<<
 * 
 *     def getIndices(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGeneralSetIndices(__pyx_v_self->iset, __pyx_v_nidx, __pyx_v_idx, __pyx_v_cm)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 242, __pyx_L1_error)

  /* "PETSc/IS.pyx":238
 *     #
 * 
 *     def setIndices(self, indices):             # <<<<<<<<<<<<<<
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.setIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":244
 *         CHKERR( ISGeneralSetIndices(self.iset, nidx, idx, cm) )
 * 
 *     def getIndices(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0
 *         cdef const_PetscInt *indices = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_77getIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_76getIndices[] = "IS.getIndices(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_77getIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getIndices (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getIndices", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getIndices", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_76getIndices(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_76getIndices(struct PyPetscISObject *__pyx_v_self) {
  PetscInt __pyx_v_size;
  const PetscInt *__pyx_v_indices;
  PyObject *__pyx_v_oindices = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  char const *__pyx_t_4;
  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;
  __Pyx_RefNannySetupContext("getIndices", 0);

  /* "PETSc/IS.pyx":245
 * 
 *     def getIndices(self):
 *         cdef PetscInt size = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 */
  __pyx_v_size = 0;

  /* "PETSc/IS.pyx":246
 *     def getIndices(self):
 *         cdef PetscInt size = 0
 *         cdef const_PetscInt *indices = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 *         CHKERR( ISGetIndices(self.iset, &indices) )
 */
  __pyx_v_indices = NULL;

  /* "PETSc/IS.pyx":247
 *         cdef PetscInt size = 0
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( ISGetLocalSize(self.iset, &size) )             # <<<<<<<<<<<<<<
 *         CHKERR( ISGetIndices(self.iset, &indices) )
 *         cdef object oindices = None
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetLocalSize(__pyx_v_self->iset, (&__pyx_v_size))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 247, __pyx_L1_error)

  /* "PETSc/IS.pyx":248
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 *         CHKERR( ISGetIndices(self.iset, &indices) )             # <<<<<<<<<<<<<<
 *         cdef object oindices = None
 *         try:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetIndices(__pyx_v_self->iset, (&__pyx_v_indices))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 248, __pyx_L1_error)

  /* "PETSc/IS.pyx":249
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 *         CHKERR( ISGetIndices(self.iset, &indices) )
 *         cdef object oindices = None             # <<<<<<<<<<<<<<
 *         try:
 *             oindices = array_i(size, indices)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_oindices = Py_None;

  /* "PETSc/IS.pyx":250
 *         CHKERR( ISGetIndices(self.iset, &indices) )
 *         cdef object oindices = None
 *         try:             # <<<<<<<<<<<<<<
 *             oindices = array_i(size, indices)
 *         finally:
 */
  /*try:*/ {

    /* "PETSc/IS.pyx":251
 *         cdef object oindices = None
 *         try:
 *             oindices = array_i(size, indices)             # <<<<<<<<<<<<<<
 *         finally:
 *             CHKERR( ISRestoreIndices(self.iset, &indices) )
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_size, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 251, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_oindices, __pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "PETSc/IS.pyx":253
 *             oindices = array_i(size, indices)
 *         finally:
 *             CHKERR( ISRestoreIndices(self.iset, &indices) )             # <<<<<<<<<<<<<<
 *         return oindices
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISRestoreIndices(__pyx_v_self->iset, (&__pyx_v_indices))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 253, __pyx_L1_error)
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L4_error:;
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __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_t_1 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_4 = __pyx_filename;
      {
        __pyx_t_11 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISRestoreIndices(__pyx_v_self->iset, (&__pyx_v_indices))); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(29, 253, __pyx_L7_error)
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_4;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "PETSc/IS.pyx":254
 *         finally:
 *             CHKERR( ISRestoreIndices(self.iset, &indices) )
 *         return oindices             # <<<<<<<<<<<<<<
 * 
 *     def setBlockIndices(self, bsize, indices):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_oindices);
  __pyx_r = __pyx_v_oindices;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":244
 *         CHKERR( ISGeneralSetIndices(self.iset, nidx, idx, cm) )
 * 
 *     def getIndices(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0
 *         cdef const_PetscInt *indices = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.getIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_oindices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":256
 *         return oindices
 * 
 *     def setBlockIndices(self, bsize, indices):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = asInt(bsize)
 *         cdef PetscInt nidx = 0, *idx = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_79setBlockIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_78setBlockIndices[] = "IS.setBlockIndices(self, bsize, indices)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_79setBlockIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setBlockIndices (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bsize,&__pyx_n_s_indices,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_bsize)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setBlockIndices", 1, 2, 2, 1); __PYX_ERR(29, 256, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setBlockIndices") < 0)) __PYX_ERR(29, 256, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_bsize = values[0];
    __pyx_v_indices = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setBlockIndices", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 256, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.setBlockIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_78setBlockIndices(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_bsize, __pyx_v_indices);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_78setBlockIndices(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_bsize, PyObject *__pyx_v_indices) {
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_nidx;
  PetscInt *__pyx_v_idx;
  PetscCopyMode __pyx_v_cm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setBlockIndices", 0);
  __Pyx_INCREF(__pyx_v_indices);

  /* "PETSc/IS.pyx":257
 * 
 *     def setBlockIndices(self, bsize, indices):
 *         cdef PetscInt bs = asInt(bsize)             # <<<<<<<<<<<<<<
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_bsize); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(29, 257, __pyx_L1_error)
  __pyx_v_bs = __pyx_t_1;

  /* "PETSc/IS.pyx":258
 *     def setBlockIndices(self, bsize, indices):
 *         cdef PetscInt bs = asInt(bsize)
 *         cdef PetscInt nidx = 0, *idx = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         indices = iarray_i(indices, &nidx, &idx)
 */
  __pyx_v_nidx = 0;
  __pyx_v_idx = NULL;

  /* "PETSc/IS.pyx":259
 *         cdef PetscInt bs = asInt(bsize)
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES             # <<<<<<<<<<<<<<
 *         indices = iarray_i(indices, &nidx, &idx)
 *         CHKERR( ISBlockSetIndices(self.iset, bs, nidx, idx, cm) )
 */
  __pyx_v_cm = PETSC_COPY_VALUES;

  /* "PETSc/IS.pyx":260
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         indices = iarray_i(indices, &nidx, &idx)             # <<<<<<<<<<<<<<
 *         CHKERR( ISBlockSetIndices(self.iset, bs, nidx, idx, cm) )
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_indices, (&__pyx_v_nidx), (&__pyx_v_idx))); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/IS.pyx":261
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         indices = iarray_i(indices, &nidx, &idx)
 *         CHKERR( ISBlockSetIndices(self.iset, bs, nidx, idx, cm) )             # <<<<<<<<<<<<<<
 * 
 *     def getBlockIndices(self):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISBlockSetIndices(__pyx_v_self->iset, __pyx_v_bs, __pyx_v_nidx, __pyx_v_idx, __pyx_v_cm)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(29, 261, __pyx_L1_error)

  /* "PETSc/IS.pyx":256
 *         return oindices
 * 
 *     def setBlockIndices(self, bsize, indices):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = asInt(bsize)
 *         cdef PetscInt nidx = 0, *idx = 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("petsc4py.PETSc.IS.setBlockIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":263
 *         CHKERR( ISBlockSetIndices(self.iset, bs, nidx, idx, cm) )
 * 
 *     def getBlockIndices(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0, bs = 1
 *         cdef const_PetscInt *indices = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_81getBlockIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_80getBlockIndices[] = "IS.getBlockIndices(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_81getBlockIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBlockIndices (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getBlockIndices", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getBlockIndices", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_80getBlockIndices(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_80getBlockIndices(struct PyPetscISObject *__pyx_v_self) {
  PetscInt __pyx_v_size;
  PetscInt __pyx_v_bs;
  const PetscInt *__pyx_v_indices;
  PyObject *__pyx_v_oindices = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  char const *__pyx_t_4;
  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;
  __Pyx_RefNannySetupContext("getBlockIndices", 0);

  /* "PETSc/IS.pyx":264
 * 
 *     def getBlockIndices(self):
 *         cdef PetscInt size = 0, bs = 1             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 */
  __pyx_v_size = 0;
  __pyx_v_bs = 1;

  /* "PETSc/IS.pyx":265
 *     def getBlockIndices(self):
 *         cdef PetscInt size = 0, bs = 1
 *         cdef const_PetscInt *indices = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 *         CHKERR( ISGetBlockSize(self.iset, &bs) )
 */
  __pyx_v_indices = NULL;

  /* "PETSc/IS.pyx":266
 *         cdef PetscInt size = 0, bs = 1
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( ISGetLocalSize(self.iset, &size) )             # <<<<<<<<<<<<<<
 *         CHKERR( ISGetBlockSize(self.iset, &bs) )
 *         CHKERR( ISBlockGetIndices(self.iset, &indices) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetLocalSize(__pyx_v_self->iset, (&__pyx_v_size))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 266, __pyx_L1_error)

  /* "PETSc/IS.pyx":267
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 *         CHKERR( ISGetBlockSize(self.iset, &bs) )             # <<<<<<<<<<<<<<
 *         CHKERR( ISBlockGetIndices(self.iset, &indices) )
 *         cdef object oindices = None
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetBlockSize(__pyx_v_self->iset, (&__pyx_v_bs))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 267, __pyx_L1_error)

  /* "PETSc/IS.pyx":268
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 *         CHKERR( ISGetBlockSize(self.iset, &bs) )
 *         CHKERR( ISBlockGetIndices(self.iset, &indices) )             # <<<<<<<<<<<<<<
 *         cdef object oindices = None
 *         try:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISBlockGetIndices(__pyx_v_self->iset, (&__pyx_v_indices))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 268, __pyx_L1_error)

  /* "PETSc/IS.pyx":269
 *         CHKERR( ISGetBlockSize(self.iset, &bs) )
 *         CHKERR( ISBlockGetIndices(self.iset, &indices) )
 *         cdef object oindices = None             # <<<<<<<<<<<<<<
 *         try:
 *             oindices = array_i(size//bs, indices)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_oindices = Py_None;

  /* "PETSc/IS.pyx":270
 *         CHKERR( ISBlockGetIndices(self.iset, &indices) )
 *         cdef object oindices = None
 *         try:             # <<<<<<<<<<<<<<
 *             oindices = array_i(size//bs, indices)
 *         finally:
 */
  /*try:*/ {

    /* "PETSc/IS.pyx":271
 *         cdef object oindices = None
 *         try:
 *             oindices = array_i(size//bs, indices)             # <<<<<<<<<<<<<<
 *         finally:
 *             CHKERR( ISBlockRestoreIndices(self.iset, &indices) )
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((__pyx_v_size / __pyx_v_bs), __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 271, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_oindices, __pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "PETSc/IS.pyx":273
 *             oindices = array_i(size//bs, indices)
 *         finally:
 *             CHKERR( ISBlockRestoreIndices(self.iset, &indices) )             # <<<<<<<<<<<<<<
 *         return oindices
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISBlockRestoreIndices(__pyx_v_self->iset, (&__pyx_v_indices))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 273, __pyx_L1_error)
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L4_error:;
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __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_t_1 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_4 = __pyx_filename;
      {
        __pyx_t_11 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISBlockRestoreIndices(__pyx_v_self->iset, (&__pyx_v_indices))); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(29, 273, __pyx_L7_error)
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_4;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "PETSc/IS.pyx":274
 *         finally:
 *             CHKERR( ISBlockRestoreIndices(self.iset, &indices) )
 *         return oindices             # <<<<<<<<<<<<<<
 * 
 *     def setStride(self, size, first=0, step=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_oindices);
  __pyx_r = __pyx_v_oindices;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":263
 *         CHKERR( ISBlockSetIndices(self.iset, bs, nidx, idx, cm) )
 * 
 *     def getBlockIndices(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0, bs = 1
 *         cdef const_PetscInt *indices = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.getBlockIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_oindices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":276
 *         return oindices
 * 
 *     def setStride(self, size, first=0, step=1):             # <<<<<<<<<<<<<<
 *         cdef PetscInt csize = asInt(size)
 *         cdef PetscInt cfirst = asInt(first)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_83setStride(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_82setStride[] = "IS.setStride(self, size, first=0, step=1)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_83setStride(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_first = 0;
  PyObject *__pyx_v_step = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setStride (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_first,&__pyx_n_s_step,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)__pyx_int_0);
    values[2] = ((PyObject *)__pyx_int_1);
    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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_first);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_step);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setStride") < 0)) __PYX_ERR(29, 276, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_size = values[0];
    __pyx_v_first = values[1];
    __pyx_v_step = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setStride", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 276, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.setStride", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_82setStride(((struct PyPetscISObject *)__pyx_v_self), __pyx_v_size, __pyx_v_first, __pyx_v_step);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_82setStride(struct PyPetscISObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_first, PyObject *__pyx_v_step) {
  PetscInt __pyx_v_csize;
  PetscInt __pyx_v_cfirst;
  PetscInt __pyx_v_cstep;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setStride", 0);

  /* "PETSc/IS.pyx":277
 * 
 *     def setStride(self, size, first=0, step=1):
 *         cdef PetscInt csize = asInt(size)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfirst = asInt(first)
 *         cdef PetscInt cstep = asInt(step)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_size); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(29, 277, __pyx_L1_error)
  __pyx_v_csize = __pyx_t_1;

  /* "PETSc/IS.pyx":278
 *     def setStride(self, size, first=0, step=1):
 *         cdef PetscInt csize = asInt(size)
 *         cdef PetscInt cfirst = asInt(first)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cstep = asInt(step)
 *         CHKERR( ISStrideSetStride(self.iset, csize, cfirst, cstep) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_first); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(29, 278, __pyx_L1_error)
  __pyx_v_cfirst = __pyx_t_1;

  /* "PETSc/IS.pyx":279
 *         cdef PetscInt csize = asInt(size)
 *         cdef PetscInt cfirst = asInt(first)
 *         cdef PetscInt cstep = asInt(step)             # <<<<<<<<<<<<<<
 *         CHKERR( ISStrideSetStride(self.iset, csize, cfirst, cstep) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_step); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(29, 279, __pyx_L1_error)
  __pyx_v_cstep = __pyx_t_1;

  /* "PETSc/IS.pyx":280
 *         cdef PetscInt cfirst = asInt(first)
 *         cdef PetscInt cstep = asInt(step)
 *         CHKERR( ISStrideSetStride(self.iset, csize, cfirst, cstep) )             # <<<<<<<<<<<<<<
 * 
 *     def getStride(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISStrideSetStride(__pyx_v_self->iset, __pyx_v_csize, __pyx_v_cfirst, __pyx_v_cstep)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 280, __pyx_L1_error)

  /* "PETSc/IS.pyx":276
 *         return oindices
 * 
 *     def setStride(self, size, first=0, step=1):             # <<<<<<<<<<<<<<
 *         cdef PetscInt csize = asInt(size)
 *         cdef PetscInt cfirst = asInt(first)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.IS.setStride", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":282
 *         CHKERR( ISStrideSetStride(self.iset, csize, cfirst, cstep) )
 * 
 *     def getStride(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size=0, first=0, step=0
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_85getStride(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_84getStride[] = "IS.getStride(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_85getStride(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getStride (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getStride", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getStride", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_84getStride(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_84getStride(struct PyPetscISObject *__pyx_v_self) {
  PetscInt __pyx_v_size;
  PetscInt __pyx_v_first;
  PetscInt __pyx_v_step;
  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;
  __Pyx_RefNannySetupContext("getStride", 0);

  /* "PETSc/IS.pyx":283
 * 
 *     def getStride(self):
 *         cdef PetscInt size=0, first=0, step=0             # <<<<<<<<<<<<<<
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 *         CHKERR( ISStrideGetInfo(self.iset, &first, &step) )
 */
  __pyx_v_size = 0;
  __pyx_v_first = 0;
  __pyx_v_step = 0;

  /* "PETSc/IS.pyx":284
 *     def getStride(self):
 *         cdef PetscInt size=0, first=0, step=0
 *         CHKERR( ISGetLocalSize(self.iset, &size) )             # <<<<<<<<<<<<<<
 *         CHKERR( ISStrideGetInfo(self.iset, &first, &step) )
 *         return (toInt(size), toInt(first), toInt(step))
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGetLocalSize(__pyx_v_self->iset, (&__pyx_v_size))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 284, __pyx_L1_error)

  /* "PETSc/IS.pyx":285
 *         cdef PetscInt size=0, first=0, step=0
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 *         CHKERR( ISStrideGetInfo(self.iset, &first, &step) )             # <<<<<<<<<<<<<<
 *         return (toInt(size), toInt(first), toInt(step))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISStrideGetInfo(__pyx_v_self->iset, (&__pyx_v_first), (&__pyx_v_step))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 285, __pyx_L1_error)

  /* "PETSc/IS.pyx":286
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 *         CHKERR( ISStrideGetInfo(self.iset, &first, &step) )
 *         return (toInt(size), toInt(first), toInt(step))             # <<<<<<<<<<<<<<
 * 
 *     def getInfo(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_first); if (unlikely(!__pyx_t_3)) __PYX_ERR(29, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_step); if (unlikely(!__pyx_t_4)) __PYX_ERR(29, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(29, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":282
 *         CHKERR( ISStrideSetStride(self.iset, csize, cfirst, cstep) )
 * 
 *     def getStride(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size=0, first=0, step=0
 *         CHKERR( ISGetLocalSize(self.iset, &size) )
 */

  /* 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("petsc4py.PETSc.IS.getStride", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":288
 *         return (toInt(size), toInt(first), toInt(step))
 * 
 *     def getInfo(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt first = 0, step = 0
 *         CHKERR( ISStrideGetInfo(self.iset, &first, &step) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_87getInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2IS_86getInfo[] = "IS.getInfo(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_87getInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getInfo (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getInfo", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getInfo", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_86getInfo(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_86getInfo(struct PyPetscISObject *__pyx_v_self) {
  PetscInt __pyx_v_first;
  PetscInt __pyx_v_step;
  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;
  __Pyx_RefNannySetupContext("getInfo", 0);

  /* "PETSc/IS.pyx":289
 * 
 *     def getInfo(self):
 *         cdef PetscInt first = 0, step = 0             # <<<<<<<<<<<<<<
 *         CHKERR( ISStrideGetInfo(self.iset, &first, &step) )
 *         return (toInt(first), toInt(step))
 */
  __pyx_v_first = 0;
  __pyx_v_step = 0;

  /* "PETSc/IS.pyx":290
 *     def getInfo(self):
 *         cdef PetscInt first = 0, step = 0
 *         CHKERR( ISStrideGetInfo(self.iset, &first, &step) )             # <<<<<<<<<<<<<<
 *         return (toInt(first), toInt(step))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISStrideGetInfo(__pyx_v_self->iset, (&__pyx_v_first), (&__pyx_v_step))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 290, __pyx_L1_error)

  /* "PETSc/IS.pyx":291
 *         cdef PetscInt first = 0, step = 0
 *         CHKERR( ISStrideGetInfo(self.iset, &first, &step) )
 *         return (toInt(first), toInt(step))             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_first); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_step); if (unlikely(!__pyx_t_3)) __PYX_ERR(29, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(29, 291, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":288
 *         return (toInt(size), toInt(first), toInt(step))
 * 
 *     def getInfo(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt first = 0, step = 0
 *         CHKERR( ISStrideGetInfo(self.iset, &first, &step) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.getInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":296
 * 
 *     property permutation:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isPermutation()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_11permutation_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_11permutation_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_11permutation___get__(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_11permutation___get__(struct PyPetscISObject *__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);

  /* "PETSc/IS.pyx":297
 *     property permutation:
 *         def __get__(self):
 *             return self.isPermutation()             # <<<<<<<<<<<<<<
 * 
 *     property identity:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_isPermutation); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 297, __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(29, 297, __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;

  /* "PETSc/IS.pyx":296
 * 
 *     property permutation:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isPermutation()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.permutation.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":300
 * 
 *     property identity:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isIdentity()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_8identity_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_8identity_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_8identity___get__(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_8identity___get__(struct PyPetscISObject *__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);

  /* "PETSc/IS.pyx":301
 *     property identity:
 *         def __get__(self):
 *             return self.isIdentity()             # <<<<<<<<<<<<<<
 * 
 *     property sorted:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_isIdentity); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 301, __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(29, 301, __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;

  /* "PETSc/IS.pyx":300
 * 
 *     property identity:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isIdentity()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.identity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":304
 * 
 *     property sorted:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isSorted()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_6sorted_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_6sorted_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_6sorted___get__(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_6sorted___get__(struct PyPetscISObject *__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);

  /* "PETSc/IS.pyx":305
 *     property sorted:
 *         def __get__(self):
 *             return self.isSorted()             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_isSorted); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 305, __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(29, 305, __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;

  /* "PETSc/IS.pyx":304
 * 
 *     property sorted:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isSorted()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.sorted.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":310
 * 
 *     property sizes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSizes()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_5sizes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_5sizes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_5sizes___get__(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_5sizes___get__(struct PyPetscISObject *__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);

  /* "PETSc/IS.pyx":311
 *     property sizes:
 *         def __get__(self):
 *             return self.getSizes()             # <<<<<<<<<<<<<<
 * 
 *     property size:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSizes); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 311, __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(29, 311, __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;

  /* "PETSc/IS.pyx":310
 * 
 *     property sizes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSizes()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.sizes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":314
 * 
 *     property size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSize()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_4size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_4size___get__(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_4size___get__(struct PyPetscISObject *__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);

  /* "PETSc/IS.pyx":315
 *     property size:
 *         def __get__(self):
 *             return self.getSize()             # <<<<<<<<<<<<<<
 * 
 *     property local_size:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 315, __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(29, 315, __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;

  /* "PETSc/IS.pyx":314
 * 
 *     property size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSize()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":318
 * 
 *     property local_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getLocalSize()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_10local_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_10local_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_10local_size___get__(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_10local_size___get__(struct PyPetscISObject *__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);

  /* "PETSc/IS.pyx":319
 *     property local_size:
 *         def __get__(self):
 *             return self.getLocalSize()             # <<<<<<<<<<<<<<
 * 
 *     property block_size:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getLocalSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 319, __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(29, 319, __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;

  /* "PETSc/IS.pyx":318
 * 
 *     property local_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getLocalSize()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.local_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":322
 * 
 *     property block_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockSize()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_10block_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_10block_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_10block_size___get__(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_10block_size___get__(struct PyPetscISObject *__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);

  /* "PETSc/IS.pyx":323
 *     property block_size:
 *         def __get__(self):
 *             return self.getBlockSize()             # <<<<<<<<<<<<<<
 * 
 *     property indices:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getBlockSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 323, __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(29, 323, __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;

  /* "PETSc/IS.pyx":322
 * 
 *     property block_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockSize()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.block_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":326
 * 
 *     property indices:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getIndices()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_7indices_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_7indices_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_7indices___get__(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_7indices___get__(struct PyPetscISObject *__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);

  /* "PETSc/IS.pyx":327
 *     property indices:
 *         def __get__(self):
 *             return self.getIndices()             # <<<<<<<<<<<<<<
 * 
 *     property array:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getIndices); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 327, __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(29, 327, __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;

  /* "PETSc/IS.pyx":326
 * 
 *     property indices:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getIndices()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.indices.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":330
 * 
 *     property array:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return asarray(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_5array_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_5array_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_5array___get__(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_5array___get__(struct PyPetscISObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/IS.pyx":331
 *     property array:
 *         def __get__(self):
 *             return asarray(self)             # <<<<<<<<<<<<<<
 * 
 *     # --- NumPy array interface (legacy) ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_asarray(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":330
 * 
 *     property array:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return asarray(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.array.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":336
 * 
 *     property __array_interface__:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef _IS_buffer buf = _IS_buffer(self)
 *             return buf.__array_interface__
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_19__array_interface___1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2IS_19__array_interface___1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2IS_19__array_interface_____get__(((struct PyPetscISObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2IS_19__array_interface_____get__(struct PyPetscISObject *__pyx_v_self) {
  struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/IS.pyx":337
 *     property __array_interface__:
 *         def __get__(self):
 *             cdef _IS_buffer buf = _IS_buffer(self)             # <<<<<<<<<<<<<<
 *             return buf.__array_interface__
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc__IS_buffer), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/IS.pyx":338
 *         def __get__(self):
 *             cdef _IS_buffer buf = _IS_buffer(self)
 *             return buf.__array_interface__             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_array_interface); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":336
 * 
 *     property __array_interface__:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef _IS_buffer buf = _IS_buffer(self)
 *             return buf.__array_interface__
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.IS.__array_interface__.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":356
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.lgm
 *         self.lgm = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_5LGMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_5LGMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap___cinit__(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_5LGMap___cinit__(struct PyPetscLGMapObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/IS.pyx":357
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.lgm             # <<<<<<<<<<<<<<
 *         self.lgm = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->lgm));

  /* "PETSc/IS.pyx":358
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.lgm
 *         self.lgm = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, indices, result=None):
 */
  __pyx_v_self->lgm = NULL;

  /* "PETSc/IS.pyx":356
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.lgm
 *         self.lgm = NULL
 */

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

/* "PETSc/IS.pyx":360
 *         self.lgm = NULL
 * 
 *     def __call__(self, indices, result=None):             # <<<<<<<<<<<<<<
 *         self.apply(indices, result)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_result,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(29, 360, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_indices = values[0];
    __pyx_v_result = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 360, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_2__call__(((struct PyPetscLGMapObject *)__pyx_v_self), __pyx_v_indices, __pyx_v_result);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_2__call__(struct PyPetscLGMapObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_result) {
  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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "PETSc/IS.pyx":361
 * 
 *     def __call__(self, indices, result=None):
 *         self.apply(indices, result)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_apply); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(29, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_v_indices);
  __Pyx_GIVEREF(__pyx_v_indices);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_indices);
  __Pyx_INCREF(__pyx_v_result);
  __Pyx_GIVEREF(__pyx_v_result);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_result);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":360
 *         self.lgm = NULL
 * 
 *     def __call__(self, indices, result=None):             # <<<<<<<<<<<<<<
 *         self.apply(indices, result)
 * 
 */

  /* 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":365
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_4view[] = "LGMap.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(29, 365, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 365, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(29, 365, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_4view(((struct PyPetscLGMapObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_4view(struct PyPetscLGMapObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_cviewer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/IS.pyx":366
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer cviewer = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: cviewer = viewer.vwr
 *         CHKERR( ISLocalToGlobalMappingView(self.lgm, cviewer) )
 */
  __pyx_v_cviewer = NULL;

  /* "PETSc/IS.pyx":367
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingView(self.lgm, cviewer) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_cviewer = __pyx_t_3;
  }

  /* "PETSc/IS.pyx":368
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 *         CHKERR( ISLocalToGlobalMappingView(self.lgm, cviewer) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingView(__pyx_v_self->lgm, __pyx_v_cviewer)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(29, 368, __pyx_L1_error)

  /* "PETSc/IS.pyx":365
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":370
 *         CHKERR( ISLocalToGlobalMappingView(self.lgm, cviewer) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingDestroy(&self.lgm) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_6destroy[] = "LGMap.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_6destroy(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_6destroy(struct PyPetscLGMapObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/IS.pyx":371
 * 
 *     def destroy(self):
 *         CHKERR( ISLocalToGlobalMappingDestroy(&self.lgm) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingDestroy((&__pyx_v_self->lgm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 371, __pyx_L1_error)

  /* "PETSc/IS.pyx":372
 *     def destroy(self):
 *         CHKERR( ISLocalToGlobalMappingDestroy(&self.lgm) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, indices, bsize=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":370
 *         CHKERR( ISLocalToGlobalMappingView(self.lgm, cviewer) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingDestroy(&self.lgm) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":374
 *         return self
 * 
 *     def create(self, indices, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs = 1, nidx = 0, *idx = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_8create[] = "LGMap.create(self, indices, bsize=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_bsize,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(29, 374, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_indices = values[0];
    __pyx_v_bsize = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 374, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_8create(((struct PyPetscLGMapObject *)__pyx_v_self), __pyx_v_indices, __pyx_v_bsize, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_8create(struct PyPetscLGMapObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_nidx;
  PetscInt *__pyx_v_idx;
  PetscCopyMode __pyx_v_cm;
  ISLocalToGlobalMapping __pyx_v_newlgm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PetscInt __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("create", 0);
  __Pyx_INCREF(__pyx_v_indices);

  /* "PETSc/IS.pyx":375
 * 
 *     def create(self, indices, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = 1, nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(29, 375, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/IS.pyx":376
 *     def create(self, indices, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs = 1, nidx = 0, *idx = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         cdef PetscLGMap newlgm = NULL
 */
  __pyx_v_bs = 1;
  __pyx_v_nidx = 0;
  __pyx_v_idx = NULL;

  /* "PETSc/IS.pyx":377
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs = 1, nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES             # <<<<<<<<<<<<<<
 *         cdef PetscLGMap newlgm = NULL
 *         if bsize is not None: bs = asInt(bsize)
 */
  __pyx_v_cm = PETSC_COPY_VALUES;

  /* "PETSc/IS.pyx":378
 *         cdef PetscInt bs = 1, nidx = 0, *idx = NULL
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         cdef PetscLGMap newlgm = NULL             # <<<<<<<<<<<<<<
 *         if bsize is not None: bs = asInt(bsize)
 *         if bs == PETSC_DECIDE: bs = 1
 */
  __pyx_v_newlgm = NULL;

  /* "PETSc/IS.pyx":379
 *         cdef PetscCopyMode cm = PETSC_COPY_VALUES
 *         cdef PetscLGMap newlgm = NULL
 *         if bsize is not None: bs = asInt(bsize)             # <<<<<<<<<<<<<<
 *         if bs == PETSC_DECIDE: bs = 1
 *         indices = iarray_i(indices, &nidx, &idx)
 */
  __pyx_t_2 = (__pyx_v_bsize != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_bsize); if (unlikely(__pyx_t_4 == -1L && PyErr_Occurred())) __PYX_ERR(29, 379, __pyx_L1_error)
    __pyx_v_bs = __pyx_t_4;
  }

  /* "PETSc/IS.pyx":380
 *         cdef PetscLGMap newlgm = NULL
 *         if bsize is not None: bs = asInt(bsize)
 *         if bs == PETSC_DECIDE: bs = 1             # <<<<<<<<<<<<<<
 *         indices = iarray_i(indices, &nidx, &idx)
 *         CHKERR( ISLocalToGlobalMappingCreate(
 */
  __pyx_t_3 = ((__pyx_v_bs == PETSC_DECIDE) != 0);
  if (__pyx_t_3) {
    __pyx_v_bs = 1;
  }

  /* "PETSc/IS.pyx":381
 *         if bsize is not None: bs = asInt(bsize)
 *         if bs == PETSC_DECIDE: bs = 1
 *         indices = iarray_i(indices, &nidx, &idx)             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingCreate(
 *                 ccomm, bs, nidx, idx, cm, &newlgm) )
 */
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_indices, (&__pyx_v_nidx), (&__pyx_v_idx))); if (unlikely(!__pyx_t_5)) __PYX_ERR(29, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "PETSc/IS.pyx":382
 *         if bs == PETSC_DECIDE: bs = 1
 *         indices = iarray_i(indices, &nidx, &idx)
 *         CHKERR( ISLocalToGlobalMappingCreate(             # <<<<<<<<<<<<<<
 *                 ccomm, bs, nidx, idx, cm, &newlgm) )
 *         PetscCLEAR(self.obj); self.lgm = newlgm
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingCreate(__pyx_v_ccomm, __pyx_v_bs, __pyx_v_nidx, __pyx_v_idx, __pyx_v_cm, (&__pyx_v_newlgm))); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(29, 382, __pyx_L1_error)

  /* "PETSc/IS.pyx":384
 *         CHKERR( ISLocalToGlobalMappingCreate(
 *                 ccomm, bs, nidx, idx, cm, &newlgm) )
 *         PetscCLEAR(self.obj); self.lgm = newlgm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->lgm = __pyx_v_newlgm;

  /* "PETSc/IS.pyx":385
 *                 ccomm, bs, nidx, idx, cm, &newlgm) )
 *         PetscCLEAR(self.obj); self.lgm = newlgm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createIS(self, IS iset not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":374
 *         return self
 * 
 *     def create(self, indices, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs = 1, nidx = 0, *idx = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":387
 *         return self
 * 
 *     def createIS(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef PetscLGMap newlgm = NULL
 *         CHKERR( ISLocalToGlobalMappingCreateIS(
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_11createIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_10createIS[] = "LGMap.createIS(self, IS iset)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_11createIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createIS (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iset,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);
        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_iset)) != 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, "createIS") < 0)) __PYX_ERR(29, 387, __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_iset = ((struct PyPetscISObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createIS", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 387, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.createIS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iset), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iset", 0))) __PYX_ERR(29, 387, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_10createIS(((struct PyPetscLGMapObject *)__pyx_v_self), __pyx_v_iset);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_10createIS(struct PyPetscLGMapObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset) {
  ISLocalToGlobalMapping __pyx_v_newlgm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("createIS", 0);

  /* "PETSc/IS.pyx":388
 * 
 *     def createIS(self, IS iset not None):
 *         cdef PetscLGMap newlgm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingCreateIS(
 *             iset.iset, &newlgm) )
 */
  __pyx_v_newlgm = NULL;

  /* "PETSc/IS.pyx":389
 *     def createIS(self, IS iset not None):
 *         cdef PetscLGMap newlgm = NULL
 *         CHKERR( ISLocalToGlobalMappingCreateIS(             # <<<<<<<<<<<<<<
 *             iset.iset, &newlgm) )
 *         PetscCLEAR(self.obj); self.lgm = newlgm
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingCreateIS(__pyx_v_iset->iset, (&__pyx_v_newlgm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 389, __pyx_L1_error)

  /* "PETSc/IS.pyx":391
 *         CHKERR( ISLocalToGlobalMappingCreateIS(
 *             iset.iset, &newlgm) )
 *         PetscCLEAR(self.obj); self.lgm = newlgm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->lgm = __pyx_v_newlgm;

  /* "PETSc/IS.pyx":392
 *             iset.iset, &newlgm) )
 *         PetscCLEAR(self.obj); self.lgm = newlgm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createSF(self, SF sf not None, start):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":387
 *         return self
 * 
 *     def createIS(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef PetscLGMap newlgm = NULL
 *         CHKERR( ISLocalToGlobalMappingCreateIS(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.createIS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":394
 *         return self
 * 
 *     def createSF(self, SF sf not None, start):             # <<<<<<<<<<<<<<
 *         cdef PetscLGMap newlgm = NULL
 *         cdef PetscInt cstart = asInt(start)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_13createSF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_12createSF[] = "LGMap.createSF(self, SF sf, start)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_13createSF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscSFObject *__pyx_v_sf = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createSF (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sf,&__pyx_n_s_start,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_sf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createSF", 1, 2, 2, 1); __PYX_ERR(29, 394, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createSF") < 0)) __PYX_ERR(29, 394, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_sf = ((struct PyPetscSFObject *)values[0]);
    __pyx_v_start = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createSF", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 394, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.createSF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sf), __pyx_ptype_8petsc4py_5PETSc_SF, 0, "sf", 0))) __PYX_ERR(29, 394, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_12createSF(((struct PyPetscLGMapObject *)__pyx_v_self), __pyx_v_sf, __pyx_v_start);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_12createSF(struct PyPetscLGMapObject *__pyx_v_self, struct PyPetscSFObject *__pyx_v_sf, PyObject *__pyx_v_start) {
  ISLocalToGlobalMapping __pyx_v_newlgm;
  PetscInt __pyx_v_cstart;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createSF", 0);

  /* "PETSc/IS.pyx":395
 * 
 *     def createSF(self, SF sf not None, start):
 *         cdef PetscLGMap newlgm = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt cstart = asInt(start)
 *         CHKERR( ISLocalToGlobalMappingCreateSF(sf.sf, cstart, &newlgm) )
 */
  __pyx_v_newlgm = NULL;

  /* "PETSc/IS.pyx":396
 *     def createSF(self, SF sf not None, start):
 *         cdef PetscLGMap newlgm = NULL
 *         cdef PetscInt cstart = asInt(start)             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingCreateSF(sf.sf, cstart, &newlgm) )
 *         PetscCLEAR(self.obj); self.lgm = newlgm
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_start); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(29, 396, __pyx_L1_error)
  __pyx_v_cstart = __pyx_t_1;

  /* "PETSc/IS.pyx":397
 *         cdef PetscLGMap newlgm = NULL
 *         cdef PetscInt cstart = asInt(start)
 *         CHKERR( ISLocalToGlobalMappingCreateSF(sf.sf, cstart, &newlgm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.lgm = newlgm
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingCreateSF(__pyx_v_sf->sf, __pyx_v_cstart, (&__pyx_v_newlgm))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 397, __pyx_L1_error)

  /* "PETSc/IS.pyx":398
 *         cdef PetscInt cstart = asInt(start)
 *         CHKERR( ISLocalToGlobalMappingCreateSF(sf.sf, cstart, &newlgm) )
 *         PetscCLEAR(self.obj); self.lgm = newlgm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->lgm = __pyx_v_newlgm;

  /* "PETSc/IS.pyx":399
 *         CHKERR( ISLocalToGlobalMappingCreateSF(sf.sf, cstart, &newlgm) )
 *         PetscCLEAR(self.obj); self.lgm = newlgm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def getSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":394
 *         return self
 * 
 *     def createSF(self, SF sf not None, start):             # <<<<<<<<<<<<<<
 *         cdef PetscLGMap newlgm = NULL
 *         cdef PetscInt cstart = asInt(start)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.createSF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":401
 *         return self
 * 
 *     def getSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( ISLocalToGlobalMappingGetSize(self.lgm, &n) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_15getSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_14getSize[] = "LGMap.getSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_15getSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_14getSize(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_14getSize(struct PyPetscLGMapObject *__pyx_v_self) {
  PetscInt __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getSize", 0);

  /* "PETSc/IS.pyx":402
 * 
 *     def getSize(self):
 *         cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingGetSize(self.lgm, &n) )
 *         return toInt(n)
 */
  __pyx_v_n = 0;

  /* "PETSc/IS.pyx":403
 *     def getSize(self):
 *         cdef PetscInt n = 0
 *         CHKERR( ISLocalToGlobalMappingGetSize(self.lgm, &n) )             # <<<<<<<<<<<<<<
 *         return toInt(n)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingGetSize(__pyx_v_self->lgm, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 403, __pyx_L1_error)

  /* "PETSc/IS.pyx":404
 *         cdef PetscInt n = 0
 *         CHKERR( ISLocalToGlobalMappingGetSize(self.lgm, &n) )
 *         return toInt(n)             # <<<<<<<<<<<<<<
 * 
 *     def getBlockSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":401
 *         return self
 * 
 *     def getSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( ISLocalToGlobalMappingGetSize(self.lgm, &n) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.getSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":406
 *         return toInt(n)
 * 
 *     def getBlockSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = 1
 *         CHKERR( ISLocalToGlobalMappingGetBlockSize(self.lgm, &bs) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_17getBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_16getBlockSize[] = "LGMap.getBlockSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_17getBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBlockSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getBlockSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getBlockSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_16getBlockSize(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_16getBlockSize(struct PyPetscLGMapObject *__pyx_v_self) {
  PetscInt __pyx_v_bs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getBlockSize", 0);

  /* "PETSc/IS.pyx":407
 * 
 *     def getBlockSize(self):
 *         cdef PetscInt bs = 1             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingGetBlockSize(self.lgm, &bs) )
 *         return toInt(bs)
 */
  __pyx_v_bs = 1;

  /* "PETSc/IS.pyx":408
 *     def getBlockSize(self):
 *         cdef PetscInt bs = 1
 *         CHKERR( ISLocalToGlobalMappingGetBlockSize(self.lgm, &bs) )             # <<<<<<<<<<<<<<
 *         return toInt(bs)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingGetBlockSize(__pyx_v_self->lgm, (&__pyx_v_bs))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 408, __pyx_L1_error)

  /* "PETSc/IS.pyx":409
 *         cdef PetscInt bs = 1
 *         CHKERR( ISLocalToGlobalMappingGetBlockSize(self.lgm, &bs) )
 *         return toInt(bs)             # <<<<<<<<<<<<<<
 * 
 *     def getIndices(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_bs); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":406
 *         return toInt(n)
 * 
 *     def getBlockSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = 1
 *         CHKERR( ISLocalToGlobalMappingGetBlockSize(self.lgm, &bs) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.getBlockSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":411
 *         return toInt(bs)
 * 
 *     def getIndices(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0
 *         cdef const_PetscInt *indices = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_19getIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_18getIndices[] = "LGMap.getIndices(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_19getIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getIndices (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getIndices", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getIndices", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_18getIndices(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_18getIndices(struct PyPetscLGMapObject *__pyx_v_self) {
  PetscInt __pyx_v_size;
  const PetscInt *__pyx_v_indices;
  PyObject *__pyx_v_oindices = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  char const *__pyx_t_4;
  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;
  __Pyx_RefNannySetupContext("getIndices", 0);

  /* "PETSc/IS.pyx":412
 * 
 *     def getIndices(self):
 *         cdef PetscInt size = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( ISLocalToGlobalMappingGetSize(
 */
  __pyx_v_size = 0;

  /* "PETSc/IS.pyx":413
 *     def getIndices(self):
 *         cdef PetscInt size = 0
 *         cdef const_PetscInt *indices = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingGetSize(
 *                 self.lgm, &size) )
 */
  __pyx_v_indices = NULL;

  /* "PETSc/IS.pyx":414
 *         cdef PetscInt size = 0
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( ISLocalToGlobalMappingGetSize(             # <<<<<<<<<<<<<<
 *                 self.lgm, &size) )
 *         CHKERR( ISLocalToGlobalMappingGetIndices(
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingGetSize(__pyx_v_self->lgm, (&__pyx_v_size))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 414, __pyx_L1_error)

  /* "PETSc/IS.pyx":416
 *         CHKERR( ISLocalToGlobalMappingGetSize(
 *                 self.lgm, &size) )
 *         CHKERR( ISLocalToGlobalMappingGetIndices(             # <<<<<<<<<<<<<<
 *                 self.lgm, &indices) )
 *         cdef object oindices = None
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingGetIndices(__pyx_v_self->lgm, (&__pyx_v_indices))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 416, __pyx_L1_error)

  /* "PETSc/IS.pyx":418
 *         CHKERR( ISLocalToGlobalMappingGetIndices(
 *                 self.lgm, &indices) )
 *         cdef object oindices = None             # <<<<<<<<<<<<<<
 *         try:
 *             oindices = array_i(size, indices)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_oindices = Py_None;

  /* "PETSc/IS.pyx":419
 *                 self.lgm, &indices) )
 *         cdef object oindices = None
 *         try:             # <<<<<<<<<<<<<<
 *             oindices = array_i(size, indices)
 *         finally:
 */
  /*try:*/ {

    /* "PETSc/IS.pyx":420
 *         cdef object oindices = None
 *         try:
 *             oindices = array_i(size, indices)             # <<<<<<<<<<<<<<
 *         finally:
 *             CHKERR( ISLocalToGlobalMappingRestoreIndices(
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_size, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 420, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_oindices, __pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "PETSc/IS.pyx":422
 *             oindices = array_i(size, indices)
 *         finally:
 *             CHKERR( ISLocalToGlobalMappingRestoreIndices(             # <<<<<<<<<<<<<<
 *                     self.lgm, &indices) )
 *         return oindices
 */
  /*finally:*/ {
    /*normal exit:*/{

      /* "PETSc/IS.pyx":423
 *         finally:
 *             CHKERR( ISLocalToGlobalMappingRestoreIndices(
 *                     self.lgm, &indices) )             # <<<<<<<<<<<<<<
 *         return oindices
 * 
 */
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingRestoreIndices(__pyx_v_self->lgm, (&__pyx_v_indices))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 422, __pyx_L1_error)
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L4_error:;
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __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_t_1 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_4 = __pyx_filename;
      {

        /* "PETSc/IS.pyx":422
 *             oindices = array_i(size, indices)
 *         finally:
 *             CHKERR( ISLocalToGlobalMappingRestoreIndices(             # <<<<<<<<<<<<<<
 *                     self.lgm, &indices) )
 *         return oindices
 */
        __pyx_t_11 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingRestoreIndices(__pyx_v_self->lgm, (&__pyx_v_indices))); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(29, 422, __pyx_L7_error)
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_4;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "PETSc/IS.pyx":424
 *             CHKERR( ISLocalToGlobalMappingRestoreIndices(
 *                     self.lgm, &indices) )
 *         return oindices             # <<<<<<<<<<<<<<
 * 
 *     def getBlockIndices(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_oindices);
  __pyx_r = __pyx_v_oindices;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":411
 *         return toInt(bs)
 * 
 *     def getIndices(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0
 *         cdef const_PetscInt *indices = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.getIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_oindices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":426
 *         return oindices
 * 
 *     def getBlockIndices(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0, bs = 1
 *         cdef const_PetscInt *indices = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_21getBlockIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_20getBlockIndices[] = "LGMap.getBlockIndices(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_21getBlockIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBlockIndices (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getBlockIndices", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getBlockIndices", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_20getBlockIndices(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_20getBlockIndices(struct PyPetscLGMapObject *__pyx_v_self) {
  PetscInt __pyx_v_size;
  PetscInt __pyx_v_bs;
  const PetscInt *__pyx_v_indices;
  PyObject *__pyx_v_oindices = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  char const *__pyx_t_4;
  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;
  __Pyx_RefNannySetupContext("getBlockIndices", 0);

  /* "PETSc/IS.pyx":427
 * 
 *     def getBlockIndices(self):
 *         cdef PetscInt size = 0, bs = 1             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( ISLocalToGlobalMappingGetSize(
 */
  __pyx_v_size = 0;
  __pyx_v_bs = 1;

  /* "PETSc/IS.pyx":428
 *     def getBlockIndices(self):
 *         cdef PetscInt size = 0, bs = 1
 *         cdef const_PetscInt *indices = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingGetSize(
 *                 self.lgm, &size) )
 */
  __pyx_v_indices = NULL;

  /* "PETSc/IS.pyx":429
 *         cdef PetscInt size = 0, bs = 1
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( ISLocalToGlobalMappingGetSize(             # <<<<<<<<<<<<<<
 *                 self.lgm, &size) )
 *         CHKERR( ISLocalToGlobalMappingGetBlockSize(
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingGetSize(__pyx_v_self->lgm, (&__pyx_v_size))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 429, __pyx_L1_error)

  /* "PETSc/IS.pyx":431
 *         CHKERR( ISLocalToGlobalMappingGetSize(
 *                 self.lgm, &size) )
 *         CHKERR( ISLocalToGlobalMappingGetBlockSize(             # <<<<<<<<<<<<<<
 *                 self.lgm, &bs) )
 *         CHKERR( ISLocalToGlobalMappingGetBlockIndices(
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingGetBlockSize(__pyx_v_self->lgm, (&__pyx_v_bs))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 431, __pyx_L1_error)

  /* "PETSc/IS.pyx":433
 *         CHKERR( ISLocalToGlobalMappingGetBlockSize(
 *                 self.lgm, &bs) )
 *         CHKERR( ISLocalToGlobalMappingGetBlockIndices(             # <<<<<<<<<<<<<<
 *                 self.lgm, &indices) )
 *         cdef object oindices = None
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingGetBlockIndices(__pyx_v_self->lgm, (&__pyx_v_indices))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 433, __pyx_L1_error)

  /* "PETSc/IS.pyx":435
 *         CHKERR( ISLocalToGlobalMappingGetBlockIndices(
 *                 self.lgm, &indices) )
 *         cdef object oindices = None             # <<<<<<<<<<<<<<
 *         try:
 *             oindices = array_i(size//bs, indices)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_oindices = Py_None;

  /* "PETSc/IS.pyx":436
 *                 self.lgm, &indices) )
 *         cdef object oindices = None
 *         try:             # <<<<<<<<<<<<<<
 *             oindices = array_i(size//bs, indices)
 *         finally:
 */
  /*try:*/ {

    /* "PETSc/IS.pyx":437
 *         cdef object oindices = None
 *         try:
 *             oindices = array_i(size//bs, indices)             # <<<<<<<<<<<<<<
 *         finally:
 *             CHKERR( ISLocalToGlobalMappingRestoreBlockIndices(
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((__pyx_v_size / __pyx_v_bs), __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 437, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_oindices, __pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "PETSc/IS.pyx":439
 *             oindices = array_i(size//bs, indices)
 *         finally:
 *             CHKERR( ISLocalToGlobalMappingRestoreBlockIndices(             # <<<<<<<<<<<<<<
 *                     self.lgm, &indices) )
 *         return oindices
 */
  /*finally:*/ {
    /*normal exit:*/{

      /* "PETSc/IS.pyx":440
 *         finally:
 *             CHKERR( ISLocalToGlobalMappingRestoreBlockIndices(
 *                     self.lgm, &indices) )             # <<<<<<<<<<<<<<
 *         return oindices
 * 
 */
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingRestoreBlockIndices(__pyx_v_self->lgm, (&__pyx_v_indices))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(29, 439, __pyx_L1_error)
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L4_error:;
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __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_t_1 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_4 = __pyx_filename;
      {

        /* "PETSc/IS.pyx":439
 *             oindices = array_i(size//bs, indices)
 *         finally:
 *             CHKERR( ISLocalToGlobalMappingRestoreBlockIndices(             # <<<<<<<<<<<<<<
 *                     self.lgm, &indices) )
 *         return oindices
 */
        __pyx_t_11 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingRestoreBlockIndices(__pyx_v_self->lgm, (&__pyx_v_indices))); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(29, 439, __pyx_L7_error)
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_4;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "PETSc/IS.pyx":441
 *             CHKERR( ISLocalToGlobalMappingRestoreBlockIndices(
 *                     self.lgm, &indices) )
 *         return oindices             # <<<<<<<<<<<<<<
 * 
 *     def getInfo(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_oindices);
  __pyx_r = __pyx_v_oindices;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":426
 *         return oindices
 * 
 *     def getBlockIndices(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0, bs = 1
 *         cdef const_PetscInt *indices = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.getBlockIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_oindices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":443
 *         return oindices
 * 
 *     def getInfo(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, nproc = 0, *procs = NULL,
 *         cdef PetscInt *numprocs = NULL, **indices = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_23getInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_22getInfo[] = "LGMap.getInfo(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_23getInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getInfo (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getInfo", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getInfo", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_22getInfo(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_22getInfo(struct PyPetscLGMapObject *__pyx_v_self) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_nproc;
  PetscInt *__pyx_v_procs;
  PetscInt *__pyx_v_numprocs;
  PetscInt **__pyx_v_indices;
  PyObject *__pyx_v_neighs = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  char const *__pyx_t_6;
  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;
  __Pyx_RefNannySetupContext("getInfo", 0);

  /* "PETSc/IS.pyx":444
 * 
 *     def getInfo(self):
 *         cdef PetscInt i, nproc = 0, *procs = NULL,             # <<<<<<<<<<<<<<
 *         cdef PetscInt *numprocs = NULL, **indices = NULL
 *         cdef object neighs = { }
 */
  __pyx_v_nproc = 0;
  __pyx_v_procs = NULL;

  /* "PETSc/IS.pyx":445
 *     def getInfo(self):
 *         cdef PetscInt i, nproc = 0, *procs = NULL,
 *         cdef PetscInt *numprocs = NULL, **indices = NULL             # <<<<<<<<<<<<<<
 *         cdef object neighs = { }
 *         CHKERR( ISLocalToGlobalMappingGetInfo(
 */
  __pyx_v_numprocs = NULL;
  __pyx_v_indices = NULL;

  /* "PETSc/IS.pyx":446
 *         cdef PetscInt i, nproc = 0, *procs = NULL,
 *         cdef PetscInt *numprocs = NULL, **indices = NULL
 *         cdef object neighs = { }             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingGetInfo(
 *                 self.lgm, &nproc, &procs, &numprocs, &indices) )
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_neighs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":447
 *         cdef PetscInt *numprocs = NULL, **indices = NULL
 *         cdef object neighs = { }
 *         CHKERR( ISLocalToGlobalMappingGetInfo(             # <<<<<<<<<<<<<<
 *                 self.lgm, &nproc, &procs, &numprocs, &indices) )
 *         try:
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingGetInfo(__pyx_v_self->lgm, (&__pyx_v_nproc), (&__pyx_v_procs), (&__pyx_v_numprocs), (&__pyx_v_indices))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 447, __pyx_L1_error)

  /* "PETSc/IS.pyx":449
 *         CHKERR( ISLocalToGlobalMappingGetInfo(
 *                 self.lgm, &nproc, &procs, &numprocs, &indices) )
 *         try:             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < nproc:
 *                 neighs[toInt(procs[i])] = array_i(numprocs[i], indices[i])
 */
  /*try:*/ {

    /* "PETSc/IS.pyx":450
 *                 self.lgm, &nproc, &procs, &numprocs, &indices) )
 *         try:
 *             for i from 0 <= i < nproc:             # <<<<<<<<<<<<<<
 *                 neighs[toInt(procs[i])] = array_i(numprocs[i], indices[i])
 *         finally:
 */
    __pyx_t_3 = __pyx_v_nproc;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

      /* "PETSc/IS.pyx":451
 *         try:
 *             for i from 0 <= i < nproc:
 *                 neighs[toInt(procs[i])] = array_i(numprocs[i], indices[i])             # <<<<<<<<<<<<<<
 *         finally:
 *             ISLocalToGlobalMappingRestoreInfo(
 */
      __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((__pyx_v_numprocs[__pyx_v_i]), (__pyx_v_indices[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 451, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_procs[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(29, 451, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(PyObject_SetItem(__pyx_v_neighs, __pyx_t_4, __pyx_t_1) < 0)) __PYX_ERR(29, 451, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }

  /* "PETSc/IS.pyx":453
 *                 neighs[toInt(procs[i])] = array_i(numprocs[i], indices[i])
 *         finally:
 *             ISLocalToGlobalMappingRestoreInfo(             # <<<<<<<<<<<<<<
 *                 self.lgm, &nproc, &procs, &numprocs, &indices)
 *         return neighs
 */
  /*finally:*/ {
    /*normal exit:*/{

      /* "PETSc/IS.pyx":454
 *         finally:
 *             ISLocalToGlobalMappingRestoreInfo(
 *                 self.lgm, &nproc, &procs, &numprocs, &indices)             # <<<<<<<<<<<<<<
 *         return neighs
 * 
 */
      ISLocalToGlobalMappingRestoreInfo(__pyx_v_self->lgm, (&__pyx_v_nproc), (&__pyx_v_procs), (&__pyx_v_numprocs), (&__pyx_v_indices));
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L4_error:;
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __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_XGOTREF(__pyx_t_12);
      __pyx_t_2 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {

        /* "PETSc/IS.pyx":453
 *                 neighs[toInt(procs[i])] = array_i(numprocs[i], indices[i])
 *         finally:
 *             ISLocalToGlobalMappingRestoreInfo(             # <<<<<<<<<<<<<<
 *                 self.lgm, &nproc, &procs, &numprocs, &indices)
 *         return neighs
 */
        ISLocalToGlobalMappingRestoreInfo(__pyx_v_self->lgm, (&__pyx_v_nproc), (&__pyx_v_procs), (&__pyx_v_numprocs), (&__pyx_v_indices));
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "PETSc/IS.pyx":455
 *             ISLocalToGlobalMappingRestoreInfo(
 *                 self.lgm, &nproc, &procs, &numprocs, &indices)
 *         return neighs             # <<<<<<<<<<<<<<
 * 
 *     def getBlockInfo(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_neighs);
  __pyx_r = __pyx_v_neighs;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":443
 *         return oindices
 * 
 *     def getInfo(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, nproc = 0, *procs = NULL,
 *         cdef PetscInt *numprocs = NULL, **indices = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.getInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_neighs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":457
 *         return neighs
 * 
 *     def getBlockInfo(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, nproc = 0, *procs = NULL,
 *         cdef PetscInt *numprocs = NULL, **indices = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_25getBlockInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_24getBlockInfo[] = "LGMap.getBlockInfo(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_25getBlockInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBlockInfo (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getBlockInfo", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getBlockInfo", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_24getBlockInfo(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_24getBlockInfo(struct PyPetscLGMapObject *__pyx_v_self) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_nproc;
  PetscInt *__pyx_v_procs;
  PetscInt *__pyx_v_numprocs;
  PetscInt **__pyx_v_indices;
  PyObject *__pyx_v_neighs = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  char const *__pyx_t_6;
  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;
  __Pyx_RefNannySetupContext("getBlockInfo", 0);

  /* "PETSc/IS.pyx":458
 * 
 *     def getBlockInfo(self):
 *         cdef PetscInt i, nproc = 0, *procs = NULL,             # <<<<<<<<<<<<<<
 *         cdef PetscInt *numprocs = NULL, **indices = NULL
 *         cdef object neighs = { }
 */
  __pyx_v_nproc = 0;
  __pyx_v_procs = NULL;

  /* "PETSc/IS.pyx":459
 *     def getBlockInfo(self):
 *         cdef PetscInt i, nproc = 0, *procs = NULL,
 *         cdef PetscInt *numprocs = NULL, **indices = NULL             # <<<<<<<<<<<<<<
 *         cdef object neighs = { }
 *         CHKERR( ISLocalToGlobalMappingGetBlockInfo(
 */
  __pyx_v_numprocs = NULL;
  __pyx_v_indices = NULL;

  /* "PETSc/IS.pyx":460
 *         cdef PetscInt i, nproc = 0, *procs = NULL,
 *         cdef PetscInt *numprocs = NULL, **indices = NULL
 *         cdef object neighs = { }             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingGetBlockInfo(
 *                 self.lgm, &nproc, &procs, &numprocs, &indices) )
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_neighs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":461
 *         cdef PetscInt *numprocs = NULL, **indices = NULL
 *         cdef object neighs = { }
 *         CHKERR( ISLocalToGlobalMappingGetBlockInfo(             # <<<<<<<<<<<<<<
 *                 self.lgm, &nproc, &procs, &numprocs, &indices) )
 *         try:
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingGetBlockInfo(__pyx_v_self->lgm, (&__pyx_v_nproc), (&__pyx_v_procs), (&__pyx_v_numprocs), (&__pyx_v_indices))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 461, __pyx_L1_error)

  /* "PETSc/IS.pyx":463
 *         CHKERR( ISLocalToGlobalMappingGetBlockInfo(
 *                 self.lgm, &nproc, &procs, &numprocs, &indices) )
 *         try:             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < nproc:
 *                 neighs[toInt(procs[i])] = array_i(numprocs[i], indices[i])
 */
  /*try:*/ {

    /* "PETSc/IS.pyx":464
 *                 self.lgm, &nproc, &procs, &numprocs, &indices) )
 *         try:
 *             for i from 0 <= i < nproc:             # <<<<<<<<<<<<<<
 *                 neighs[toInt(procs[i])] = array_i(numprocs[i], indices[i])
 *         finally:
 */
    __pyx_t_3 = __pyx_v_nproc;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

      /* "PETSc/IS.pyx":465
 *         try:
 *             for i from 0 <= i < nproc:
 *                 neighs[toInt(procs[i])] = array_i(numprocs[i], indices[i])             # <<<<<<<<<<<<<<
 *         finally:
 *             ISLocalToGlobalMappingRestoreBlockInfo(
 */
      __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((__pyx_v_numprocs[__pyx_v_i]), (__pyx_v_indices[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 465, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_procs[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(29, 465, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(PyObject_SetItem(__pyx_v_neighs, __pyx_t_4, __pyx_t_1) < 0)) __PYX_ERR(29, 465, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }

  /* "PETSc/IS.pyx":467
 *                 neighs[toInt(procs[i])] = array_i(numprocs[i], indices[i])
 *         finally:
 *             ISLocalToGlobalMappingRestoreBlockInfo(             # <<<<<<<<<<<<<<
 *                 self.lgm, &nproc, &procs, &numprocs, &indices)
 *         return neighs
 */
  /*finally:*/ {
    /*normal exit:*/{

      /* "PETSc/IS.pyx":468
 *         finally:
 *             ISLocalToGlobalMappingRestoreBlockInfo(
 *                 self.lgm, &nproc, &procs, &numprocs, &indices)             # <<<<<<<<<<<<<<
 *         return neighs
 * 
 */
      ISLocalToGlobalMappingRestoreBlockInfo(__pyx_v_self->lgm, (&__pyx_v_nproc), (&__pyx_v_procs), (&__pyx_v_numprocs), (&__pyx_v_indices));
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L4_error:;
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __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_XGOTREF(__pyx_t_12);
      __pyx_t_2 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {

        /* "PETSc/IS.pyx":467
 *                 neighs[toInt(procs[i])] = array_i(numprocs[i], indices[i])
 *         finally:
 *             ISLocalToGlobalMappingRestoreBlockInfo(             # <<<<<<<<<<<<<<
 *                 self.lgm, &nproc, &procs, &numprocs, &indices)
 *         return neighs
 */
        ISLocalToGlobalMappingRestoreBlockInfo(__pyx_v_self->lgm, (&__pyx_v_nproc), (&__pyx_v_procs), (&__pyx_v_numprocs), (&__pyx_v_indices));
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "PETSc/IS.pyx":469
 *             ISLocalToGlobalMappingRestoreBlockInfo(
 *                 self.lgm, &nproc, &procs, &numprocs, &indices)
 *         return neighs             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_neighs);
  __pyx_r = __pyx_v_neighs;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":457
 *         return neighs
 * 
 *     def getBlockInfo(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, nproc = 0, *procs = NULL,
 *         cdef PetscInt *numprocs = NULL, **indices = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.getBlockInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_neighs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":473
 *     #
 * 
 *     def apply(self, indices, result=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt niidx = 0, *iidx = NULL
 *         cdef PetscInt noidx = 0, *oidx = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_27apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_26apply[] = "LGMap.apply(self, indices, result=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_27apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_result,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) __PYX_ERR(29, 473, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_indices = values[0];
    __pyx_v_result = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 473, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_26apply(((struct PyPetscLGMapObject *)__pyx_v_self), __pyx_v_indices, __pyx_v_result);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_26apply(struct PyPetscLGMapObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_result) {
  PetscInt __pyx_v_niidx;
  PetscInt *__pyx_v_iidx;
  PetscInt __pyx_v_noidx;
  PetscInt *__pyx_v_oidx;
  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("apply", 0);
  __Pyx_INCREF(__pyx_v_indices);
  __Pyx_INCREF(__pyx_v_result);

  /* "PETSc/IS.pyx":474
 * 
 *     def apply(self, indices, result=None):
 *         cdef PetscInt niidx = 0, *iidx = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt noidx = 0, *oidx = NULL
 *         indices = iarray_i(indices, &niidx, &iidx)
 */
  __pyx_v_niidx = 0;
  __pyx_v_iidx = NULL;

  /* "PETSc/IS.pyx":475
 *     def apply(self, indices, result=None):
 *         cdef PetscInt niidx = 0, *iidx = NULL
 *         cdef PetscInt noidx = 0, *oidx = NULL             # <<<<<<<<<<<<<<
 *         indices = iarray_i(indices, &niidx, &iidx)
 *         if result is None: result = empty_i(niidx)
 */
  __pyx_v_noidx = 0;
  __pyx_v_oidx = NULL;

  /* "PETSc/IS.pyx":476
 *         cdef PetscInt niidx = 0, *iidx = NULL
 *         cdef PetscInt noidx = 0, *oidx = NULL
 *         indices = iarray_i(indices, &niidx, &iidx)             # <<<<<<<<<<<<<<
 *         if result is None: result = empty_i(niidx)
 *         result  = oarray_i(result,  &noidx, &oidx)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_indices, (&__pyx_v_niidx), (&__pyx_v_iidx))); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":477
 *         cdef PetscInt noidx = 0, *oidx = NULL
 *         indices = iarray_i(indices, &niidx, &iidx)
 *         if result is None: result = empty_i(niidx)             # <<<<<<<<<<<<<<
 *         result  = oarray_i(result,  &noidx, &oidx)
 *         assert niidx == noidx, "incompatible array sizes"
 */
  __pyx_t_2 = (__pyx_v_result == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_i(__pyx_v_niidx)); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 477, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/IS.pyx":478
 *         indices = iarray_i(indices, &niidx, &iidx)
 *         if result is None: result = empty_i(niidx)
 *         result  = oarray_i(result,  &noidx, &oidx)             # <<<<<<<<<<<<<<
 *         assert niidx == noidx, "incompatible array sizes"
 *         CHKERR( ISLocalToGlobalMappingApply(
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_i(__pyx_v_result, (&__pyx_v_noidx), (&__pyx_v_oidx))); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":479
 *         if result is None: result = empty_i(niidx)
 *         result  = oarray_i(result,  &noidx, &oidx)
 *         assert niidx == noidx, "incompatible array sizes"             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingApply(
 *             self.lgm, niidx, iidx, oidx) )
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_niidx == __pyx_v_noidx) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_incompatible_array_sizes);
      __PYX_ERR(29, 479, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/IS.pyx":480
 *         result  = oarray_i(result,  &noidx, &oidx)
 *         assert niidx == noidx, "incompatible array sizes"
 *         CHKERR( ISLocalToGlobalMappingApply(             # <<<<<<<<<<<<<<
 *             self.lgm, niidx, iidx, oidx) )
 *         return result
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingApply(__pyx_v_self->lgm, __pyx_v_niidx, __pyx_v_iidx, __pyx_v_oidx)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(29, 480, __pyx_L1_error)

  /* "PETSc/IS.pyx":482
 *         CHKERR( ISLocalToGlobalMappingApply(
 *             self.lgm, niidx, iidx, oidx) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def applyBlock(self, indices, result=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":473
 *     #
 * 
 *     def apply(self, indices, result=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt niidx = 0, *iidx = NULL
 *         cdef PetscInt noidx = 0, *oidx = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":484
 *         return result
 * 
 *     def applyBlock(self, indices, result=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt niidx = 0, *iidx = NULL
 *         cdef PetscInt noidx = 0, *oidx = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_29applyBlock(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_28applyBlock[] = "LGMap.applyBlock(self, indices, result=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_29applyBlock(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("applyBlock (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_result,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "applyBlock") < 0)) __PYX_ERR(29, 484, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_indices = values[0];
    __pyx_v_result = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("applyBlock", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 484, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.applyBlock", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_28applyBlock(((struct PyPetscLGMapObject *)__pyx_v_self), __pyx_v_indices, __pyx_v_result);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_28applyBlock(struct PyPetscLGMapObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_result) {
  PetscInt __pyx_v_niidx;
  PetscInt *__pyx_v_iidx;
  PetscInt __pyx_v_noidx;
  PetscInt *__pyx_v_oidx;
  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("applyBlock", 0);
  __Pyx_INCREF(__pyx_v_indices);
  __Pyx_INCREF(__pyx_v_result);

  /* "PETSc/IS.pyx":485
 * 
 *     def applyBlock(self, indices, result=None):
 *         cdef PetscInt niidx = 0, *iidx = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt noidx = 0, *oidx = NULL
 *         indices = iarray_i(indices, &niidx, &iidx)
 */
  __pyx_v_niidx = 0;
  __pyx_v_iidx = NULL;

  /* "PETSc/IS.pyx":486
 *     def applyBlock(self, indices, result=None):
 *         cdef PetscInt niidx = 0, *iidx = NULL
 *         cdef PetscInt noidx = 0, *oidx = NULL             # <<<<<<<<<<<<<<
 *         indices = iarray_i(indices, &niidx, &iidx)
 *         if result is None: result = empty_i(niidx)
 */
  __pyx_v_noidx = 0;
  __pyx_v_oidx = NULL;

  /* "PETSc/IS.pyx":487
 *         cdef PetscInt niidx = 0, *iidx = NULL
 *         cdef PetscInt noidx = 0, *oidx = NULL
 *         indices = iarray_i(indices, &niidx, &iidx)             # <<<<<<<<<<<<<<
 *         if result is None: result = empty_i(niidx)
 *         result  = oarray_i(result,  &noidx, &oidx)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_indices, (&__pyx_v_niidx), (&__pyx_v_iidx))); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":488
 *         cdef PetscInt noidx = 0, *oidx = NULL
 *         indices = iarray_i(indices, &niidx, &iidx)
 *         if result is None: result = empty_i(niidx)             # <<<<<<<<<<<<<<
 *         result  = oarray_i(result,  &noidx, &oidx)
 *         assert niidx == noidx, "incompatible array sizes"
 */
  __pyx_t_2 = (__pyx_v_result == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_i(__pyx_v_niidx)); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 488, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "PETSc/IS.pyx":489
 *         indices = iarray_i(indices, &niidx, &iidx)
 *         if result is None: result = empty_i(niidx)
 *         result  = oarray_i(result,  &noidx, &oidx)             # <<<<<<<<<<<<<<
 *         assert niidx == noidx, "incompatible array sizes"
 *         CHKERR( ISLocalToGlobalMappingApplyBlock(
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_i(__pyx_v_result, (&__pyx_v_noidx), (&__pyx_v_oidx))); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":490
 *         if result is None: result = empty_i(niidx)
 *         result  = oarray_i(result,  &noidx, &oidx)
 *         assert niidx == noidx, "incompatible array sizes"             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingApplyBlock(
 *             self.lgm, niidx, iidx, oidx) )
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_niidx == __pyx_v_noidx) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_incompatible_array_sizes);
      __PYX_ERR(29, 490, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/IS.pyx":491
 *         result  = oarray_i(result,  &noidx, &oidx)
 *         assert niidx == noidx, "incompatible array sizes"
 *         CHKERR( ISLocalToGlobalMappingApplyBlock(             # <<<<<<<<<<<<<<
 *             self.lgm, niidx, iidx, oidx) )
 *         return result
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingApplyBlock(__pyx_v_self->lgm, __pyx_v_niidx, __pyx_v_iidx, __pyx_v_oidx)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(29, 491, __pyx_L1_error)

  /* "PETSc/IS.pyx":493
 *         CHKERR( ISLocalToGlobalMappingApplyBlock(
 *             self.lgm, niidx, iidx, oidx) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def applyIS(self, IS iset not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "PETSc/IS.pyx":484
 *         return result
 * 
 *     def applyBlock(self, indices, result=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt niidx = 0, *iidx = NULL
 *         cdef PetscInt noidx = 0, *oidx = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.applyBlock", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":495
 *         return result
 * 
 *     def applyIS(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef IS result = IS()
 *         CHKERR( ISLocalToGlobalMappingApplyIS(
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_31applyIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_30applyIS[] = "LGMap.applyIS(self, IS iset)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_31applyIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("applyIS (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iset,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);
        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_iset)) != 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, "applyIS") < 0)) __PYX_ERR(29, 495, __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_iset = ((struct PyPetscISObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("applyIS", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 495, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.applyIS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iset), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iset", 0))) __PYX_ERR(29, 495, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_30applyIS(((struct PyPetscLGMapObject *)__pyx_v_self), __pyx_v_iset);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_30applyIS(struct PyPetscLGMapObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset) {
  struct PyPetscISObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("applyIS", 0);

  /* "PETSc/IS.pyx":496
 * 
 *     def applyIS(self, IS iset not None):
 *         cdef IS result = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( ISLocalToGlobalMappingApplyIS(
 *             self.lgm, iset.iset, &result.iset) )
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/IS.pyx":497
 *     def applyIS(self, IS iset not None):
 *         cdef IS result = IS()
 *         CHKERR( ISLocalToGlobalMappingApplyIS(             # <<<<<<<<<<<<<<
 *             self.lgm, iset.iset, &result.iset) )
 *         return result
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingApplyIS(__pyx_v_self->lgm, __pyx_v_iset->iset, (&__pyx_v_result->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(29, 497, __pyx_L1_error)

  /* "PETSc/IS.pyx":499
 *         CHKERR( ISLocalToGlobalMappingApplyIS(
 *             self.lgm, iset.iset, &result.iset) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def applyInverse(self, indices, map_type=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":495
 *         return result
 * 
 *     def applyIS(self, IS iset not None):             # <<<<<<<<<<<<<<
 *         cdef IS result = IS()
 *         CHKERR( ISLocalToGlobalMappingApplyIS(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.applyIS", __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;
}

/* "PETSc/IS.pyx":501
 *         return result
 * 
 *     def applyInverse(self, indices, map_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscGLMapType cmtype = PETSC_IS_GTOLM_MASK
 *         if map_type is not None: cmtype = map_type
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_33applyInverse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_32applyInverse[] = "LGMap.applyInverse(self, indices, map_type=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_33applyInverse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_map_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("applyInverse (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_map_type,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_map_type);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "applyInverse") < 0)) __PYX_ERR(29, 501, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_indices = values[0];
    __pyx_v_map_type = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("applyInverse", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 501, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.applyInverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_32applyInverse(((struct PyPetscLGMapObject *)__pyx_v_self), __pyx_v_indices, __pyx_v_map_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_32applyInverse(struct PyPetscLGMapObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_map_type) {
  ISGlobalToLocalMappingType __pyx_v_cmtype;
  PetscInt __pyx_v_n;
  PetscInt *__pyx_v_idx;
  PetscInt __pyx_v_nout;
  PetscInt *__pyx_v_idxout;
  PyArrayObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  ISGlobalToLocalMappingType __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("applyInverse", 0);
  __Pyx_INCREF(__pyx_v_indices);

  /* "PETSc/IS.pyx":502
 * 
 *     def applyInverse(self, indices, map_type=None):
 *         cdef PetscGLMapType cmtype = PETSC_IS_GTOLM_MASK             # <<<<<<<<<<<<<<
 *         if map_type is not None: cmtype = map_type
 *         cdef PetscInt n = 0, *idx = NULL
 */
  __pyx_v_cmtype = IS_GTOLM_MASK;

  /* "PETSc/IS.pyx":503
 *     def applyInverse(self, indices, map_type=None):
 *         cdef PetscGLMapType cmtype = PETSC_IS_GTOLM_MASK
 *         if map_type is not None: cmtype = map_type             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0, *idx = NULL
 *         indices = iarray_i(indices, &n, &idx)
 */
  __pyx_t_1 = (__pyx_v_map_type != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = ((ISGlobalToLocalMappingType)__Pyx_PyInt_As_ISGlobalToLocalMappingType(__pyx_v_map_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(29, 503, __pyx_L1_error)
    __pyx_v_cmtype = __pyx_t_3;
  }

  /* "PETSc/IS.pyx":504
 *         cdef PetscGLMapType cmtype = PETSC_IS_GTOLM_MASK
 *         if map_type is not None: cmtype = map_type
 *         cdef PetscInt n = 0, *idx = NULL             # <<<<<<<<<<<<<<
 *         indices = iarray_i(indices, &n, &idx)
 *         cdef PetscInt nout = n, *idxout = NULL
 */
  __pyx_v_n = 0;
  __pyx_v_idx = NULL;

  /* "PETSc/IS.pyx":505
 *         if map_type is not None: cmtype = map_type
 *         cdef PetscInt n = 0, *idx = NULL
 *         indices = iarray_i(indices, &n, &idx)             # <<<<<<<<<<<<<<
 *         cdef PetscInt nout = n, *idxout = NULL
 *         if cmtype != PETSC_IS_GTOLM_MASK:
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_indices, (&__pyx_v_n), (&__pyx_v_idx))); if (unlikely(!__pyx_t_4)) __PYX_ERR(29, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/IS.pyx":506
 *         cdef PetscInt n = 0, *idx = NULL
 *         indices = iarray_i(indices, &n, &idx)
 *         cdef PetscInt nout = n, *idxout = NULL             # <<<<<<<<<<<<<<
 *         if cmtype != PETSC_IS_GTOLM_MASK:
 *             CHKERR( ISGlobalToLocalMappingApply(
 */
  __pyx_v_nout = __pyx_v_n;
  __pyx_v_idxout = NULL;

  /* "PETSc/IS.pyx":507
 *         indices = iarray_i(indices, &n, &idx)
 *         cdef PetscInt nout = n, *idxout = NULL
 *         if cmtype != PETSC_IS_GTOLM_MASK:             # <<<<<<<<<<<<<<
 *             CHKERR( ISGlobalToLocalMappingApply(
 *                     self.lgm, cmtype, n, idx, &nout, NULL) )
 */
  __pyx_t_2 = ((__pyx_v_cmtype != IS_GTOLM_MASK) != 0);
  if (__pyx_t_2) {

    /* "PETSc/IS.pyx":508
 *         cdef PetscInt nout = n, *idxout = NULL
 *         if cmtype != PETSC_IS_GTOLM_MASK:
 *             CHKERR( ISGlobalToLocalMappingApply(             # <<<<<<<<<<<<<<
 *                     self.lgm, cmtype, n, idx, &nout, NULL) )
 *         result = oarray_i(empty_i(nout), &nout, &idxout)
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGlobalToLocalMappingApply(__pyx_v_self->lgm, __pyx_v_cmtype, __pyx_v_n, __pyx_v_idx, (&__pyx_v_nout), NULL)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(29, 508, __pyx_L1_error)

    /* "PETSc/IS.pyx":507
 *         indices = iarray_i(indices, &n, &idx)
 *         cdef PetscInt nout = n, *idxout = NULL
 *         if cmtype != PETSC_IS_GTOLM_MASK:             # <<<<<<<<<<<<<<
 *             CHKERR( ISGlobalToLocalMappingApply(
 *                     self.lgm, cmtype, n, idx, &nout, NULL) )
 */
  }

  /* "PETSc/IS.pyx":510
 *             CHKERR( ISGlobalToLocalMappingApply(
 *                     self.lgm, cmtype, n, idx, &nout, NULL) )
 *         result = oarray_i(empty_i(nout), &nout, &idxout)             # <<<<<<<<<<<<<<
 *         CHKERR( ISGlobalToLocalMappingApply(
 *                 self.lgm, cmtype, n, idx, &nout, idxout) )
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_i(__pyx_v_nout)); if (unlikely(!__pyx_t_4)) __PYX_ERR(29, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_i(__pyx_t_4, (&__pyx_v_nout), (&__pyx_v_idxout))); if (unlikely(!__pyx_t_6)) __PYX_ERR(29, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "PETSc/IS.pyx":511
 *                     self.lgm, cmtype, n, idx, &nout, NULL) )
 *         result = oarray_i(empty_i(nout), &nout, &idxout)
 *         CHKERR( ISGlobalToLocalMappingApply(             # <<<<<<<<<<<<<<
 *                 self.lgm, cmtype, n, idx, &nout, idxout) )
 *         return result
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGlobalToLocalMappingApply(__pyx_v_self->lgm, __pyx_v_cmtype, __pyx_v_n, __pyx_v_idx, (&__pyx_v_nout), __pyx_v_idxout)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(29, 511, __pyx_L1_error)

  /* "PETSc/IS.pyx":513
 *         CHKERR( ISGlobalToLocalMappingApply(
 *                 self.lgm, cmtype, n, idx, &nout, idxout) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def applyBlockInverse(self, indices, map_type=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":501
 *         return result
 * 
 *     def applyInverse(self, indices, map_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscGLMapType cmtype = PETSC_IS_GTOLM_MASK
 *         if map_type is not None: cmtype = map_type
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.applyInverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":515
 *         return result
 * 
 *     def applyBlockInverse(self, indices, map_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscGLMapType cmtype = PETSC_IS_GTOLM_MASK
 *         if map_type is not None: cmtype = map_type
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_35applyBlockInverse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_5LGMap_34applyBlockInverse[] = "LGMap.applyBlockInverse(self, indices, map_type=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_35applyBlockInverse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_map_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("applyBlockInverse (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_map_type,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_map_type);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "applyBlockInverse") < 0)) __PYX_ERR(29, 515, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_indices = values[0];
    __pyx_v_map_type = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("applyBlockInverse", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(29, 515, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.applyBlockInverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_34applyBlockInverse(((struct PyPetscLGMapObject *)__pyx_v_self), __pyx_v_indices, __pyx_v_map_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_34applyBlockInverse(struct PyPetscLGMapObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_map_type) {
  ISGlobalToLocalMappingType __pyx_v_cmtype;
  PetscInt __pyx_v_n;
  PetscInt *__pyx_v_idx;
  PetscInt __pyx_v_nout;
  PetscInt *__pyx_v_idxout;
  PyArrayObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  ISGlobalToLocalMappingType __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("applyBlockInverse", 0);
  __Pyx_INCREF(__pyx_v_indices);

  /* "PETSc/IS.pyx":516
 * 
 *     def applyBlockInverse(self, indices, map_type=None):
 *         cdef PetscGLMapType cmtype = PETSC_IS_GTOLM_MASK             # <<<<<<<<<<<<<<
 *         if map_type is not None: cmtype = map_type
 *         cdef PetscInt n = 0, *idx = NULL
 */
  __pyx_v_cmtype = IS_GTOLM_MASK;

  /* "PETSc/IS.pyx":517
 *     def applyBlockInverse(self, indices, map_type=None):
 *         cdef PetscGLMapType cmtype = PETSC_IS_GTOLM_MASK
 *         if map_type is not None: cmtype = map_type             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0, *idx = NULL
 *         indices = iarray_i(indices, &n, &idx)
 */
  __pyx_t_1 = (__pyx_v_map_type != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = ((ISGlobalToLocalMappingType)__Pyx_PyInt_As_ISGlobalToLocalMappingType(__pyx_v_map_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(29, 517, __pyx_L1_error)
    __pyx_v_cmtype = __pyx_t_3;
  }

  /* "PETSc/IS.pyx":518
 *         cdef PetscGLMapType cmtype = PETSC_IS_GTOLM_MASK
 *         if map_type is not None: cmtype = map_type
 *         cdef PetscInt n = 0, *idx = NULL             # <<<<<<<<<<<<<<
 *         indices = iarray_i(indices, &n, &idx)
 *         cdef PetscInt nout = n, *idxout = NULL
 */
  __pyx_v_n = 0;
  __pyx_v_idx = NULL;

  /* "PETSc/IS.pyx":519
 *         if map_type is not None: cmtype = map_type
 *         cdef PetscInt n = 0, *idx = NULL
 *         indices = iarray_i(indices, &n, &idx)             # <<<<<<<<<<<<<<
 *         cdef PetscInt nout = n, *idxout = NULL
 *         if cmtype != PETSC_IS_GTOLM_MASK:
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_indices, (&__pyx_v_n), (&__pyx_v_idx))); if (unlikely(!__pyx_t_4)) __PYX_ERR(29, 519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/IS.pyx":520
 *         cdef PetscInt n = 0, *idx = NULL
 *         indices = iarray_i(indices, &n, &idx)
 *         cdef PetscInt nout = n, *idxout = NULL             # <<<<<<<<<<<<<<
 *         if cmtype != PETSC_IS_GTOLM_MASK:
 *             CHKERR( ISGlobalToLocalMappingApply(
 */
  __pyx_v_nout = __pyx_v_n;
  __pyx_v_idxout = NULL;

  /* "PETSc/IS.pyx":521
 *         indices = iarray_i(indices, &n, &idx)
 *         cdef PetscInt nout = n, *idxout = NULL
 *         if cmtype != PETSC_IS_GTOLM_MASK:             # <<<<<<<<<<<<<<
 *             CHKERR( ISGlobalToLocalMappingApply(
 *                     self.lgm, cmtype, n, idx, &nout, NULL) )
 */
  __pyx_t_2 = ((__pyx_v_cmtype != IS_GTOLM_MASK) != 0);
  if (__pyx_t_2) {

    /* "PETSc/IS.pyx":522
 *         cdef PetscInt nout = n, *idxout = NULL
 *         if cmtype != PETSC_IS_GTOLM_MASK:
 *             CHKERR( ISGlobalToLocalMappingApply(             # <<<<<<<<<<<<<<
 *                     self.lgm, cmtype, n, idx, &nout, NULL) )
 *         result = oarray_i(empty_i(nout), &nout, &idxout)
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGlobalToLocalMappingApply(__pyx_v_self->lgm, __pyx_v_cmtype, __pyx_v_n, __pyx_v_idx, (&__pyx_v_nout), NULL)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(29, 522, __pyx_L1_error)

    /* "PETSc/IS.pyx":521
 *         indices = iarray_i(indices, &n, &idx)
 *         cdef PetscInt nout = n, *idxout = NULL
 *         if cmtype != PETSC_IS_GTOLM_MASK:             # <<<<<<<<<<<<<<
 *             CHKERR( ISGlobalToLocalMappingApply(
 *                     self.lgm, cmtype, n, idx, &nout, NULL) )
 */
  }

  /* "PETSc/IS.pyx":524
 *             CHKERR( ISGlobalToLocalMappingApply(
 *                     self.lgm, cmtype, n, idx, &nout, NULL) )
 *         result = oarray_i(empty_i(nout), &nout, &idxout)             # <<<<<<<<<<<<<<
 *         CHKERR( ISGlobalToLocalMappingApplyBlock(
 *                 self.lgm, cmtype, n, idx, &nout, idxout) )
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_i(__pyx_v_nout)); if (unlikely(!__pyx_t_4)) __PYX_ERR(29, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_i(__pyx_t_4, (&__pyx_v_nout), (&__pyx_v_idxout))); if (unlikely(!__pyx_t_6)) __PYX_ERR(29, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "PETSc/IS.pyx":525
 *                     self.lgm, cmtype, n, idx, &nout, NULL) )
 *         result = oarray_i(empty_i(nout), &nout, &idxout)
 *         CHKERR( ISGlobalToLocalMappingApplyBlock(             # <<<<<<<<<<<<<<
 *                 self.lgm, cmtype, n, idx, &nout, idxout) )
 *         return result
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISGlobalToLocalMappingApplyBlock(__pyx_v_self->lgm, __pyx_v_cmtype, __pyx_v_n, __pyx_v_idx, (&__pyx_v_nout), __pyx_v_idxout)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(29, 525, __pyx_L1_error)

  /* "PETSc/IS.pyx":527
 *         CHKERR( ISGlobalToLocalMappingApplyBlock(
 *                 self.lgm, cmtype, n, idx, &nout, idxout) )
 *         return result             # <<<<<<<<<<<<<<
 *     #
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/IS.pyx":515
 *         return result
 * 
 *     def applyBlockInverse(self, indices, map_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscGLMapType cmtype = PETSC_IS_GTOLM_MASK
 *         if map_type is not None: cmtype = map_type
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.applyBlockInverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":531
 * 
 *     property size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSize()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_4size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_4size___get__(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_4size___get__(struct PyPetscLGMapObject *__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);

  /* "PETSc/IS.pyx":532
 *     property size:
 *         def __get__(self):
 *             return self.getSize()             # <<<<<<<<<<<<<<
 * 
 *     property block_size:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 532, __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(29, 532, __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;

  /* "PETSc/IS.pyx":531
 * 
 *     property size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSize()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":535
 * 
 *     property block_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockSize()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_10block_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_10block_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_10block_size___get__(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_10block_size___get__(struct PyPetscLGMapObject *__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);

  /* "PETSc/IS.pyx":536
 *     property block_size:
 *         def __get__(self):
 *             return self.getBlockSize()             # <<<<<<<<<<<<<<
 * 
 *     property indices:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getBlockSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 536, __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(29, 536, __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;

  /* "PETSc/IS.pyx":535
 * 
 *     property block_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockSize()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.block_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":539
 * 
 *     property indices:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getIndices()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_7indices_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_7indices_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_7indices___get__(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_7indices___get__(struct PyPetscLGMapObject *__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);

  /* "PETSc/IS.pyx":540
 *     property indices:
 *         def __get__(self):
 *             return self.getIndices()             # <<<<<<<<<<<<<<
 * 
 *     property block_indices:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getIndices); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 540, __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(29, 540, __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;

  /* "PETSc/IS.pyx":539
 * 
 *     property indices:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getIndices()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.indices.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":543
 * 
 *     property block_indices:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockIndices()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_13block_indices_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_13block_indices_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_13block_indices___get__(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_13block_indices___get__(struct PyPetscLGMapObject *__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);

  /* "PETSc/IS.pyx":544
 *     property block_indices:
 *         def __get__(self):
 *             return self.getBlockIndices()             # <<<<<<<<<<<<<<
 * 
 *     property info:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getBlockIndices); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 544, __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(29, 544, __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;

  /* "PETSc/IS.pyx":543
 * 
 *     property block_indices:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockIndices()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.block_indices.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":547
 * 
 *     property info:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getInfo()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_4info_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_4info_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_4info___get__(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_4info___get__(struct PyPetscLGMapObject *__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);

  /* "PETSc/IS.pyx":548
 *     property info:
 *         def __get__(self):
 *             return self.getInfo()             # <<<<<<<<<<<<<<
 * 
 *     property block_info:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getInfo); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 548, __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(29, 548, __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;

  /* "PETSc/IS.pyx":547
 * 
 *     property info:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getInfo()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.info.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/IS.pyx":551
 * 
 *     property block_info:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockInfo()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_10block_info_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_5LGMap_10block_info_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_5LGMap_10block_info___get__(((struct PyPetscLGMapObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_5LGMap_10block_info___get__(struct PyPetscLGMapObject *__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);

  /* "PETSc/IS.pyx":552
 *     property block_info:
 *         def __get__(self):
 *             return self.getBlockInfo()             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getBlockInfo); if (unlikely(!__pyx_t_2)) __PYX_ERR(29, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(29, 552, __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(29, 552, __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;

  /* "PETSc/IS.pyx":551
 * 
 *     property block_info:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockInfo()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.LGMap.block_info.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":32
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.vec
 *         self.vec = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3Vec_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3Vec_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec___cinit__(((struct PyPetscVecObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_3Vec___cinit__(struct PyPetscVecObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Vec.pyx":33
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.vec             # <<<<<<<<<<<<<<
 *         self.vec = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->vec));

  /* "PETSc/Vec.pyx":34
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.vec
 *         self.vec = NULL             # <<<<<<<<<<<<<<
 * 
 *     # unary operations
 */
  __pyx_v_self->vec = NULL;

  /* "PETSc/Vec.pyx":32
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.vec
 *         self.vec = NULL
 */

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

/* "PETSc/Vec.pyx":38
 *     # unary operations
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         return vec_pos(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_3__pos__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_3__pos__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pos__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_2__pos__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_2__pos__(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pos__", 0);

  /* "PETSc/Vec.pyx":39
 * 
 *     def __pos__(self):
 *         return vec_pos(self)             # <<<<<<<<<<<<<<
 * 
 *     def __neg__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_pos(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":38
 *     # unary operations
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         return vec_pos(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__pos__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":41
 *         return vec_pos(self)
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         return vec_neg(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_5__neg__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_5__neg__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_4__neg__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_4__neg__(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__neg__", 0);

  /* "PETSc/Vec.pyx":42
 * 
 *     def __neg__(self):
 *         return vec_neg(self)             # <<<<<<<<<<<<<<
 * 
 *     def __abs__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_neg(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":41
 *         return vec_pos(self)
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         return vec_neg(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":44
 *         return vec_neg(self)
 * 
 *     def __abs__(self):             # <<<<<<<<<<<<<<
 *         return vec_abs(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_7__abs__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_7__abs__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__abs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_6__abs__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_6__abs__(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__abs__", 0);

  /* "PETSc/Vec.pyx":45
 * 
 *     def __abs__(self):
 *         return vec_abs(self)             # <<<<<<<<<<<<<<
 * 
 *     # inplace binary operations
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_abs(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":44
 *         return vec_neg(self)
 * 
 *     def __abs__(self):             # <<<<<<<<<<<<<<
 *         return vec_abs(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__abs__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":49
 *     # inplace binary operations
 * 
 *     def __iadd__(self, other):             # <<<<<<<<<<<<<<
 *         return vec_iadd(self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_9__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_9__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_8__iadd__(((struct PyPetscVecObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_8__iadd__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__iadd__", 0);

  /* "PETSc/Vec.pyx":50
 * 
 *     def __iadd__(self, other):
 *         return vec_iadd(self, other)             # <<<<<<<<<<<<<<
 * 
 *     def __isub__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_iadd(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":49
 *     # inplace binary operations
 * 
 *     def __iadd__(self, other):             # <<<<<<<<<<<<<<
 *         return vec_iadd(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__iadd__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":52
 *         return vec_iadd(self, other)
 * 
 *     def __isub__(self, other):             # <<<<<<<<<<<<<<
 *         return vec_isub(self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_11__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_11__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_10__isub__(((struct PyPetscVecObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_10__isub__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__isub__", 0);

  /* "PETSc/Vec.pyx":53
 * 
 *     def __isub__(self, other):
 *         return vec_isub(self, other)             # <<<<<<<<<<<<<<
 * 
 *     def __imul__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_isub(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":52
 *         return vec_iadd(self, other)
 * 
 *     def __isub__(self, other):             # <<<<<<<<<<<<<<
 *         return vec_isub(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__isub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":55
 *         return vec_isub(self, other)
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         return vec_imul(self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_13__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_13__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__imul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_12__imul__(((struct PyPetscVecObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_12__imul__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__imul__", 0);

  /* "PETSc/Vec.pyx":56
 * 
 *     def __imul__(self, other):
 *         return vec_imul(self, other)             # <<<<<<<<<<<<<<
 * 
 *     def __idiv__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_imul(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":55
 *         return vec_isub(self, other)
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         return vec_imul(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__imul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":58
 *         return vec_imul(self, other)
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         return vec_idiv(self, other)
 * 
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_15__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_15__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__idiv__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_14__idiv__(((struct PyPetscVecObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY)*/

#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_14__idiv__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__idiv__", 0);

  /* "PETSc/Vec.pyx":59
 * 
 *     def __idiv__(self, other):
 *         return vec_idiv(self, other)             # <<<<<<<<<<<<<<
 * 
 *     def __itruediv__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_idiv(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":58
 *         return vec_imul(self, other)
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         return vec_idiv(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__idiv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY)*/

/* "PETSc/Vec.pyx":61
 *         return vec_idiv(self, other)
 * 
 *     def __itruediv__(self, other):             # <<<<<<<<<<<<<<
 *         return vec_idiv(self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_17__itruediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_17__itruediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__itruediv__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_16__itruediv__(((struct PyPetscVecObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_16__itruediv__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__itruediv__", 0);

  /* "PETSc/Vec.pyx":62
 * 
 *     def __itruediv__(self, other):
 *         return vec_idiv(self, other)             # <<<<<<<<<<<<<<
 * 
 *     # binary operations
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_idiv(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":61
 *         return vec_idiv(self, other)
 * 
 *     def __itruediv__(self, other):             # <<<<<<<<<<<<<<
 *         return vec_idiv(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__itruediv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":66
 *     # binary operations
 * 
 *     def __add__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Vec):
 *             return vec_add(self, other)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_19__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_19__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_18__add__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_18__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__add__", 0);

  /* "PETSc/Vec.pyx":67
 * 
 *     def __add__(self, other):
 *         if isinstance(self, Vec):             # <<<<<<<<<<<<<<
 *             return vec_add(self, other)
 *         else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Vec.pyx":68
 *     def __add__(self, other):
 *         if isinstance(self, Vec):
 *             return vec_add(self, other)             # <<<<<<<<<<<<<<
 *         else:
 *             return vec_radd(other, self)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(30, 68, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_add(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_other)); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/Vec.pyx":67
 * 
 *     def __add__(self, other):
 *         if isinstance(self, Vec):             # <<<<<<<<<<<<<<
 *             return vec_add(self, other)
 *         else:
 */
  }

  /* "PETSc/Vec.pyx":70
 *             return vec_add(self, other)
 *         else:
 *             return vec_radd(other, self)             # <<<<<<<<<<<<<<
 * 
 *     def __sub__(self, other):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(30, 70, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_radd(((struct PyPetscVecObject *)__pyx_v_other), __pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 70, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":66
 *     # binary operations
 * 
 *     def __add__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Vec):
 *             return vec_add(self, other)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":72
 *             return vec_radd(other, self)
 * 
 *     def __sub__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Vec):
 *             return vec_sub(self, other)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_21__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_21__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_20__sub__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_20__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__sub__", 0);

  /* "PETSc/Vec.pyx":73
 * 
 *     def __sub__(self, other):
 *         if isinstance(self, Vec):             # <<<<<<<<<<<<<<
 *             return vec_sub(self, other)
 *         else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Vec.pyx":74
 *     def __sub__(self, other):
 *         if isinstance(self, Vec):
 *             return vec_sub(self, other)             # <<<<<<<<<<<<<<
 *         else:
 *             return vec_rsub(other, self)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(30, 74, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_sub(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_other)); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 74, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/Vec.pyx":73
 * 
 *     def __sub__(self, other):
 *         if isinstance(self, Vec):             # <<<<<<<<<<<<<<
 *             return vec_sub(self, other)
 *         else:
 */
  }

  /* "PETSc/Vec.pyx":76
 *             return vec_sub(self, other)
 *         else:
 *             return vec_rsub(other, self)             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(self, other):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(30, 76, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_rsub(((struct PyPetscVecObject *)__pyx_v_other), __pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 76, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":72
 *             return vec_radd(other, self)
 * 
 *     def __sub__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Vec):
 *             return vec_sub(self, other)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":78
 *             return vec_rsub(other, self)
 * 
 *     def __mul__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Vec):
 *             return vec_mul(self, other)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_23__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_23__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_22__mul__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_22__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__mul__", 0);

  /* "PETSc/Vec.pyx":79
 * 
 *     def __mul__(self, other):
 *         if isinstance(self, Vec):             # <<<<<<<<<<<<<<
 *             return vec_mul(self, other)
 *         else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Vec.pyx":80
 *     def __mul__(self, other):
 *         if isinstance(self, Vec):
 *             return vec_mul(self, other)             # <<<<<<<<<<<<<<
 *         else:
 *             return vec_rmul(other, self)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(30, 80, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_mul(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_other)); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 80, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/Vec.pyx":79
 * 
 *     def __mul__(self, other):
 *         if isinstance(self, Vec):             # <<<<<<<<<<<<<<
 *             return vec_mul(self, other)
 *         else:
 */
  }

  /* "PETSc/Vec.pyx":82
 *             return vec_mul(self, other)
 *         else:
 *             return vec_rmul(other, self)             # <<<<<<<<<<<<<<
 * 
 *     def __div__(self, other):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(30, 82, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_rmul(((struct PyPetscVecObject *)__pyx_v_other), __pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":78
 *             return vec_rsub(other, self)
 * 
 *     def __mul__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Vec):
 *             return vec_mul(self, other)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":84
 *             return vec_rmul(other, self)
 * 
 *     def __div__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Vec):
 *             return vec_div(self, other)
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_25__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_25__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__div__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_24__div__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY)*/

#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_24__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__div__", 0);

  /* "PETSc/Vec.pyx":85
 * 
 *     def __div__(self, other):
 *         if isinstance(self, Vec):             # <<<<<<<<<<<<<<
 *             return vec_div(self, other)
 *         else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Vec.pyx":86
 *     def __div__(self, other):
 *         if isinstance(self, Vec):
 *             return vec_div(self, other)             # <<<<<<<<<<<<<<
 *         else:
 *             return vec_rdiv(other, self)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(30, 86, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_div(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_other)); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/Vec.pyx":85
 * 
 *     def __div__(self, other):
 *         if isinstance(self, Vec):             # <<<<<<<<<<<<<<
 *             return vec_div(self, other)
 *         else:
 */
  }

  /* "PETSc/Vec.pyx":88
 *             return vec_div(self, other)
 *         else:
 *             return vec_rdiv(other, self)             # <<<<<<<<<<<<<<
 * 
 *     def __truediv__(self, other):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(30, 88, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_rdiv(((struct PyPetscVecObject *)__pyx_v_other), __pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":84
 *             return vec_rmul(other, self)
 * 
 *     def __div__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Vec):
 *             return vec_div(self, other)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY)*/

/* "PETSc/Vec.pyx":90
 *             return vec_rdiv(other, self)
 * 
 *     def __truediv__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Vec):
 *             return vec_div(self, other)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_27__truediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_27__truediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__truediv__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_26__truediv__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_26__truediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__truediv__", 0);

  /* "PETSc/Vec.pyx":91
 * 
 *     def __truediv__(self, other):
 *         if isinstance(self, Vec):             # <<<<<<<<<<<<<<
 *             return vec_div(self, other)
 *         else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Vec.pyx":92
 *     def __truediv__(self, other):
 *         if isinstance(self, Vec):
 *             return vec_div(self, other)             # <<<<<<<<<<<<<<
 *         else:
 *             return vec_rdiv(other, self)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(30, 92, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_div(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_other)); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/Vec.pyx":91
 * 
 *     def __truediv__(self, other):
 *         if isinstance(self, Vec):             # <<<<<<<<<<<<<<
 *             return vec_div(self, other)
 *         else:
 */
  }

  /* "PETSc/Vec.pyx":94
 *             return vec_div(self, other)
 *         else:
 *             return vec_rdiv(other, self)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(30, 94, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_rdiv(((struct PyPetscVecObject *)__pyx_v_other), __pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 94, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":90
 *             return vec_rdiv(other, self)
 * 
 *     def __truediv__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Vec):
 *             return vec_div(self, other)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__truediv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":103
 *     #    return <Py_ssize_t>size
 * 
 *     def __getitem__(self, i):             # <<<<<<<<<<<<<<
 *         return vec_getitem(self, i)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_29__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_29__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_28__getitem__(((struct PyPetscVecObject *)__pyx_v_self), ((PyObject *)__pyx_v_i));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_28__getitem__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "PETSc/Vec.pyx":104
 * 
 *     def __getitem__(self, i):
 *         return vec_getitem(self, i)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, i, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_vec_getitem(__pyx_v_self, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":103
 *     #    return <Py_ssize_t>size
 * 
 *     def __getitem__(self, i):             # <<<<<<<<<<<<<<
 *         return vec_getitem(self, i)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":106
 *         return vec_getitem(self, i)
 * 
 *     def __setitem__(self, i, v):             # <<<<<<<<<<<<<<
 *         vec_setitem(self, i, v)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3Vec_31__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3Vec_31__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_v) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_30__setitem__(((struct PyPetscVecObject *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_v));

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

static int __pyx_pf_8petsc4py_5PETSc_3Vec_30__setitem__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_v) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "PETSc/Vec.pyx":107
 * 
 *     def __setitem__(self, i, v):
 *         vec_setitem(self, i, v)             # <<<<<<<<<<<<<<
 * 
 *     # buffer interface (PEP 3118)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_vec_setitem(__pyx_v_self, __pyx_v_i, __pyx_v_v); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 107, __pyx_L1_error)

  /* "PETSc/Vec.pyx":106
 *         return vec_getitem(self, i)
 * 
 *     def __setitem__(self, i, v):             # <<<<<<<<<<<<<<
 *         vec_setitem(self, i, v)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":111
 *     # buffer interface (PEP 3118)
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):             # <<<<<<<<<<<<<<
 *         cdef _Vec_buffer buf = _Vec_buffer(self)
 *         buf.acquirebuffer(view, flags)
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_8petsc4py_5PETSc_3Vec_33__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_8petsc4py_5PETSc_3Vec_33__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_32__getbuffer__(((struct PyPetscVecObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_view), ((int)__pyx_v_flags));

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

static int __pyx_pf_8petsc4py_5PETSc_3Vec_32__getbuffer__(struct PyPetscVecObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) {
  struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_buf = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_view != NULL) {
    __pyx_v_view->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_view->obj);
  }

  /* "PETSc/Vec.pyx":112
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):
 *         cdef _Vec_buffer buf = _Vec_buffer(self)             # <<<<<<<<<<<<<<
 *         buf.acquirebuffer(view, flags)
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc__Vec_buffer), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Vec.pyx":113
 *     def __getbuffer__(self, Py_buffer *view, int flags):
 *         cdef _Vec_buffer buf = _Vec_buffer(self)
 *         buf.acquirebuffer(view, flags)             # <<<<<<<<<<<<<<
 * 
 *     def __releasebuffer__(self, Py_buffer *view):
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_buf->__pyx_vtab)->acquirebuffer(__pyx_v_buf, __pyx_v_view, __pyx_v_flags); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 113, __pyx_L1_error)

  /* "PETSc/Vec.pyx":111
 *     # buffer interface (PEP 3118)
 * 
 *     def __getbuffer__(self, Py_buffer *view, int flags):             # <<<<<<<<<<<<<<
 *         cdef _Vec_buffer buf = _Vec_buffer(self)
 *         buf.acquirebuffer(view, flags)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_view != NULL && __pyx_v_view->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_view->obj);
    __Pyx_DECREF(__pyx_v_view->obj); __pyx_v_view->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_view != NULL && __pyx_v_view->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_view->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":115
 *         buf.acquirebuffer(view, flags)
 * 
 *     def __releasebuffer__(self, Py_buffer *view):             # <<<<<<<<<<<<<<
 *         cdef _Vec_buffer buf = <_Vec_buffer>(view.obj)
 *         buf.releasebuffer(view)
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_8petsc4py_5PETSc_3Vec_35__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view); /*proto*/
static CYTHON_UNUSED void __pyx_pw_8petsc4py_5PETSc_3Vec_35__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_8petsc4py_5PETSc_3Vec_34__releasebuffer__(((struct PyPetscVecObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_view));

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

static void __pyx_pf_8petsc4py_5PETSc_3Vec_34__releasebuffer__(struct PyPetscVecObject *__pyx_v_self, Py_buffer *__pyx_v_view) {
  struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_buf = 0;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "PETSc/Vec.pyx":116
 * 
 *     def __releasebuffer__(self, Py_buffer *view):
 *         cdef _Vec_buffer buf = <_Vec_buffer>(view.obj)             # <<<<<<<<<<<<<<
 *         buf.releasebuffer(view)
 *         <void>self # unused
 */
  __pyx_t_1 = __pyx_v_view->obj;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":117
 *     def __releasebuffer__(self, Py_buffer *view):
 *         cdef _Vec_buffer buf = <_Vec_buffer>(view.obj)
 *         buf.releasebuffer(view)             # <<<<<<<<<<<<<<
 *         <void>self # unused
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_buf->__pyx_vtab)->releasebuffer(__pyx_v_buf, __pyx_v_view); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 117, __pyx_L1_error)

  /* "PETSc/Vec.pyx":118
 *         cdef _Vec_buffer buf = <_Vec_buffer>(view.obj)
 *         buf.releasebuffer(view)
 *         <void>self # unused             # <<<<<<<<<<<<<<
 * 
 *     # 'with' statement (PEP 343)
 */
  ((void)__pyx_v_self);

  /* "PETSc/Vec.pyx":115
 *         buf.acquirebuffer(view, flags)
 * 
 *     def __releasebuffer__(self, Py_buffer *view):             # <<<<<<<<<<<<<<
 *         cdef _Vec_buffer buf = <_Vec_buffer>(view.obj)
 *         buf.releasebuffer(view)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("petsc4py.PETSc.Vec.__releasebuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_RefNannyFinishContext();
}

/* "PETSc/Vec.pyx":122
 *     # 'with' statement (PEP 343)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         cdef _Vec_buffer buf = _Vec_buffer(self)
 *         self.set_attr('__buffer__', buf)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_37__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_36__enter__[] = "Vec.__enter__(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_37__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_36__enter__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_36__enter__(struct PyPetscVecObject *__pyx_v_self) {
  struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "PETSc/Vec.pyx":123
 * 
 *     def __enter__(self):
 *         cdef _Vec_buffer buf = _Vec_buffer(self)             # <<<<<<<<<<<<<<
 *         self.set_attr('__buffer__', buf)
 *         return buf.enter()
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc__Vec_buffer), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Vec.pyx":124
 *     def __enter__(self):
 *         cdef _Vec_buffer buf = _Vec_buffer(self)
 *         self.set_attr('__buffer__', buf)             # <<<<<<<<<<<<<<
 *         return buf.enter()
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Vec *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__buffer__"), ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/Vec.pyx":125
 *         cdef _Vec_buffer buf = _Vec_buffer(self)
 *         self.set_attr('__buffer__', buf)
 *         return buf.enter()             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *exc):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_buf->__pyx_vtab)->enter(__pyx_v_buf); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":122
 *     # 'with' statement (PEP 343)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         cdef _Vec_buffer buf = _Vec_buffer(self)
 *         self.set_attr('__buffer__', buf)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":127
 *         return buf.enter()
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         cdef _Vec_buffer buf = self.get_attr('__buffer__')
 *         self.set_attr('__buffer__', None)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_39__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_38__exit__[] = "Vec.__exit__(self, *exc)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_39__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_exc = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_38__exit__(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_exc);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_38__exit__(struct PyPetscVecObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "PETSc/Vec.pyx":128
 * 
 *     def __exit__(self, *exc):
 *         cdef _Vec_buffer buf = self.get_attr('__buffer__')             # <<<<<<<<<<<<<<
 *         self.set_attr('__buffer__', None)
 *         return buf.exit()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Vec *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__buffer__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc__Vec_buffer))))) __PYX_ERR(30, 128, __pyx_L1_error)
  __pyx_v_buf = ((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":129
 *     def __exit__(self, *exc):
 *         cdef _Vec_buffer buf = self.get_attr('__buffer__')
 *         self.set_attr('__buffer__', None)             # <<<<<<<<<<<<<<
 *         return buf.exit()
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Vec *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__buffer__"), Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":130
 *         cdef _Vec_buffer buf = self.get_attr('__buffer__')
 *         self.set_attr('__buffer__', None)
 *         return buf.exit()             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc__Vec_buffer *)__pyx_v_buf->__pyx_vtab)->exit(__pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":127
 *         return buf.enter()
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         cdef _Vec_buffer buf = self.get_attr('__buffer__')
 *         self.set_attr('__buffer__', None)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":134
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_41view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_40view[] = "Vec.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_41view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(30, 134, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 134, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(30, 134, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_40view(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_40view(struct PyPetscVecObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/Vec.pyx":135
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( VecView(self.vec, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/Vec.pyx":136
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( VecView(self.vec, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/Vec.pyx":137
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( VecView(self.vec, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecView(__pyx_v_self->vec, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 137, __pyx_L1_error)

  /* "PETSc/Vec.pyx":134
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":139
 *         CHKERR( VecView(self.vec, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecDestroy(&self.vec) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_43destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_42destroy[] = "Vec.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_43destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_42destroy(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_42destroy(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/Vec.pyx":140
 * 
 *     def destroy(self):
 *         CHKERR( VecDestroy(&self.vec) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecDestroy((&__pyx_v_self->vec))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 140, __pyx_L1_error)

  /* "PETSc/Vec.pyx":141
 *     def destroy(self):
 *         CHKERR( VecDestroy(&self.vec) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":139
 *         CHKERR( VecView(self.vec, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecDestroy(&self.vec) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":143
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscVec newvec = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_45create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_44create[] = "Vec.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_45create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(30, 143, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 143, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_44create(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_44create(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  Vec __pyx_v_newvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/Vec.pyx":144
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreate(ccomm, &newvec) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 144, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Vec.pyx":145
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscVec newvec = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( VecCreate(ccomm, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 */
  __pyx_v_newvec = NULL;

  /* "PETSc/Vec.pyx":146
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreate(ccomm, &newvec) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreate(__pyx_v_ccomm, (&__pyx_v_newvec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 146, __pyx_L1_error)

  /* "PETSc/Vec.pyx":147
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreate(ccomm, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vec = __pyx_v_newvec;

  /* "PETSc/Vec.pyx":148
 *         CHKERR( VecCreate(ccomm, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, vec_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":143
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscVec newvec = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":150
 *         return self
 * 
 *     def setType(self, vec_type):             # <<<<<<<<<<<<<<
 *         cdef PetscVecType cval = NULL
 *         vec_type = str2bytes(vec_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_47setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_46setType[] = "Vec.setType(self, vec_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_47setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vec_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec_type,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);
        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_vec_type)) != 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, "setType") < 0)) __PYX_ERR(30, 150, __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_vec_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 150, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_46setType(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vec_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_46setType(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vec_type) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_vec_type);

  /* "PETSc/Vec.pyx":151
 * 
 *     def setType(self, vec_type):
 *         cdef PetscVecType cval = NULL             # <<<<<<<<<<<<<<
 *         vec_type = str2bytes(vec_type, &cval)
 *         CHKERR( VecSetType(self.vec, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Vec.pyx":152
 *     def setType(self, vec_type):
 *         cdef PetscVecType cval = NULL
 *         vec_type = str2bytes(vec_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetType(self.vec, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_vec_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_vec_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":153
 *         cdef PetscVecType cval = NULL
 *         vec_type = str2bytes(vec_type, &cval)
 *         CHKERR( VecSetType(self.vec, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def setSizes(self, size, bsize=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetType(__pyx_v_self->vec, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 153, __pyx_L1_error)

  /* "PETSc/Vec.pyx":150
 *         return self
 * 
 *     def setType(self, vec_type):             # <<<<<<<<<<<<<<
 *         cdef PetscVecType cval = NULL
 *         vec_type = str2bytes(vec_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_vec_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":155
 *         CHKERR( VecSetType(self.vec, cval) )
 * 
 *     def setSizes(self, size, bsize=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_49setSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_48setSizes[] = "Vec.setSizes(self, size, bsize=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_49setSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setSizes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_bsize,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSizes") < 0)) __PYX_ERR(30, 155, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_size = values[0];
    __pyx_v_bsize = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setSizes", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 155, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_48setSizes(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_size, __pyx_v_bsize);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_48setSizes(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize) {
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_N;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setSizes", 0);

  /* "PETSc/Vec.pyx":156
 * 
 *     def setSizes(self, size, bsize=None):
 *         cdef PetscInt bs=0, n=0, N=0             # <<<<<<<<<<<<<<
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         CHKERR( VecSetSizes(self.vec, n, N) )
 */
  __pyx_v_bs = 0;
  __pyx_v_n = 0;
  __pyx_v_N = 0;

  /* "PETSc/Vec.pyx":157
 *     def setSizes(self, size, bsize=None):
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetSizes(self.vec, n, N) )
 *         if bs != PETSC_DECIDE:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Vec_Sizes(__pyx_v_size, __pyx_v_bsize, (&__pyx_v_bs), (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 157, __pyx_L1_error)

  /* "PETSc/Vec.pyx":158
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         CHKERR( VecSetSizes(self.vec, n, N) )             # <<<<<<<<<<<<<<
 *         if bs != PETSC_DECIDE:
 *             CHKERR( VecSetBlockSize(self.vec, bs) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetSizes(__pyx_v_self->vec, __pyx_v_n, __pyx_v_N)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 158, __pyx_L1_error)

  /* "PETSc/Vec.pyx":159
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         CHKERR( VecSetSizes(self.vec, n, N) )
 *         if bs != PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             CHKERR( VecSetBlockSize(self.vec, bs) )
 * 
 */
  __pyx_t_2 = ((__pyx_v_bs != PETSC_DECIDE) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Vec.pyx":160
 *         CHKERR( VecSetSizes(self.vec, n, N) )
 *         if bs != PETSC_DECIDE:
 *             CHKERR( VecSetBlockSize(self.vec, bs) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetBlockSize(__pyx_v_self->vec, __pyx_v_bs)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 160, __pyx_L1_error)

    /* "PETSc/Vec.pyx":159
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         CHKERR( VecSetSizes(self.vec, n, N) )
 *         if bs != PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             CHKERR( VecSetBlockSize(self.vec, bs) )
 * 
 */
  }

  /* "PETSc/Vec.pyx":155
 *         CHKERR( VecSetType(self.vec, cval) )
 * 
 *     def setSizes(self, size, bsize=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":164
 *     #
 * 
 *     def createSeq(self, size, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_SELF)
 *         cdef PetscInt bs=0, n=0, N=0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_51createSeq(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_50createSeq[] = "Vec.createSeq(self, size, bsize=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_51createSeq(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createSeq (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_bsize,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createSeq") < 0)) __PYX_ERR(30, 164, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_size = values[0];
    __pyx_v_bsize = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createSeq", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 164, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createSeq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_50createSeq(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_size, __pyx_v_bsize, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_50createSeq(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_N;
  Vec __pyx_v_newvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("createSeq", 0);

  /* "PETSc/Vec.pyx":165
 * 
 *     def createSeq(self, size, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_SELF)             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, PETSC_COMM_SELF); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 165, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Vec.pyx":166
 *     def createSeq(self, size, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_SELF)
 *         cdef PetscInt bs=0, n=0, N=0             # <<<<<<<<<<<<<<
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 */
  __pyx_v_bs = 0;
  __pyx_v_n = 0;
  __pyx_v_N = 0;

  /* "PETSc/Vec.pyx":167
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_SELF)
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)             # <<<<<<<<<<<<<<
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Vec_Sizes(__pyx_v_size, __pyx_v_bsize, (&__pyx_v_bs), (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 167, __pyx_L1_error)

  /* "PETSc/Vec.pyx":168
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)             # <<<<<<<<<<<<<<
 *         if bs == PETSC_DECIDE: bs = 1
 *         cdef PetscVec newvec = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Sys_Layout(__pyx_v_ccomm, __pyx_v_bs, (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 168, __pyx_L1_error)

  /* "PETSc/Vec.pyx":169
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1             # <<<<<<<<<<<<<<
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreate(ccomm,&newvec) )
 */
  __pyx_t_3 = ((__pyx_v_bs == PETSC_DECIDE) != 0);
  if (__pyx_t_3) {
    __pyx_v_bs = 1;
  }

  /* "PETSc/Vec.pyx":170
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1
 *         cdef PetscVec newvec = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( VecCreate(ccomm,&newvec) )
 *         CHKERR( VecSetSizes(newvec, n, N) )
 */
  __pyx_v_newvec = NULL;

  /* "PETSc/Vec.pyx":171
 *         if bs == PETSC_DECIDE: bs = 1
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreate(ccomm,&newvec) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetSizes(newvec, n, N) )
 *         CHKERR( VecSetBlockSize(newvec, bs) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreate(__pyx_v_ccomm, (&__pyx_v_newvec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 171, __pyx_L1_error)

  /* "PETSc/Vec.pyx":172
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreate(ccomm,&newvec) )
 *         CHKERR( VecSetSizes(newvec, n, N) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetBlockSize(newvec, bs) )
 *         CHKERR( VecSetType(newvec, VECSEQ) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetSizes(__pyx_v_newvec, __pyx_v_n, __pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 172, __pyx_L1_error)

  /* "PETSc/Vec.pyx":173
 *         CHKERR( VecCreate(ccomm,&newvec) )
 *         CHKERR( VecSetSizes(newvec, n, N) )
 *         CHKERR( VecSetBlockSize(newvec, bs) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetType(newvec, VECSEQ) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetBlockSize(__pyx_v_newvec, __pyx_v_bs)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 173, __pyx_L1_error)

  /* "PETSc/Vec.pyx":174
 *         CHKERR( VecSetSizes(newvec, n, N) )
 *         CHKERR( VecSetBlockSize(newvec, bs) )
 *         CHKERR( VecSetType(newvec, VECSEQ) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetType(__pyx_v_newvec, VECSEQ)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 174, __pyx_L1_error)

  /* "PETSc/Vec.pyx":175
 *         CHKERR( VecSetBlockSize(newvec, bs) )
 *         CHKERR( VecSetType(newvec, VECSEQ) )
 *         PetscCLEAR(self.obj); self.vec = newvec             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vec = __pyx_v_newvec;

  /* "PETSc/Vec.pyx":176
 *         CHKERR( VecSetType(newvec, VECSEQ) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createMPI(self, size, bsize=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":164
 *     #
 * 
 *     def createSeq(self, size, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_SELF)
 *         cdef PetscInt bs=0, n=0, N=0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createSeq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":178
 *         return self
 * 
 *     def createMPI(self, size, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_53createMPI(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_52createMPI[] = "Vec.createMPI(self, size, bsize=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_53createMPI(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createMPI (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_bsize,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createMPI") < 0)) __PYX_ERR(30, 178, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_size = values[0];
    __pyx_v_bsize = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createMPI", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 178, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createMPI", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_52createMPI(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_size, __pyx_v_bsize, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_52createMPI(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_N;
  Vec __pyx_v_newvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("createMPI", 0);

  /* "PETSc/Vec.pyx":179
 * 
 *     def createMPI(self, size, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 179, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Vec.pyx":180
 *     def createMPI(self, size, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0             # <<<<<<<<<<<<<<
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 */
  __pyx_v_bs = 0;
  __pyx_v_n = 0;
  __pyx_v_N = 0;

  /* "PETSc/Vec.pyx":181
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)             # <<<<<<<<<<<<<<
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Vec_Sizes(__pyx_v_size, __pyx_v_bsize, (&__pyx_v_bs), (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 181, __pyx_L1_error)

  /* "PETSc/Vec.pyx":182
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)             # <<<<<<<<<<<<<<
 *         if bs == PETSC_DECIDE: bs = 1
 *         cdef PetscVec newvec = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Sys_Layout(__pyx_v_ccomm, __pyx_v_bs, (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 182, __pyx_L1_error)

  /* "PETSc/Vec.pyx":183
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1             # <<<<<<<<<<<<<<
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreate(ccomm, &newvec) )
 */
  __pyx_t_3 = ((__pyx_v_bs == PETSC_DECIDE) != 0);
  if (__pyx_t_3) {
    __pyx_v_bs = 1;
  }

  /* "PETSc/Vec.pyx":184
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1
 *         cdef PetscVec newvec = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( VecCreate(ccomm, &newvec) )
 *         CHKERR( VecSetSizes(newvec, n, N) )
 */
  __pyx_v_newvec = NULL;

  /* "PETSc/Vec.pyx":185
 *         if bs == PETSC_DECIDE: bs = 1
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreate(ccomm, &newvec) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetSizes(newvec, n, N) )
 *         CHKERR( VecSetBlockSize(newvec, bs) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreate(__pyx_v_ccomm, (&__pyx_v_newvec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 185, __pyx_L1_error)

  /* "PETSc/Vec.pyx":186
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreate(ccomm, &newvec) )
 *         CHKERR( VecSetSizes(newvec, n, N) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetBlockSize(newvec, bs) )
 *         CHKERR( VecSetType(newvec, VECMPI) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetSizes(__pyx_v_newvec, __pyx_v_n, __pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 186, __pyx_L1_error)

  /* "PETSc/Vec.pyx":187
 *         CHKERR( VecCreate(ccomm, &newvec) )
 *         CHKERR( VecSetSizes(newvec, n, N) )
 *         CHKERR( VecSetBlockSize(newvec, bs) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetType(newvec, VECMPI) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetBlockSize(__pyx_v_newvec, __pyx_v_bs)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 187, __pyx_L1_error)

  /* "PETSc/Vec.pyx":188
 *         CHKERR( VecSetSizes(newvec, n, N) )
 *         CHKERR( VecSetBlockSize(newvec, bs) )
 *         CHKERR( VecSetType(newvec, VECMPI) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetType(__pyx_v_newvec, VECMPI)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 188, __pyx_L1_error)

  /* "PETSc/Vec.pyx":189
 *         CHKERR( VecSetBlockSize(newvec, bs) )
 *         CHKERR( VecSetType(newvec, VECMPI) )
 *         PetscCLEAR(self.obj); self.vec = newvec             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vec = __pyx_v_newvec;

  /* "PETSc/Vec.pyx":190
 *         CHKERR( VecSetType(newvec, VECMPI) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createWithArray(self, array, size=None, bsize=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":178
 *         return self
 * 
 *     def createMPI(self, size, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createMPI", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":192
 *         return self
 * 
 *     def createWithArray(self, array, size=None, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt na=0
 *         cdef PetscScalar *sa=NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_55createWithArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_54createWithArray[] = "Vec.createWithArray(self, array, size=None, bsize=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_55createWithArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_array = 0;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createWithArray (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_array,&__pyx_n_s_size,&__pyx_n_s_bsize,&__pyx_n_s_comm,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_array)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createWithArray") < 0)) __PYX_ERR(30, 192, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_array = values[0];
    __pyx_v_size = values[1];
    __pyx_v_bsize = values[2];
    __pyx_v_comm = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createWithArray", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 192, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createWithArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_54createWithArray(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_array, __pyx_v_size, __pyx_v_bsize, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_54createWithArray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_array, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm) {
  PetscInt __pyx_v_na;
  PetscScalar *__pyx_v_sa;
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_N;
  Vec __pyx_v_newvec;
  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;
  MPI_Comm __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("createWithArray", 0);
  __Pyx_INCREF(__pyx_v_array);
  __Pyx_INCREF(__pyx_v_size);

  /* "PETSc/Vec.pyx":193
 * 
 *     def createWithArray(self, array, size=None, bsize=None, comm=None):
 *         cdef PetscInt na=0             # <<<<<<<<<<<<<<
 *         cdef PetscScalar *sa=NULL
 *         array = iarray_s(array, &na, &sa)
 */
  __pyx_v_na = 0;

  /* "PETSc/Vec.pyx":194
 *     def createWithArray(self, array, size=None, bsize=None, comm=None):
 *         cdef PetscInt na=0
 *         cdef PetscScalar *sa=NULL             # <<<<<<<<<<<<<<
 *         array = iarray_s(array, &na, &sa)
 *         if size is None: size = (toInt(na), toInt(PETSC_DECIDE))
 */
  __pyx_v_sa = NULL;

  /* "PETSc/Vec.pyx":195
 *         cdef PetscInt na=0
 *         cdef PetscScalar *sa=NULL
 *         array = iarray_s(array, &na, &sa)             # <<<<<<<<<<<<<<
 *         if size is None: size = (toInt(na), toInt(PETSC_DECIDE))
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_s(__pyx_v_array, (&__pyx_v_na), (&__pyx_v_sa))); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_array, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":196
 *         cdef PetscScalar *sa=NULL
 *         array = iarray_s(array, &na, &sa)
 *         if size is None: size = (toInt(na), toInt(PETSC_DECIDE))             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0
 */
  __pyx_t_2 = (__pyx_v_size == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_na); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(PETSC_DECIDE); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 196, __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_t_1 = 0;
    __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_size, __pyx_t_5);
    __pyx_t_5 = 0;
  }

  /* "PETSc/Vec.pyx":197
 *         array = iarray_s(array, &na, &sa)
 *         if size is None: size = (toInt(na), toInt(PETSC_DECIDE))
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 197, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_6;

  /* "PETSc/Vec.pyx":198
 *         if size is None: size = (toInt(na), toInt(PETSC_DECIDE))
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0             # <<<<<<<<<<<<<<
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 */
  __pyx_v_bs = 0;
  __pyx_v_n = 0;
  __pyx_v_N = 0;

  /* "PETSc/Vec.pyx":199
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)             # <<<<<<<<<<<<<<
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_Vec_Sizes(__pyx_v_size, __pyx_v_bsize, (&__pyx_v_bs), (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(30, 199, __pyx_L1_error)

  /* "PETSc/Vec.pyx":200
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)             # <<<<<<<<<<<<<<
 *         if bs == PETSC_DECIDE: bs = 1
 *         if na < n:  raise ValueError(
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_Sys_Layout(__pyx_v_ccomm, __pyx_v_bs, (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(30, 200, __pyx_L1_error)

  /* "PETSc/Vec.pyx":201
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1             # <<<<<<<<<<<<<<
 *         if na < n:  raise ValueError(
 *             "array size %d and vector local size %d block size %d" %
 */
  __pyx_t_3 = ((__pyx_v_bs == PETSC_DECIDE) != 0);
  if (__pyx_t_3) {
    __pyx_v_bs = 1;
  }

  /* "PETSc/Vec.pyx":202
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1
 *         if na < n:  raise ValueError(             # <<<<<<<<<<<<<<
 *             "array size %d and vector local size %d block size %d" %
 *             (toInt(na), toInt(n), toInt(bs)))
 */
  __pyx_t_3 = ((__pyx_v_na < __pyx_v_n) != 0);
  if (__pyx_t_3) {

    /* "PETSc/Vec.pyx":204
 *         if na < n:  raise ValueError(
 *             "array size %d and vector local size %d block size %d" %
 *             (toInt(na), toInt(n), toInt(bs)))             # <<<<<<<<<<<<<<
 *         cdef PetscVec newvec = NULL
 *         if comm_size(ccomm) == 1:
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_na); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_bs); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 204, __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_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;

    /* "PETSc/Vec.pyx":203
 *         if bs == PETSC_DECIDE: bs = 1
 *         if na < n:  raise ValueError(
 *             "array size %d and vector local size %d block size %d" %             # <<<<<<<<<<<<<<
 *             (toInt(na), toInt(n), toInt(bs)))
 *         cdef PetscVec newvec = NULL
 */
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_array_size_d_and_vector_local_si, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "PETSc/Vec.pyx":202
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if bs == PETSC_DECIDE: bs = 1
 *         if na < n:  raise ValueError(             # <<<<<<<<<<<<<<
 *             "array size %d and vector local size %d block size %d" %
 *             (toInt(na), toInt(n), toInt(bs)))
 */
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 202, __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_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(30, 202, __pyx_L1_error)
  }

  /* "PETSc/Vec.pyx":205
 *             "array size %d and vector local size %d block size %d" %
 *             (toInt(na), toInt(n), toInt(bs)))
 *         cdef PetscVec newvec = NULL             # <<<<<<<<<<<<<<
 *         if comm_size(ccomm) == 1:
 *             CHKERR( VecCreateSeqWithArray(ccomm,bs,N,sa,&newvec) )
 */
  __pyx_v_newvec = NULL;

  /* "PETSc/Vec.pyx":206
 *             (toInt(na), toInt(n), toInt(bs)))
 *         cdef PetscVec newvec = NULL
 *         if comm_size(ccomm) == 1:             # <<<<<<<<<<<<<<
 *             CHKERR( VecCreateSeqWithArray(ccomm,bs,N,sa,&newvec) )
 *         else:
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_comm_size(__pyx_v_ccomm); if (unlikely(__pyx_t_7 == -1 && PyErr_Occurred())) __PYX_ERR(30, 206, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_7 == 1) != 0);
  if (__pyx_t_3) {

    /* "PETSc/Vec.pyx":207
 *         cdef PetscVec newvec = NULL
 *         if comm_size(ccomm) == 1:
 *             CHKERR( VecCreateSeqWithArray(ccomm,bs,N,sa,&newvec) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( VecCreateMPIWithArray(ccomm,bs,n,N,sa,&newvec) )
 */
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreateSeqWithArray(__pyx_v_ccomm, __pyx_v_bs, __pyx_v_N, __pyx_v_sa, (&__pyx_v_newvec))); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(30, 207, __pyx_L1_error)

    /* "PETSc/Vec.pyx":206
 *             (toInt(na), toInt(n), toInt(bs)))
 *         cdef PetscVec newvec = NULL
 *         if comm_size(ccomm) == 1:             # <<<<<<<<<<<<<<
 *             CHKERR( VecCreateSeqWithArray(ccomm,bs,N,sa,&newvec) )
 *         else:
 */
    goto __pyx_L6;
  }

  /* "PETSc/Vec.pyx":209
 *             CHKERR( VecCreateSeqWithArray(ccomm,bs,N,sa,&newvec) )
 *         else:
 *             CHKERR( VecCreateMPIWithArray(ccomm,bs,n,N,sa,&newvec) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         self.set_attr('__array__', array)
 */
  /*else*/ {
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreateMPIWithArray(__pyx_v_ccomm, __pyx_v_bs, __pyx_v_n, __pyx_v_N, __pyx_v_sa, (&__pyx_v_newvec))); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(30, 209, __pyx_L1_error)
  }
  __pyx_L6:;

  /* "PETSc/Vec.pyx":210
 *         else:
 *             CHKERR( VecCreateMPIWithArray(ccomm,bs,n,N,sa,&newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec             # <<<<<<<<<<<<<<
 *         self.set_attr('__array__', array)
 *         return self
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vec = __pyx_v_newvec;

  /* "PETSc/Vec.pyx":211
 *             CHKERR( VecCreateMPIWithArray(ccomm,bs,n,N,sa,&newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         self.set_attr('__array__', array)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Vec *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__array__"), __pyx_v_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":212
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         self.set_attr('__array__', array)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createGhost(self, ghosts, size, bsize=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":192
 *         return self
 * 
 *     def createWithArray(self, array, size=None, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt na=0
 *         cdef PetscScalar *sa=NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createWithArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_XDECREF(__pyx_v_size);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":214
 *         return self
 * 
 *     def createGhost(self, ghosts, size, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt ng=0, *ig=NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_57createGhost(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_56createGhost[] = "Vec.createGhost(self, ghosts, size, bsize=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_57createGhost(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ghosts = 0;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createGhost (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ghosts,&__pyx_n_s_size,&__pyx_n_s_bsize,&__pyx_n_s_comm,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_ghosts)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createGhost", 0, 2, 4, 1); __PYX_ERR(30, 214, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createGhost") < 0)) __PYX_ERR(30, 214, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_ghosts = values[0];
    __pyx_v_size = values[1];
    __pyx_v_bsize = values[2];
    __pyx_v_comm = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createGhost", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 214, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createGhost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_56createGhost(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_ghosts, __pyx_v_size, __pyx_v_bsize, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_56createGhost(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_ghosts, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_ng;
  PetscInt *__pyx_v_ig;
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_N;
  Vec __pyx_v_newvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createGhost", 0);
  __Pyx_INCREF(__pyx_v_ghosts);

  /* "PETSc/Vec.pyx":215
 * 
 *     def createGhost(self, ghosts, size, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscInt ng=0, *ig=NULL
 *         ghosts = iarray_i(ghosts, &ng, &ig)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 215, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Vec.pyx":216
 *     def createGhost(self, ghosts, size, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt ng=0, *ig=NULL             # <<<<<<<<<<<<<<
 *         ghosts = iarray_i(ghosts, &ng, &ig)
 *         cdef PetscInt bs=0, n=0, N=0
 */
  __pyx_v_ng = 0;
  __pyx_v_ig = NULL;

  /* "PETSc/Vec.pyx":217
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt ng=0, *ig=NULL
 *         ghosts = iarray_i(ghosts, &ng, &ig)             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_ghosts, (&__pyx_v_ng), (&__pyx_v_ig))); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_ghosts, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Vec.pyx":218
 *         cdef PetscInt ng=0, *ig=NULL
 *         ghosts = iarray_i(ghosts, &ng, &ig)
 *         cdef PetscInt bs=0, n=0, N=0             # <<<<<<<<<<<<<<
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 */
  __pyx_v_bs = 0;
  __pyx_v_n = 0;
  __pyx_v_N = 0;

  /* "PETSc/Vec.pyx":219
 *         ghosts = iarray_i(ghosts, &ng, &ig)
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)             # <<<<<<<<<<<<<<
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         cdef PetscVec newvec = NULL
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_Vec_Sizes(__pyx_v_size, __pyx_v_bsize, (&__pyx_v_bs), (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 219, __pyx_L1_error)

  /* "PETSc/Vec.pyx":220
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)             # <<<<<<<<<<<<<<
 *         cdef PetscVec newvec = NULL
 *         if bs == PETSC_DECIDE:
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_Sys_Layout(__pyx_v_ccomm, __pyx_v_bs, (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 220, __pyx_L1_error)

  /* "PETSc/Vec.pyx":221
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         cdef PetscVec newvec = NULL             # <<<<<<<<<<<<<<
 *         if bs == PETSC_DECIDE:
 *             CHKERR( VecCreateGhost(
 */
  __pyx_v_newvec = NULL;

  /* "PETSc/Vec.pyx":222
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         cdef PetscVec newvec = NULL
 *         if bs == PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             CHKERR( VecCreateGhost(
 *                     ccomm, n, N, ng, ig, &newvec) )
 */
  __pyx_t_4 = ((__pyx_v_bs == PETSC_DECIDE) != 0);
  if (__pyx_t_4) {

    /* "PETSc/Vec.pyx":223
 *         cdef PetscVec newvec = NULL
 *         if bs == PETSC_DECIDE:
 *             CHKERR( VecCreateGhost(             # <<<<<<<<<<<<<<
 *                     ccomm, n, N, ng, ig, &newvec) )
 *         else:
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreateGhost(__pyx_v_ccomm, __pyx_v_n, __pyx_v_N, __pyx_v_ng, __pyx_v_ig, (&__pyx_v_newvec))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 223, __pyx_L1_error)

    /* "PETSc/Vec.pyx":222
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         cdef PetscVec newvec = NULL
 *         if bs == PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             CHKERR( VecCreateGhost(
 *                     ccomm, n, N, ng, ig, &newvec) )
 */
    goto __pyx_L3;
  }

  /* "PETSc/Vec.pyx":226
 *                     ccomm, n, N, ng, ig, &newvec) )
 *         else:
 *             CHKERR( VecCreateGhostBlock(             # <<<<<<<<<<<<<<
 *                     ccomm, bs, n, N, ng, ig, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 */
  /*else*/ {

    /* "PETSc/Vec.pyx":227
 *         else:
 *             CHKERR( VecCreateGhostBlock(
 *                     ccomm, bs, n, N, ng, ig, &newvec) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         return self
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreateGhostBlock(__pyx_v_ccomm, __pyx_v_bs, __pyx_v_n, __pyx_v_N, __pyx_v_ng, __pyx_v_ig, (&__pyx_v_newvec))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 226, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/Vec.pyx":228
 *             CHKERR( VecCreateGhostBlock(
 *                     ccomm, bs, n, N, ng, ig, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vec = __pyx_v_newvec;

  /* "PETSc/Vec.pyx":229
 *                     ccomm, bs, n, N, ng, ig, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createGhostWithArray(self, ghosts, array,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":214
 *         return self
 * 
 *     def createGhost(self, ghosts, size, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt ng=0, *ig=NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createGhost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ghosts);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":231
 *         return self
 * 
 *     def createGhostWithArray(self, ghosts, array,             # <<<<<<<<<<<<<<
 *                              size=None, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_59createGhostWithArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_58createGhostWithArray[] = "Vec.createGhostWithArray(self, ghosts, array, size=None, bsize=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_59createGhostWithArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ghosts = 0;
  PyObject *__pyx_v_array = 0;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createGhostWithArray (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ghosts,&__pyx_n_s_array,&__pyx_n_s_size,&__pyx_n_s_bsize,&__pyx_n_s_comm,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "PETSc/Vec.pyx":232
 * 
 *     def createGhostWithArray(self, ghosts, array,
 *                              size=None, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt ng=0, *ig=NULL
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_ghosts)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_array)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createGhostWithArray", 0, 2, 5, 1); __PYX_ERR(30, 231, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createGhostWithArray") < 0)) __PYX_ERR(30, 231, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_ghosts = values[0];
    __pyx_v_array = values[1];
    __pyx_v_size = values[2];
    __pyx_v_bsize = values[3];
    __pyx_v_comm = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createGhostWithArray", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 231, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createGhostWithArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_58createGhostWithArray(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_ghosts, __pyx_v_array, __pyx_v_size, __pyx_v_bsize, __pyx_v_comm);

  /* "PETSc/Vec.pyx":231
 *         return self
 * 
 *     def createGhostWithArray(self, ghosts, array,             # <<<<<<<<<<<<<<
 *                              size=None, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_58createGhostWithArray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_ghosts, PyObject *__pyx_v_array, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_ng;
  PetscInt *__pyx_v_ig;
  PetscInt __pyx_v_na;
  PetscScalar *__pyx_v_sa;
  PetscInt __pyx_v_b;
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_N;
  Vec __pyx_v_newvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscInt __pyx_t_3;
  int __pyx_t_4;
  PetscInt __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("createGhostWithArray", 0);
  __Pyx_INCREF(__pyx_v_ghosts);
  __Pyx_INCREF(__pyx_v_array);
  __Pyx_INCREF(__pyx_v_size);

  /* "PETSc/Vec.pyx":233
 *     def createGhostWithArray(self, ghosts, array,
 *                              size=None, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscInt ng=0, *ig=NULL
 *         ghosts = iarray_i(ghosts, &ng, &ig)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 233, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Vec.pyx":234
 *                              size=None, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt ng=0, *ig=NULL             # <<<<<<<<<<<<<<
 *         ghosts = iarray_i(ghosts, &ng, &ig)
 *         cdef PetscInt na=0
 */
  __pyx_v_ng = 0;
  __pyx_v_ig = NULL;

  /* "PETSc/Vec.pyx":235
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt ng=0, *ig=NULL
 *         ghosts = iarray_i(ghosts, &ng, &ig)             # <<<<<<<<<<<<<<
 *         cdef PetscInt na=0
 *         cdef PetscScalar *sa=NULL
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_ghosts, (&__pyx_v_ng), (&__pyx_v_ig))); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_ghosts, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Vec.pyx":236
 *         cdef PetscInt ng=0, *ig=NULL
 *         ghosts = iarray_i(ghosts, &ng, &ig)
 *         cdef PetscInt na=0             # <<<<<<<<<<<<<<
 *         cdef PetscScalar *sa=NULL
 *         array = oarray_s(array, &na, &sa)
 */
  __pyx_v_na = 0;

  /* "PETSc/Vec.pyx":237
 *         ghosts = iarray_i(ghosts, &ng, &ig)
 *         cdef PetscInt na=0
 *         cdef PetscScalar *sa=NULL             # <<<<<<<<<<<<<<
 *         array = oarray_s(array, &na, &sa)
 *         cdef PetscInt b = 1 if bsize is None else asInt(bsize)
 */
  __pyx_v_sa = NULL;

  /* "PETSc/Vec.pyx":238
 *         cdef PetscInt na=0
 *         cdef PetscScalar *sa=NULL
 *         array = oarray_s(array, &na, &sa)             # <<<<<<<<<<<<<<
 *         cdef PetscInt b = 1 if bsize is None else asInt(bsize)
 *         if size is None: size = (toInt(na-ng*b), toInt(PETSC_DECIDE))
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_s(__pyx_v_array, (&__pyx_v_na), (&__pyx_v_sa))); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_array, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Vec.pyx":239
 *         cdef PetscScalar *sa=NULL
 *         array = oarray_s(array, &na, &sa)
 *         cdef PetscInt b = 1 if bsize is None else asInt(bsize)             # <<<<<<<<<<<<<<
 *         if size is None: size = (toInt(na-ng*b), toInt(PETSC_DECIDE))
 *         cdef PetscInt bs=0, n=0, N=0
 */
  __pyx_t_4 = (__pyx_v_bsize == Py_None);
  if ((__pyx_t_4 != 0)) {
    __pyx_t_3 = 1;
  } else {
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_bsize); if (unlikely(__pyx_t_5 == -1L && PyErr_Occurred())) __PYX_ERR(30, 239, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_5;
  }
  __pyx_v_b = __pyx_t_3;

  /* "PETSc/Vec.pyx":240
 *         array = oarray_s(array, &na, &sa)
 *         cdef PetscInt b = 1 if bsize is None else asInt(bsize)
 *         if size is None: size = (toInt(na-ng*b), toInt(PETSC_DECIDE))             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 */
  __pyx_t_4 = (__pyx_v_size == Py_None);
  __pyx_t_6 = (__pyx_t_4 != 0);
  if (__pyx_t_6) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_na - (__pyx_v_ng * __pyx_v_b))); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toInt(PETSC_DECIDE); if (unlikely(!__pyx_t_7)) __PYX_ERR(30, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 240, __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_7);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
    __pyx_t_2 = 0;
    __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_size, __pyx_t_8);
    __pyx_t_8 = 0;
  }

  /* "PETSc/Vec.pyx":241
 *         cdef PetscInt b = 1 if bsize is None else asInt(bsize)
 *         if size is None: size = (toInt(na-ng*b), toInt(PETSC_DECIDE))
 *         cdef PetscInt bs=0, n=0, N=0             # <<<<<<<<<<<<<<
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 */
  __pyx_v_bs = 0;
  __pyx_v_n = 0;
  __pyx_v_N = 0;

  /* "PETSc/Vec.pyx":242
 *         if size is None: size = (toInt(na-ng*b), toInt(PETSC_DECIDE))
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)             # <<<<<<<<<<<<<<
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if na < (n+ng*b): raise ValueError(
 */
  __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_Vec_Sizes(__pyx_v_size, __pyx_v_bsize, (&__pyx_v_bs), (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(30, 242, __pyx_L1_error)

  /* "PETSc/Vec.pyx":243
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)             # <<<<<<<<<<<<<<
 *         if na < (n+ng*b): raise ValueError(
 *             "ghosts size %d, array size %d, and "
 */
  __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_Sys_Layout(__pyx_v_ccomm, __pyx_v_bs, (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(30, 243, __pyx_L1_error)

  /* "PETSc/Vec.pyx":244
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if na < (n+ng*b): raise ValueError(             # <<<<<<<<<<<<<<
 *             "ghosts size %d, array size %d, and "
 *             "vector local size %d block size %d" %
 */
  __pyx_t_6 = ((__pyx_v_na < (__pyx_v_n + (__pyx_v_ng * __pyx_v_b))) != 0);
  if (__pyx_t_6) {

    /* "PETSc/Vec.pyx":247
 *             "ghosts size %d, array size %d, and "
 *             "vector local size %d block size %d" %
 *             (toInt(ng), toInt(na), toInt(n), toInt(b)))             # <<<<<<<<<<<<<<
 *         cdef PetscVec newvec = NULL
 *         if bs == PETSC_DECIDE:
 */
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ng); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_na); if (unlikely(!__pyx_t_7)) __PYX_ERR(30, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_b); if (unlikely(!__pyx_t_10)) __PYX_ERR(30, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(30, 247, __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_7);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_10);
    __pyx_t_8 = 0;
    __pyx_t_7 = 0;
    __pyx_t_2 = 0;
    __pyx_t_10 = 0;

    /* "PETSc/Vec.pyx":246
 *         if na < (n+ng*b): raise ValueError(
 *             "ghosts size %d, array size %d, and "
 *             "vector local size %d block size %d" %             # <<<<<<<<<<<<<<
 *             (toInt(ng), toInt(na), toInt(n), toInt(b)))
 *         cdef PetscVec newvec = NULL
 */
    __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_ghosts_size_d_array_size_d_and_v, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(30, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "PETSc/Vec.pyx":244
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         if na < (n+ng*b): raise ValueError(             # <<<<<<<<<<<<<<
 *             "ghosts size %d, array size %d, and "
 *             "vector local size %d block size %d" %
 */
    __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(30, 244, __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 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(30, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_Raise(__pyx_t_10, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(30, 244, __pyx_L1_error)
  }

  /* "PETSc/Vec.pyx":248
 *             "vector local size %d block size %d" %
 *             (toInt(ng), toInt(na), toInt(n), toInt(b)))
 *         cdef PetscVec newvec = NULL             # <<<<<<<<<<<<<<
 *         if bs == PETSC_DECIDE:
 *             CHKERR( VecCreateGhostWithArray(
 */
  __pyx_v_newvec = NULL;

  /* "PETSc/Vec.pyx":249
 *             (toInt(ng), toInt(na), toInt(n), toInt(b)))
 *         cdef PetscVec newvec = NULL
 *         if bs == PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             CHKERR( VecCreateGhostWithArray(
 *                     ccomm, n, N, ng, ig, sa, &newvec) )
 */
  __pyx_t_6 = ((__pyx_v_bs == PETSC_DECIDE) != 0);
  if (__pyx_t_6) {

    /* "PETSc/Vec.pyx":250
 *         cdef PetscVec newvec = NULL
 *         if bs == PETSC_DECIDE:
 *             CHKERR( VecCreateGhostWithArray(             # <<<<<<<<<<<<<<
 *                     ccomm, n, N, ng, ig, sa, &newvec) )
 *         else:
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreateGhostWithArray(__pyx_v_ccomm, __pyx_v_n, __pyx_v_N, __pyx_v_ng, __pyx_v_ig, __pyx_v_sa, (&__pyx_v_newvec))); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(30, 250, __pyx_L1_error)

    /* "PETSc/Vec.pyx":249
 *             (toInt(ng), toInt(na), toInt(n), toInt(b)))
 *         cdef PetscVec newvec = NULL
 *         if bs == PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             CHKERR( VecCreateGhostWithArray(
 *                     ccomm, n, N, ng, ig, sa, &newvec) )
 */
    goto __pyx_L5;
  }

  /* "PETSc/Vec.pyx":253
 *                     ccomm, n, N, ng, ig, sa, &newvec) )
 *         else:
 *             CHKERR( VecCreateGhostBlockWithArray(             # <<<<<<<<<<<<<<
 *                     ccomm, bs, n, N, ng, ig, sa, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 */
  /*else*/ {

    /* "PETSc/Vec.pyx":254
 *         else:
 *             CHKERR( VecCreateGhostBlockWithArray(
 *                     ccomm, bs, n, N, ng, ig, sa, &newvec) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         self.set_attr('__array__', array)
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreateGhostBlockWithArray(__pyx_v_ccomm, __pyx_v_bs, __pyx_v_n, __pyx_v_N, __pyx_v_ng, __pyx_v_ig, __pyx_v_sa, (&__pyx_v_newvec))); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(30, 253, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "PETSc/Vec.pyx":255
 *             CHKERR( VecCreateGhostBlockWithArray(
 *                     ccomm, bs, n, N, ng, ig, sa, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec             # <<<<<<<<<<<<<<
 *         self.set_attr('__array__', array)
 *         return self
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vec = __pyx_v_newvec;

  /* "PETSc/Vec.pyx":256
 *                     ccomm, bs, n, N, ng, ig, sa, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         self.set_attr('__array__', array)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_10 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Vec *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__array__"), __pyx_v_array); if (unlikely(!__pyx_t_10)) __PYX_ERR(30, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "PETSc/Vec.pyx":257
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         self.set_attr('__array__', array)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createShared(self, size, bsize=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":231
 *         return self
 * 
 *     def createGhostWithArray(self, ghosts, array,             # <<<<<<<<<<<<<<
 *                              size=None, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createGhostWithArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ghosts);
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_XDECREF(__pyx_v_size);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":259
 *         return self
 * 
 *     def createShared(self, size, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_61createShared(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_60createShared[] = "Vec.createShared(self, size, bsize=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_61createShared(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createShared (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_bsize,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createShared") < 0)) __PYX_ERR(30, 259, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_size = values[0];
    __pyx_v_bsize = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createShared", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 259, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createShared", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_60createShared(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_size, __pyx_v_bsize, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_60createShared(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_N;
  Vec __pyx_v_newvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("createShared", 0);

  /* "PETSc/Vec.pyx":260
 * 
 *     def createShared(self, size, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 260, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Vec.pyx":261
 *     def createShared(self, size, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0             # <<<<<<<<<<<<<<
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 */
  __pyx_v_bs = 0;
  __pyx_v_n = 0;
  __pyx_v_N = 0;

  /* "PETSc/Vec.pyx":262
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)             # <<<<<<<<<<<<<<
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         cdef PetscVec newvec = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Vec_Sizes(__pyx_v_size, __pyx_v_bsize, (&__pyx_v_bs), (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 262, __pyx_L1_error)

  /* "PETSc/Vec.pyx":263
 *         cdef PetscInt bs=0, n=0, N=0
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)             # <<<<<<<<<<<<<<
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreateShared(ccomm, n, N, &newvec) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Sys_Layout(__pyx_v_ccomm, __pyx_v_bs, (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 263, __pyx_L1_error)

  /* "PETSc/Vec.pyx":264
 *         Vec_Sizes(size, bsize, &bs, &n, &N)
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         cdef PetscVec newvec = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( VecCreateShared(ccomm, n, N, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 */
  __pyx_v_newvec = NULL;

  /* "PETSc/Vec.pyx":265
 *         Sys_Layout(ccomm, bs, &n, &N)
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreateShared(ccomm, n, N, &newvec) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         if bs != PETSC_DECIDE:
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreateShared(__pyx_v_ccomm, __pyx_v_n, __pyx_v_N, (&__pyx_v_newvec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 265, __pyx_L1_error)

  /* "PETSc/Vec.pyx":266
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreateShared(ccomm, n, N, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec             # <<<<<<<<<<<<<<
 *         if bs != PETSC_DECIDE:
 *             CHKERR( VecSetBlockSize(self.vec, bs) )
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vec = __pyx_v_newvec;

  /* "PETSc/Vec.pyx":267
 *         CHKERR( VecCreateShared(ccomm, n, N, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         if bs != PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             CHKERR( VecSetBlockSize(self.vec, bs) )
 *         return self
 */
  __pyx_t_3 = ((__pyx_v_bs != PETSC_DECIDE) != 0);
  if (__pyx_t_3) {

    /* "PETSc/Vec.pyx":268
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         if bs != PETSC_DECIDE:
 *             CHKERR( VecSetBlockSize(self.vec, bs) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetBlockSize(__pyx_v_self->vec, __pyx_v_bs)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 268, __pyx_L1_error)

    /* "PETSc/Vec.pyx":267
 *         CHKERR( VecCreateShared(ccomm, n, N, &newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         if bs != PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             CHKERR( VecSetBlockSize(self.vec, bs) )
 *         return self
 */
  }

  /* "PETSc/Vec.pyx":269
 *         if bs != PETSC_DECIDE:
 *             CHKERR( VecSetBlockSize(self.vec, bs) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createNest(self, vecs, isets=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":259
 *         return self
 * 
 *     def createShared(self, size, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createShared", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":271
 *         return self
 * 
 *     def createNest(self, vecs, isets=None, comm=None):             # <<<<<<<<<<<<<<
 *         vecs = list(vecs)
 *         if isets:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_63createNest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_62createNest[] = "Vec.createNest(self, vecs, isets=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_63createNest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vecs = 0;
  PyObject *__pyx_v_isets = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createNest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vecs,&__pyx_n_s_isets,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vecs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_isets);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createNest") < 0)) __PYX_ERR(30, 271, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_vecs = values[0];
    __pyx_v_isets = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createNest", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 271, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createNest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_62createNest(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vecs, __pyx_v_isets, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_62createNest(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_isets, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_m;
  PetscInt __pyx_v_n;
  Vec *__pyx_v_cvecs;
  IS *__pyx_v_cisets;
  CYTHON_UNUSED PyObject *__pyx_v_tmp1 = 0;
  CYTHON_UNUSED PyObject *__pyx_v_tmp2 = 0;
  Vec __pyx_v_newvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  MPI_Comm __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Vec __pyx_t_7;
  int __pyx_t_8;
  IS __pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("createNest", 0);
  __Pyx_INCREF(__pyx_v_vecs);
  __Pyx_INCREF(__pyx_v_isets);

  /* "PETSc/Vec.pyx":272
 * 
 *     def createNest(self, vecs, isets=None, comm=None):
 *         vecs = list(vecs)             # <<<<<<<<<<<<<<
 *         if isets:
 *             isets = list(isets)
 */
  __pyx_t_1 = PySequence_List(__pyx_v_vecs); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_vecs, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":273
 *     def createNest(self, vecs, isets=None, comm=None):
 *         vecs = list(vecs)
 *         if isets:             # <<<<<<<<<<<<<<
 *             isets = list(isets)
 *             assert len(isets) == len(vecs)
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_isets); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(30, 273, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "PETSc/Vec.pyx":274
 *         vecs = list(vecs)
 *         if isets:
 *             isets = list(isets)             # <<<<<<<<<<<<<<
 *             assert len(isets) == len(vecs)
 *         else:
 */
    __pyx_t_1 = PySequence_List(__pyx_v_isets); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_isets, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "PETSc/Vec.pyx":275
 *         if isets:
 *             isets = list(isets)
 *             assert len(isets) == len(vecs)             # <<<<<<<<<<<<<<
 *         else:
 *             isets = None
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_3 = PyObject_Length(__pyx_v_isets); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 275, __pyx_L1_error)
      __pyx_t_4 = PyObject_Length(__pyx_v_vecs); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 275, __pyx_L1_error)
      if (unlikely(!((__pyx_t_3 == __pyx_t_4) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(30, 275, __pyx_L1_error)
      }
    }
    #endif

    /* "PETSc/Vec.pyx":273
 *     def createNest(self, vecs, isets=None, comm=None):
 *         vecs = list(vecs)
 *         if isets:             # <<<<<<<<<<<<<<
 *             isets = list(isets)
 *             assert len(isets) == len(vecs)
 */
    goto __pyx_L3;
  }

  /* "PETSc/Vec.pyx":277
 *             assert len(isets) == len(vecs)
 *         else:
 *             isets = None             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Py_ssize_t i, m = len(vecs)
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_isets, Py_None);
  }
  __pyx_L3:;

  /* "PETSc/Vec.pyx":278
 *         else:
 *             isets = None
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i, m = len(vecs)
 *         cdef PetscInt n = <PetscInt>m
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 278, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_5;

  /* "PETSc/Vec.pyx":279
 *             isets = None
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Py_ssize_t i, m = len(vecs)             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = <PetscInt>m
 *         cdef PetscVec *cvecs  = NULL
 */
  __pyx_t_4 = PyObject_Length(__pyx_v_vecs); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 279, __pyx_L1_error)
  __pyx_v_m = __pyx_t_4;

  /* "PETSc/Vec.pyx":280
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Py_ssize_t i, m = len(vecs)
 *         cdef PetscInt n = <PetscInt>m             # <<<<<<<<<<<<<<
 *         cdef PetscVec *cvecs  = NULL
 *         cdef PetscIS  *cisets = NULL
 */
  __pyx_v_n = ((PetscInt)__pyx_v_m);

  /* "PETSc/Vec.pyx":281
 *         cdef Py_ssize_t i, m = len(vecs)
 *         cdef PetscInt n = <PetscInt>m
 *         cdef PetscVec *cvecs  = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscIS  *cisets = NULL
 *         cdef object tmp1, tmp2
 */
  __pyx_v_cvecs = NULL;

  /* "PETSc/Vec.pyx":282
 *         cdef PetscInt n = <PetscInt>m
 *         cdef PetscVec *cvecs  = NULL
 *         cdef PetscIS  *cisets = NULL             # <<<<<<<<<<<<<<
 *         cdef object tmp1, tmp2
 *         tmp1 = oarray_p(empty_p(n), NULL, <void**>&cvecs)
 */
  __pyx_v_cisets = NULL;

  /* "PETSc/Vec.pyx":284
 *         cdef PetscIS  *cisets = NULL
 *         cdef object tmp1, tmp2
 *         tmp1 = oarray_p(empty_p(n), NULL, <void**>&cvecs)             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < m: cvecs[i] = (<Vec?>vecs[i]).vec
 *         if isets is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_1, NULL, ((void **)(&__pyx_v_cvecs)))); if (unlikely(!__pyx_t_6)) __PYX_ERR(30, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_tmp1 = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "PETSc/Vec.pyx":285
 *         cdef object tmp1, tmp2
 *         tmp1 = oarray_p(empty_p(n), NULL, <void**>&cvecs)
 *         for i from 0 <= i < m: cvecs[i] = (<Vec?>vecs[i]).vec             # <<<<<<<<<<<<<<
 *         if isets is not None:
 *             tmp2 = oarray_p(empty_p(n), NULL, <void**>&cisets)
 */
  __pyx_t_4 = __pyx_v_m;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_vecs, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(30, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8petsc4py_5PETSc_Vec)))) __PYX_ERR(30, 285, __pyx_L1_error)
    __pyx_t_7 = ((struct PyPetscVecObject *)__pyx_t_6)->vec;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    (__pyx_v_cvecs[__pyx_v_i]) = __pyx_t_7;
  }

  /* "PETSc/Vec.pyx":286
 *         tmp1 = oarray_p(empty_p(n), NULL, <void**>&cvecs)
 *         for i from 0 <= i < m: cvecs[i] = (<Vec?>vecs[i]).vec
 *         if isets is not None:             # <<<<<<<<<<<<<<
 *             tmp2 = oarray_p(empty_p(n), NULL, <void**>&cisets)
 *             for i from 0 <= i < m: cisets[i] = (<IS?>isets[i]).iset
 */
  __pyx_t_2 = (__pyx_v_isets != Py_None);
  __pyx_t_8 = (__pyx_t_2 != 0);
  if (__pyx_t_8) {

    /* "PETSc/Vec.pyx":287
 *         for i from 0 <= i < m: cvecs[i] = (<Vec?>vecs[i]).vec
 *         if isets is not None:
 *             tmp2 = oarray_p(empty_p(n), NULL, <void**>&cisets)             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < m: cisets[i] = (<IS?>isets[i]).iset
 *         cdef PetscVec newvec = NULL
 */
    __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_n)); if (unlikely(!__pyx_t_6)) __PYX_ERR(30, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_6, NULL, ((void **)(&__pyx_v_cisets)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_tmp2 = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PETSc/Vec.pyx":288
 *         if isets is not None:
 *             tmp2 = oarray_p(empty_p(n), NULL, <void**>&cisets)
 *             for i from 0 <= i < m: cisets[i] = (<IS?>isets[i]).iset             # <<<<<<<<<<<<<<
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreateNest(ccomm, n, cisets, cvecs,&newvec) )
 */
    __pyx_t_4 = __pyx_v_m;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_isets, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 288, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(30, 288, __pyx_L1_error)
      __pyx_t_9 = ((struct PyPetscISObject *)__pyx_t_1)->iset;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      (__pyx_v_cisets[__pyx_v_i]) = __pyx_t_9;
    }

    /* "PETSc/Vec.pyx":286
 *         tmp1 = oarray_p(empty_p(n), NULL, <void**>&cvecs)
 *         for i from 0 <= i < m: cvecs[i] = (<Vec?>vecs[i]).vec
 *         if isets is not None:             # <<<<<<<<<<<<<<
 *             tmp2 = oarray_p(empty_p(n), NULL, <void**>&cisets)
 *             for i from 0 <= i < m: cisets[i] = (<IS?>isets[i]).iset
 */
  }

  /* "PETSc/Vec.pyx":289
 *             tmp2 = oarray_p(empty_p(n), NULL, <void**>&cisets)
 *             for i from 0 <= i < m: cisets[i] = (<IS?>isets[i]).iset
 *         cdef PetscVec newvec = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( VecCreateNest(ccomm, n, cisets, cvecs,&newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 */
  __pyx_v_newvec = NULL;

  /* "PETSc/Vec.pyx":290
 *             for i from 0 <= i < m: cisets[i] = (<IS?>isets[i]).iset
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreateNest(ccomm, n, cisets, cvecs,&newvec) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         return self
 */
  __pyx_t_10 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreateNest(__pyx_v_ccomm, __pyx_v_n, __pyx_v_cisets, __pyx_v_cvecs, (&__pyx_v_newvec))); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(30, 290, __pyx_L1_error)

  /* "PETSc/Vec.pyx":291
 *         cdef PetscVec newvec = NULL
 *         CHKERR( VecCreateNest(ccomm, n, cisets, cvecs,&newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->vec = __pyx_v_newvec;

  /* "PETSc/Vec.pyx":292
 *         CHKERR( VecCreateNest(ccomm, n, cisets, cvecs,&newvec) )
 *         PetscCLEAR(self.obj); self.vec = newvec
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":271
 *         return self
 * 
 *     def createNest(self, vecs, isets=None, comm=None):             # <<<<<<<<<<<<<<
 *         vecs = list(vecs)
 *         if isets:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.createNest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp1);
  __Pyx_XDECREF(__pyx_v_tmp2);
  __Pyx_XDECREF(__pyx_v_vecs);
  __Pyx_XDECREF(__pyx_v_isets);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":296
 *     #
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_65setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_64setOptionsPrefix[] = "Vec.setOptionsPrefix(self, prefix)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_65setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOptionsPrefix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,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);
        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_prefix)) != 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, "setOptionsPrefix") < 0)) __PYX_ERR(30, 296, __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_prefix = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOptionsPrefix", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 296, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_64setOptionsPrefix(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_prefix);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_64setOptionsPrefix(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setOptionsPrefix", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "PETSc/Vec.pyx":297
 * 
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( VecSetOptionsPrefix(self.vec, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Vec.pyx":298
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetOptionsPrefix(self.vec, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_prefix, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":299
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( VecSetOptionsPrefix(self.vec, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getOptionsPrefix(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetOptionsPrefix(__pyx_v_self->vec, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 299, __pyx_L1_error)

  /* "PETSc/Vec.pyx":296
 *     #
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":301
 *         CHKERR( VecSetOptionsPrefix(self.vec, cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( VecGetOptionsPrefix(self.vec, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_67getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_66getOptionsPrefix[] = "Vec.getOptionsPrefix(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_67getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOptionsPrefix (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOptionsPrefix", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOptionsPrefix", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_66getOptionsPrefix(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_66getOptionsPrefix(struct PyPetscVecObject *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getOptionsPrefix", 0);

  /* "PETSc/Vec.pyx":302
 * 
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetOptionsPrefix(self.vec, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Vec.pyx":303
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( VecGetOptionsPrefix(self.vec, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetOptionsPrefix(__pyx_v_self->vec, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 303, __pyx_L1_error)

  /* "PETSc/Vec.pyx":304
 *         cdef const_char *cval = NULL
 *         CHKERR( VecGetOptionsPrefix(self.vec, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":301
 *         CHKERR( VecSetOptionsPrefix(self.vec, cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( VecGetOptionsPrefix(self.vec, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":306
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetFromOptions(self.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_69setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_68setFromOptions[] = "Vec.setFromOptions(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_69setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_68setFromOptions(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_68setFromOptions(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/Vec.pyx":307
 * 
 *     def setFromOptions(self):
 *         CHKERR( VecSetFromOptions(self.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def setUp(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetFromOptions(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 307, __pyx_L1_error)

  /* "PETSc/Vec.pyx":306
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetFromOptions(self.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":309
 *         CHKERR( VecSetFromOptions(self.vec) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetUp(self.vec) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_71setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_70setUp[] = "Vec.setUp(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_71setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUp (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUp", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUp", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_70setUp(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_70setUp(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUp", 0);

  /* "PETSc/Vec.pyx":310
 * 
 *     def setUp(self):
 *         CHKERR( VecSetUp(self.vec) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetUp(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 310, __pyx_L1_error)

  /* "PETSc/Vec.pyx":311
 *     def setUp(self):
 *         CHKERR( VecSetUp(self.vec) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setOption(self, option, flag):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":309
 *         CHKERR( VecSetFromOptions(self.vec) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetUp(self.vec) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":313
 *         return self
 * 
 *     def setOption(self, option, flag):             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetOption(self.vec, option, flag) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_73setOption(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_72setOption[] = "Vec.setOption(self, option, flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_73setOption(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_option = 0;
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOption (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_option,&__pyx_n_s_flag,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_option)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flag)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setOption", 1, 2, 2, 1); __PYX_ERR(30, 313, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setOption") < 0)) __PYX_ERR(30, 313, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_option = values[0];
    __pyx_v_flag = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOption", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 313, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setOption", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_72setOption(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_option, __pyx_v_flag);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_72setOption(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_option, PyObject *__pyx_v_flag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  VecOption __pyx_t_1;
  PetscBool __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setOption", 0);

  /* "PETSc/Vec.pyx":314
 * 
 *     def setOption(self, option, flag):
 *         CHKERR( VecSetOption(self.vec, option, flag) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_1 = ((VecOption)__Pyx_PyInt_As_VecOption(__pyx_v_option)); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 314, __pyx_L1_error)
  __pyx_t_2 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_flag)); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 314, __pyx_L1_error)
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetOption(__pyx_v_self->vec, __pyx_t_1, __pyx_t_2)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 314, __pyx_L1_error)

  /* "PETSc/Vec.pyx":313
 *         return self
 * 
 *     def setOption(self, option, flag):             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetOption(self.vec, option, flag) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setOption", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":316
 *         CHKERR( VecSetOption(self.vec, option, flag) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscVecType cval = NULL
 *         CHKERR( VecGetType(self.vec, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_75getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_74getType[] = "Vec.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_75getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_74getType(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_74getType(struct PyPetscVecObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/Vec.pyx":317
 * 
 *     def getType(self):
 *         cdef PetscVecType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetType(self.vec, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Vec.pyx":318
 *     def getType(self):
 *         cdef PetscVecType cval = NULL
 *         CHKERR( VecGetType(self.vec, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetType(__pyx_v_self->vec, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 318, __pyx_L1_error)

  /* "PETSc/Vec.pyx":319
 *         cdef PetscVecType cval = NULL
 *         CHKERR( VecGetType(self.vec, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def getSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":316
 *         CHKERR( VecSetOption(self.vec, option, flag) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscVecType cval = NULL
 *         CHKERR( VecGetType(self.vec, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":321
 *         return bytes2str(cval)
 * 
 *     def getSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt N = 0
 *         CHKERR( VecGetSize(self.vec, &N) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_77getSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_76getSize[] = "Vec.getSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_77getSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_76getSize(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_76getSize(struct PyPetscVecObject *__pyx_v_self) {
  PetscInt __pyx_v_N;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getSize", 0);

  /* "PETSc/Vec.pyx":322
 * 
 *     def getSize(self):
 *         cdef PetscInt N = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetSize(self.vec, &N) )
 *         return toInt(N)
 */
  __pyx_v_N = 0;

  /* "PETSc/Vec.pyx":323
 *     def getSize(self):
 *         cdef PetscInt N = 0
 *         CHKERR( VecGetSize(self.vec, &N) )             # <<<<<<<<<<<<<<
 *         return toInt(N)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetSize(__pyx_v_self->vec, (&__pyx_v_N))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 323, __pyx_L1_error)

  /* "PETSc/Vec.pyx":324
 *         cdef PetscInt N = 0
 *         CHKERR( VecGetSize(self.vec, &N) )
 *         return toInt(N)             # <<<<<<<<<<<<<<
 * 
 *     def getLocalSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":321
 *         return bytes2str(cval)
 * 
 *     def getSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt N = 0
 *         CHKERR( VecGetSize(self.vec, &N) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":326
 *         return toInt(N)
 * 
 *     def getLocalSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( VecGetLocalSize(self.vec, &n) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_79getLocalSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_78getLocalSize[] = "Vec.getLocalSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_79getLocalSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLocalSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getLocalSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getLocalSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_78getLocalSize(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_78getLocalSize(struct PyPetscVecObject *__pyx_v_self) {
  PetscInt __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getLocalSize", 0);

  /* "PETSc/Vec.pyx":327
 * 
 *     def getLocalSize(self):
 *         cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetLocalSize(self.vec, &n) )
 *         return toInt(n)
 */
  __pyx_v_n = 0;

  /* "PETSc/Vec.pyx":328
 *     def getLocalSize(self):
 *         cdef PetscInt n = 0
 *         CHKERR( VecGetLocalSize(self.vec, &n) )             # <<<<<<<<<<<<<<
 *         return toInt(n)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetLocalSize(__pyx_v_self->vec, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 328, __pyx_L1_error)

  /* "PETSc/Vec.pyx":329
 *         cdef PetscInt n = 0
 *         CHKERR( VecGetLocalSize(self.vec, &n) )
 *         return toInt(n)             # <<<<<<<<<<<<<<
 * 
 *     def getSizes(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":326
 *         return toInt(N)
 * 
 *     def getLocalSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( VecGetLocalSize(self.vec, &n) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getLocalSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":331
 *         return toInt(n)
 * 
 *     def getSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0, N = 0
 *         CHKERR( VecGetLocalSize(self.vec, &n) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_81getSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_80getSizes[] = "Vec.getSizes(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_81getSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSizes (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSizes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSizes", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_80getSizes(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_80getSizes(struct PyPetscVecObject *__pyx_v_self) {
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_N;
  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;
  __Pyx_RefNannySetupContext("getSizes", 0);

  /* "PETSc/Vec.pyx":332
 * 
 *     def getSizes(self):
 *         cdef PetscInt n = 0, N = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetLocalSize(self.vec, &n) )
 *         CHKERR( VecGetSize(self.vec, &N) )
 */
  __pyx_v_n = 0;
  __pyx_v_N = 0;

  /* "PETSc/Vec.pyx":333
 *     def getSizes(self):
 *         cdef PetscInt n = 0, N = 0
 *         CHKERR( VecGetLocalSize(self.vec, &n) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetSize(self.vec, &N) )
 *         return (toInt(n), toInt(N))
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetLocalSize(__pyx_v_self->vec, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 333, __pyx_L1_error)

  /* "PETSc/Vec.pyx":334
 *         cdef PetscInt n = 0, N = 0
 *         CHKERR( VecGetLocalSize(self.vec, &n) )
 *         CHKERR( VecGetSize(self.vec, &N) )             # <<<<<<<<<<<<<<
 *         return (toInt(n), toInt(N))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetSize(__pyx_v_self->vec, (&__pyx_v_N))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 334, __pyx_L1_error)

  /* "PETSc/Vec.pyx":335
 *         CHKERR( VecGetLocalSize(self.vec, &n) )
 *         CHKERR( VecGetSize(self.vec, &N) )
 *         return (toInt(n), toInt(N))             # <<<<<<<<<<<<<<
 * 
 *     def setBlockSize(self, bsize):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 335, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":331
 *         return toInt(n)
 * 
 *     def getSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0, N = 0
 *         CHKERR( VecGetLocalSize(self.vec, &n) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":337
 *         return (toInt(n), toInt(N))
 * 
 *     def setBlockSize(self, bsize):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = asInt(bsize)
 *         CHKERR( VecSetBlockSize(self.vec, bs) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_83setBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_82setBlockSize[] = "Vec.setBlockSize(self, bsize)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_83setBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setBlockSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bsize,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);
        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_bsize)) != 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, "setBlockSize") < 0)) __PYX_ERR(30, 337, __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_bsize = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setBlockSize", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 337, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setBlockSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_82setBlockSize(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_bsize);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_82setBlockSize(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_bsize) {
  PetscInt __pyx_v_bs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setBlockSize", 0);

  /* "PETSc/Vec.pyx":338
 * 
 *     def setBlockSize(self, bsize):
 *         cdef PetscInt bs = asInt(bsize)             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetBlockSize(self.vec, bs) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_bsize); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(30, 338, __pyx_L1_error)
  __pyx_v_bs = __pyx_t_1;

  /* "PETSc/Vec.pyx":339
 *     def setBlockSize(self, bsize):
 *         cdef PetscInt bs = asInt(bsize)
 *         CHKERR( VecSetBlockSize(self.vec, bs) )             # <<<<<<<<<<<<<<
 * 
 *     def getBlockSize(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetBlockSize(__pyx_v_self->vec, __pyx_v_bs)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 339, __pyx_L1_error)

  /* "PETSc/Vec.pyx":337
 *         return (toInt(n), toInt(N))
 * 
 *     def setBlockSize(self, bsize):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = asInt(bsize)
 *         CHKERR( VecSetBlockSize(self.vec, bs) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setBlockSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":341
 *         CHKERR( VecSetBlockSize(self.vec, bs) )
 * 
 *     def getBlockSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs=0
 *         CHKERR( VecGetBlockSize(self.vec, &bs) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_85getBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_84getBlockSize[] = "Vec.getBlockSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_85getBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBlockSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getBlockSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getBlockSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_84getBlockSize(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_84getBlockSize(struct PyPetscVecObject *__pyx_v_self) {
  PetscInt __pyx_v_bs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getBlockSize", 0);

  /* "PETSc/Vec.pyx":342
 * 
 *     def getBlockSize(self):
 *         cdef PetscInt bs=0             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetBlockSize(self.vec, &bs) )
 *         return toInt(bs)
 */
  __pyx_v_bs = 0;

  /* "PETSc/Vec.pyx":343
 *     def getBlockSize(self):
 *         cdef PetscInt bs=0
 *         CHKERR( VecGetBlockSize(self.vec, &bs) )             # <<<<<<<<<<<<<<
 *         return toInt(bs)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetBlockSize(__pyx_v_self->vec, (&__pyx_v_bs))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 343, __pyx_L1_error)

  /* "PETSc/Vec.pyx":344
 *         cdef PetscInt bs=0
 *         CHKERR( VecGetBlockSize(self.vec, &bs) )
 *         return toInt(bs)             # <<<<<<<<<<<<<<
 * 
 *     def getOwnershipRange(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_bs); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":341
 *         CHKERR( VecSetBlockSize(self.vec, bs) )
 * 
 *     def getBlockSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs=0
 *         CHKERR( VecGetBlockSize(self.vec, &bs) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getBlockSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":346
 *         return toInt(bs)
 * 
 *     def getOwnershipRange(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt low=0, high=0
 *         CHKERR( VecGetOwnershipRange(self.vec, &low, &high) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_87getOwnershipRange(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_86getOwnershipRange[] = "Vec.getOwnershipRange(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_87getOwnershipRange(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOwnershipRange (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOwnershipRange", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOwnershipRange", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_86getOwnershipRange(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_86getOwnershipRange(struct PyPetscVecObject *__pyx_v_self) {
  PetscInt __pyx_v_low;
  PetscInt __pyx_v_high;
  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;
  __Pyx_RefNannySetupContext("getOwnershipRange", 0);

  /* "PETSc/Vec.pyx":347
 * 
 *     def getOwnershipRange(self):
 *         cdef PetscInt low=0, high=0             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetOwnershipRange(self.vec, &low, &high) )
 *         return (toInt(low), toInt(high))
 */
  __pyx_v_low = 0;
  __pyx_v_high = 0;

  /* "PETSc/Vec.pyx":348
 *     def getOwnershipRange(self):
 *         cdef PetscInt low=0, high=0
 *         CHKERR( VecGetOwnershipRange(self.vec, &low, &high) )             # <<<<<<<<<<<<<<
 *         return (toInt(low), toInt(high))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetOwnershipRange(__pyx_v_self->vec, (&__pyx_v_low), (&__pyx_v_high))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 348, __pyx_L1_error)

  /* "PETSc/Vec.pyx":349
 *         cdef PetscInt low=0, high=0
 *         CHKERR( VecGetOwnershipRange(self.vec, &low, &high) )
 *         return (toInt(low), toInt(high))             # <<<<<<<<<<<<<<
 * 
 *     def getOwnershipRanges(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_low); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_high); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 349, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":346
 *         return toInt(bs)
 * 
 *     def getOwnershipRange(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt low=0, high=0
 *         CHKERR( VecGetOwnershipRange(self.vec, &low, &high) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getOwnershipRange", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":351
 *         return (toInt(low), toInt(high))
 * 
 *     def getOwnershipRanges(self):             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *rng = NULL
 *         CHKERR( VecGetOwnershipRanges(self.vec, &rng) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_89getOwnershipRanges(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_88getOwnershipRanges[] = "Vec.getOwnershipRanges(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_89getOwnershipRanges(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOwnershipRanges (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOwnershipRanges", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOwnershipRanges", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_88getOwnershipRanges(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_88getOwnershipRanges(struct PyPetscVecObject *__pyx_v_self) {
  const PetscInt *__pyx_v_rng;
  MPI_Comm __pyx_v_comm;
  int __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getOwnershipRanges", 0);

  /* "PETSc/Vec.pyx":352
 * 
 *     def getOwnershipRanges(self):
 *         cdef const_PetscInt *rng = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetOwnershipRanges(self.vec, &rng) )
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 */
  __pyx_v_rng = NULL;

  /* "PETSc/Vec.pyx":353
 *     def getOwnershipRanges(self):
 *         cdef const_PetscInt *rng = NULL
 *         CHKERR( VecGetOwnershipRanges(self.vec, &rng) )             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.vec, &comm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetOwnershipRanges(__pyx_v_self->vec, (&__pyx_v_rng))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 353, __pyx_L1_error)

  /* "PETSc/Vec.pyx":354
 *         cdef const_PetscInt *rng = NULL
 *         CHKERR( VecGetOwnershipRanges(self.vec, &rng) )
 *         cdef MPI_Comm comm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.vec, &comm) )
 *         cdef int size = -1
 */
  __pyx_v_comm = MPI_COMM_NULL;

  /* "PETSc/Vec.pyx":355
 *         CHKERR( VecGetOwnershipRanges(self.vec, &rng) )
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.vec, &comm) )             # <<<<<<<<<<<<<<
 *         cdef int size = -1
 *         CHKERR( MPI_Comm_size(comm, &size) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetComm(((PetscObject)__pyx_v_self->vec), (&__pyx_v_comm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 355, __pyx_L1_error)

  /* "PETSc/Vec.pyx":356
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.vec, &comm) )
 *         cdef int size = -1             # <<<<<<<<<<<<<<
 *         CHKERR( MPI_Comm_size(comm, &size) )
 *         return array_i(size+1, rng)
 */
  __pyx_v_size = -1;

  /* "PETSc/Vec.pyx":357
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.vec, &comm) )
 *         cdef int size = -1
 *         CHKERR( MPI_Comm_size(comm, &size) )             # <<<<<<<<<<<<<<
 *         return array_i(size+1, rng)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MPI_Comm_size(__pyx_v_comm, (&__pyx_v_size))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 357, __pyx_L1_error)

  /* "PETSc/Vec.pyx":358
 *         cdef int size = -1
 *         CHKERR( MPI_Comm_size(comm, &size) )
 *         return array_i(size+1, rng)             # <<<<<<<<<<<<<<
 * 
 *     def getBuffer(self, readonly=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((__pyx_v_size + 1), __pyx_v_rng)); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":351
 *         return (toInt(low), toInt(high))
 * 
 *     def getOwnershipRanges(self):             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *rng = NULL
 *         CHKERR( VecGetOwnershipRanges(self.vec, &rng) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getOwnershipRanges", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":360
 *         return array_i(size+1, rng)
 * 
 *     def getBuffer(self, readonly=False):             # <<<<<<<<<<<<<<
 *         if readonly:
 *             return vec_getbuffer_r(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_91getBuffer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_90getBuffer[] = "Vec.getBuffer(self, readonly=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_91getBuffer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_readonly = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBuffer (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_readonly,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_readonly);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getBuffer") < 0)) __PYX_ERR(30, 360, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_readonly = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getBuffer", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 360, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getBuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_90getBuffer(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_readonly);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_90getBuffer(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_readonly) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getBuffer", 0);

  /* "PETSc/Vec.pyx":361
 * 
 *     def getBuffer(self, readonly=False):
 *         if readonly:             # <<<<<<<<<<<<<<
 *             return vec_getbuffer_r(self)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_readonly); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(30, 361, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/Vec.pyx":362
 *     def getBuffer(self, readonly=False):
 *         if readonly:
 *             return vec_getbuffer_r(self)             # <<<<<<<<<<<<<<
 *         else:
 *             return vec_getbuffer_w(self)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_getbuffer_r(__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "PETSc/Vec.pyx":361
 * 
 *     def getBuffer(self, readonly=False):
 *         if readonly:             # <<<<<<<<<<<<<<
 *             return vec_getbuffer_r(self)
 *         else:
 */
  }

  /* "PETSc/Vec.pyx":364
 *             return vec_getbuffer_r(self)
 *         else:
 *             return vec_getbuffer_w(self)             # <<<<<<<<<<<<<<
 * 
 *     def getArray(self, readonly=False):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_getbuffer_w(__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":360
 *         return array_i(size+1, rng)
 * 
 *     def getBuffer(self, readonly=False):             # <<<<<<<<<<<<<<
 *         if readonly:
 *             return vec_getbuffer_r(self)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getBuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":366
 *             return vec_getbuffer_w(self)
 * 
 *     def getArray(self, readonly=False):             # <<<<<<<<<<<<<<
 *         if readonly:
 *             return vec_getarray_r(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_93getArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_92getArray[] = "Vec.getArray(self, readonly=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_93getArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_readonly = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getArray (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_readonly,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_readonly);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getArray") < 0)) __PYX_ERR(30, 366, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_readonly = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getArray", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 366, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_92getArray(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_readonly);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_92getArray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_readonly) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getArray", 0);

  /* "PETSc/Vec.pyx":367
 * 
 *     def getArray(self, readonly=False):
 *         if readonly:             # <<<<<<<<<<<<<<
 *             return vec_getarray_r(self)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_readonly); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(30, 367, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/Vec.pyx":368
 *     def getArray(self, readonly=False):
 *         if readonly:
 *             return vec_getarray_r(self)             # <<<<<<<<<<<<<<
 *         else:
 *             return vec_getarray_w(self)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_getarray_r(__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "PETSc/Vec.pyx":367
 * 
 *     def getArray(self, readonly=False):
 *         if readonly:             # <<<<<<<<<<<<<<
 *             return vec_getarray_r(self)
 *         else:
 */
  }

  /* "PETSc/Vec.pyx":370
 *             return vec_getarray_r(self)
 *         else:
 *             return vec_getarray_w(self)             # <<<<<<<<<<<<<<
 * 
 *     def setArray(self, array):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_vec_getarray_w(__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":366
 *             return vec_getbuffer_w(self)
 * 
 *     def getArray(self, readonly=False):             # <<<<<<<<<<<<<<
 *         if readonly:
 *             return vec_getarray_r(self)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":372
 *             return vec_getarray_w(self)
 * 
 *     def setArray(self, array):             # <<<<<<<<<<<<<<
 *         vec_setarray(self, array)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_95setArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_94setArray[] = "Vec.setArray(self, array)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_95setArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_array = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setArray (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_array,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);
        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_array)) != 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, "setArray") < 0)) __PYX_ERR(30, 372, __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_array = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setArray", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 372, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_94setArray(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_array);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_94setArray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_array) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setArray", 0);

  /* "PETSc/Vec.pyx":373
 * 
 *     def setArray(self, array):
 *         vec_setarray(self, array)             # <<<<<<<<<<<<<<
 * 
 *     def placeArray(self, array):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_vec_setarray(__pyx_v_self, __pyx_v_array); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 373, __pyx_L1_error)

  /* "PETSc/Vec.pyx":372
 *             return vec_getarray_w(self)
 * 
 *     def setArray(self, array):             # <<<<<<<<<<<<<<
 *         vec_setarray(self, array)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":375
 *         vec_setarray(self, array)
 * 
 *     def placeArray(self, array):             # <<<<<<<<<<<<<<
 *         cdef PetscInt nv=0
 *         cdef PetscInt na=0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_97placeArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_96placeArray[] = "Vec.placeArray(self, array)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_97placeArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_array = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("placeArray (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_array,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);
        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_array)) != 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, "placeArray") < 0)) __PYX_ERR(30, 375, __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_array = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("placeArray", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 375, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.placeArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_96placeArray(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_array);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_96placeArray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_array) {
  PetscInt __pyx_v_nv;
  PetscInt __pyx_v_na;
  PetscScalar *__pyx_v_a;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("placeArray", 0);
  __Pyx_INCREF(__pyx_v_array);

  /* "PETSc/Vec.pyx":376
 * 
 *     def placeArray(self, array):
 *         cdef PetscInt nv=0             # <<<<<<<<<<<<<<
 *         cdef PetscInt na=0
 *         cdef PetscScalar *a = NULL
 */
  __pyx_v_nv = 0;

  /* "PETSc/Vec.pyx":377
 *     def placeArray(self, array):
 *         cdef PetscInt nv=0
 *         cdef PetscInt na=0             # <<<<<<<<<<<<<<
 *         cdef PetscScalar *a = NULL
 *         CHKERR( VecGetLocalSize(self.vec, &nv) )
 */
  __pyx_v_na = 0;

  /* "PETSc/Vec.pyx":378
 *         cdef PetscInt nv=0
 *         cdef PetscInt na=0
 *         cdef PetscScalar *a = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetLocalSize(self.vec, &nv) )
 *         array = oarray_s(array, &na, &a)
 */
  __pyx_v_a = NULL;

  /* "PETSc/Vec.pyx":379
 *         cdef PetscInt na=0
 *         cdef PetscScalar *a = NULL
 *         CHKERR( VecGetLocalSize(self.vec, &nv) )             # <<<<<<<<<<<<<<
 *         array = oarray_s(array, &na, &a)
 *         if (na != nv): raise ValueError(
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetLocalSize(__pyx_v_self->vec, (&__pyx_v_nv))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 379, __pyx_L1_error)

  /* "PETSc/Vec.pyx":380
 *         cdef PetscScalar *a = NULL
 *         CHKERR( VecGetLocalSize(self.vec, &nv) )
 *         array = oarray_s(array, &na, &a)             # <<<<<<<<<<<<<<
 *         if (na != nv): raise ValueError(
 *             "cannot place input array size %d, vector size %d" %
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_s(__pyx_v_array, (&__pyx_v_na), (&__pyx_v_a))); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_array, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Vec.pyx":381
 *         CHKERR( VecGetLocalSize(self.vec, &nv) )
 *         array = oarray_s(array, &na, &a)
 *         if (na != nv): raise ValueError(             # <<<<<<<<<<<<<<
 *             "cannot place input array size %d, vector size %d" %
 *             (toInt(na), toInt(nv)))
 */
  __pyx_t_3 = ((__pyx_v_na != __pyx_v_nv) != 0);
  if (__pyx_t_3) {

    /* "PETSc/Vec.pyx":383
 *         if (na != nv): raise ValueError(
 *             "cannot place input array size %d, vector size %d" %
 *             (toInt(na), toInt(nv)))             # <<<<<<<<<<<<<<
 *         CHKERR( VecPlaceArray(self.vec, a) )
 *         self.set_attr('__placed_array__', array)
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_na); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nv); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;

    /* "PETSc/Vec.pyx":382
 *         array = oarray_s(array, &na, &a)
 *         if (na != nv): raise ValueError(
 *             "cannot place input array size %d, vector size %d" %             # <<<<<<<<<<<<<<
 *             (toInt(na), toInt(nv)))
 *         CHKERR( VecPlaceArray(self.vec, a) )
 */
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_cannot_place_input_array_size_d, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/Vec.pyx":381
 *         CHKERR( VecGetLocalSize(self.vec, &nv) )
 *         array = oarray_s(array, &na, &a)
 *         if (na != nv): raise ValueError(             # <<<<<<<<<<<<<<
 *             "cannot place input array size %d, vector size %d" %
 *             (toInt(na), toInt(nv)))
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 381, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(30, 381, __pyx_L1_error)
  }

  /* "PETSc/Vec.pyx":384
 *             "cannot place input array size %d, vector size %d" %
 *             (toInt(na), toInt(nv)))
 *         CHKERR( VecPlaceArray(self.vec, a) )             # <<<<<<<<<<<<<<
 *         self.set_attr('__placed_array__', array)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecPlaceArray(__pyx_v_self->vec, __pyx_v_a)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 384, __pyx_L1_error)

  /* "PETSc/Vec.pyx":385
 *             (toInt(na), toInt(nv)))
 *         CHKERR( VecPlaceArray(self.vec, a) )
 *         self.set_attr('__placed_array__', array)             # <<<<<<<<<<<<<<
 * 
 *     def resetArray(self, force=False):
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Vec *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__placed_array__"), __pyx_v_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "PETSc/Vec.pyx":375
 *         vec_setarray(self, array)
 * 
 *     def placeArray(self, array):             # <<<<<<<<<<<<<<
 *         cdef PetscInt nv=0
 *         cdef PetscInt na=0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.placeArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":387
 *         self.set_attr('__placed_array__', array)
 * 
 *     def resetArray(self, force=False):             # <<<<<<<<<<<<<<
 *         cdef object array = None
 *         array = self.get_attr('__placed_array__')
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_99resetArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_98resetArray[] = "Vec.resetArray(self, force=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_99resetArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_force = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resetArray (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_force,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_force);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "resetArray") < 0)) __PYX_ERR(30, 387, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_force = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resetArray", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 387, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.resetArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_98resetArray(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_force);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_98resetArray(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_force) {
  PyObject *__pyx_v_array = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("resetArray", 0);

  /* "PETSc/Vec.pyx":388
 * 
 *     def resetArray(self, force=False):
 *         cdef object array = None             # <<<<<<<<<<<<<<
 *         array = self.get_attr('__placed_array__')
 *         if array is None and not force: return None
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_array = Py_None;

  /* "PETSc/Vec.pyx":389
 *     def resetArray(self, force=False):
 *         cdef object array = None
 *         array = self.get_attr('__placed_array__')             # <<<<<<<<<<<<<<
 *         if array is None and not force: return None
 *         CHKERR( VecResetArray(self.vec) )
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Vec *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__placed_array__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_array, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":390
 *         cdef object array = None
 *         array = self.get_attr('__placed_array__')
 *         if array is None and not force: return None             # <<<<<<<<<<<<<<
 *         CHKERR( VecResetArray(self.vec) )
 *         self.set_attr('__placed_array__', None)
 */
  __pyx_t_3 = (__pyx_v_array == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(30, 390, __pyx_L1_error)
  __pyx_t_3 = ((!__pyx_t_4) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":391
 *         array = self.get_attr('__placed_array__')
 *         if array is None and not force: return None
 *         CHKERR( VecResetArray(self.vec) )             # <<<<<<<<<<<<<<
 *         self.set_attr('__placed_array__', None)
 *         return array
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecResetArray(__pyx_v_self->vec)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(30, 391, __pyx_L1_error)

  /* "PETSc/Vec.pyx":392
 *         if array is None and not force: return None
 *         CHKERR( VecResetArray(self.vec) )
 *         self.set_attr('__placed_array__', None)             # <<<<<<<<<<<<<<
 *         return array
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Vec *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__placed_array__"), Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":393
 *         CHKERR( VecResetArray(self.vec) )
 *         self.set_attr('__placed_array__', None)
 *         return array             # <<<<<<<<<<<<<<
 * 
 *     def getCUDAHandle(self, mode=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_array);
  __pyx_r = __pyx_v_array;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":387
 *         self.set_attr('__placed_array__', array)
 * 
 *     def resetArray(self, force=False):             # <<<<<<<<<<<<<<
 *         cdef object array = None
 *         array = self.get_attr('__placed_array__')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.resetArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":395
 *         return array
 * 
 *     def getCUDAHandle(self, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar *hdl = NULL
 *         cdef const_char *m = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_101getCUDAHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_100getCUDAHandle[] = "Vec.getCUDAHandle(self, mode=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_101getCUDAHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCUDAHandle (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mode,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getCUDAHandle") < 0)) __PYX_ERR(30, 395, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mode = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getCUDAHandle", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 395, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getCUDAHandle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_100getCUDAHandle(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_mode);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_100getCUDAHandle(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_mode) {
  PetscScalar *__pyx_v_hdl;
  const char *__pyx_v_m;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("getCUDAHandle", 0);
  __Pyx_INCREF(__pyx_v_mode);

  /* "PETSc/Vec.pyx":396
 * 
 *     def getCUDAHandle(self, mode=None):
 *         cdef PetscScalar *hdl = NULL             # <<<<<<<<<<<<<<
 *         cdef const_char *m = NULL
 *         if mode is not None: mode = str2bytes(mode, &m)
 */
  __pyx_v_hdl = NULL;

  /* "PETSc/Vec.pyx":397
 *     def getCUDAHandle(self, mode=None):
 *         cdef PetscScalar *hdl = NULL
 *         cdef const_char *m = NULL             # <<<<<<<<<<<<<<
 *         if mode is not None: mode = str2bytes(mode, &m)
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):
 */
  __pyx_v_m = NULL;

  /* "PETSc/Vec.pyx":398
 *         cdef PetscScalar *hdl = NULL
 *         cdef const_char *m = NULL
 *         if mode is not None: mode = str2bytes(mode, &m)             # <<<<<<<<<<<<<<
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):
 *             CHKERR( VecCUSPGetCUDAArrayReadWrite(self.vec, &hdl) )
 */
  __pyx_t_1 = (__pyx_v_mode != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_mode, (&__pyx_v_m)); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 398, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "PETSc/Vec.pyx":399
 *         cdef const_char *m = NULL
 *         if mode is not None: mode = str2bytes(mode, &m)
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):             # <<<<<<<<<<<<<<
 *             CHKERR( VecCUSPGetCUDAArrayReadWrite(self.vec, &hdl) )
 *         elif m[0] == c'r':
 */
  __pyx_t_1 = ((__pyx_v_m == NULL) != 0);
  if (!__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = (((__pyx_v_m[0]) == 'r') != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = (((__pyx_v_m[1]) == 'w') != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "PETSc/Vec.pyx":400
 *         if mode is not None: mode = str2bytes(mode, &m)
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):
 *             CHKERR( VecCUSPGetCUDAArrayReadWrite(self.vec, &hdl) )             # <<<<<<<<<<<<<<
 *         elif m[0] == c'r':
 *             CHKERR( VecCUSPGetCUDAArrayRead(self.vec, &hdl) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCUSPGetCUDAArrayReadWrite(__pyx_v_self->vec, (&__pyx_v_hdl))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 400, __pyx_L1_error)

    /* "PETSc/Vec.pyx":399
 *         cdef const_char *m = NULL
 *         if mode is not None: mode = str2bytes(mode, &m)
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):             # <<<<<<<<<<<<<<
 *             CHKERR( VecCUSPGetCUDAArrayReadWrite(self.vec, &hdl) )
 *         elif m[0] == c'r':
 */
    goto __pyx_L4;
  }

  /* "PETSc/Vec.pyx":401
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):
 *             CHKERR( VecCUSPGetCUDAArrayReadWrite(self.vec, &hdl) )
 *         elif m[0] == c'r':             # <<<<<<<<<<<<<<
 *             CHKERR( VecCUSPGetCUDAArrayRead(self.vec, &hdl) )
 *         elif m[0] == c'w':
 */
  __pyx_t_2 = (((__pyx_v_m[0]) == 'r') != 0);
  if (__pyx_t_2) {

    /* "PETSc/Vec.pyx":402
 *             CHKERR( VecCUSPGetCUDAArrayReadWrite(self.vec, &hdl) )
 *         elif m[0] == c'r':
 *             CHKERR( VecCUSPGetCUDAArrayRead(self.vec, &hdl) )             # <<<<<<<<<<<<<<
 *         elif m[0] == c'w':
 *             CHKERR( VecCUSPGetCUDAArrayWrite(self.vec, &hdl) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCUSPGetCUDAArrayRead(__pyx_v_self->vec, (&__pyx_v_hdl))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 402, __pyx_L1_error)

    /* "PETSc/Vec.pyx":401
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):
 *             CHKERR( VecCUSPGetCUDAArrayReadWrite(self.vec, &hdl) )
 *         elif m[0] == c'r':             # <<<<<<<<<<<<<<
 *             CHKERR( VecCUSPGetCUDAArrayRead(self.vec, &hdl) )
 *         elif m[0] == c'w':
 */
    goto __pyx_L4;
  }

  /* "PETSc/Vec.pyx":403
 *         elif m[0] == c'r':
 *             CHKERR( VecCUSPGetCUDAArrayRead(self.vec, &hdl) )
 *         elif m[0] == c'w':             # <<<<<<<<<<<<<<
 *             CHKERR( VecCUSPGetCUDAArrayWrite(self.vec, &hdl) )
 *         else:
 */
  __pyx_t_2 = (((__pyx_v_m[0]) == 'w') != 0);
  if (__pyx_t_2) {

    /* "PETSc/Vec.pyx":404
 *             CHKERR( VecCUSPGetCUDAArrayRead(self.vec, &hdl) )
 *         elif m[0] == c'w':
 *             CHKERR( VecCUSPGetCUDAArrayWrite(self.vec, &hdl) )             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Invalid mode: expected 'rw', 'r', or 'w'")
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCUSPGetCUDAArrayWrite(__pyx_v_self->vec, (&__pyx_v_hdl))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 404, __pyx_L1_error)

    /* "PETSc/Vec.pyx":403
 *         elif m[0] == c'r':
 *             CHKERR( VecCUSPGetCUDAArrayRead(self.vec, &hdl) )
 *         elif m[0] == c'w':             # <<<<<<<<<<<<<<
 *             CHKERR( VecCUSPGetCUDAArrayWrite(self.vec, &hdl) )
 *         else:
 */
    goto __pyx_L4;
  }

  /* "PETSc/Vec.pyx":406
 *             CHKERR( VecCUSPGetCUDAArrayWrite(self.vec, &hdl) )
 *         else:
 *             raise ValueError("Invalid mode: expected 'rw', 'r', or 'w'")             # <<<<<<<<<<<<<<
 *         return <Py_uintptr_t>hdl
 * 
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 406, __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(30, 406, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "PETSc/Vec.pyx":407
 *         else:
 *             raise ValueError("Invalid mode: expected 'rw', 'r', or 'w'")
 *         return <Py_uintptr_t>hdl             # <<<<<<<<<<<<<<
 * 
 *     def restoreCUDAHandle(self, handle, mode='rw'):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(((Py_uintptr_t)__pyx_v_hdl)); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":395
 *         return array
 * 
 *     def getCUDAHandle(self, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar *hdl = NULL
 *         cdef const_char *m = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getCUDAHandle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mode);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":409
 *         return <Py_uintptr_t>hdl
 * 
 *     def restoreCUDAHandle(self, handle, mode='rw'):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar *hdl = <PetscScalar*>(<Py_uintptr_t>handle)
 *         cdef const_char *m = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_103restoreCUDAHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_102restoreCUDAHandle[] = "Vec.restoreCUDAHandle(self, handle, mode='rw')";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_103restoreCUDAHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_handle = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("restoreCUDAHandle (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_mode,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_n_s_rw);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "restoreCUDAHandle") < 0)) __PYX_ERR(30, 409, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_handle = values[0];
    __pyx_v_mode = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("restoreCUDAHandle", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 409, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.restoreCUDAHandle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_102restoreCUDAHandle(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_handle, __pyx_v_mode);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_102restoreCUDAHandle(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_handle, PyObject *__pyx_v_mode) {
  PetscScalar *__pyx_v_hdl;
  const char *__pyx_v_m;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_uintptr_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("restoreCUDAHandle", 0);
  __Pyx_INCREF(__pyx_v_mode);

  /* "PETSc/Vec.pyx":410
 * 
 *     def restoreCUDAHandle(self, handle, mode='rw'):
 *         cdef PetscScalar *hdl = <PetscScalar*>(<Py_uintptr_t>handle)             # <<<<<<<<<<<<<<
 *         cdef const_char *m = NULL
 *         if mode is not None: mode = str2bytes(mode, &m)
 */
  __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_handle); if (unlikely((__pyx_t_1 == (Py_uintptr_t)-1) && PyErr_Occurred())) __PYX_ERR(30, 410, __pyx_L1_error)
  __pyx_v_hdl = ((PetscScalar *)((Py_uintptr_t)__pyx_t_1));

  /* "PETSc/Vec.pyx":411
 *     def restoreCUDAHandle(self, handle, mode='rw'):
 *         cdef PetscScalar *hdl = <PetscScalar*>(<Py_uintptr_t>handle)
 *         cdef const_char *m = NULL             # <<<<<<<<<<<<<<
 *         if mode is not None: mode = str2bytes(mode, &m)
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):
 */
  __pyx_v_m = NULL;

  /* "PETSc/Vec.pyx":412
 *         cdef PetscScalar *hdl = <PetscScalar*>(<Py_uintptr_t>handle)
 *         cdef const_char *m = NULL
 *         if mode is not None: mode = str2bytes(mode, &m)             # <<<<<<<<<<<<<<
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):
 *             CHKERR( VecCUSPRestoreCUDAArrayReadWrite(self.vec, &hdl) )
 */
  __pyx_t_2 = (__pyx_v_mode != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_mode, (&__pyx_v_m)); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_4);
    __pyx_t_4 = 0;
  }

  /* "PETSc/Vec.pyx":413
 *         cdef const_char *m = NULL
 *         if mode is not None: mode = str2bytes(mode, &m)
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):             # <<<<<<<<<<<<<<
 *             CHKERR( VecCUSPRestoreCUDAArrayReadWrite(self.vec, &hdl) )
 *         elif m[0] == c'r':
 */
  __pyx_t_2 = ((__pyx_v_m == NULL) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = (((__pyx_v_m[0]) == 'r') != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = (((__pyx_v_m[1]) == 'w') != 0);
  __pyx_t_3 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_3) {

    /* "PETSc/Vec.pyx":414
 *         if mode is not None: mode = str2bytes(mode, &m)
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):
 *             CHKERR( VecCUSPRestoreCUDAArrayReadWrite(self.vec, &hdl) )             # <<<<<<<<<<<<<<
 *         elif m[0] == c'r':
 *             CHKERR( VecCUSPRestoreCUDAArrayRead(self.vec, &hdl) )
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCUSPRestoreCUDAArrayReadWrite(__pyx_v_self->vec, (&__pyx_v_hdl))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(30, 414, __pyx_L1_error)

    /* "PETSc/Vec.pyx":413
 *         cdef const_char *m = NULL
 *         if mode is not None: mode = str2bytes(mode, &m)
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):             # <<<<<<<<<<<<<<
 *             CHKERR( VecCUSPRestoreCUDAArrayReadWrite(self.vec, &hdl) )
 *         elif m[0] == c'r':
 */
    goto __pyx_L4;
  }

  /* "PETSc/Vec.pyx":415
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):
 *             CHKERR( VecCUSPRestoreCUDAArrayReadWrite(self.vec, &hdl) )
 *         elif m[0] == c'r':             # <<<<<<<<<<<<<<
 *             CHKERR( VecCUSPRestoreCUDAArrayRead(self.vec, &hdl) )
 *         elif m[0] == c'w':
 */
  __pyx_t_3 = (((__pyx_v_m[0]) == 'r') != 0);
  if (__pyx_t_3) {

    /* "PETSc/Vec.pyx":416
 *             CHKERR( VecCUSPRestoreCUDAArrayReadWrite(self.vec, &hdl) )
 *         elif m[0] == c'r':
 *             CHKERR( VecCUSPRestoreCUDAArrayRead(self.vec, &hdl) )             # <<<<<<<<<<<<<<
 *         elif m[0] == c'w':
 *             CHKERR( VecCUSPRestoreCUDAArrayWrite(self.vec, &hdl) )
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCUSPRestoreCUDAArrayRead(__pyx_v_self->vec, (&__pyx_v_hdl))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(30, 416, __pyx_L1_error)

    /* "PETSc/Vec.pyx":415
 *         if m == NULL or (m[0] == c'r' and m[1] == c'w'):
 *             CHKERR( VecCUSPRestoreCUDAArrayReadWrite(self.vec, &hdl) )
 *         elif m[0] == c'r':             # <<<<<<<<<<<<<<
 *             CHKERR( VecCUSPRestoreCUDAArrayRead(self.vec, &hdl) )
 *         elif m[0] == c'w':
 */
    goto __pyx_L4;
  }

  /* "PETSc/Vec.pyx":417
 *         elif m[0] == c'r':
 *             CHKERR( VecCUSPRestoreCUDAArrayRead(self.vec, &hdl) )
 *         elif m[0] == c'w':             # <<<<<<<<<<<<<<
 *             CHKERR( VecCUSPRestoreCUDAArrayWrite(self.vec, &hdl) )
 *         else:
 */
  __pyx_t_3 = (((__pyx_v_m[0]) == 'w') != 0);
  if (__pyx_t_3) {

    /* "PETSc/Vec.pyx":418
 *             CHKERR( VecCUSPRestoreCUDAArrayRead(self.vec, &hdl) )
 *         elif m[0] == c'w':
 *             CHKERR( VecCUSPRestoreCUDAArrayWrite(self.vec, &hdl) )             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Invalid mode: expected 'rw', 'r', or 'w'")
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCUSPRestoreCUDAArrayWrite(__pyx_v_self->vec, (&__pyx_v_hdl))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(30, 418, __pyx_L1_error)

    /* "PETSc/Vec.pyx":417
 *         elif m[0] == c'r':
 *             CHKERR( VecCUSPRestoreCUDAArrayRead(self.vec, &hdl) )
 *         elif m[0] == c'w':             # <<<<<<<<<<<<<<
 *             CHKERR( VecCUSPRestoreCUDAArrayWrite(self.vec, &hdl) )
 *         else:
 */
    goto __pyx_L4;
  }

  /* "PETSc/Vec.pyx":420
 *             CHKERR( VecCUSPRestoreCUDAArrayWrite(self.vec, &hdl) )
 *         else:
 *             raise ValueError("Invalid mode: expected 'rw', 'r', or 'w'")             # <<<<<<<<<<<<<<
 * 
 *     def duplicate(self, array=None):
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 420, __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(30, 420, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "PETSc/Vec.pyx":409
 *         return <Py_uintptr_t>hdl
 * 
 *     def restoreCUDAHandle(self, handle, mode='rw'):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar *hdl = <PetscScalar*>(<Py_uintptr_t>handle)
 *         cdef const_char *m = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.restoreCUDAHandle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mode);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":422
 *             raise ValueError("Invalid mode: expected 'rw', 'r', or 'w'")
 * 
 *     def duplicate(self, array=None):             # <<<<<<<<<<<<<<
 *         cdef Vec vec = type(self)()
 *         CHKERR( VecDuplicate(self.vec, &vec.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_105duplicate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_104duplicate[] = "Vec.duplicate(self, array=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_105duplicate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_array = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("duplicate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_array,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_array);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "duplicate") < 0)) __PYX_ERR(30, 422, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_array = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("duplicate", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 422, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.duplicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_104duplicate(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_array);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_104duplicate(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_array) {
  struct PyPetscVecObject *__pyx_v_vec = 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;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("duplicate", 0);

  /* "PETSc/Vec.pyx":423
 * 
 *     def duplicate(self, array=None):
 *         cdef Vec vec = type(self)()             # <<<<<<<<<<<<<<
 *         CHKERR( VecDuplicate(self.vec, &vec.vec) )
 *         if array is not None:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __pyx_t_2 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 423, __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(30, 423, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(30, 423, __pyx_L1_error)
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":424
 *     def duplicate(self, array=None):
 *         cdef Vec vec = type(self)()
 *         CHKERR( VecDuplicate(self.vec, &vec.vec) )             # <<<<<<<<<<<<<<
 *         if array is not None:
 *             vec_setarray(vec, array)
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecDuplicate(__pyx_v_self->vec, (&__pyx_v_vec->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 424, __pyx_L1_error)

  /* "PETSc/Vec.pyx":425
 *         cdef Vec vec = type(self)()
 *         CHKERR( VecDuplicate(self.vec, &vec.vec) )
 *         if array is not None:             # <<<<<<<<<<<<<<
 *             vec_setarray(vec, array)
 *         return vec
 */
  __pyx_t_5 = (__pyx_v_array != Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "PETSc/Vec.pyx":426
 *         CHKERR( VecDuplicate(self.vec, &vec.vec) )
 *         if array is not None:
 *             vec_setarray(vec, array)             # <<<<<<<<<<<<<<
 *         return vec
 * 
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_vec_setarray(__pyx_v_vec, __pyx_v_array); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 426, __pyx_L1_error)

    /* "PETSc/Vec.pyx":425
 *         cdef Vec vec = type(self)()
 *         CHKERR( VecDuplicate(self.vec, &vec.vec) )
 *         if array is not None:             # <<<<<<<<<<<<<<
 *             vec_setarray(vec, array)
 *         return vec
 */
  }

  /* "PETSc/Vec.pyx":427
 *         if array is not None:
 *             vec_setarray(vec, array)
 *         return vec             # <<<<<<<<<<<<<<
 * 
 *     def copy(self, Vec result=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = ((PyObject *)__pyx_v_vec);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":422
 *             raise ValueError("Invalid mode: expected 'rw', 'r', or 'w'")
 * 
 *     def duplicate(self, array=None):             # <<<<<<<<<<<<<<
 *         cdef Vec vec = type(self)()
 *         CHKERR( VecDuplicate(self.vec, &vec.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.duplicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":429
 *         return vec
 * 
 *     def copy(self, Vec result=None):             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = type(self)()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_107copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_106copy[] = "Vec.copy(self, Vec result=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_107copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_result = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_result,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscVecObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy") < 0)) __PYX_ERR(30, 429, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_result = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 429, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "result", 0))) __PYX_ERR(30, 429, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_106copy(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_result);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_106copy(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_result) {
  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;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_result);

  /* "PETSc/Vec.pyx":430
 * 
 *     def copy(self, Vec result=None):
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = type(self)()
 *         if result.vec == NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_result) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Vec.pyx":431
 *     def copy(self, Vec result=None):
 *         if result is None:
 *             result = type(self)()             # <<<<<<<<<<<<<<
 *         if result.vec == NULL:
 *             CHKERR( VecDuplicate(self.vec, &result.vec) )
 */
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __pyx_t_4 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 431, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 431, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(30, 431, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_result, ((struct PyPetscVecObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/Vec.pyx":430
 * 
 *     def copy(self, Vec result=None):
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = type(self)()
 *         if result.vec == NULL:
 */
  }

  /* "PETSc/Vec.pyx":432
 *         if result is None:
 *             result = type(self)()
 *         if result.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( VecDuplicate(self.vec, &result.vec) )
 *         CHKERR( VecCopy(self.vec, result.vec) )
 */
  __pyx_t_2 = ((__pyx_v_result->vec == NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Vec.pyx":433
 *             result = type(self)()
 *         if result.vec == NULL:
 *             CHKERR( VecDuplicate(self.vec, &result.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecCopy(self.vec, result.vec) )
 *         return result
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecDuplicate(__pyx_v_self->vec, (&__pyx_v_result->vec))); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(30, 433, __pyx_L1_error)

    /* "PETSc/Vec.pyx":432
 *         if result is None:
 *             result = type(self)()
 *         if result.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( VecDuplicate(self.vec, &result.vec) )
 *         CHKERR( VecCopy(self.vec, result.vec) )
 */
  }

  /* "PETSc/Vec.pyx":434
 *         if result.vec == NULL:
 *             CHKERR( VecDuplicate(self.vec, &result.vec) )
 *         CHKERR( VecCopy(self.vec, result.vec) )             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCopy(__pyx_v_self->vec, __pyx_v_result->vec)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(30, 434, __pyx_L1_error)

  /* "PETSc/Vec.pyx":435
 *             CHKERR( VecDuplicate(self.vec, &result.vec) )
 *         CHKERR( VecCopy(self.vec, result.vec) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def chop(self, tol):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":429
 *         return vec
 * 
 *     def copy(self, Vec result=None):             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = type(self)()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.copy", __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;
}

/* "PETSc/Vec.pyx":437
 *         return result
 * 
 *     def chop(self, tol):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(tol)
 *         CHKERR( VecChop(self.vec, rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_109chop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_108chop[] = "Vec.chop(self, tol)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_109chop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tol,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);
        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_tol)) != 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, "chop") < 0)) __PYX_ERR(30, 437, __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_tol = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chop", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 437, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.chop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_108chop(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_tol);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_108chop(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_tol) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("chop", 0);

  /* "PETSc/Vec.pyx":438
 * 
 *     def chop(self, tol):
 *         cdef PetscReal rval = asReal(tol)             # <<<<<<<<<<<<<<
 *         CHKERR( VecChop(self.vec, rval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_tol); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(30, 438, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/Vec.pyx":439
 *     def chop(self, tol):
 *         cdef PetscReal rval = asReal(tol)
 *         CHKERR( VecChop(self.vec, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def load(self, Viewer viewer not None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecChop(__pyx_v_self->vec, __pyx_v_rval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 439, __pyx_L1_error)

  /* "PETSc/Vec.pyx":437
 *         return result
 * 
 *     def chop(self, tol):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(tol)
 *         CHKERR( VecChop(self.vec, rval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.chop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":441
 *         CHKERR( VecChop(self.vec, rval) )
 * 
 *     def load(self, Viewer viewer not None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_111load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_110load[] = "Vec.load(self, Viewer viewer)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_111load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,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);
        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_viewer)) != 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, "load") < 0)) __PYX_ERR(30, 441, __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_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 441, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 0, "viewer", 0))) __PYX_ERR(30, 441, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_110load(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_110load(struct PyPetscVecObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  MPI_Comm __pyx_v_comm;
  PetscObject __pyx_v_obj;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("load", 0);

  /* "PETSc/Vec.pyx":442
 * 
 *     def load(self, Viewer viewer not None):
 *         cdef MPI_Comm comm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 *         if self.vec == NULL:
 */
  __pyx_v_comm = MPI_COMM_NULL;

  /* "PETSc/Vec.pyx":443
 *     def load(self, Viewer viewer not None):
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)             # <<<<<<<<<<<<<<
 *         if self.vec == NULL:
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 */
  __pyx_v_obj = ((PetscObject)__pyx_v_viewer->vwr);

  /* "PETSc/Vec.pyx":444
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 *         if self.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 *             CHKERR( VecCreate(comm, &self.vec) )
 */
  __pyx_t_1 = ((__pyx_v_self->vec == NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Vec.pyx":445
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 *         if self.vec == NULL:
 *             CHKERR( PetscObjectGetComm(obj, &comm) )             # <<<<<<<<<<<<<<
 *             CHKERR( VecCreate(comm, &self.vec) )
 *         CHKERR( VecLoad(self.vec, viewer.vwr) )
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetComm(__pyx_v_obj, (&__pyx_v_comm))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 445, __pyx_L1_error)

    /* "PETSc/Vec.pyx":446
 *         if self.vec == NULL:
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 *             CHKERR( VecCreate(comm, &self.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecLoad(self.vec, viewer.vwr) )
 *         return self
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreate(__pyx_v_comm, (&__pyx_v_self->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 446, __pyx_L1_error)

    /* "PETSc/Vec.pyx":444
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 *         if self.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 *             CHKERR( VecCreate(comm, &self.vec) )
 */
  }

  /* "PETSc/Vec.pyx":447
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 *             CHKERR( VecCreate(comm, &self.vec) )
 *         CHKERR( VecLoad(self.vec, viewer.vwr) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecLoad(__pyx_v_self->vec, __pyx_v_viewer->vwr)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 447, __pyx_L1_error)

  /* "PETSc/Vec.pyx":448
 *             CHKERR( VecCreate(comm, &self.vec) )
 *         CHKERR( VecLoad(self.vec, viewer.vwr) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def equal(self, Vec vec not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":441
 *         CHKERR( VecChop(self.vec, rval) )
 * 
 *     def load(self, Viewer viewer not None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":450
 *         return self
 * 
 *     def equal(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( VecEqual(self.vec, vec.vec, &flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_113equal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_112equal[] = "Vec.equal(self, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_113equal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("equal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "equal") < 0)) __PYX_ERR(30, 450, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("equal", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 450, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(30, 450, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_112equal(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_112equal(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("equal", 0);

  /* "PETSc/Vec.pyx":451
 * 
 *     def equal(self, Vec vec not None):
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( VecEqual(self.vec, vec.vec, &flag) )
 *         return <bint> flag
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/Vec.pyx":452
 *     def equal(self, Vec vec not None):
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( VecEqual(self.vec, vec.vec, &flag) )             # <<<<<<<<<<<<<<
 *         return <bint> flag
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecEqual(__pyx_v_self->vec, __pyx_v_vec->vec, (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 452, __pyx_L1_error)

  /* "PETSc/Vec.pyx":453
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( VecEqual(self.vec, vec.vec, &flag) )
 *         return <bint> flag             # <<<<<<<<<<<<<<
 * 
 *     def dot(self, Vec vec not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":450
 *         return self
 * 
 *     def equal(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( VecEqual(self.vec, vec.vec, &flag) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":455
 *         return <bint> flag
 * 
 *     def dot(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecDot(self.vec, vec.vec, &sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_115dot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_114dot[] = "Vec.dot(self, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_115dot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dot (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "dot") < 0)) __PYX_ERR(30, 455, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dot", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 455, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(30, 455, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_114dot(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_114dot(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("dot", 0);

  /* "PETSc/Vec.pyx":456
 * 
 *     def dot(self, Vec vec not None):
 *         cdef PetscScalar sval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecDot(self.vec, vec.vec, &sval) )
 *         return toScalar(sval)
 */
  __pyx_v_sval = 0.0;

  /* "PETSc/Vec.pyx":457
 *     def dot(self, Vec vec not None):
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecDot(self.vec, vec.vec, &sval) )             # <<<<<<<<<<<<<<
 *         return toScalar(sval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecDot(__pyx_v_self->vec, __pyx_v_vec->vec, (&__pyx_v_sval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 457, __pyx_L1_error)

  /* "PETSc/Vec.pyx":458
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecDot(self.vec, vec.vec, &sval) )
 *         return toScalar(sval)             # <<<<<<<<<<<<<<
 * 
 *     def dotBegin(self, Vec vec not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toScalar(__pyx_v_sval); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":455
 *         return <bint> flag
 * 
 *     def dot(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecDot(self.vec, vec.vec, &sval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":460
 *         return toScalar(sval)
 * 
 *     def dotBegin(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecDotBegin(self.vec, vec.vec, &sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_117dotBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_116dotBegin[] = "Vec.dotBegin(self, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_117dotBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dotBegin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "dotBegin") < 0)) __PYX_ERR(30, 460, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dotBegin", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 460, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.dotBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(30, 460, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_116dotBegin(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_116dotBegin(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("dotBegin", 0);

  /* "PETSc/Vec.pyx":461
 * 
 *     def dotBegin(self, Vec vec not None):
 *         cdef PetscScalar sval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecDotBegin(self.vec, vec.vec, &sval) )
 * 
 */
  __pyx_v_sval = 0.0;

  /* "PETSc/Vec.pyx":462
 *     def dotBegin(self, Vec vec not None):
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecDotBegin(self.vec, vec.vec, &sval) )             # <<<<<<<<<<<<<<
 * 
 *     def dotEnd(self, Vec vec not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecDotBegin(__pyx_v_self->vec, __pyx_v_vec->vec, (&__pyx_v_sval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 462, __pyx_L1_error)

  /* "PETSc/Vec.pyx":460
 *         return toScalar(sval)
 * 
 *     def dotBegin(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecDotBegin(self.vec, vec.vec, &sval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.dotBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":464
 *         CHKERR( VecDotBegin(self.vec, vec.vec, &sval) )
 * 
 *     def dotEnd(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecDotEnd(self.vec, vec.vec, &sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_119dotEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_118dotEnd[] = "Vec.dotEnd(self, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_119dotEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dotEnd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "dotEnd") < 0)) __PYX_ERR(30, 464, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dotEnd", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 464, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.dotEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(30, 464, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_118dotEnd(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_118dotEnd(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("dotEnd", 0);

  /* "PETSc/Vec.pyx":465
 * 
 *     def dotEnd(self, Vec vec not None):
 *         cdef PetscScalar sval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecDotEnd(self.vec, vec.vec, &sval) )
 *         return toScalar(sval)
 */
  __pyx_v_sval = 0.0;

  /* "PETSc/Vec.pyx":466
 *     def dotEnd(self, Vec vec not None):
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecDotEnd(self.vec, vec.vec, &sval) )             # <<<<<<<<<<<<<<
 *         return toScalar(sval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecDotEnd(__pyx_v_self->vec, __pyx_v_vec->vec, (&__pyx_v_sval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 466, __pyx_L1_error)

  /* "PETSc/Vec.pyx":467
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecDotEnd(self.vec, vec.vec, &sval) )
 *         return toScalar(sval)             # <<<<<<<<<<<<<<
 * 
 *     def tDot(self, Vec vec not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toScalar(__pyx_v_sval); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":464
 *         CHKERR( VecDotBegin(self.vec, vec.vec, &sval) )
 * 
 *     def dotEnd(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecDotEnd(self.vec, vec.vec, &sval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.dotEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":469
 *         return toScalar(sval)
 * 
 *     def tDot(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecTDot(self.vec, vec.vec, &sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_121tDot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_120tDot[] = "Vec.tDot(self, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_121tDot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tDot (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "tDot") < 0)) __PYX_ERR(30, 469, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tDot", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 469, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.tDot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(30, 469, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_120tDot(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_120tDot(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("tDot", 0);

  /* "PETSc/Vec.pyx":470
 * 
 *     def tDot(self, Vec vec not None):
 *         cdef PetscScalar sval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecTDot(self.vec, vec.vec, &sval) )
 *         return toScalar(sval)
 */
  __pyx_v_sval = 0.0;

  /* "PETSc/Vec.pyx":471
 *     def tDot(self, Vec vec not None):
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecTDot(self.vec, vec.vec, &sval) )             # <<<<<<<<<<<<<<
 *         return toScalar(sval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecTDot(__pyx_v_self->vec, __pyx_v_vec->vec, (&__pyx_v_sval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 471, __pyx_L1_error)

  /* "PETSc/Vec.pyx":472
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecTDot(self.vec, vec.vec, &sval) )
 *         return toScalar(sval)             # <<<<<<<<<<<<<<
 * 
 *     def tDotBegin(self, Vec vec not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toScalar(__pyx_v_sval); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":469
 *         return toScalar(sval)
 * 
 *     def tDot(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecTDot(self.vec, vec.vec, &sval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.tDot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":474
 *         return toScalar(sval)
 * 
 *     def tDotBegin(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecTDotBegin(self.vec, vec.vec, &sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_123tDotBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_122tDotBegin[] = "Vec.tDotBegin(self, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_123tDotBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tDotBegin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "tDotBegin") < 0)) __PYX_ERR(30, 474, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tDotBegin", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 474, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.tDotBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(30, 474, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_122tDotBegin(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_122tDotBegin(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("tDotBegin", 0);

  /* "PETSc/Vec.pyx":475
 * 
 *     def tDotBegin(self, Vec vec not None):
 *         cdef PetscScalar sval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecTDotBegin(self.vec, vec.vec, &sval) )
 * 
 */
  __pyx_v_sval = 0.0;

  /* "PETSc/Vec.pyx":476
 *     def tDotBegin(self, Vec vec not None):
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecTDotBegin(self.vec, vec.vec, &sval) )             # <<<<<<<<<<<<<<
 * 
 *     def tDotEnd(self, Vec vec not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecTDotBegin(__pyx_v_self->vec, __pyx_v_vec->vec, (&__pyx_v_sval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 476, __pyx_L1_error)

  /* "PETSc/Vec.pyx":474
 *         return toScalar(sval)
 * 
 *     def tDotBegin(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecTDotBegin(self.vec, vec.vec, &sval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.tDotBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":478
 *         CHKERR( VecTDotBegin(self.vec, vec.vec, &sval) )
 * 
 *     def tDotEnd(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecTDotEnd(self.vec, vec.vec, &sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_125tDotEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_124tDotEnd[] = "Vec.tDotEnd(self, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_125tDotEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tDotEnd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "tDotEnd") < 0)) __PYX_ERR(30, 478, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tDotEnd", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 478, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.tDotEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(30, 478, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_124tDotEnd(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_124tDotEnd(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("tDotEnd", 0);

  /* "PETSc/Vec.pyx":479
 * 
 *     def tDotEnd(self, Vec vec not None):
 *         cdef PetscScalar sval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecTDotEnd(self.vec, vec.vec, &sval) )
 *         return toScalar(sval)
 */
  __pyx_v_sval = 0.0;

  /* "PETSc/Vec.pyx":480
 *     def tDotEnd(self, Vec vec not None):
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecTDotEnd(self.vec, vec.vec, &sval) )             # <<<<<<<<<<<<<<
 *         return toScalar(sval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecTDotEnd(__pyx_v_self->vec, __pyx_v_vec->vec, (&__pyx_v_sval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 480, __pyx_L1_error)

  /* "PETSc/Vec.pyx":481
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecTDotEnd(self.vec, vec.vec, &sval) )
 *         return toScalar(sval)             # <<<<<<<<<<<<<<
 * 
 *     def mDot(self, vecs, out=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toScalar(__pyx_v_sval); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":478
 *         CHKERR( VecTDotBegin(self.vec, vec.vec, &sval) )
 * 
 *     def tDotEnd(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecTDotEnd(self.vec, vec.vec, &sval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.tDotEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":483
 *         return toScalar(sval)
 * 
 *     def mDot(self, vecs, out=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_127mDot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_126mDot[] = "Vec.mDot(self, vecs, out=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_127mDot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vecs = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mDot (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vecs,&__pyx_n_s_out,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vecs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mDot") < 0)) __PYX_ERR(30, 483, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_vecs = values[0];
    __pyx_v_out = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mDot", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 483, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.mDot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_126mDot(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vecs, __pyx_v_out);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_126mDot(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_out) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mDot", 0);

  /* "PETSc/Vec.pyx":484
 * 
 *     def mDot(self, vecs, out=None):
 *         <void>self; <void>vecs; <void>out; # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_vecs);
  ((void)__pyx_v_out);

  /* "PETSc/Vec.pyx":485
 *     def mDot(self, vecs, out=None):
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def mDotBegin(self, vecs, out=None):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(30, 485, __pyx_L1_error)

  /* "PETSc/Vec.pyx":483
 *         return toScalar(sval)
 * 
 *     def mDot(self, vecs, out=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.mDot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":487
 *         raise NotImplementedError
 * 
 *     def mDotBegin(self, vecs, out=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_129mDotBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_128mDotBegin[] = "Vec.mDotBegin(self, vecs, out=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_129mDotBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vecs = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mDotBegin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vecs,&__pyx_n_s_out,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vecs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mDotBegin") < 0)) __PYX_ERR(30, 487, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_vecs = values[0];
    __pyx_v_out = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mDotBegin", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 487, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.mDotBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_128mDotBegin(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vecs, __pyx_v_out);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_128mDotBegin(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_out) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mDotBegin", 0);

  /* "PETSc/Vec.pyx":488
 * 
 *     def mDotBegin(self, vecs, out=None):
 *         <void>self; <void>vecs; <void>out; # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_vecs);
  ((void)__pyx_v_out);

  /* "PETSc/Vec.pyx":489
 *     def mDotBegin(self, vecs, out=None):
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def mDotEnd(self, vecs, out=None):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(30, 489, __pyx_L1_error)

  /* "PETSc/Vec.pyx":487
 *         raise NotImplementedError
 * 
 *     def mDotBegin(self, vecs, out=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.mDotBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":491
 *         raise NotImplementedError
 * 
 *     def mDotEnd(self, vecs, out=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_131mDotEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_130mDotEnd[] = "Vec.mDotEnd(self, vecs, out=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_131mDotEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vecs = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mDotEnd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vecs,&__pyx_n_s_out,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vecs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mDotEnd") < 0)) __PYX_ERR(30, 491, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_vecs = values[0];
    __pyx_v_out = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mDotEnd", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 491, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.mDotEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_130mDotEnd(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vecs, __pyx_v_out);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_130mDotEnd(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_out) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mDotEnd", 0);

  /* "PETSc/Vec.pyx":492
 * 
 *     def mDotEnd(self, vecs, out=None):
 *         <void>self; <void>vecs; <void>out; # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_vecs);
  ((void)__pyx_v_out);

  /* "PETSc/Vec.pyx":493
 *     def mDotEnd(self, vecs, out=None):
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def mtDot(self, vecs, out=None):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(30, 493, __pyx_L1_error)

  /* "PETSc/Vec.pyx":491
 *         raise NotImplementedError
 * 
 *     def mDotEnd(self, vecs, out=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.mDotEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":495
 *         raise NotImplementedError
 * 
 *     def mtDot(self, vecs, out=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_133mtDot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_132mtDot[] = "Vec.mtDot(self, vecs, out=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_133mtDot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vecs = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mtDot (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vecs,&__pyx_n_s_out,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vecs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mtDot") < 0)) __PYX_ERR(30, 495, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_vecs = values[0];
    __pyx_v_out = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mtDot", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 495, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.mtDot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_132mtDot(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vecs, __pyx_v_out);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_132mtDot(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_out) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mtDot", 0);

  /* "PETSc/Vec.pyx":496
 * 
 *     def mtDot(self, vecs, out=None):
 *         <void>self; <void>vecs; <void>out; # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_vecs);
  ((void)__pyx_v_out);

  /* "PETSc/Vec.pyx":497
 *     def mtDot(self, vecs, out=None):
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def mtDotBegin(self, vecs, out=None):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(30, 497, __pyx_L1_error)

  /* "PETSc/Vec.pyx":495
 *         raise NotImplementedError
 * 
 *     def mtDot(self, vecs, out=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.mtDot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":499
 *         raise NotImplementedError
 * 
 *     def mtDotBegin(self, vecs, out=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_135mtDotBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_134mtDotBegin[] = "Vec.mtDotBegin(self, vecs, out=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_135mtDotBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vecs = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mtDotBegin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vecs,&__pyx_n_s_out,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vecs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mtDotBegin") < 0)) __PYX_ERR(30, 499, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_vecs = values[0];
    __pyx_v_out = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mtDotBegin", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 499, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.mtDotBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_134mtDotBegin(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vecs, __pyx_v_out);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_134mtDotBegin(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_out) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mtDotBegin", 0);

  /* "PETSc/Vec.pyx":500
 * 
 *     def mtDotBegin(self, vecs, out=None):
 *         <void>self; <void>vecs; <void>out; # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_vecs);
  ((void)__pyx_v_out);

  /* "PETSc/Vec.pyx":501
 *     def mtDotBegin(self, vecs, out=None):
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def mtDotEnd(self, vecs, out=None):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(30, 501, __pyx_L1_error)

  /* "PETSc/Vec.pyx":499
 *         raise NotImplementedError
 * 
 *     def mtDotBegin(self, vecs, out=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.mtDotBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":503
 *         raise NotImplementedError
 * 
 *     def mtDotEnd(self, vecs, out=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_137mtDotEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_136mtDotEnd[] = "Vec.mtDotEnd(self, vecs, out=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_137mtDotEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vecs = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mtDotEnd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vecs,&__pyx_n_s_out,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vecs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mtDotEnd") < 0)) __PYX_ERR(30, 503, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_vecs = values[0];
    __pyx_v_out = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mtDotEnd", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 503, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.mtDotEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_136mtDotEnd(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vecs, __pyx_v_out);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_136mtDotEnd(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_vecs, PyObject *__pyx_v_out) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mtDotEnd", 0);

  /* "PETSc/Vec.pyx":504
 * 
 *     def mtDotEnd(self, vecs, out=None):
 *         <void>self; <void>vecs; <void>out; # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_vecs);
  ((void)__pyx_v_out);

  /* "PETSc/Vec.pyx":505
 *     def mtDotEnd(self, vecs, out=None):
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def norm(self, norm_type=None):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(30, 505, __pyx_L1_error)

  /* "PETSc/Vec.pyx":503
 *         raise NotImplementedError
 * 
 *     def mtDotEnd(self, vecs, out=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>vecs; <void>out; # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.mtDotEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":507
 *         raise NotImplementedError
 * 
 *     def norm(self, norm_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_2
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_139norm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_138norm[] = "Vec.norm(self, norm_type=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_139norm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_norm_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("norm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_norm_type,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_norm_type);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "norm") < 0)) __PYX_ERR(30, 507, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_norm_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("norm", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 507, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_138norm(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_norm_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_138norm(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_norm_type) {
  NormType __pyx_v_norm_1_2;
  NormType __pyx_v_ntype;
  PetscReal __pyx_v_rval[2];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  NormType __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("norm", 0);

  /* "PETSc/Vec.pyx":508
 * 
 *     def norm(self, norm_type=None):
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2             # <<<<<<<<<<<<<<
 *         cdef PetscNormType ntype = PETSC_NORM_2
 *         if norm_type is not None: ntype = norm_type
 */
  __pyx_v_norm_1_2 = NORM_1_AND_2;

  /* "PETSc/Vec.pyx":509
 *     def norm(self, norm_type=None):
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_2             # <<<<<<<<<<<<<<
 *         if norm_type is not None: ntype = norm_type
 *         cdef PetscReal rval[2]
 */
  __pyx_v_ntype = NORM_2;

  /* "PETSc/Vec.pyx":510
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_2
 *         if norm_type is not None: ntype = norm_type             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval[2]
 *         CHKERR( VecNorm(self.vec, ntype, rval) )
 */
  __pyx_t_1 = (__pyx_v_norm_type != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = ((NormType)__Pyx_PyInt_As_NormType(__pyx_v_norm_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 510, __pyx_L1_error)
    __pyx_v_ntype = __pyx_t_3;
  }

  /* "PETSc/Vec.pyx":512
 *         if norm_type is not None: ntype = norm_type
 *         cdef PetscReal rval[2]
 *         CHKERR( VecNorm(self.vec, ntype, rval) )             # <<<<<<<<<<<<<<
 *         if ntype != norm_1_2: return toReal(rval[0])
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecNorm(__pyx_v_self->vec, __pyx_v_ntype, __pyx_v_rval)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 512, __pyx_L1_error)

  /* "PETSc/Vec.pyx":513
 *         cdef PetscReal rval[2]
 *         CHKERR( VecNorm(self.vec, ntype, rval) )
 *         if ntype != norm_1_2: return toReal(rval[0])             # <<<<<<<<<<<<<<
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 * 
 */
  __pyx_t_2 = ((__pyx_v_ntype != __pyx_v_norm_1_2) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_rval[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":514
 *         CHKERR( VecNorm(self.vec, ntype, rval) )
 *         if ntype != norm_1_2: return toReal(rval[0])
 *         else: return (toReal(rval[0]), toReal(rval[1]))             # <<<<<<<<<<<<<<
 * 
 *     def normBegin(self, norm_type=None):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_rval[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_rval[1])); if (unlikely(!__pyx_t_6)) __PYX_ERR(30, 514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(30, 514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":507
 *         raise NotImplementedError
 * 
 *     def norm(self, norm_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":516
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 * 
 *     def normBegin(self, norm_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscNormType ntype = PETSC_NORM_2
 *         if norm_type is not None: ntype = norm_type
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_141normBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_140normBegin[] = "Vec.normBegin(self, norm_type=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_141normBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_norm_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normBegin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_norm_type,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_norm_type);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "normBegin") < 0)) __PYX_ERR(30, 516, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_norm_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("normBegin", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 516, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.normBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_140normBegin(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_norm_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_140normBegin(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_norm_type) {
  NormType __pyx_v_ntype;
  PetscReal __pyx_v_dummy[2];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  NormType __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("normBegin", 0);

  /* "PETSc/Vec.pyx":517
 * 
 *     def normBegin(self, norm_type=None):
 *         cdef PetscNormType ntype = PETSC_NORM_2             # <<<<<<<<<<<<<<
 *         if norm_type is not None: ntype = norm_type
 *         cdef PetscReal dummy[2]
 */
  __pyx_v_ntype = NORM_2;

  /* "PETSc/Vec.pyx":518
 *     def normBegin(self, norm_type=None):
 *         cdef PetscNormType ntype = PETSC_NORM_2
 *         if norm_type is not None: ntype = norm_type             # <<<<<<<<<<<<<<
 *         cdef PetscReal dummy[2]
 *         CHKERR( VecNormBegin(self.vec, ntype, dummy) )
 */
  __pyx_t_1 = (__pyx_v_norm_type != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = ((NormType)__Pyx_PyInt_As_NormType(__pyx_v_norm_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 518, __pyx_L1_error)
    __pyx_v_ntype = __pyx_t_3;
  }

  /* "PETSc/Vec.pyx":520
 *         if norm_type is not None: ntype = norm_type
 *         cdef PetscReal dummy[2]
 *         CHKERR( VecNormBegin(self.vec, ntype, dummy) )             # <<<<<<<<<<<<<<
 * 
 *     def normEnd(self, norm_type=None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecNormBegin(__pyx_v_self->vec, __pyx_v_ntype, __pyx_v_dummy)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 520, __pyx_L1_error)

  /* "PETSc/Vec.pyx":516
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 * 
 *     def normBegin(self, norm_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscNormType ntype = PETSC_NORM_2
 *         if norm_type is not None: ntype = norm_type
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.normBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":522
 *         CHKERR( VecNormBegin(self.vec, ntype, dummy) )
 * 
 *     def normEnd(self, norm_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_2
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_143normEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_142normEnd[] = "Vec.normEnd(self, norm_type=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_143normEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_norm_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normEnd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_norm_type,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_norm_type);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "normEnd") < 0)) __PYX_ERR(30, 522, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_norm_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("normEnd", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 522, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.normEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_142normEnd(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_norm_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_142normEnd(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_norm_type) {
  NormType __pyx_v_norm_1_2;
  NormType __pyx_v_ntype;
  PetscReal __pyx_v_rval[2];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  NormType __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("normEnd", 0);

  /* "PETSc/Vec.pyx":523
 * 
 *     def normEnd(self, norm_type=None):
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2             # <<<<<<<<<<<<<<
 *         cdef PetscNormType ntype = PETSC_NORM_2
 *         if norm_type is not None: ntype = norm_type
 */
  __pyx_v_norm_1_2 = NORM_1_AND_2;

  /* "PETSc/Vec.pyx":524
 *     def normEnd(self, norm_type=None):
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_2             # <<<<<<<<<<<<<<
 *         if norm_type is not None: ntype = norm_type
 *         cdef PetscReal rval[2]
 */
  __pyx_v_ntype = NORM_2;

  /* "PETSc/Vec.pyx":525
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_2
 *         if norm_type is not None: ntype = norm_type             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval[2]
 *         CHKERR( VecNormEnd(self.vec, ntype, rval) )
 */
  __pyx_t_1 = (__pyx_v_norm_type != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = ((NormType)__Pyx_PyInt_As_NormType(__pyx_v_norm_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 525, __pyx_L1_error)
    __pyx_v_ntype = __pyx_t_3;
  }

  /* "PETSc/Vec.pyx":527
 *         if norm_type is not None: ntype = norm_type
 *         cdef PetscReal rval[2]
 *         CHKERR( VecNormEnd(self.vec, ntype, rval) )             # <<<<<<<<<<<<<<
 *         if ntype != norm_1_2: return toReal(rval[0])
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecNormEnd(__pyx_v_self->vec, __pyx_v_ntype, __pyx_v_rval)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 527, __pyx_L1_error)

  /* "PETSc/Vec.pyx":528
 *         cdef PetscReal rval[2]
 *         CHKERR( VecNormEnd(self.vec, ntype, rval) )
 *         if ntype != norm_1_2: return toReal(rval[0])             # <<<<<<<<<<<<<<
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 * 
 */
  __pyx_t_2 = ((__pyx_v_ntype != __pyx_v_norm_1_2) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_rval[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":529
 *         CHKERR( VecNormEnd(self.vec, ntype, rval) )
 *         if ntype != norm_1_2: return toReal(rval[0])
 *         else: return (toReal(rval[0]), toReal(rval[1]))             # <<<<<<<<<<<<<<
 * 
 *     def sum(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_rval[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_rval[1])); if (unlikely(!__pyx_t_6)) __PYX_ERR(30, 529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(30, 529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":522
 *         CHKERR( VecNormBegin(self.vec, ntype, dummy) )
 * 
 *     def normEnd(self, norm_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.normEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":531
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 * 
 *     def sum(self):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecSum(self.vec, &sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_145sum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_144sum[] = "Vec.sum(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_145sum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sum (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("sum", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "sum", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_144sum(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_144sum(struct PyPetscVecObject *__pyx_v_self) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("sum", 0);

  /* "PETSc/Vec.pyx":532
 * 
 *     def sum(self):
 *         cdef PetscScalar sval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecSum(self.vec, &sval) )
 *         return toScalar(sval)
 */
  __pyx_v_sval = 0.0;

  /* "PETSc/Vec.pyx":533
 *     def sum(self):
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecSum(self.vec, &sval) )             # <<<<<<<<<<<<<<
 *         return toScalar(sval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSum(__pyx_v_self->vec, (&__pyx_v_sval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 533, __pyx_L1_error)

  /* "PETSc/Vec.pyx":534
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecSum(self.vec, &sval) )
 *         return toScalar(sval)             # <<<<<<<<<<<<<<
 * 
 *     def min(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toScalar(__pyx_v_sval); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":531
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 * 
 *     def sum(self):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecSum(self.vec, &sval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":536
 *         return toScalar(sval)
 * 
 *     def min(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_147min(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_146min[] = "Vec.min(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_147min(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("min (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("min", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "min", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_146min(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_146min(struct PyPetscVecObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PetscReal __pyx_v_rval;
  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;
  __Pyx_RefNannySetupContext("min", 0);

  /* "PETSc/Vec.pyx":537
 * 
 *     def min(self):
 *         cdef PetscInt  ival = 0             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( VecMin(self.vec, &ival, &rval) )
 */
  __pyx_v_ival = 0;

  /* "PETSc/Vec.pyx":538
 *     def min(self):
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecMin(self.vec, &ival, &rval) )
 *         return (toInt(ival), toReal(rval))
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/Vec.pyx":539
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0
 *         CHKERR( VecMin(self.vec, &ival, &rval) )             # <<<<<<<<<<<<<<
 *         return (toInt(ival), toReal(rval))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecMin(__pyx_v_self->vec, (&__pyx_v_ival), (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 539, __pyx_L1_error)

  /* "PETSc/Vec.pyx":540
 *         cdef PetscReal rval = 0
 *         CHKERR( VecMin(self.vec, &ival, &rval) )
 *         return (toInt(ival), toReal(rval))             # <<<<<<<<<<<<<<
 * 
 *     def max(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 540, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":536
 *         return toScalar(sval)
 * 
 *     def min(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":542
 *         return (toInt(ival), toReal(rval))
 * 
 *     def max(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_149max(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_148max[] = "Vec.max(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_149max(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("max (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("max", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "max", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_148max(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_148max(struct PyPetscVecObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PetscReal __pyx_v_rval;
  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;
  __Pyx_RefNannySetupContext("max", 0);

  /* "PETSc/Vec.pyx":543
 * 
 *     def max(self):
 *         cdef PetscInt  ival = 0             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( VecMax(self.vec, &ival, &rval) )
 */
  __pyx_v_ival = 0;

  /* "PETSc/Vec.pyx":544
 *     def max(self):
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecMax(self.vec, &ival, &rval) )
 *         return (toInt(ival), toReal(rval))
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/Vec.pyx":545
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0
 *         CHKERR( VecMax(self.vec, &ival, &rval) )             # <<<<<<<<<<<<<<
 *         return (toInt(ival), toReal(rval))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecMax(__pyx_v_self->vec, (&__pyx_v_ival), (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 545, __pyx_L1_error)

  /* "PETSc/Vec.pyx":546
 *         cdef PetscReal rval = 0
 *         CHKERR( VecMax(self.vec, &ival, &rval) )
 *         return (toInt(ival), toReal(rval))             # <<<<<<<<<<<<<<
 * 
 *     def normalize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 546, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":542
 *         return (toInt(ival), toReal(rval))
 * 
 *     def max(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":548
 *         return (toInt(ival), toReal(rval))
 * 
 *     def normalize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( VecNormalize(self.vec, &rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_151normalize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_150normalize[] = "Vec.normalize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_151normalize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normalize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("normalize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "normalize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_150normalize(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_150normalize(struct PyPetscVecObject *__pyx_v_self) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("normalize", 0);

  /* "PETSc/Vec.pyx":549
 * 
 *     def normalize(self):
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecNormalize(self.vec, &rval) )
 *         return toReal(rval)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/Vec.pyx":550
 *     def normalize(self):
 *         cdef PetscReal rval = 0
 *         CHKERR( VecNormalize(self.vec, &rval) )             # <<<<<<<<<<<<<<
 *         return toReal(rval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecNormalize(__pyx_v_self->vec, (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 550, __pyx_L1_error)

  /* "PETSc/Vec.pyx":551
 *         cdef PetscReal rval = 0
 *         CHKERR( VecNormalize(self.vec, &rval) )
 *         return toReal(rval)             # <<<<<<<<<<<<<<
 * 
 *     def reciprocal(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":548
 *         return (toInt(ival), toReal(rval))
 * 
 *     def normalize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( VecNormalize(self.vec, &rval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.normalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":553
 *         return toReal(rval)
 * 
 *     def reciprocal(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecReciprocal(self.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_153reciprocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_152reciprocal[] = "Vec.reciprocal(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_153reciprocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reciprocal (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("reciprocal", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "reciprocal", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_152reciprocal(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_152reciprocal(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("reciprocal", 0);

  /* "PETSc/Vec.pyx":554
 * 
 *     def reciprocal(self):
 *         CHKERR( VecReciprocal(self.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def exp(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecReciprocal(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 554, __pyx_L1_error)

  /* "PETSc/Vec.pyx":553
 *         return toReal(rval)
 * 
 *     def reciprocal(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecReciprocal(self.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.reciprocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":556
 *         CHKERR( VecReciprocal(self.vec) )
 * 
 *     def exp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecExp(self.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_155exp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_154exp[] = "Vec.exp(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_155exp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("exp (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("exp", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "exp", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_154exp(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_154exp(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("exp", 0);

  /* "PETSc/Vec.pyx":557
 * 
 *     def exp(self):
 *         CHKERR( VecExp(self.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def log(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecExp(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 557, __pyx_L1_error)

  /* "PETSc/Vec.pyx":556
 *         CHKERR( VecReciprocal(self.vec) )
 * 
 *     def exp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecExp(self.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.exp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":559
 *         CHKERR( VecExp(self.vec) )
 * 
 *     def log(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecLog(self.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_157log(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_156log[] = "Vec.log(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_157log(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("log (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("log", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "log", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_156log(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_156log(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("log", 0);

  /* "PETSc/Vec.pyx":560
 * 
 *     def log(self):
 *         CHKERR( VecLog(self.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def sqrtabs(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecLog(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 560, __pyx_L1_error)

  /* "PETSc/Vec.pyx":559
 *         CHKERR( VecExp(self.vec) )
 * 
 *     def log(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecLog(self.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":562
 *         CHKERR( VecLog(self.vec) )
 * 
 *     def sqrtabs(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecSqrtAbs(self.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_159sqrtabs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_158sqrtabs[] = "Vec.sqrtabs(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_159sqrtabs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sqrtabs (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("sqrtabs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "sqrtabs", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_158sqrtabs(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_158sqrtabs(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("sqrtabs", 0);

  /* "PETSc/Vec.pyx":563
 * 
 *     def sqrtabs(self):
 *         CHKERR( VecSqrtAbs(self.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def abs(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSqrtAbs(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 563, __pyx_L1_error)

  /* "PETSc/Vec.pyx":562
 *         CHKERR( VecLog(self.vec) )
 * 
 *     def sqrtabs(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecSqrtAbs(self.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.sqrtabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":565
 *         CHKERR( VecSqrtAbs(self.vec) )
 * 
 *     def abs(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecAbs(self.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_161abs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_160abs[] = "Vec.abs(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_161abs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("abs (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("abs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "abs", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_160abs(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_160abs(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("abs", 0);

  /* "PETSc/Vec.pyx":566
 * 
 *     def abs(self):
 *         CHKERR( VecAbs(self.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def conjugate(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAbs(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 566, __pyx_L1_error)

  /* "PETSc/Vec.pyx":565
 *         CHKERR( VecSqrtAbs(self.vec) )
 * 
 *     def abs(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecAbs(self.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.abs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":568
 *         CHKERR( VecAbs(self.vec) )
 * 
 *     def conjugate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecConjugate(self.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_163conjugate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_162conjugate[] = "Vec.conjugate(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_163conjugate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("conjugate (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("conjugate", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "conjugate", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_162conjugate(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_162conjugate(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("conjugate", 0);

  /* "PETSc/Vec.pyx":569
 * 
 *     def conjugate(self):
 *         CHKERR( VecConjugate(self.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def setRandom(self, Random random=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecConjugate(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 569, __pyx_L1_error)

  /* "PETSc/Vec.pyx":568
 *         CHKERR( VecAbs(self.vec) )
 * 
 *     def conjugate(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecConjugate(self.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.conjugate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":571
 *         CHKERR( VecConjugate(self.vec) )
 * 
 *     def setRandom(self, Random random=None):             # <<<<<<<<<<<<<<
 *         cdef PetscRandom rnd = NULL
 *         if random is not None: rnd = random.rnd
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_165setRandom(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_164setRandom[] = "Vec.setRandom(self, Random random=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_165setRandom(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscRandomObject *__pyx_v_random = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRandom (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_random,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscRandomObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_random);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setRandom") < 0)) __PYX_ERR(30, 571, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_random = ((struct PyPetscRandomObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRandom", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 571, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setRandom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_random), __pyx_ptype_8petsc4py_5PETSc_Random, 1, "random", 0))) __PYX_ERR(30, 571, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_164setRandom(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_random);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_164setRandom(struct PyPetscVecObject *__pyx_v_self, struct PyPetscRandomObject *__pyx_v_random) {
  PetscRandom __pyx_v_rnd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscRandom __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setRandom", 0);

  /* "PETSc/Vec.pyx":572
 * 
 *     def setRandom(self, Random random=None):
 *         cdef PetscRandom rnd = NULL             # <<<<<<<<<<<<<<
 *         if random is not None: rnd = random.rnd
 *         CHKERR( VecSetRandom(self.vec, rnd) )
 */
  __pyx_v_rnd = NULL;

  /* "PETSc/Vec.pyx":573
 *     def setRandom(self, Random random=None):
 *         cdef PetscRandom rnd = NULL
 *         if random is not None: rnd = random.rnd             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetRandom(self.vec, rnd) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_random) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_random->rnd;
    __pyx_v_rnd = __pyx_t_3;
  }

  /* "PETSc/Vec.pyx":574
 *         cdef PetscRandom rnd = NULL
 *         if random is not None: rnd = random.rnd
 *         CHKERR( VecSetRandom(self.vec, rnd) )             # <<<<<<<<<<<<<<
 * 
 *     def permute(self, IS order not None, invert=False):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetRandom(__pyx_v_self->vec, __pyx_v_rnd)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 574, __pyx_L1_error)

  /* "PETSc/Vec.pyx":571
 *         CHKERR( VecConjugate(self.vec) )
 * 
 *     def setRandom(self, Random random=None):             # <<<<<<<<<<<<<<
 *         cdef PetscRandom rnd = NULL
 *         if random is not None: rnd = random.rnd
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setRandom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":576
 *         CHKERR( VecSetRandom(self.vec, rnd) )
 * 
 *     def permute(self, IS order not None, invert=False):             # <<<<<<<<<<<<<<
 *         cdef PetscBool cinvert = PETSC_FALSE
 *         if invert: cinvert = PETSC_TRUE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_167permute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_166permute[] = "Vec.permute(self, IS order, invert=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_167permute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_order = 0;
  PyObject *__pyx_v_invert = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("permute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_order,&__pyx_n_s_invert,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_order)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_invert);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "permute") < 0)) __PYX_ERR(30, 576, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_order = ((struct PyPetscISObject *)values[0]);
    __pyx_v_invert = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("permute", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 576, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.permute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_order), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "order", 0))) __PYX_ERR(30, 576, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_166permute(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_order, __pyx_v_invert);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_166permute(struct PyPetscVecObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_order, PyObject *__pyx_v_invert) {
  PetscBool __pyx_v_cinvert;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("permute", 0);

  /* "PETSc/Vec.pyx":577
 * 
 *     def permute(self, IS order not None, invert=False):
 *         cdef PetscBool cinvert = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if invert: cinvert = PETSC_TRUE
 *         CHKERR( VecPermute(self.vec, order.iset, cinvert) )
 */
  __pyx_v_cinvert = PETSC_FALSE;

  /* "PETSc/Vec.pyx":578
 *     def permute(self, IS order not None, invert=False):
 *         cdef PetscBool cinvert = PETSC_FALSE
 *         if invert: cinvert = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         CHKERR( VecPermute(self.vec, order.iset, cinvert) )
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_invert); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(30, 578, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_v_cinvert = PETSC_TRUE;
  }

  /* "PETSc/Vec.pyx":579
 *         cdef PetscBool cinvert = PETSC_FALSE
 *         if invert: cinvert = PETSC_TRUE
 *         CHKERR( VecPermute(self.vec, order.iset, cinvert) )             # <<<<<<<<<<<<<<
 * 
 *     def zeroEntries(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecPermute(__pyx_v_self->vec, __pyx_v_order->iset, __pyx_v_cinvert)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 579, __pyx_L1_error)

  /* "PETSc/Vec.pyx":576
 *         CHKERR( VecSetRandom(self.vec, rnd) )
 * 
 *     def permute(self, IS order not None, invert=False):             # <<<<<<<<<<<<<<
 *         cdef PetscBool cinvert = PETSC_FALSE
 *         if invert: cinvert = PETSC_TRUE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.permute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":581
 *         CHKERR( VecPermute(self.vec, order.iset, cinvert) )
 * 
 *     def zeroEntries(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecZeroEntries(self.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_169zeroEntries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_168zeroEntries[] = "Vec.zeroEntries(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_169zeroEntries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zeroEntries (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("zeroEntries", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "zeroEntries", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_168zeroEntries(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_168zeroEntries(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("zeroEntries", 0);

  /* "PETSc/Vec.pyx":582
 * 
 *     def zeroEntries(self):
 *         CHKERR( VecZeroEntries(self.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def set(self, alpha):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecZeroEntries(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 582, __pyx_L1_error)

  /* "PETSc/Vec.pyx":581
 *         CHKERR( VecPermute(self.vec, order.iset, cinvert) )
 * 
 *     def zeroEntries(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecZeroEntries(self.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.zeroEntries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":584
 *         CHKERR( VecZeroEntries(self.vec) )
 * 
 *     def set(self, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecSet(self.vec, sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_171set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_170set[] = "Vec.set(self, alpha)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_171set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alpha,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);
        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_alpha)) != 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, "set") < 0)) __PYX_ERR(30, 584, __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_alpha = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 584, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_170set(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_alpha);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_170set(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("set", 0);

  /* "PETSc/Vec.pyx":585
 * 
 *     def set(self, alpha):
 *         cdef PetscScalar sval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         CHKERR( VecSet(self.vec, sval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 585, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Vec.pyx":586
 *     def set(self, alpha):
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecSet(self.vec, sval) )             # <<<<<<<<<<<<<<
 * 
 *     def isset(self, IS idx not None, alpha):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSet(__pyx_v_self->vec, __pyx_v_sval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 586, __pyx_L1_error)

  /* "PETSc/Vec.pyx":584
 *         CHKERR( VecZeroEntries(self.vec) )
 * 
 *     def set(self, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecSet(self.vec, sval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":588
 *         CHKERR( VecSet(self.vec, sval) )
 * 
 *     def isset(self, IS idx not None, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar aval = asScalar(alpha)
 *         CHKERR( VecISSet(self.vec, idx.iset, aval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_173isset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_172isset[] = "Vec.isset(self, IS idx, alpha)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_173isset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_idx = 0;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isset (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_alpha,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_idx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("isset", 1, 2, 2, 1); __PYX_ERR(30, 588, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "isset") < 0)) __PYX_ERR(30, 588, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_idx = ((struct PyPetscISObject *)values[0]);
    __pyx_v_alpha = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("isset", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 588, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.isset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "idx", 0))) __PYX_ERR(30, 588, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_172isset(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_idx, __pyx_v_alpha);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_172isset(struct PyPetscVecObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_idx, PyObject *__pyx_v_alpha) {
  PetscScalar __pyx_v_aval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("isset", 0);

  /* "PETSc/Vec.pyx":589
 * 
 *     def isset(self, IS idx not None, alpha):
 *         cdef PetscScalar aval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         CHKERR( VecISSet(self.vec, idx.iset, aval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 589, __pyx_L1_error)
  __pyx_v_aval = __pyx_t_1;

  /* "PETSc/Vec.pyx":590
 *     def isset(self, IS idx not None, alpha):
 *         cdef PetscScalar aval = asScalar(alpha)
 *         CHKERR( VecISSet(self.vec, idx.iset, aval) )             # <<<<<<<<<<<<<<
 * 
 *     def scale(self, alpha):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecISSet(__pyx_v_self->vec, __pyx_v_idx->iset, __pyx_v_aval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 590, __pyx_L1_error)

  /* "PETSc/Vec.pyx":588
 *         CHKERR( VecSet(self.vec, sval) )
 * 
 *     def isset(self, IS idx not None, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar aval = asScalar(alpha)
 *         CHKERR( VecISSet(self.vec, idx.iset, aval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.isset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":592
 *         CHKERR( VecISSet(self.vec, idx.iset, aval) )
 * 
 *     def scale(self, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecScale(self.vec, sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_175scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_174scale[] = "Vec.scale(self, alpha)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_175scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scale (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alpha,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);
        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_alpha)) != 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, "scale") < 0)) __PYX_ERR(30, 592, __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_alpha = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scale", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 592, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_174scale(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_alpha);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_174scale(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("scale", 0);

  /* "PETSc/Vec.pyx":593
 * 
 *     def scale(self, alpha):
 *         cdef PetscScalar sval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         CHKERR( VecScale(self.vec, sval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 593, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Vec.pyx":594
 *     def scale(self, alpha):
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecScale(self.vec, sval) )             # <<<<<<<<<<<<<<
 * 
 *     def shift(self, alpha):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScale(__pyx_v_self->vec, __pyx_v_sval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 594, __pyx_L1_error)

  /* "PETSc/Vec.pyx":592
 *         CHKERR( VecISSet(self.vec, idx.iset, aval) )
 * 
 *     def scale(self, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecScale(self.vec, sval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":596
 *         CHKERR( VecScale(self.vec, sval) )
 * 
 *     def shift(self, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecShift(self.vec, sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_177shift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_176shift[] = "Vec.shift(self, alpha)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_177shift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alpha,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);
        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_alpha)) != 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, "shift") < 0)) __PYX_ERR(30, 596, __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_alpha = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("shift", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 596, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.shift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_176shift(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_alpha);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_176shift(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("shift", 0);

  /* "PETSc/Vec.pyx":597
 * 
 *     def shift(self, alpha):
 *         cdef PetscScalar sval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         CHKERR( VecShift(self.vec, sval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 597, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Vec.pyx":598
 *     def shift(self, alpha):
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecShift(self.vec, sval) )             # <<<<<<<<<<<<<<
 * 
 *     def chop(self, tol):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecShift(__pyx_v_self->vec, __pyx_v_sval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 598, __pyx_L1_error)

  /* "PETSc/Vec.pyx":596
 *         CHKERR( VecScale(self.vec, sval) )
 * 
 *     def shift(self, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecShift(self.vec, sval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.shift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":600
 *         CHKERR( VecShift(self.vec, sval) )
 * 
 *     def chop(self, tol):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(tol)
 *         CHKERR( VecChop(self.vec, rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_179chop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_178chop[] = "Vec.chop(self, tol)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_179chop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tol,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);
        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_tol)) != 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, "chop") < 0)) __PYX_ERR(30, 600, __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_tol = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chop", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 600, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.chop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_178chop(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_tol);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_178chop(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_tol) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("chop", 0);

  /* "PETSc/Vec.pyx":601
 * 
 *     def chop(self, tol):
 *         cdef PetscReal rval = asReal(tol)             # <<<<<<<<<<<<<<
 *         CHKERR( VecChop(self.vec, rval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_tol); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(30, 601, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/Vec.pyx":602
 *     def chop(self, tol):
 *         cdef PetscReal rval = asReal(tol)
 *         CHKERR( VecChop(self.vec, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def swap(self, Vec vec not None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecChop(__pyx_v_self->vec, __pyx_v_rval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 602, __pyx_L1_error)

  /* "PETSc/Vec.pyx":600
 *         CHKERR( VecShift(self.vec, sval) )
 * 
 *     def chop(self, tol):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(tol)
 *         CHKERR( VecChop(self.vec, rval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.chop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":604
 *         CHKERR( VecChop(self.vec, rval) )
 * 
 *     def swap(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecSwap(self.vec, vec.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_181swap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_180swap[] = "Vec.swap(self, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_181swap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("swap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "swap") < 0)) __PYX_ERR(30, 604, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("swap", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 604, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.swap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(30, 604, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_180swap(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_180swap(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("swap", 0);

  /* "PETSc/Vec.pyx":605
 * 
 *     def swap(self, Vec vec not None):
 *         CHKERR( VecSwap(self.vec, vec.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def axpy(self, alpha, Vec x not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSwap(__pyx_v_self->vec, __pyx_v_vec->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 605, __pyx_L1_error)

  /* "PETSc/Vec.pyx":604
 *         CHKERR( VecChop(self.vec, rval) )
 * 
 *     def swap(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecSwap(self.vec, vec.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.swap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":607
 *         CHKERR( VecSwap(self.vec, vec.vec) )
 * 
 *     def axpy(self, alpha, Vec x not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecAXPY(self.vec, sval, x.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_183axpy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_182axpy[] = "Vec.axpy(self, alpha, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_183axpy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("axpy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alpha,&__pyx_n_s_x,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_alpha)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("axpy", 1, 2, 2, 1); __PYX_ERR(30, 607, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "axpy") < 0)) __PYX_ERR(30, 607, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_alpha = values[0];
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("axpy", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 607, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.axpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(30, 607, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_182axpy(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_alpha, __pyx_v_x);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_182axpy(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha, struct PyPetscVecObject *__pyx_v_x) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("axpy", 0);

  /* "PETSc/Vec.pyx":608
 * 
 *     def axpy(self, alpha, Vec x not None):
 *         cdef PetscScalar sval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         CHKERR( VecAXPY(self.vec, sval, x.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 608, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Vec.pyx":609
 *     def axpy(self, alpha, Vec x not None):
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecAXPY(self.vec, sval, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def isaxpy(self, IS idx not None, alpha, Vec x not None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAXPY(__pyx_v_self->vec, __pyx_v_sval, __pyx_v_x->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 609, __pyx_L1_error)

  /* "PETSc/Vec.pyx":607
 *         CHKERR( VecSwap(self.vec, vec.vec) )
 * 
 *     def axpy(self, alpha, Vec x not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecAXPY(self.vec, sval, x.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.axpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":611
 *         CHKERR( VecAXPY(self.vec, sval, x.vec) )
 * 
 *     def isaxpy(self, IS idx not None, alpha, Vec x not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecISAXPY(self.vec, idx.iset, sval, x.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_185isaxpy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_184isaxpy[] = "Vec.isaxpy(self, IS idx, alpha, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_185isaxpy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_idx = 0;
  PyObject *__pyx_v_alpha = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isaxpy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_alpha,&__pyx_n_s_x,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_idx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("isaxpy", 1, 3, 3, 1); __PYX_ERR(30, 611, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("isaxpy", 1, 3, 3, 2); __PYX_ERR(30, 611, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "isaxpy") < 0)) __PYX_ERR(30, 611, __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_idx = ((struct PyPetscISObject *)values[0]);
    __pyx_v_alpha = values[1];
    __pyx_v_x = ((struct PyPetscVecObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("isaxpy", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 611, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.isaxpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "idx", 0))) __PYX_ERR(30, 611, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(30, 611, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_184isaxpy(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_idx, __pyx_v_alpha, __pyx_v_x);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_184isaxpy(struct PyPetscVecObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_idx, PyObject *__pyx_v_alpha, struct PyPetscVecObject *__pyx_v_x) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("isaxpy", 0);

  /* "PETSc/Vec.pyx":612
 * 
 *     def isaxpy(self, IS idx not None, alpha, Vec x not None):
 *         cdef PetscScalar sval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         CHKERR( VecISAXPY(self.vec, idx.iset, sval, x.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 612, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Vec.pyx":613
 *     def isaxpy(self, IS idx not None, alpha, Vec x not None):
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecISAXPY(self.vec, idx.iset, sval, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def aypx(self, alpha, Vec x not None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecISAXPY(__pyx_v_self->vec, __pyx_v_idx->iset, __pyx_v_sval, __pyx_v_x->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 613, __pyx_L1_error)

  /* "PETSc/Vec.pyx":611
 *         CHKERR( VecAXPY(self.vec, sval, x.vec) )
 * 
 *     def isaxpy(self, IS idx not None, alpha, Vec x not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecISAXPY(self.vec, idx.iset, sval, x.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.isaxpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":615
 *         CHKERR( VecISAXPY(self.vec, idx.iset, sval, x.vec) )
 * 
 *     def aypx(self, alpha, Vec x not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecAYPX(self.vec, sval, x.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_187aypx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_186aypx[] = "Vec.aypx(self, alpha, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_187aypx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("aypx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alpha,&__pyx_n_s_x,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_alpha)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aypx", 1, 2, 2, 1); __PYX_ERR(30, 615, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "aypx") < 0)) __PYX_ERR(30, 615, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_alpha = values[0];
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("aypx", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 615, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.aypx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(30, 615, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_186aypx(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_alpha, __pyx_v_x);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_186aypx(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha, struct PyPetscVecObject *__pyx_v_x) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("aypx", 0);

  /* "PETSc/Vec.pyx":616
 * 
 *     def aypx(self, alpha, Vec x not None):
 *         cdef PetscScalar sval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         CHKERR( VecAYPX(self.vec, sval, x.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 616, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Vec.pyx":617
 *     def aypx(self, alpha, Vec x not None):
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecAYPX(self.vec, sval, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def axpby(self, alpha, beta, Vec y not None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAYPX(__pyx_v_self->vec, __pyx_v_sval, __pyx_v_x->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 617, __pyx_L1_error)

  /* "PETSc/Vec.pyx":615
 *         CHKERR( VecISAXPY(self.vec, idx.iset, sval, x.vec) )
 * 
 *     def aypx(self, alpha, Vec x not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecAYPX(self.vec, sval, x.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.aypx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":619
 *         CHKERR( VecAYPX(self.vec, sval, x.vec) )
 * 
 *     def axpby(self, alpha, beta, Vec y not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval1 = asScalar(alpha)
 *         cdef PetscScalar sval2 = asScalar(beta)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_189axpby(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_188axpby[] = "Vec.axpby(self, alpha, beta, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_189axpby(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_v_beta = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("axpby (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alpha,&__pyx_n_s_beta,&__pyx_n_s_y,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_alpha)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("axpby", 1, 3, 3, 1); __PYX_ERR(30, 619, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("axpby", 1, 3, 3, 2); __PYX_ERR(30, 619, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "axpby") < 0)) __PYX_ERR(30, 619, __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_alpha = values[0];
    __pyx_v_beta = values[1];
    __pyx_v_y = ((struct PyPetscVecObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("axpby", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 619, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.axpby", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(30, 619, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_188axpby(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_alpha, __pyx_v_beta, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_188axpby(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha, PyObject *__pyx_v_beta, struct PyPetscVecObject *__pyx_v_y) {
  PetscScalar __pyx_v_sval1;
  PetscScalar __pyx_v_sval2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("axpby", 0);

  /* "PETSc/Vec.pyx":620
 * 
 *     def axpby(self, alpha, beta, Vec y not None):
 *         cdef PetscScalar sval1 = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval2 = asScalar(beta)
 *         CHKERR( VecAXPBY(self.vec, sval1, sval2, y.vec) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 620, __pyx_L1_error)
  __pyx_v_sval1 = __pyx_t_1;

  /* "PETSc/Vec.pyx":621
 *     def axpby(self, alpha, beta, Vec y not None):
 *         cdef PetscScalar sval1 = asScalar(alpha)
 *         cdef PetscScalar sval2 = asScalar(beta)             # <<<<<<<<<<<<<<
 *         CHKERR( VecAXPBY(self.vec, sval1, sval2, y.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_beta); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 621, __pyx_L1_error)
  __pyx_v_sval2 = __pyx_t_1;

  /* "PETSc/Vec.pyx":622
 *         cdef PetscScalar sval1 = asScalar(alpha)
 *         cdef PetscScalar sval2 = asScalar(beta)
 *         CHKERR( VecAXPBY(self.vec, sval1, sval2, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def waxpy(self, alpha, Vec x not None, Vec y not None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAXPBY(__pyx_v_self->vec, __pyx_v_sval1, __pyx_v_sval2, __pyx_v_y->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 622, __pyx_L1_error)

  /* "PETSc/Vec.pyx":619
 *         CHKERR( VecAYPX(self.vec, sval, x.vec) )
 * 
 *     def axpby(self, alpha, beta, Vec y not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval1 = asScalar(alpha)
 *         cdef PetscScalar sval2 = asScalar(beta)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.axpby", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":624
 *         CHKERR( VecAXPBY(self.vec, sval1, sval2, y.vec) )
 * 
 *     def waxpy(self, alpha, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecWAXPY(self.vec, sval, x.vec, y.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_191waxpy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_190waxpy[] = "Vec.waxpy(self, alpha, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_191waxpy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("waxpy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alpha,&__pyx_n_s_x,&__pyx_n_s_y,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_alpha)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("waxpy", 1, 3, 3, 1); __PYX_ERR(30, 624, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("waxpy", 1, 3, 3, 2); __PYX_ERR(30, 624, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "waxpy") < 0)) __PYX_ERR(30, 624, __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_alpha = values[0];
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("waxpy", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 624, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.waxpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(30, 624, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(30, 624, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_190waxpy(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_alpha, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_190waxpy(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alpha, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("waxpy", 0);

  /* "PETSc/Vec.pyx":625
 * 
 *     def waxpy(self, alpha, Vec x not None, Vec y not None):
 *         cdef PetscScalar sval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         CHKERR( VecWAXPY(self.vec, sval, x.vec, y.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 625, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Vec.pyx":626
 *     def waxpy(self, alpha, Vec x not None, Vec y not None):
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecWAXPY(self.vec, sval, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def maxpy(self, alphas, vecs):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecWAXPY(__pyx_v_self->vec, __pyx_v_sval, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 626, __pyx_L1_error)

  /* "PETSc/Vec.pyx":624
 *         CHKERR( VecAXPBY(self.vec, sval1, sval2, y.vec) )
 * 
 *     def waxpy(self, alpha, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecWAXPY(self.vec, sval, x.vec, y.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.waxpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":628
 *         CHKERR( VecWAXPY(self.vec, sval, x.vec, y.vec) )
 * 
 *     def maxpy(self, alphas, vecs):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         cdef PetscScalar *a = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_193maxpy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_192maxpy[] = "Vec.maxpy(self, alphas, vecs)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_193maxpy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alphas = 0;
  PyObject *__pyx_v_vecs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("maxpy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alphas,&__pyx_n_s_vecs,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_alphas)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vecs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("maxpy", 1, 2, 2, 1); __PYX_ERR(30, 628, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "maxpy") < 0)) __PYX_ERR(30, 628, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_alphas = values[0];
    __pyx_v_vecs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("maxpy", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 628, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.maxpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_192maxpy(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_alphas, __pyx_v_vecs);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_192maxpy(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_alphas, PyObject *__pyx_v_vecs) {
  PetscInt __pyx_v_n;
  PetscScalar *__pyx_v_a;
  Vec *__pyx_v_v;
  CYTHON_UNUSED PyObject *__pyx_v_tmp1 = 0;
  CYTHON_UNUSED PyObject *__pyx_v_tmp2 = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PetscInt __pyx_t_4;
  Vec __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("maxpy", 0);

  /* "PETSc/Vec.pyx":629
 * 
 *     def maxpy(self, alphas, vecs):
 *         cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *         cdef PetscScalar *a = NULL
 *         cdef PetscVec *v = NULL
 */
  __pyx_v_n = 0;

  /* "PETSc/Vec.pyx":630
 *     def maxpy(self, alphas, vecs):
 *         cdef PetscInt n = 0
 *         cdef PetscScalar *a = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscVec *v = NULL
 *         cdef object tmp1 = iarray_s(alphas, &n, &a)
 */
  __pyx_v_a = NULL;

  /* "PETSc/Vec.pyx":631
 *         cdef PetscInt n = 0
 *         cdef PetscScalar *a = NULL
 *         cdef PetscVec *v = NULL             # <<<<<<<<<<<<<<
 *         cdef object tmp1 = iarray_s(alphas, &n, &a)
 *         cdef object tmp2 = oarray_p(empty_p(n),NULL, <void**>&v)
 */
  __pyx_v_v = NULL;

  /* "PETSc/Vec.pyx":632
 *         cdef PetscScalar *a = NULL
 *         cdef PetscVec *v = NULL
 *         cdef object tmp1 = iarray_s(alphas, &n, &a)             # <<<<<<<<<<<<<<
 *         cdef object tmp2 = oarray_p(empty_p(n),NULL, <void**>&v)
 *         assert n == len(vecs)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_s(__pyx_v_alphas, (&__pyx_v_n), (&__pyx_v_a))); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tmp1 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":633
 *         cdef PetscVec *v = NULL
 *         cdef object tmp1 = iarray_s(alphas, &n, &a)
 *         cdef object tmp2 = oarray_p(empty_p(n),NULL, <void**>&v)             # <<<<<<<<<<<<<<
 *         assert n == len(vecs)
 *         cdef Py_ssize_t i=0
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_1, NULL, ((void **)(&__pyx_v_v)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_tmp2 = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/Vec.pyx":634
 *         cdef object tmp1 = iarray_s(alphas, &n, &a)
 *         cdef object tmp2 = oarray_p(empty_p(n),NULL, <void**>&v)
 *         assert n == len(vecs)             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i=0
 *         for i from 0 <= i < n:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = PyObject_Length(__pyx_v_vecs); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 634, __pyx_L1_error)
    if (unlikely(!((__pyx_v_n == __pyx_t_3) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(30, 634, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/Vec.pyx":635
 *         cdef object tmp2 = oarray_p(empty_p(n),NULL, <void**>&v)
 *         assert n == len(vecs)
 *         cdef Py_ssize_t i=0             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n:
 *             v[i] = (<Vec?>(vecs[i])).vec
 */
  __pyx_v_i = 0;

  /* "PETSc/Vec.pyx":636
 *         assert n == len(vecs)
 *         cdef Py_ssize_t i=0
 *         for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *             v[i] = (<Vec?>(vecs[i])).vec
 *         CHKERR( VecMAXPY(self.vec, n, a, v) )
 */
  __pyx_t_4 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {

    /* "PETSc/Vec.pyx":637
 *         cdef Py_ssize_t i=0
 *         for i from 0 <= i < n:
 *             v[i] = (<Vec?>(vecs[i])).vec             # <<<<<<<<<<<<<<
 *         CHKERR( VecMAXPY(self.vec, n, a, v) )
 * 
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_vecs, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_Vec)))) __PYX_ERR(30, 637, __pyx_L1_error)
    __pyx_t_5 = ((struct PyPetscVecObject *)__pyx_t_2)->vec;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    (__pyx_v_v[__pyx_v_i]) = __pyx_t_5;
  }

  /* "PETSc/Vec.pyx":638
 *         for i from 0 <= i < n:
 *             v[i] = (<Vec?>(vecs[i])).vec
 *         CHKERR( VecMAXPY(self.vec, n, a, v) )             # <<<<<<<<<<<<<<
 * 
 *     def pointwiseMult(self, Vec x not None, Vec y not None):
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecMAXPY(__pyx_v_self->vec, __pyx_v_n, __pyx_v_a, __pyx_v_v)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(30, 638, __pyx_L1_error)

  /* "PETSc/Vec.pyx":628
 *         CHKERR( VecWAXPY(self.vec, sval, x.vec, y.vec) )
 * 
 *     def maxpy(self, alphas, vecs):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         cdef PetscScalar *a = NULL
 */

  /* 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_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.maxpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp1);
  __Pyx_XDECREF(__pyx_v_tmp2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":640
 *         CHKERR( VecMAXPY(self.vec, n, a, v) )
 * 
 *     def pointwiseMult(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecPointwiseMult(self.vec, x.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_195pointwiseMult(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_194pointwiseMult[] = "Vec.pointwiseMult(self, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_195pointwiseMult(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pointwiseMult (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pointwiseMult", 1, 2, 2, 1); __PYX_ERR(30, 640, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pointwiseMult") < 0)) __PYX_ERR(30, 640, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pointwiseMult", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 640, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.pointwiseMult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(30, 640, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(30, 640, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_194pointwiseMult(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_194pointwiseMult(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("pointwiseMult", 0);

  /* "PETSc/Vec.pyx":641
 * 
 *     def pointwiseMult(self, Vec x not None, Vec y not None):
 *         CHKERR( VecPointwiseMult(self.vec, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def pointwiseDivide(self, Vec x not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecPointwiseMult(__pyx_v_self->vec, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 641, __pyx_L1_error)

  /* "PETSc/Vec.pyx":640
 *         CHKERR( VecMAXPY(self.vec, n, a, v) )
 * 
 *     def pointwiseMult(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecPointwiseMult(self.vec, x.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.pointwiseMult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":643
 *         CHKERR( VecPointwiseMult(self.vec, x.vec, y.vec) )
 * 
 *     def pointwiseDivide(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecPointwiseDivide(self.vec, x.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_197pointwiseDivide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_196pointwiseDivide[] = "Vec.pointwiseDivide(self, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_197pointwiseDivide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pointwiseDivide (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pointwiseDivide", 1, 2, 2, 1); __PYX_ERR(30, 643, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pointwiseDivide") < 0)) __PYX_ERR(30, 643, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pointwiseDivide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 643, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.pointwiseDivide", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(30, 643, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(30, 643, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_196pointwiseDivide(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_196pointwiseDivide(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("pointwiseDivide", 0);

  /* "PETSc/Vec.pyx":644
 * 
 *     def pointwiseDivide(self, Vec x not None, Vec y not None):
 *         CHKERR( VecPointwiseDivide(self.vec, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def pointwiseMin(self, Vec x not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecPointwiseDivide(__pyx_v_self->vec, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 644, __pyx_L1_error)

  /* "PETSc/Vec.pyx":643
 *         CHKERR( VecPointwiseMult(self.vec, x.vec, y.vec) )
 * 
 *     def pointwiseDivide(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecPointwiseDivide(self.vec, x.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.pointwiseDivide", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":646
 *         CHKERR( VecPointwiseDivide(self.vec, x.vec, y.vec) )
 * 
 *     def pointwiseMin(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecPointwiseMin(self.vec, x.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_199pointwiseMin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_198pointwiseMin[] = "Vec.pointwiseMin(self, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_199pointwiseMin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pointwiseMin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pointwiseMin", 1, 2, 2, 1); __PYX_ERR(30, 646, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pointwiseMin") < 0)) __PYX_ERR(30, 646, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pointwiseMin", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 646, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.pointwiseMin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(30, 646, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(30, 646, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_198pointwiseMin(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_198pointwiseMin(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("pointwiseMin", 0);

  /* "PETSc/Vec.pyx":647
 * 
 *     def pointwiseMin(self, Vec x not None, Vec y not None):
 *         CHKERR( VecPointwiseMin(self.vec, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def pointwiseMax(self, Vec x not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecPointwiseMin(__pyx_v_self->vec, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 647, __pyx_L1_error)

  /* "PETSc/Vec.pyx":646
 *         CHKERR( VecPointwiseDivide(self.vec, x.vec, y.vec) )
 * 
 *     def pointwiseMin(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecPointwiseMin(self.vec, x.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.pointwiseMin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":649
 *         CHKERR( VecPointwiseMin(self.vec, x.vec, y.vec) )
 * 
 *     def pointwiseMax(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecPointwiseMax(self.vec, x.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_201pointwiseMax(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_200pointwiseMax[] = "Vec.pointwiseMax(self, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_201pointwiseMax(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pointwiseMax (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pointwiseMax", 1, 2, 2, 1); __PYX_ERR(30, 649, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pointwiseMax") < 0)) __PYX_ERR(30, 649, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pointwiseMax", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 649, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.pointwiseMax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(30, 649, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(30, 649, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_200pointwiseMax(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_200pointwiseMax(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("pointwiseMax", 0);

  /* "PETSc/Vec.pyx":650
 * 
 *     def pointwiseMax(self, Vec x not None, Vec y not None):
 *         CHKERR( VecPointwiseMax(self.vec, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def pointwiseMaxAbs(self, Vec x not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecPointwiseMax(__pyx_v_self->vec, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 650, __pyx_L1_error)

  /* "PETSc/Vec.pyx":649
 *         CHKERR( VecPointwiseMin(self.vec, x.vec, y.vec) )
 * 
 *     def pointwiseMax(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecPointwiseMax(self.vec, x.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.pointwiseMax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":652
 *         CHKERR( VecPointwiseMax(self.vec, x.vec, y.vec) )
 * 
 *     def pointwiseMaxAbs(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecPointwiseMaxAbs(self.vec, x.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_203pointwiseMaxAbs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_202pointwiseMaxAbs[] = "Vec.pointwiseMaxAbs(self, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_203pointwiseMaxAbs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pointwiseMaxAbs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pointwiseMaxAbs", 1, 2, 2, 1); __PYX_ERR(30, 652, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pointwiseMaxAbs") < 0)) __PYX_ERR(30, 652, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pointwiseMaxAbs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 652, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.pointwiseMaxAbs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(30, 652, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(30, 652, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_202pointwiseMaxAbs(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_202pointwiseMaxAbs(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("pointwiseMaxAbs", 0);

  /* "PETSc/Vec.pyx":653
 * 
 *     def pointwiseMaxAbs(self, Vec x not None, Vec y not None):
 *         CHKERR( VecPointwiseMaxAbs(self.vec, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def maxPointwiseDivide(self, Vec vec not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecPointwiseMaxAbs(__pyx_v_self->vec, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 653, __pyx_L1_error)

  /* "PETSc/Vec.pyx":652
 *         CHKERR( VecPointwiseMax(self.vec, x.vec, y.vec) )
 * 
 *     def pointwiseMaxAbs(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecPointwiseMaxAbs(self.vec, x.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.pointwiseMaxAbs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":655
 *         CHKERR( VecPointwiseMaxAbs(self.vec, x.vec, y.vec) )
 * 
 *     def maxPointwiseDivide(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( VecMaxPointwiseDivide(self.vec, vec.vec, &rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_205maxPointwiseDivide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_204maxPointwiseDivide[] = "Vec.maxPointwiseDivide(self, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_205maxPointwiseDivide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("maxPointwiseDivide (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "maxPointwiseDivide") < 0)) __PYX_ERR(30, 655, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("maxPointwiseDivide", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 655, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.maxPointwiseDivide", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(30, 655, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_204maxPointwiseDivide(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_204maxPointwiseDivide(struct PyPetscVecObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("maxPointwiseDivide", 0);

  /* "PETSc/Vec.pyx":656
 * 
 *     def maxPointwiseDivide(self, Vec vec not None):
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecMaxPointwiseDivide(self.vec, vec.vec, &rval) )
 *         return toReal(rval)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/Vec.pyx":657
 *     def maxPointwiseDivide(self, Vec vec not None):
 *         cdef PetscReal rval = 0
 *         CHKERR( VecMaxPointwiseDivide(self.vec, vec.vec, &rval) )             # <<<<<<<<<<<<<<
 *         return toReal(rval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecMaxPointwiseDivide(__pyx_v_self->vec, __pyx_v_vec->vec, (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 657, __pyx_L1_error)

  /* "PETSc/Vec.pyx":658
 *         cdef PetscReal rval = 0
 *         CHKERR( VecMaxPointwiseDivide(self.vec, vec.vec, &rval) )
 *         return toReal(rval)             # <<<<<<<<<<<<<<
 * 
 *     def getValue(self, index):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":655
 *         CHKERR( VecPointwiseMaxAbs(self.vec, x.vec, y.vec) )
 * 
 *     def maxPointwiseDivide(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( VecMaxPointwiseDivide(self.vec, vec.vec, &rval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.maxPointwiseDivide", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":660
 *         return toReal(rval)
 * 
 *     def getValue(self, index):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival = asInt(index)
 *         cdef PetscScalar sval = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_207getValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_206getValue[] = "Vec.getValue(self, index)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_207getValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getValue (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,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);
        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_index)) != 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, "getValue") < 0)) __PYX_ERR(30, 660, __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_index = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getValue", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 660, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_206getValue(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_index);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_206getValue(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PetscInt __pyx_v_ival;
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getValue", 0);

  /* "PETSc/Vec.pyx":661
 * 
 *     def getValue(self, index):
 *         cdef PetscInt    ival = asInt(index)             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecGetValues(self.vec, 1, &ival, &sval) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_index); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(30, 661, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/Vec.pyx":662
 *     def getValue(self, index):
 *         cdef PetscInt    ival = asInt(index)
 *         cdef PetscScalar sval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetValues(self.vec, 1, &ival, &sval) )
 *         return toScalar(sval)
 */
  __pyx_v_sval = 0.0;

  /* "PETSc/Vec.pyx":663
 *         cdef PetscInt    ival = asInt(index)
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecGetValues(self.vec, 1, &ival, &sval) )             # <<<<<<<<<<<<<<
 *         return toScalar(sval)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetValues(__pyx_v_self->vec, 1, (&__pyx_v_ival), (&__pyx_v_sval))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 663, __pyx_L1_error)

  /* "PETSc/Vec.pyx":664
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecGetValues(self.vec, 1, &ival, &sval) )
 *         return toScalar(sval)             # <<<<<<<<<<<<<<
 * 
 *     def getValues(self, indices, values=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toScalar(__pyx_v_sval); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":660
 *         return toReal(rval)
 * 
 *     def getValue(self, index):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival = asInt(index)
 *         cdef PetscScalar sval = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":666
 *         return toScalar(sval)
 * 
 *     def getValues(self, indices, values=None):             # <<<<<<<<<<<<<<
 *         return vecgetvalues(self.vec, indices, values)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_209getValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_208getValues[] = "Vec.getValues(self, indices, values=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_209getValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getValues (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_values,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_values);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getValues") < 0)) __PYX_ERR(30, 666, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_indices = values[0];
    __pyx_v_values = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getValues", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 666, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_208getValues(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_indices, __pyx_v_values);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_208getValues(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_values) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getValues", 0);

  /* "PETSc/Vec.pyx":667
 * 
 *     def getValues(self, indices, values=None):
 *         return vecgetvalues(self.vec, indices, values)             # <<<<<<<<<<<<<<
 * 
 *     def setValue(self, index, value, addv=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_vecgetvalues(__pyx_v_self->vec, __pyx_v_indices, __pyx_v_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":666
 *         return toScalar(sval)
 * 
 *     def getValues(self, indices, values=None):             # <<<<<<<<<<<<<<
 *         return vecgetvalues(self.vec, indices, values)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":669
 *         return vecgetvalues(self.vec, indices, values)
 * 
 *     def setValue(self, index, value, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival = asInt(index)
 *         cdef PetscScalar sval = asScalar(value)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_211setValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_210setValue[] = "Vec.setValue(self, index, value, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_211setValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValue (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,&__pyx_n_s_value,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValue", 0, 2, 3, 1); __PYX_ERR(30, 669, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValue") < 0)) __PYX_ERR(30, 669, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_index = values[0];
    __pyx_v_value = values[1];
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValue", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 669, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_210setValue(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_index, __pyx_v_value, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_210setValue(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value, PyObject *__pyx_v_addv) {
  PetscInt __pyx_v_ival;
  PetscScalar __pyx_v_sval;
  InsertMode __pyx_v_caddv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscScalar __pyx_t_2;
  InsertMode __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setValue", 0);

  /* "PETSc/Vec.pyx":670
 * 
 *     def setValue(self, index, value, addv=None):
 *         cdef PetscInt    ival = asInt(index)             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(value)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_index); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(30, 670, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/Vec.pyx":671
 *     def setValue(self, index, value, addv=None):
 *         cdef PetscInt    ival = asInt(index)
 *         cdef PetscScalar sval = asScalar(value)             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( VecSetValues(self.vec, 1, &ival, &sval, caddv) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 671, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_2;

  /* "PETSc/Vec.pyx":672
 *         cdef PetscInt    ival = asInt(index)
 *         cdef PetscScalar sval = asScalar(value)
 *         cdef PetscInsertMode caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetValues(self.vec, 1, &ival, &sval, caddv) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_3 == ((InsertMode)-1L))) __PYX_ERR(30, 672, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_3;

  /* "PETSc/Vec.pyx":673
 *         cdef PetscScalar sval = asScalar(value)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( VecSetValues(self.vec, 1, &ival, &sval, caddv) )             # <<<<<<<<<<<<<<
 * 
 *     def setValues(self, indices, values, addv=None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetValues(__pyx_v_self->vec, 1, (&__pyx_v_ival), (&__pyx_v_sval), __pyx_v_caddv)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 673, __pyx_L1_error)

  /* "PETSc/Vec.pyx":669
 *         return vecgetvalues(self.vec, indices, values)
 * 
 *     def setValue(self, index, value, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival = asInt(index)
 *         cdef PetscScalar sval = asScalar(value)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":675
 *         CHKERR( VecSetValues(self.vec, 1, &ival, &sval, caddv) )
 * 
 *     def setValues(self, indices, values, addv=None):             # <<<<<<<<<<<<<<
 *         vecsetvalues(self.vec, indices, values, addv, 0, 0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_213setValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_212setValues[] = "Vec.setValues(self, indices, values, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_213setValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValues (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_values,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValues", 0, 2, 3, 1); __PYX_ERR(30, 675, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValues") < 0)) __PYX_ERR(30, 675, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_indices = values[0];
    __pyx_v_values = values[1];
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValues", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 675, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_212setValues(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_indices, __pyx_v_values, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_212setValues(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_values, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValues", 0);

  /* "PETSc/Vec.pyx":676
 * 
 *     def setValues(self, indices, values, addv=None):
 *         vecsetvalues(self.vec, indices, values, addv, 0, 0)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesBlocked(self, indices, values, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_vecsetvalues(__pyx_v_self->vec, __pyx_v_indices, __pyx_v_values, __pyx_v_addv, 0, 0); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 676, __pyx_L1_error)

  /* "PETSc/Vec.pyx":675
 *         CHKERR( VecSetValues(self.vec, 1, &ival, &sval, caddv) )
 * 
 *     def setValues(self, indices, values, addv=None):             # <<<<<<<<<<<<<<
 *         vecsetvalues(self.vec, indices, values, addv, 0, 0)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":678
 *         vecsetvalues(self.vec, indices, values, addv, 0, 0)
 * 
 *     def setValuesBlocked(self, indices, values, addv=None):             # <<<<<<<<<<<<<<
 *         vecsetvalues(self.vec, indices, values, addv, 1, 0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_215setValuesBlocked(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_214setValuesBlocked[] = "Vec.setValuesBlocked(self, indices, values, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_215setValuesBlocked(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesBlocked (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_values,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlocked", 0, 2, 3, 1); __PYX_ERR(30, 678, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesBlocked") < 0)) __PYX_ERR(30, 678, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_indices = values[0];
    __pyx_v_values = values[1];
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesBlocked", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 678, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setValuesBlocked", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_214setValuesBlocked(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_indices, __pyx_v_values, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_214setValuesBlocked(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_values, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesBlocked", 0);

  /* "PETSc/Vec.pyx":679
 * 
 *     def setValuesBlocked(self, indices, values, addv=None):
 *         vecsetvalues(self.vec, indices, values, addv, 1, 0)             # <<<<<<<<<<<<<<
 * 
 *     def setLGMap(self, LGMap lgmap not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_vecsetvalues(__pyx_v_self->vec, __pyx_v_indices, __pyx_v_values, __pyx_v_addv, 1, 0); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 679, __pyx_L1_error)

  /* "PETSc/Vec.pyx":678
 *         vecsetvalues(self.vec, indices, values, addv, 0, 0)
 * 
 *     def setValuesBlocked(self, indices, values, addv=None):             # <<<<<<<<<<<<<<
 *         vecsetvalues(self.vec, indices, values, addv, 1, 0)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setValuesBlocked", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":681
 *         vecsetvalues(self.vec, indices, values, addv, 1, 0)
 * 
 *     def setLGMap(self, LGMap lgmap not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetLocalToGlobalMapping(self.vec, lgmap.lgm) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_217setLGMap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_216setLGMap[] = "Vec.setLGMap(self, LGMap lgmap)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_217setLGMap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscLGMapObject *__pyx_v_lgmap = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setLGMap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lgmap,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);
        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_lgmap)) != 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, "setLGMap") < 0)) __PYX_ERR(30, 681, __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_lgmap = ((struct PyPetscLGMapObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setLGMap", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 681, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setLGMap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lgmap), __pyx_ptype_8petsc4py_5PETSc_LGMap, 0, "lgmap", 0))) __PYX_ERR(30, 681, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_216setLGMap(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_lgmap);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_216setLGMap(struct PyPetscVecObject *__pyx_v_self, struct PyPetscLGMapObject *__pyx_v_lgmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setLGMap", 0);

  /* "PETSc/Vec.pyx":682
 * 
 *     def setLGMap(self, LGMap lgmap not None):
 *         CHKERR( VecSetLocalToGlobalMapping(self.vec, lgmap.lgm) )             # <<<<<<<<<<<<<<
 * 
 *     def setValueLocal(self, index, value, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetLocalToGlobalMapping(__pyx_v_self->vec, __pyx_v_lgmap->lgm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 682, __pyx_L1_error)

  /* "PETSc/Vec.pyx":681
 *         vecsetvalues(self.vec, indices, values, addv, 1, 0)
 * 
 *     def setLGMap(self, LGMap lgmap not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetLocalToGlobalMapping(self.vec, lgmap.lgm) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setLGMap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":684
 *         CHKERR( VecSetLocalToGlobalMapping(self.vec, lgmap.lgm) )
 * 
 *     def setValueLocal(self, index, value, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival = asInt(index)
 *         cdef PetscScalar sval = asScalar(value)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_219setValueLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_218setValueLocal[] = "Vec.setValueLocal(self, index, value, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_219setValueLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValueLocal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,&__pyx_n_s_value,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValueLocal", 0, 2, 3, 1); __PYX_ERR(30, 684, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValueLocal") < 0)) __PYX_ERR(30, 684, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_index = values[0];
    __pyx_v_value = values[1];
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValueLocal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 684, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setValueLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_218setValueLocal(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_index, __pyx_v_value, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_218setValueLocal(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value, PyObject *__pyx_v_addv) {
  PetscInt __pyx_v_ival;
  PetscScalar __pyx_v_sval;
  InsertMode __pyx_v_caddv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscScalar __pyx_t_2;
  InsertMode __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setValueLocal", 0);

  /* "PETSc/Vec.pyx":685
 * 
 *     def setValueLocal(self, index, value, addv=None):
 *         cdef PetscInt    ival = asInt(index)             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(value)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_index); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(30, 685, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/Vec.pyx":686
 *     def setValueLocal(self, index, value, addv=None):
 *         cdef PetscInt    ival = asInt(index)
 *         cdef PetscScalar sval = asScalar(value)             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( VecSetValuesLocal(self.vec, 1, &ival, &sval, caddv) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 686, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_2;

  /* "PETSc/Vec.pyx":687
 *         cdef PetscInt    ival = asInt(index)
 *         cdef PetscScalar sval = asScalar(value)
 *         cdef PetscInsertMode caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         CHKERR( VecSetValuesLocal(self.vec, 1, &ival, &sval, caddv) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_3 == ((InsertMode)-1L))) __PYX_ERR(30, 687, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_3;

  /* "PETSc/Vec.pyx":688
 *         cdef PetscScalar sval = asScalar(value)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( VecSetValuesLocal(self.vec, 1, &ival, &sval, caddv) )             # <<<<<<<<<<<<<<
 * 
 *     def setValuesLocal(self, indices, values, addv=None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSetValuesLocal(__pyx_v_self->vec, 1, (&__pyx_v_ival), (&__pyx_v_sval), __pyx_v_caddv)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 688, __pyx_L1_error)

  /* "PETSc/Vec.pyx":684
 *         CHKERR( VecSetLocalToGlobalMapping(self.vec, lgmap.lgm) )
 * 
 *     def setValueLocal(self, index, value, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival = asInt(index)
 *         cdef PetscScalar sval = asScalar(value)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setValueLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":690
 *         CHKERR( VecSetValuesLocal(self.vec, 1, &ival, &sval, caddv) )
 * 
 *     def setValuesLocal(self, indices, values, addv=None):             # <<<<<<<<<<<<<<
 *         vecsetvalues(self.vec, indices, values, addv, 0, 1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_221setValuesLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_220setValuesLocal[] = "Vec.setValuesLocal(self, indices, values, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_221setValuesLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesLocal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_values,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesLocal", 0, 2, 3, 1); __PYX_ERR(30, 690, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesLocal") < 0)) __PYX_ERR(30, 690, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_indices = values[0];
    __pyx_v_values = values[1];
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesLocal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 690, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setValuesLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_220setValuesLocal(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_indices, __pyx_v_values, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_220setValuesLocal(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_values, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesLocal", 0);

  /* "PETSc/Vec.pyx":691
 * 
 *     def setValuesLocal(self, indices, values, addv=None):
 *         vecsetvalues(self.vec, indices, values, addv, 0, 1)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesBlockedLocal(self, indices, values, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_vecsetvalues(__pyx_v_self->vec, __pyx_v_indices, __pyx_v_values, __pyx_v_addv, 0, 1); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 691, __pyx_L1_error)

  /* "PETSc/Vec.pyx":690
 *         CHKERR( VecSetValuesLocal(self.vec, 1, &ival, &sval, caddv) )
 * 
 *     def setValuesLocal(self, indices, values, addv=None):             # <<<<<<<<<<<<<<
 *         vecsetvalues(self.vec, indices, values, addv, 0, 1)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setValuesLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":693
 *         vecsetvalues(self.vec, indices, values, addv, 0, 1)
 * 
 *     def setValuesBlockedLocal(self, indices, values, addv=None):             # <<<<<<<<<<<<<<
 *         vecsetvalues(self.vec, indices, values, addv, 1, 1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_223setValuesBlockedLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_222setValuesBlockedLocal[] = "Vec.setValuesBlockedLocal(self, indices, values, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_223setValuesBlockedLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesBlockedLocal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_values,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocal", 0, 2, 3, 1); __PYX_ERR(30, 693, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesBlockedLocal") < 0)) __PYX_ERR(30, 693, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_indices = values[0];
    __pyx_v_values = values[1];
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 693, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setValuesBlockedLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_222setValuesBlockedLocal(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_indices, __pyx_v_values, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_222setValuesBlockedLocal(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_indices, PyObject *__pyx_v_values, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesBlockedLocal", 0);

  /* "PETSc/Vec.pyx":694
 * 
 *     def setValuesBlockedLocal(self, indices, values, addv=None):
 *         vecsetvalues(self.vec, indices, values, addv, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *     def assemblyBegin(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_vecsetvalues(__pyx_v_self->vec, __pyx_v_indices, __pyx_v_values, __pyx_v_addv, 1, 1); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 694, __pyx_L1_error)

  /* "PETSc/Vec.pyx":693
 *         vecsetvalues(self.vec, indices, values, addv, 0, 1)
 * 
 *     def setValuesBlockedLocal(self, indices, values, addv=None):             # <<<<<<<<<<<<<<
 *         vecsetvalues(self.vec, indices, values, addv, 1, 1)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setValuesBlockedLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":696
 *         vecsetvalues(self.vec, indices, values, addv, 1, 1)
 * 
 *     def assemblyBegin(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecAssemblyBegin(self.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_225assemblyBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_224assemblyBegin[] = "Vec.assemblyBegin(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_225assemblyBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assemblyBegin (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("assemblyBegin", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "assemblyBegin", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_224assemblyBegin(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_224assemblyBegin(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("assemblyBegin", 0);

  /* "PETSc/Vec.pyx":697
 * 
 *     def assemblyBegin(self):
 *         CHKERR( VecAssemblyBegin(self.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def assemblyEnd(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAssemblyBegin(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 697, __pyx_L1_error)

  /* "PETSc/Vec.pyx":696
 *         vecsetvalues(self.vec, indices, values, addv, 1, 1)
 * 
 *     def assemblyBegin(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecAssemblyBegin(self.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.assemblyBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":699
 *         CHKERR( VecAssemblyBegin(self.vec) )
 * 
 *     def assemblyEnd(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecAssemblyEnd(self.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_227assemblyEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_226assemblyEnd[] = "Vec.assemblyEnd(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_227assemblyEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assemblyEnd (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("assemblyEnd", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "assemblyEnd", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_226assemblyEnd(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_226assemblyEnd(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("assemblyEnd", 0);

  /* "PETSc/Vec.pyx":700
 * 
 *     def assemblyEnd(self):
 *         CHKERR( VecAssemblyEnd(self.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def assemble(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAssemblyEnd(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 700, __pyx_L1_error)

  /* "PETSc/Vec.pyx":699
 *         CHKERR( VecAssemblyBegin(self.vec) )
 * 
 *     def assemblyEnd(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecAssemblyEnd(self.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.assemblyEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":702
 *         CHKERR( VecAssemblyEnd(self.vec) )
 * 
 *     def assemble(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecAssemblyBegin(self.vec) )
 *         CHKERR( VecAssemblyEnd(self.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_229assemble(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_228assemble[] = "Vec.assemble(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_229assemble(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assemble (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("assemble", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "assemble", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_228assemble(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_228assemble(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("assemble", 0);

  /* "PETSc/Vec.pyx":703
 * 
 *     def assemble(self):
 *         CHKERR( VecAssemblyBegin(self.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecAssemblyEnd(self.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAssemblyBegin(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 703, __pyx_L1_error)

  /* "PETSc/Vec.pyx":704
 *     def assemble(self):
 *         CHKERR( VecAssemblyBegin(self.vec) )
 *         CHKERR( VecAssemblyEnd(self.vec) )             # <<<<<<<<<<<<<<
 * 
 *     # --- methods for strided vectors ---
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecAssemblyEnd(__pyx_v_self->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 704, __pyx_L1_error)

  /* "PETSc/Vec.pyx":702
 *         CHKERR( VecAssemblyEnd(self.vec) )
 * 
 *     def assemble(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecAssemblyBegin(self.vec) )
 *         CHKERR( VecAssemblyEnd(self.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.assemble", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":708
 *     # --- methods for strided vectors ---
 * 
 *     def strideScale(self, field, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival = asInt(field)
 *         cdef PetscScalar sval = asScalar(alpha)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_231strideScale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_230strideScale[] = "Vec.strideScale(self, field, alpha)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_231strideScale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strideScale (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,&__pyx_n_s_alpha,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_field)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("strideScale", 1, 2, 2, 1); __PYX_ERR(30, 708, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "strideScale") < 0)) __PYX_ERR(30, 708, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_field = values[0];
    __pyx_v_alpha = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strideScale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 708, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideScale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_230strideScale(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_field, __pyx_v_alpha);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_230strideScale(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_alpha) {
  PetscInt __pyx_v_ival;
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscScalar __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("strideScale", 0);

  /* "PETSc/Vec.pyx":709
 * 
 *     def strideScale(self, field, alpha):
 *         cdef PetscInt    ival = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecStrideScale(self.vec, ival, sval) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(30, 709, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/Vec.pyx":710
 *     def strideScale(self, field, alpha):
 *         cdef PetscInt    ival = asInt(field)
 *         cdef PetscScalar sval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         CHKERR( VecStrideScale(self.vec, ival, sval) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 710, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_2;

  /* "PETSc/Vec.pyx":711
 *         cdef PetscInt    ival = asInt(field)
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( VecStrideScale(self.vec, ival, sval) )             # <<<<<<<<<<<<<<
 * 
 *     def strideSum(self, field):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecStrideScale(__pyx_v_self->vec, __pyx_v_ival, __pyx_v_sval)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 711, __pyx_L1_error)

  /* "PETSc/Vec.pyx":708
 *     # --- methods for strided vectors ---
 * 
 *     def strideScale(self, field, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival = asInt(field)
 *         cdef PetscScalar sval = asScalar(alpha)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideScale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":713
 *         CHKERR( VecStrideScale(self.vec, ival, sval) )
 * 
 *     def strideSum(self, field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival = asInt(field)
 *         cdef PetscScalar sval = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_233strideSum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_232strideSum[] = "Vec.strideSum(self, field)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_233strideSum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strideSum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,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);
        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_field)) != 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, "strideSum") < 0)) __PYX_ERR(30, 713, __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_field = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strideSum", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 713, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideSum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_232strideSum(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_field);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_232strideSum(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field) {
  PetscInt __pyx_v_ival;
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("strideSum", 0);

  /* "PETSc/Vec.pyx":714
 * 
 *     def strideSum(self, field):
 *         cdef PetscInt    ival = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecStrideSum(self.vec, ival, &sval) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(30, 714, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/Vec.pyx":715
 *     def strideSum(self, field):
 *         cdef PetscInt    ival = asInt(field)
 *         cdef PetscScalar sval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecStrideSum(self.vec, ival, &sval) )
 *         return toScalar(sval)
 */
  __pyx_v_sval = 0.0;

  /* "PETSc/Vec.pyx":716
 *         cdef PetscInt    ival = asInt(field)
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecStrideSum(self.vec, ival, &sval) )             # <<<<<<<<<<<<<<
 *         return toScalar(sval)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecStrideSum(__pyx_v_self->vec, __pyx_v_ival, (&__pyx_v_sval))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 716, __pyx_L1_error)

  /* "PETSc/Vec.pyx":717
 *         cdef PetscScalar sval = 0
 *         CHKERR( VecStrideSum(self.vec, ival, &sval) )
 *         return toScalar(sval)             # <<<<<<<<<<<<<<
 * 
 *     def strideMin(self, field):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toScalar(__pyx_v_sval); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":713
 *         CHKERR( VecStrideScale(self.vec, ival, sval) )
 * 
 *     def strideSum(self, field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival = asInt(field)
 *         cdef PetscScalar sval = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideSum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":719
 *         return toScalar(sval)
 * 
 *     def strideMin(self, field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival1 = asInt(field)
 *         cdef PetscInt  ival2 = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_235strideMin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_234strideMin[] = "Vec.strideMin(self, field)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_235strideMin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strideMin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,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);
        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_field)) != 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, "strideMin") < 0)) __PYX_ERR(30, 719, __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_field = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strideMin", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 719, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideMin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_234strideMin(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_field);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_234strideMin(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field) {
  PetscInt __pyx_v_ival1;
  PetscInt __pyx_v_ival2;
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("strideMin", 0);

  /* "PETSc/Vec.pyx":720
 * 
 *     def strideMin(self, field):
 *         cdef PetscInt  ival1 = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival2 = 0
 *         cdef PetscReal rval  = 0
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(30, 720, __pyx_L1_error)
  __pyx_v_ival1 = __pyx_t_1;

  /* "PETSc/Vec.pyx":721
 *     def strideMin(self, field):
 *         cdef PetscInt  ival1 = asInt(field)
 *         cdef PetscInt  ival2 = 0             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval  = 0
 *         CHKERR( VecStrideMin(self.vec, ival1, &ival2, &rval) )
 */
  __pyx_v_ival2 = 0;

  /* "PETSc/Vec.pyx":722
 *         cdef PetscInt  ival1 = asInt(field)
 *         cdef PetscInt  ival2 = 0
 *         cdef PetscReal rval  = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecStrideMin(self.vec, ival1, &ival2, &rval) )
 *         return (toInt(ival2), toReal(rval))
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/Vec.pyx":723
 *         cdef PetscInt  ival2 = 0
 *         cdef PetscReal rval  = 0
 *         CHKERR( VecStrideMin(self.vec, ival1, &ival2, &rval) )             # <<<<<<<<<<<<<<
 *         return (toInt(ival2), toReal(rval))
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecStrideMin(__pyx_v_self->vec, __pyx_v_ival1, (&__pyx_v_ival2), (&__pyx_v_rval))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 723, __pyx_L1_error)

  /* "PETSc/Vec.pyx":724
 *         cdef PetscReal rval  = 0
 *         CHKERR( VecStrideMin(self.vec, ival1, &ival2, &rval) )
 *         return (toInt(ival2), toReal(rval))             # <<<<<<<<<<<<<<
 * 
 *     def strideMax(self, field):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival2); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 724, __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_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":719
 *         return toScalar(sval)
 * 
 *     def strideMin(self, field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival1 = asInt(field)
 *         cdef PetscInt  ival2 = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideMin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":726
 *         return (toInt(ival2), toReal(rval))
 * 
 *     def strideMax(self, field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival1 = asInt(field)
 *         cdef PetscInt  ival2 = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_237strideMax(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_236strideMax[] = "Vec.strideMax(self, field)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_237strideMax(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strideMax (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,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);
        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_field)) != 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, "strideMax") < 0)) __PYX_ERR(30, 726, __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_field = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strideMax", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 726, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideMax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_236strideMax(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_field);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_236strideMax(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field) {
  PetscInt __pyx_v_ival1;
  PetscInt __pyx_v_ival2;
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("strideMax", 0);

  /* "PETSc/Vec.pyx":727
 * 
 *     def strideMax(self, field):
 *         cdef PetscInt  ival1 = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival2 = 0
 *         cdef PetscReal rval  = 0
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(30, 727, __pyx_L1_error)
  __pyx_v_ival1 = __pyx_t_1;

  /* "PETSc/Vec.pyx":728
 *     def strideMax(self, field):
 *         cdef PetscInt  ival1 = asInt(field)
 *         cdef PetscInt  ival2 = 0             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval  = 0
 *         CHKERR( VecStrideMax(self.vec, ival1, &ival2, &rval) )
 */
  __pyx_v_ival2 = 0;

  /* "PETSc/Vec.pyx":729
 *         cdef PetscInt  ival1 = asInt(field)
 *         cdef PetscInt  ival2 = 0
 *         cdef PetscReal rval  = 0             # <<<<<<<<<<<<<<
 *         CHKERR( VecStrideMax(self.vec, ival1, &ival2, &rval) )
 *         return (toInt(ival2), toReal(rval))
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/Vec.pyx":730
 *         cdef PetscInt  ival2 = 0
 *         cdef PetscReal rval  = 0
 *         CHKERR( VecStrideMax(self.vec, ival1, &ival2, &rval) )             # <<<<<<<<<<<<<<
 *         return (toInt(ival2), toReal(rval))
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecStrideMax(__pyx_v_self->vec, __pyx_v_ival1, (&__pyx_v_ival2), (&__pyx_v_rval))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 730, __pyx_L1_error)

  /* "PETSc/Vec.pyx":731
 *         cdef PetscReal rval  = 0
 *         CHKERR( VecStrideMax(self.vec, ival1, &ival2, &rval) )
 *         return (toInt(ival2), toReal(rval))             # <<<<<<<<<<<<<<
 * 
 *     def strideNorm(self, field, norm_type=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival2); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 731, __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_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":726
 *         return (toInt(ival2), toReal(rval))
 * 
 *     def strideMax(self, field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival1 = asInt(field)
 *         cdef PetscInt  ival2 = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideMax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":733
 *         return (toInt(ival2), toReal(rval))
 * 
 *     def strideNorm(self, field, norm_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(field)
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_239strideNorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_238strideNorm[] = "Vec.strideNorm(self, field, norm_type=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_239strideNorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_v_norm_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strideNorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,&__pyx_n_s_norm_type,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_field)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_norm_type);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "strideNorm") < 0)) __PYX_ERR(30, 733, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_field = values[0];
    __pyx_v_norm_type = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strideNorm", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 733, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideNorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_238strideNorm(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_field, __pyx_v_norm_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_238strideNorm(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_norm_type) {
  PetscInt __pyx_v_ival;
  NormType __pyx_v_norm_1_2;
  NormType __pyx_v_ntype;
  PetscReal __pyx_v_rval[2];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  NormType __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("strideNorm", 0);

  /* "PETSc/Vec.pyx":734
 * 
 *     def strideNorm(self, field, norm_type=None):
 *         cdef PetscInt ival = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_2
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(30, 734, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/Vec.pyx":735
 *     def strideNorm(self, field, norm_type=None):
 *         cdef PetscInt ival = asInt(field)
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2             # <<<<<<<<<<<<<<
 *         cdef PetscNormType ntype = PETSC_NORM_2
 *         if norm_type is not None: ntype = norm_type
 */
  __pyx_v_norm_1_2 = NORM_1_AND_2;

  /* "PETSc/Vec.pyx":736
 *         cdef PetscInt ival = asInt(field)
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_2             # <<<<<<<<<<<<<<
 *         if norm_type is not None: ntype = norm_type
 *         cdef PetscReal rval[2]
 */
  __pyx_v_ntype = NORM_2;

  /* "PETSc/Vec.pyx":737
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_2
 *         if norm_type is not None: ntype = norm_type             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval[2]
 *         CHKERR( VecStrideNorm(self.vec, ival, ntype, rval) )
 */
  __pyx_t_2 = (__pyx_v_norm_type != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = ((NormType)__Pyx_PyInt_As_NormType(__pyx_v_norm_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(30, 737, __pyx_L1_error)
    __pyx_v_ntype = __pyx_t_4;
  }

  /* "PETSc/Vec.pyx":739
 *         if norm_type is not None: ntype = norm_type
 *         cdef PetscReal rval[2]
 *         CHKERR( VecStrideNorm(self.vec, ival, ntype, rval) )             # <<<<<<<<<<<<<<
 *         if ntype != norm_1_2: return toReal(rval[0])
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecStrideNorm(__pyx_v_self->vec, __pyx_v_ival, __pyx_v_ntype, __pyx_v_rval)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(30, 739, __pyx_L1_error)

  /* "PETSc/Vec.pyx":740
 *         cdef PetscReal rval[2]
 *         CHKERR( VecStrideNorm(self.vec, ival, ntype, rval) )
 *         if ntype != norm_1_2: return toReal(rval[0])             # <<<<<<<<<<<<<<
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 * 
 */
  __pyx_t_3 = ((__pyx_v_ntype != __pyx_v_norm_1_2) != 0);
  if (__pyx_t_3) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_rval[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(30, 740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":741
 *         CHKERR( VecStrideNorm(self.vec, ival, ntype, rval) )
 *         if ntype != norm_1_2: return toReal(rval[0])
 *         else: return (toReal(rval[0]), toReal(rval[1]))             # <<<<<<<<<<<<<<
 * 
 *     def strideScatter(self, field, Vec vec not None, addv=None):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_rval[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(30, 741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_rval[1])); if (unlikely(!__pyx_t_7)) __PYX_ERR(30, 741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Vec.pyx":733
 *         return (toInt(ival2), toReal(rval))
 * 
 *     def strideNorm(self, field, norm_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(field)
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideNorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":743
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 * 
 *     def strideScatter(self, field, Vec vec not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(field)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_241strideScatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_240strideScatter[] = "Vec.strideScatter(self, field, Vec vec, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_241strideScatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strideScatter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,&__pyx_n_s_vec,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_field)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("strideScatter", 0, 2, 3, 1); __PYX_ERR(30, 743, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "strideScatter") < 0)) __PYX_ERR(30, 743, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_field = values[0];
    __pyx_v_vec = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strideScatter", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 743, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideScatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(30, 743, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_240strideScatter(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_field, __pyx_v_vec, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_240strideScatter(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field, struct PyPetscVecObject *__pyx_v_vec, PyObject *__pyx_v_addv) {
  PetscInt __pyx_v_ival;
  InsertMode __pyx_v_caddv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  InsertMode __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("strideScatter", 0);

  /* "PETSc/Vec.pyx":744
 * 
 *     def strideScatter(self, field, Vec vec not None, addv=None):
 *         cdef PetscInt ival = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( VecStrideScatter(self.vec, ival, vec.vec, caddv) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(30, 744, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/Vec.pyx":745
 *     def strideScatter(self, field, Vec vec not None, addv=None):
 *         cdef PetscInt ival = asInt(field)
 *         cdef PetscInsertMode caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         CHKERR( VecStrideScatter(self.vec, ival, vec.vec, caddv) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_2 == ((InsertMode)-1L))) __PYX_ERR(30, 745, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_2;

  /* "PETSc/Vec.pyx":746
 *         cdef PetscInt ival = asInt(field)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( VecStrideScatter(self.vec, ival, vec.vec, caddv) )             # <<<<<<<<<<<<<<
 * 
 *     def strideGather(self, field, Vec vec not None, addv=None):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecStrideScatter(__pyx_v_self->vec, __pyx_v_ival, __pyx_v_vec->vec, __pyx_v_caddv)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 746, __pyx_L1_error)

  /* "PETSc/Vec.pyx":743
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 * 
 *     def strideScatter(self, field, Vec vec not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(field)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideScatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":748
 *         CHKERR( VecStrideScatter(self.vec, ival, vec.vec, caddv) )
 * 
 *     def strideGather(self, field, Vec vec not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(field)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_243strideGather(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_242strideGather[] = "Vec.strideGather(self, field, Vec vec, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_243strideGather(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strideGather (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,&__pyx_n_s_vec,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_field)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("strideGather", 0, 2, 3, 1); __PYX_ERR(30, 748, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "strideGather") < 0)) __PYX_ERR(30, 748, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_field = values[0];
    __pyx_v_vec = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strideGather", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 748, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideGather", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(30, 748, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_242strideGather(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_field, __pyx_v_vec, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_242strideGather(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_field, struct PyPetscVecObject *__pyx_v_vec, PyObject *__pyx_v_addv) {
  PetscInt __pyx_v_ival;
  InsertMode __pyx_v_caddv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  InsertMode __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("strideGather", 0);

  /* "PETSc/Vec.pyx":749
 * 
 *     def strideGather(self, field, Vec vec not None, addv=None):
 *         cdef PetscInt ival = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( VecStrideGather(self.vec, ival, vec.vec, caddv) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(30, 749, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/Vec.pyx":750
 *     def strideGather(self, field, Vec vec not None, addv=None):
 *         cdef PetscInt ival = asInt(field)
 *         cdef PetscInsertMode caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         CHKERR( VecStrideGather(self.vec, ival, vec.vec, caddv) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_2 == ((InsertMode)-1L))) __PYX_ERR(30, 750, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_2;

  /* "PETSc/Vec.pyx":751
 *         cdef PetscInt ival = asInt(field)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( VecStrideGather(self.vec, ival, vec.vec, caddv) )             # <<<<<<<<<<<<<<
 * 
 *     # --- methods for vectors with ghost values ---
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecStrideGather(__pyx_v_self->vec, __pyx_v_ival, __pyx_v_vec->vec, __pyx_v_caddv)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 751, __pyx_L1_error)

  /* "PETSc/Vec.pyx":748
 *         CHKERR( VecStrideScatter(self.vec, ival, vec.vec, caddv) )
 * 
 *     def strideGather(self, field, Vec vec not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(field)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.strideGather", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":755
 *     # --- methods for vectors with ghost values ---
 * 
 *     def localForm(self):             # <<<<<<<<<<<<<<
 *         """
 *         Intended for use in context manager::
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_245localForm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_244localForm[] = "Vec.localForm(self)\n\n        Intended for use in context manager::\n\n            with vec.localForm() as lf:\n                use(lf)\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_245localForm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("localForm (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("localForm", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "localForm", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_244localForm(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_244localForm(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("localForm", 0);

  /* "PETSc/Vec.pyx":762
 *                 use(lf)
 *         """
 *         return _Vec_LocalForm(self)             # <<<<<<<<<<<<<<
 * 
 *     def ghostUpdateBegin(self, addv=None, mode=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc__Vec_LocalForm), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 762, __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;

  /* "PETSc/Vec.pyx":755
 *     # --- methods for vectors with ghost values ---
 * 
 *     def localForm(self):             # <<<<<<<<<<<<<<
 *         """
 *         Intended for use in context manager::
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.localForm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":764
 *         return _Vec_LocalForm(self)
 * 
 *     def ghostUpdateBegin(self, addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_247ghostUpdateBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_246ghostUpdateBegin[] = "Vec.ghostUpdateBegin(self, addv=None, mode=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_247ghostUpdateBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ghostUpdateBegin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addv,&__pyx_n_s_mode,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ghostUpdateBegin") < 0)) __PYX_ERR(30, 764, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_addv = values[0];
    __pyx_v_mode = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ghostUpdateBegin", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 764, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.ghostUpdateBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_246ghostUpdateBegin(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_addv, __pyx_v_mode);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_246ghostUpdateBegin(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode) {
  InsertMode __pyx_v_caddv;
  ScatterMode __pyx_v_csctm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  ScatterMode __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("ghostUpdateBegin", 0);

  /* "PETSc/Vec.pyx":765
 * 
 *     def ghostUpdateBegin(self, addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecGhostUpdateBegin(self.vec, caddv, csctm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(30, 765, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_1;

  /* "PETSc/Vec.pyx":766
 *     def ghostUpdateBegin(self, addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)             # <<<<<<<<<<<<<<
 *         CHKERR( VecGhostUpdateBegin(self.vec, caddv, csctm) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_scattermode(__pyx_v_mode); if (unlikely(__pyx_t_2 == ((ScatterMode)-1L))) __PYX_ERR(30, 766, __pyx_L1_error)
  __pyx_v_csctm = __pyx_t_2;

  /* "PETSc/Vec.pyx":767
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecGhostUpdateBegin(self.vec, caddv, csctm) )             # <<<<<<<<<<<<<<
 * 
 *     def ghostUpdateEnd(self, addv=None, mode=None):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGhostUpdateBegin(__pyx_v_self->vec, __pyx_v_caddv, __pyx_v_csctm)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 767, __pyx_L1_error)

  /* "PETSc/Vec.pyx":764
 *         return _Vec_LocalForm(self)
 * 
 *     def ghostUpdateBegin(self, addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.ghostUpdateBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":769
 *         CHKERR( VecGhostUpdateBegin(self.vec, caddv, csctm) )
 * 
 *     def ghostUpdateEnd(self, addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_249ghostUpdateEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_248ghostUpdateEnd[] = "Vec.ghostUpdateEnd(self, addv=None, mode=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_249ghostUpdateEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ghostUpdateEnd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addv,&__pyx_n_s_mode,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ghostUpdateEnd") < 0)) __PYX_ERR(30, 769, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_addv = values[0];
    __pyx_v_mode = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ghostUpdateEnd", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 769, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.ghostUpdateEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_248ghostUpdateEnd(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_addv, __pyx_v_mode);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_248ghostUpdateEnd(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode) {
  InsertMode __pyx_v_caddv;
  ScatterMode __pyx_v_csctm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  ScatterMode __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("ghostUpdateEnd", 0);

  /* "PETSc/Vec.pyx":770
 * 
 *     def ghostUpdateEnd(self, addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecGhostUpdateEnd(self.vec, caddv, csctm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(30, 770, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_1;

  /* "PETSc/Vec.pyx":771
 *     def ghostUpdateEnd(self, addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)             # <<<<<<<<<<<<<<
 *         CHKERR( VecGhostUpdateEnd(self.vec, caddv, csctm) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_scattermode(__pyx_v_mode); if (unlikely(__pyx_t_2 == ((ScatterMode)-1L))) __PYX_ERR(30, 771, __pyx_L1_error)
  __pyx_v_csctm = __pyx_t_2;

  /* "PETSc/Vec.pyx":772
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecGhostUpdateEnd(self.vec, caddv, csctm) )             # <<<<<<<<<<<<<<
 * 
 *     def ghostUpdate(self, addv=None, mode=None):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGhostUpdateEnd(__pyx_v_self->vec, __pyx_v_caddv, __pyx_v_csctm)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 772, __pyx_L1_error)

  /* "PETSc/Vec.pyx":769
 *         CHKERR( VecGhostUpdateBegin(self.vec, caddv, csctm) )
 * 
 *     def ghostUpdateEnd(self, addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.ghostUpdateEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":774
 *         CHKERR( VecGhostUpdateEnd(self.vec, caddv, csctm) )
 * 
 *     def ghostUpdate(self, addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_251ghostUpdate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_250ghostUpdate[] = "Vec.ghostUpdate(self, addv=None, mode=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_251ghostUpdate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ghostUpdate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addv,&__pyx_n_s_mode,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ghostUpdate") < 0)) __PYX_ERR(30, 774, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_addv = values[0];
    __pyx_v_mode = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ghostUpdate", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 774, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.ghostUpdate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_250ghostUpdate(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_addv, __pyx_v_mode);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_250ghostUpdate(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode) {
  InsertMode __pyx_v_caddv;
  ScatterMode __pyx_v_csctm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  ScatterMode __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("ghostUpdate", 0);

  /* "PETSc/Vec.pyx":775
 * 
 *     def ghostUpdate(self, addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecGhostUpdateBegin(self.vec, caddv, csctm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(30, 775, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_1;

  /* "PETSc/Vec.pyx":776
 *     def ghostUpdate(self, addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)             # <<<<<<<<<<<<<<
 *         CHKERR( VecGhostUpdateBegin(self.vec, caddv, csctm) )
 *         CHKERR( VecGhostUpdateEnd(self.vec, caddv, csctm) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_scattermode(__pyx_v_mode); if (unlikely(__pyx_t_2 == ((ScatterMode)-1L))) __PYX_ERR(30, 776, __pyx_L1_error)
  __pyx_v_csctm = __pyx_t_2;

  /* "PETSc/Vec.pyx":777
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecGhostUpdateBegin(self.vec, caddv, csctm) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecGhostUpdateEnd(self.vec, caddv, csctm) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGhostUpdateBegin(__pyx_v_self->vec, __pyx_v_caddv, __pyx_v_csctm)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 777, __pyx_L1_error)

  /* "PETSc/Vec.pyx":778
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecGhostUpdateBegin(self.vec, caddv, csctm) )
 *         CHKERR( VecGhostUpdateEnd(self.vec, caddv, csctm) )             # <<<<<<<<<<<<<<
 * 
 *     def setMPIGhost(self, ghosts):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGhostUpdateEnd(__pyx_v_self->vec, __pyx_v_caddv, __pyx_v_csctm)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 778, __pyx_L1_error)

  /* "PETSc/Vec.pyx":774
 *         CHKERR( VecGhostUpdateEnd(self.vec, caddv, csctm) )
 * 
 *     def ghostUpdate(self, addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.ghostUpdate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":780
 *         CHKERR( VecGhostUpdateEnd(self.vec, caddv, csctm) )
 * 
 *     def setMPIGhost(self, ghosts):             # <<<<<<<<<<<<<<
 *         "Alternative to createGhost()"
 *         cdef PetscInt ng=0, *ig=NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_253setMPIGhost(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_252setMPIGhost[] = "Vec.setMPIGhost(self, ghosts)\nAlternative to createGhost()";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_253setMPIGhost(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ghosts = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMPIGhost (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ghosts,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);
        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_ghosts)) != 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, "setMPIGhost") < 0)) __PYX_ERR(30, 780, __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_ghosts = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMPIGhost", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 780, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setMPIGhost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_252setMPIGhost(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_ghosts);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_252setMPIGhost(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_ghosts) {
  PetscInt __pyx_v_ng;
  PetscInt *__pyx_v_ig;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMPIGhost", 0);
  __Pyx_INCREF(__pyx_v_ghosts);

  /* "PETSc/Vec.pyx":782
 *     def setMPIGhost(self, ghosts):
 *         "Alternative to createGhost()"
 *         cdef PetscInt ng=0, *ig=NULL             # <<<<<<<<<<<<<<
 *         ghosts = iarray_i(ghosts, &ng, &ig)
 *         CHKERR( VecMPISetGhost(self.vec, ng, ig) )
 */
  __pyx_v_ng = 0;
  __pyx_v_ig = NULL;

  /* "PETSc/Vec.pyx":783
 *         "Alternative to createGhost()"
 *         cdef PetscInt ng=0, *ig=NULL
 *         ghosts = iarray_i(ghosts, &ng, &ig)             # <<<<<<<<<<<<<<
 *         CHKERR( VecMPISetGhost(self.vec, ng, ig) )
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_ghosts, (&__pyx_v_ng), (&__pyx_v_ig))); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_ghosts, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":784
 *         cdef PetscInt ng=0, *ig=NULL
 *         ghosts = iarray_i(ghosts, &ng, &ig)
 *         CHKERR( VecMPISetGhost(self.vec, ng, ig) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecMPISetGhost(__pyx_v_self->vec, __pyx_v_ng, __pyx_v_ig)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(30, 784, __pyx_L1_error)

  /* "PETSc/Vec.pyx":780
 *         CHKERR( VecGhostUpdateEnd(self.vec, caddv, csctm) )
 * 
 *     def setMPIGhost(self, ghosts):             # <<<<<<<<<<<<<<
 *         "Alternative to createGhost()"
 *         cdef PetscInt ng=0, *ig=NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setMPIGhost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ghosts);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":788
 *     #
 * 
 *     def getSubVector(self, IS iset not None, Vec subvec=None):             # <<<<<<<<<<<<<<
 *         if subvec is None: subvec = Vec()
 *         else: CHKERR( VecDestroy(&subvec.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_255getSubVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_254getSubVector[] = "Vec.getSubVector(self, IS iset, Vec subvec=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_255getSubVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  struct PyPetscVecObject *__pyx_v_subvec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSubVector (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iset,&__pyx_n_s_subvec,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct PyPetscVecObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_iset)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_subvec);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getSubVector") < 0)) __PYX_ERR(30, 788, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_iset = ((struct PyPetscISObject *)values[0]);
    __pyx_v_subvec = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getSubVector", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 788, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getSubVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iset), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iset", 0))) __PYX_ERR(30, 788, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_subvec), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "subvec", 0))) __PYX_ERR(30, 788, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_254getSubVector(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_iset, __pyx_v_subvec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_254getSubVector(struct PyPetscVecObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset, struct PyPetscVecObject *__pyx_v_subvec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("getSubVector", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_subvec);

  /* "PETSc/Vec.pyx":789
 * 
 *     def getSubVector(self, IS iset not None, Vec subvec=None):
 *         if subvec is None: subvec = Vec()             # <<<<<<<<<<<<<<
 *         else: CHKERR( VecDestroy(&subvec.vec) )
 *         CHKERR( VecGetSubVector(self.vec, iset.iset, &subvec.vec) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_subvec) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_subvec, ((struct PyPetscVecObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "PETSc/Vec.pyx":790
 *     def getSubVector(self, IS iset not None, Vec subvec=None):
 *         if subvec is None: subvec = Vec()
 *         else: CHKERR( VecDestroy(&subvec.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( VecGetSubVector(self.vec, iset.iset, &subvec.vec) )
 *         return subvec
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecDestroy((&__pyx_v_subvec->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 790, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/Vec.pyx":791
 *         if subvec is None: subvec = Vec()
 *         else: CHKERR( VecDestroy(&subvec.vec) )
 *         CHKERR( VecGetSubVector(self.vec, iset.iset, &subvec.vec) )             # <<<<<<<<<<<<<<
 *         return subvec
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecGetSubVector(__pyx_v_self->vec, __pyx_v_iset->iset, (&__pyx_v_subvec->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(30, 791, __pyx_L1_error)

  /* "PETSc/Vec.pyx":792
 *         else: CHKERR( VecDestroy(&subvec.vec) )
 *         CHKERR( VecGetSubVector(self.vec, iset.iset, &subvec.vec) )
 *         return subvec             # <<<<<<<<<<<<<<
 * 
 *     def restoreSubVector(self, IS iset not None, Vec subvec not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_subvec));
  __pyx_r = ((PyObject *)__pyx_v_subvec);
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":788
 *     #
 * 
 *     def getSubVector(self, IS iset not None, Vec subvec=None):             # <<<<<<<<<<<<<<
 *         if subvec is None: subvec = Vec()
 *         else: CHKERR( VecDestroy(&subvec.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getSubVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_subvec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":794
 *         return subvec
 * 
 *     def restoreSubVector(self, IS iset not None, Vec subvec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecRestoreSubVector(self.vec, iset.iset, &subvec.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_257restoreSubVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_256restoreSubVector[] = "Vec.restoreSubVector(self, IS iset, Vec subvec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_257restoreSubVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  struct PyPetscVecObject *__pyx_v_subvec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("restoreSubVector (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iset,&__pyx_n_s_subvec,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_iset)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_subvec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("restoreSubVector", 1, 2, 2, 1); __PYX_ERR(30, 794, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "restoreSubVector") < 0)) __PYX_ERR(30, 794, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_iset = ((struct PyPetscISObject *)values[0]);
    __pyx_v_subvec = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("restoreSubVector", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 794, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.restoreSubVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iset), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iset", 0))) __PYX_ERR(30, 794, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_subvec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "subvec", 0))) __PYX_ERR(30, 794, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_256restoreSubVector(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_iset, __pyx_v_subvec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_256restoreSubVector(struct PyPetscVecObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset, struct PyPetscVecObject *__pyx_v_subvec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("restoreSubVector", 0);

  /* "PETSc/Vec.pyx":795
 * 
 *     def restoreSubVector(self, IS iset not None, Vec subvec not None):
 *         CHKERR( VecRestoreSubVector(self.vec, iset.iset, &subvec.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def getNestSubVecs(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecRestoreSubVector(__pyx_v_self->vec, __pyx_v_iset->iset, (&__pyx_v_subvec->vec))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 795, __pyx_L1_error)

  /* "PETSc/Vec.pyx":794
 *         return subvec
 * 
 *     def restoreSubVector(self, IS iset not None, Vec subvec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( VecRestoreSubVector(self.vec, iset.iset, &subvec.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.restoreSubVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":797
 *         CHKERR( VecRestoreSubVector(self.vec, iset.iset, &subvec.vec) )
 * 
 *     def getNestSubVecs(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt N=0
 *         cdef PetscVec* sx=NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_259getNestSubVecs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_258getNestSubVecs[] = "Vec.getNestSubVecs(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_259getNestSubVecs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getNestSubVecs (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getNestSubVecs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getNestSubVecs", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_258getNestSubVecs(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_258getNestSubVecs(struct PyPetscVecObject *__pyx_v_self) {
  PetscInt __pyx_v_N;
  Vec *__pyx_v_sx;
  PyObject *__pyx_v_output = NULL;
  PetscInt __pyx_v_i;
  struct PyPetscVecObject *__pyx_v_pyvec = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscInt __pyx_t_3;
  PetscInt __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("getNestSubVecs", 0);

  /* "PETSc/Vec.pyx":798
 * 
 *     def getNestSubVecs(self):
 *         cdef PetscInt N=0             # <<<<<<<<<<<<<<
 *         cdef PetscVec* sx=NULL
 *         CHKERR( VecNestGetSubVecs(self.vec, &N, &sx) )
 */
  __pyx_v_N = 0;

  /* "PETSc/Vec.pyx":799
 *     def getNestSubVecs(self):
 *         cdef PetscInt N=0
 *         cdef PetscVec* sx=NULL             # <<<<<<<<<<<<<<
 *         CHKERR( VecNestGetSubVecs(self.vec, &N, &sx) )
 *         output = []
 */
  __pyx_v_sx = NULL;

  /* "PETSc/Vec.pyx":800
 *         cdef PetscInt N=0
 *         cdef PetscVec* sx=NULL
 *         CHKERR( VecNestGetSubVecs(self.vec, &N, &sx) )             # <<<<<<<<<<<<<<
 *         output = []
 *         for i in range(N):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecNestGetSubVecs(__pyx_v_self->vec, (&__pyx_v_N), (&__pyx_v_sx))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 800, __pyx_L1_error)

  /* "PETSc/Vec.pyx":801
 *         cdef PetscVec* sx=NULL
 *         CHKERR( VecNestGetSubVecs(self.vec, &N, &sx) )
 *         output = []             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *           pyvec = Vec()
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_output = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Vec.pyx":802
 *         CHKERR( VecNestGetSubVecs(self.vec, &N, &sx) )
 *         output = []
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *           pyvec = Vec()
 *           pyvec.vec = sx[i]
 */
  __pyx_t_3 = __pyx_v_N;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "PETSc/Vec.pyx":803
 *         output = []
 *         for i in range(N):
 *           pyvec = Vec()             # <<<<<<<<<<<<<<
 *           pyvec.vec = sx[i]
 *           CHKERR( PetscObjectReference(<PetscObject> pyvec.vec) )
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_pyvec, ((struct PyPetscVecObject *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "PETSc/Vec.pyx":804
 *         for i in range(N):
 *           pyvec = Vec()
 *           pyvec.vec = sx[i]             # <<<<<<<<<<<<<<
 *           CHKERR( PetscObjectReference(<PetscObject> pyvec.vec) )
 *           output.append(pyvec)
 */
    __pyx_v_pyvec->vec = (__pyx_v_sx[__pyx_v_i]);

    /* "PETSc/Vec.pyx":805
 *           pyvec = Vec()
 *           pyvec.vec = sx[i]
 *           CHKERR( PetscObjectReference(<PetscObject> pyvec.vec) )             # <<<<<<<<<<<<<<
 *           output.append(pyvec)
 * 
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectReference(((PetscObject)__pyx_v_pyvec->vec))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(30, 805, __pyx_L1_error)

    /* "PETSc/Vec.pyx":806
 *           pyvec.vec = sx[i]
 *           CHKERR( PetscObjectReference(<PetscObject> pyvec.vec) )
 *           output.append(pyvec)             # <<<<<<<<<<<<<<
 * 
 *         return output
 */
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_output, ((PyObject *)__pyx_v_pyvec)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(30, 806, __pyx_L1_error)
  }

  /* "PETSc/Vec.pyx":808
 *           output.append(pyvec)
 * 
 *         return output             # <<<<<<<<<<<<<<
 * 
 *     def setNestSubVecs(self, sx, idxm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output);
  __pyx_r = __pyx_v_output;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":797
 *         CHKERR( VecRestoreSubVector(self.vec, iset.iset, &subvec.vec) )
 * 
 *     def getNestSubVecs(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt N=0
 *         cdef PetscVec* sx=NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.getNestSubVecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output);
  __Pyx_XDECREF((PyObject *)__pyx_v_pyvec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":810
 *         return output
 * 
 *     def setNestSubVecs(self, sx, idxm=None):             # <<<<<<<<<<<<<<
 *         if idxm is None: idxm = range(len(sx))
 *         else: assert len(idxm) == len(sx)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_261setNestSubVecs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Vec_260setNestSubVecs[] = "Vec.setNestSubVecs(self, sx, idxm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_261setNestSubVecs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sx = 0;
  PyObject *__pyx_v_idxm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setNestSubVecs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sx,&__pyx_n_s_idxm,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_sx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_idxm);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setNestSubVecs") < 0)) __PYX_ERR(30, 810, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sx = values[0];
    __pyx_v_idxm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setNestSubVecs", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(30, 810, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setNestSubVecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_260setNestSubVecs(((struct PyPetscVecObject *)__pyx_v_self), __pyx_v_sx, __pyx_v_idxm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_260setNestSubVecs(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_sx, PyObject *__pyx_v_idxm) {
  PetscInt __pyx_v_N;
  PetscInt *__pyx_v_cidxm;
  Vec *__pyx_v_csx;
  CYTHON_UNUSED PyArrayObject *__pyx_v_tmp = NULL;
  long __pyx_v_i;
  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;
  Py_ssize_t __pyx_t_6;
  PetscInt __pyx_t_7;
  Vec __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("setNestSubVecs", 0);
  __Pyx_INCREF(__pyx_v_idxm);

  /* "PETSc/Vec.pyx":811
 * 
 *     def setNestSubVecs(self, sx, idxm=None):
 *         if idxm is None: idxm = range(len(sx))             # <<<<<<<<<<<<<<
 *         else: assert len(idxm) == len(sx)
 *         cdef PetscInt N = 0
 */
  __pyx_t_1 = (__pyx_v_idxm == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = PyObject_Length(__pyx_v_sx); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 811, __pyx_L1_error)
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 811, __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_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_idxm, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }

  /* "PETSc/Vec.pyx":812
 *     def setNestSubVecs(self, sx, idxm=None):
 *         if idxm is None: idxm = range(len(sx))
 *         else: assert len(idxm) == len(sx)             # <<<<<<<<<<<<<<
 *         cdef PetscInt N = 0
 *         cdef PetscInt* cidxm = NULL
 */
  /*else*/ {
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_3 = PyObject_Length(__pyx_v_idxm); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(30, 812, __pyx_L1_error)
      __pyx_t_6 = PyObject_Length(__pyx_v_sx); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(30, 812, __pyx_L1_error)
      if (unlikely(!((__pyx_t_3 == __pyx_t_6) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(30, 812, __pyx_L1_error)
      }
    }
    #endif
  }
  __pyx_L3:;

  /* "PETSc/Vec.pyx":813
 *         if idxm is None: idxm = range(len(sx))
 *         else: assert len(idxm) == len(sx)
 *         cdef PetscInt N = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt* cidxm = NULL
 *         idxm = iarray_i(idxm, &N, &cidxm)
 */
  __pyx_v_N = 0;

  /* "PETSc/Vec.pyx":814
 *         else: assert len(idxm) == len(sx)
 *         cdef PetscInt N = 0
 *         cdef PetscInt* cidxm = NULL             # <<<<<<<<<<<<<<
 *         idxm = iarray_i(idxm, &N, &cidxm)
 * 
 */
  __pyx_v_cidxm = NULL;

  /* "PETSc/Vec.pyx":815
 *         cdef PetscInt N = 0
 *         cdef PetscInt* cidxm = NULL
 *         idxm = iarray_i(idxm, &N, &cidxm)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_idxm, (&__pyx_v_N), (&__pyx_v_cidxm))); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_idxm, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/Vec.pyx":818
 * 
 * 
 *         cdef PetscVec* csx = NULL             # <<<<<<<<<<<<<<
 *         tmp = oarray_p(empty_p(N), NULL, <void**>&csx)
 *         for i from 0 <= i < N: csx[i] = (<Vec?>sx[i]).vec
 */
  __pyx_v_csx = NULL;

  /* "PETSc/Vec.pyx":819
 * 
 *         cdef PetscVec* csx = NULL
 *         tmp = oarray_p(empty_p(N), NULL, <void**>&csx)             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < N: csx[i] = (<Vec?>sx[i]).vec
 * 
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_N)); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_4, NULL, ((void **)(&__pyx_v_csx)))); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_tmp = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "PETSc/Vec.pyx":820
 *         cdef PetscVec* csx = NULL
 *         tmp = oarray_p(empty_p(N), NULL, <void**>&csx)
 *         for i from 0 <= i < N: csx[i] = (<Vec?>sx[i]).vec             # <<<<<<<<<<<<<<
 * 
 *         CHKERR( VecNestSetSubVecs(self.vec, N, cidxm, csx) )
 */
  __pyx_t_7 = __pyx_v_N;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_sx, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(30, 820, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_8petsc4py_5PETSc_Vec)))) __PYX_ERR(30, 820, __pyx_L1_error)
    __pyx_t_8 = ((struct PyPetscVecObject *)__pyx_t_5)->vec;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    (__pyx_v_csx[__pyx_v_i]) = __pyx_t_8;
  }

  /* "PETSc/Vec.pyx":822
 *         for i from 0 <= i < N: csx[i] = (<Vec?>sx[i]).vec
 * 
 *         CHKERR( VecNestSetSubVecs(self.vec, N, cidxm, csx) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecNestSetSubVecs(__pyx_v_self->vec, __pyx_v_N, __pyx_v_cidxm, __pyx_v_csx)); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(30, 822, __pyx_L1_error)

  /* "PETSc/Vec.pyx":810
 *         return output
 * 
 *     def setNestSubVecs(self, sx, idxm=None):             # <<<<<<<<<<<<<<
 *         if idxm is None: idxm = range(len(sx))
 *         else: assert len(idxm) == len(sx)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.setNestSubVecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tmp);
  __Pyx_XDECREF(__pyx_v_idxm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":827
 * 
 *     property sizes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSizes()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_5sizes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_5sizes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_5sizes___get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_5sizes___get__(struct PyPetscVecObject *__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);

  /* "PETSc/Vec.pyx":828
 *     property sizes:
 *         def __get__(self):
 *             return self.getSizes()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setSizes(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSizes); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(30, 828, __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(30, 828, __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;

  /* "PETSc/Vec.pyx":827
 * 
 *     property sizes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSizes()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.sizes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":829
 *         def __get__(self):
 *             return self.getSizes()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setSizes(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3Vec_5sizes_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3Vec_5sizes_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_5sizes_2__set__(((struct PyPetscVecObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_3Vec_5sizes_2__set__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Vec.pyx":830
 *             return self.getSizes()
 *         def __set__(self, value):
 *             self.setSizes(value)             # <<<<<<<<<<<<<<
 * 
 *     property size:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setSizes); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 830, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 830, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 830, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":829
 *         def __get__(self):
 *             return self.getSizes()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setSizes(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.sizes.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":833
 * 
 *     property size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSize()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_4size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_4size___get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_4size___get__(struct PyPetscVecObject *__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);

  /* "PETSc/Vec.pyx":834
 *     property size:
 *         def __get__(self):
 *             return self.getSize()             # <<<<<<<<<<<<<<
 * 
 *     property local_size:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(30, 834, __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(30, 834, __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;

  /* "PETSc/Vec.pyx":833
 * 
 *     property size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSize()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":837
 * 
 *     property local_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getLocalSize()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_10local_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_10local_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_10local_size___get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_10local_size___get__(struct PyPetscVecObject *__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);

  /* "PETSc/Vec.pyx":838
 *     property local_size:
 *         def __get__(self):
 *             return self.getLocalSize()             # <<<<<<<<<<<<<<
 * 
 *     property block_size:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getLocalSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(30, 838, __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(30, 838, __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;

  /* "PETSc/Vec.pyx":837
 * 
 *     property local_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getLocalSize()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.local_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":841
 * 
 *     property block_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockSize()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_10block_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_10block_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_10block_size___get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_10block_size___get__(struct PyPetscVecObject *__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);

  /* "PETSc/Vec.pyx":842
 *     property block_size:
 *         def __get__(self):
 *             return self.getBlockSize()             # <<<<<<<<<<<<<<
 * 
 *     property owner_range:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getBlockSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(30, 842, __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(30, 842, __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;

  /* "PETSc/Vec.pyx":841
 * 
 *     property block_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockSize()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.block_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":845
 * 
 *     property owner_range:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOwnershipRange()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_11owner_range_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_11owner_range_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_11owner_range___get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_11owner_range___get__(struct PyPetscVecObject *__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);

  /* "PETSc/Vec.pyx":846
 *     property owner_range:
 *         def __get__(self):
 *             return self.getOwnershipRange()             # <<<<<<<<<<<<<<
 * 
 *     property owner_ranges:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getOwnershipRange); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(30, 846, __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(30, 846, __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;

  /* "PETSc/Vec.pyx":845
 * 
 *     property owner_range:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOwnershipRange()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.owner_range.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":849
 * 
 *     property owner_ranges:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOwnershipRanges()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_12owner_ranges_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_12owner_ranges_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_12owner_ranges___get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_12owner_ranges___get__(struct PyPetscVecObject *__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);

  /* "PETSc/Vec.pyx":850
 *     property owner_ranges:
 *         def __get__(self):
 *             return self.getOwnershipRanges()             # <<<<<<<<<<<<<<
 * 
 *     property buffer_w:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getOwnershipRanges); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(30, 850, __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(30, 850, __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;

  /* "PETSc/Vec.pyx":849
 * 
 *     property owner_ranges:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOwnershipRanges()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.owner_ranges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":854
 *     property buffer_w:
 *         "Vec buffer (writable)"
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBuffer()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_8buffer_w_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_8buffer_w_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_8buffer_w___get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_8buffer_w___get__(struct PyPetscVecObject *__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);

  /* "PETSc/Vec.pyx":855
 *         "Vec buffer (writable)"
 *         def __get__(self):
 *             return self.getBuffer()             # <<<<<<<<<<<<<<
 * 
 *     property buffer_r:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getBuffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(30, 855, __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(30, 855, __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;

  /* "PETSc/Vec.pyx":854
 *     property buffer_w:
 *         "Vec buffer (writable)"
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBuffer()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.buffer_w.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":859
 *     property buffer_r:
 *         "Vec buffer (read-only)"
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBuffer(True)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_8buffer_r_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_8buffer_r_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_8buffer_r___get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_8buffer_r___get__(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/Vec.pyx":860
 *         "Vec buffer (read-only)"
 *         def __get__(self):
 *             return self.getBuffer(True)             # <<<<<<<<<<<<<<
 * 
 *     property array_w:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getBuffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 860, __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;

  /* "PETSc/Vec.pyx":859
 *     property buffer_r:
 *         "Vec buffer (read-only)"
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBuffer(True)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.buffer_r.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":864
 *     property array_w:
 *         "Vec array (writable)"
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getArray()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_7array_w_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_7array_w_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_7array_w___get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_7array_w___get__(struct PyPetscVecObject *__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);

  /* "PETSc/Vec.pyx":865
 *         "Vec array (writable)"
 *         def __get__(self):
 *             return self.getArray()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             cdef buf = self.getBuffer()
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(30, 865, __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(30, 865, __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;

  /* "PETSc/Vec.pyx":864
 *     property array_w:
 *         "Vec array (writable)"
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getArray()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.array_w.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":866
 *         def __get__(self):
 *             return self.getArray()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef buf = self.getBuffer()
 *             with buf as array: array[:] = value
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3Vec_7array_w_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3Vec_7array_w_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_7array_w_2__set__(((struct PyPetscVecObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_3Vec_7array_w_2__set__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_buf = 0;
  PyObject *__pyx_v_array = NULL;
  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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Vec.pyx":867
 *             return self.getArray()
 *         def __set__(self, value):
 *             cdef buf = self.getBuffer()             # <<<<<<<<<<<<<<
 *             with buf as array: array[:] = value
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getBuffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(30, 867, __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(30, 867, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_buf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":868
 *         def __set__(self, value):
 *             cdef buf = self.getBuffer()
 *             with buf as array: array[:] = value             # <<<<<<<<<<<<<<
 * 
 *     property array_r:
 */
  /*with:*/ {
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_v_buf, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_v_buf, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 868, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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(30, 868, __pyx_L3_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(30, 868, __pyx_L3_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        /*try:*/ {
          __pyx_v_array = __pyx_t_2;
          __pyx_t_2 = 0;
          if (__Pyx_PyObject_SetSlice(__pyx_v_array, __pyx_v_value, 0, 0, NULL, NULL, &__pyx_slice__55, 0, 0, 1) < 0) __PYX_ERR(30, 868, __pyx_L7_error)
        }
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_PyThreadState_assign
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("petsc4py.PETSc.Vec.array_w.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(30, 868, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_8 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 868, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(30, 868, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_10 < 0) __PYX_ERR(30, 868, __pyx_L9_except_error)
          __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_XGIVEREF(__pyx_t_3);
            __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_3);
            __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0; 
            __PYX_ERR(30, 868, __pyx_L9_except_error)
          }
          __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;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_PyThreadState_assign
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_PyThreadState_assign
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_4) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__56, NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(30, 868, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L18;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L1_error;
    __pyx_L18:;
  }

  /* "PETSc/Vec.pyx":866
 *         def __get__(self):
 *             return self.getArray()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef buf = self.getBuffer()
 *             with buf as array: array[:] = value
 */

  /* 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_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.array_w.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_buf);
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":872
 *     property array_r:
 *         "Vec array (read-only)"
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getArray(True)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_7array_r_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_7array_r_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_7array_r___get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_7array_r___get__(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/Vec.pyx":873
 *         "Vec array (read-only)"
 *         def __get__(self):
 *             return self.getArray(True)             # <<<<<<<<<<<<<<
 * 
 *     property buffer:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 873, __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;

  /* "PETSc/Vec.pyx":872
 *     property array_r:
 *         "Vec array (read-only)"
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getArray(True)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.array_r.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":876
 * 
 *     property buffer:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.buffer_w
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_6buffer_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_6buffer_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_6buffer___get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_6buffer___get__(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/Vec.pyx":877
 *     property buffer:
 *         def __get__(self):
 *             return self.buffer_w             # <<<<<<<<<<<<<<
 * 
 *     property array:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_buffer_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":876
 * 
 *     property buffer:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.buffer_w
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.buffer.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":880
 * 
 *     property array:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.array_w
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_5array_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_5array_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_5array___get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_5array___get__(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/Vec.pyx":881
 *     property array:
 *         def __get__(self):
 *             return self.array_w             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.array_w = value
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_array_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":880
 * 
 *     property array:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.array_w
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.array.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":882
 *         def __get__(self):
 *             return self.array_w
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.array_w = value
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3Vec_5array_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3Vec_5array_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_5array_2__set__(((struct PyPetscVecObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_3Vec_5array_2__set__(struct PyPetscVecObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Vec.pyx":883
 *             return self.array_w
 *         def __set__(self, value):
 *             self.array_w = value             # <<<<<<<<<<<<<<
 * 
 *     # --- NumPy array interface (legacy) ---
 */
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_array_w, __pyx_v_value) < 0) __PYX_ERR(30, 883, __pyx_L1_error)

  /* "PETSc/Vec.pyx":882
 *         def __get__(self):
 *             return self.array_w
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.array_w = value
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.array.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Vec.pyx":888
 * 
 *     property __array_interface__:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef buf = self.getBuffer()
 *             return buf.__array_interface__
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_19__array_interface___1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Vec_19__array_interface___1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Vec_19__array_interface_____get__(((struct PyPetscVecObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Vec_19__array_interface_____get__(struct PyPetscVecObject *__pyx_v_self) {
  PyObject *__pyx_v_buf = 0;
  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);

  /* "PETSc/Vec.pyx":889
 *     property __array_interface__:
 *         def __get__(self):
 *             cdef buf = self.getBuffer()             # <<<<<<<<<<<<<<
 *             return buf.__array_interface__
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getBuffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(30, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(30, 889, __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(30, 889, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_buf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/Vec.pyx":890
 *         def __get__(self):
 *             cdef buf = self.getBuffer()
 *             return buf.__array_interface__             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_buf, __pyx_n_s_array_interface); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Vec.pyx":888
 * 
 *     property __array_interface__:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef buf = self.getBuffer()
 *             return buf.__array_interface__
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Vec.__array_interface__.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Scatter.pyx":9
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.sct
 *         self.sct = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_7Scatter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_7Scatter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter___cinit__(((struct PyPetscScatterObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_7Scatter___cinit__(struct PyPetscScatterObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Scatter.pyx":10
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.sct             # <<<<<<<<<<<<<<
 *         self.sct = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->sct));

  /* "PETSc/Scatter.pyx":11
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.sct
 *         self.sct = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, x, y, addv=None, mode=None):
 */
  __pyx_v_self->sct = NULL;

  /* "PETSc/Scatter.pyx":9
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.sct
 *         self.sct = NULL
 */

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

/* "PETSc/Scatter.pyx":13
 *         self.sct = NULL
 * 
 *     def __call__(self, x, y, addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         self.scatter(x, y, addv, mode)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_addv,&__pyx_n_s_mode,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__call__", 0, 2, 4, 1); __PYX_ERR(31, 13, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(31, 13, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_addv = values[2];
    __pyx_v_mode = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(31, 13, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter_2__call__(((struct PyPetscScatterObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_addv, __pyx_v_mode);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_2__call__(struct PyPetscScatterObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode) {
  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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "PETSc/Scatter.pyx":14
 * 
 *     def __call__(self, x, y, addv=None, mode=None):
 *         self.scatter(x, y, addv, mode)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_scatter); if (unlikely(!__pyx_t_2)) __PYX_ERR(31, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(31, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_y);
  __Pyx_INCREF(__pyx_v_addv);
  __Pyx_GIVEREF(__pyx_v_addv);
  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_addv);
  __Pyx_INCREF(__pyx_v_mode);
  __Pyx_GIVEREF(__pyx_v_mode);
  PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_mode);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(31, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Scatter.pyx":13
 *         self.sct = NULL
 * 
 *     def __call__(self, x, y, addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         self.scatter(x, y, addv, mode)
 * 
 */

  /* 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Scatter.pyx":18
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Scatter_4view[] = "Scatter.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(31, 18, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(31, 18, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(31, 18, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter_4view(((struct PyPetscScatterObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_4view(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/Scatter.pyx":19
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( VecScatterView(self.sct, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/Scatter.pyx":20
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( VecScatterView(self.sct, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/Scatter.pyx":21
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( VecScatterView(self.sct, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScatterView(__pyx_v_self->sct, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(31, 21, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":18
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Scatter.pyx":23
 *         CHKERR( VecScatterView(self.sct, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecScatterDestroy(&self.sct) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Scatter_6destroy[] = "Scatter.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter_6destroy(((struct PyPetscScatterObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_6destroy(struct PyPetscScatterObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/Scatter.pyx":24
 * 
 *     def destroy(self):
 *         CHKERR( VecScatterDestroy(&self.sct) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScatterDestroy((&__pyx_v_self->sct))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(31, 24, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":25
 *     def destroy(self):
 *         CHKERR( VecScatterDestroy(&self.sct) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, Vec vec_from not None, IS is_from,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Scatter.pyx":23
 *         CHKERR( VecScatterView(self.sct, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( VecScatterDestroy(&self.sct) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Scatter.pyx":27
 *         return self
 * 
 *     def create(self, Vec vec_from not None, IS is_from,             # <<<<<<<<<<<<<<
 *                Vec vec_to not None, IS is_to):
 *         cdef PetscIS cisfrom = NULL, cisto = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Scatter_8create[] = "Scatter.create(self, Vec vec_from, IS is_from, Vec vec_to, IS is_to)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec_from = 0;
  struct PyPetscISObject *__pyx_v_is_from = 0;
  struct PyPetscVecObject *__pyx_v_vec_to = 0;
  struct PyPetscISObject *__pyx_v_is_to = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec_from,&__pyx_n_s_is_from,&__pyx_n_s_vec_to,&__pyx_n_s_is_to,0};
    PyObject* values[4] = {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  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vec_from)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_is_from)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create", 1, 4, 4, 1); __PYX_ERR(31, 27, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vec_to)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create", 1, 4, 4, 2); __PYX_ERR(31, 27, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_is_to)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create", 1, 4, 4, 3); __PYX_ERR(31, 27, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(31, 27, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      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);
    }
    __pyx_v_vec_from = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_is_from = ((struct PyPetscISObject *)values[1]);
    __pyx_v_vec_to = ((struct PyPetscVecObject *)values[2]);
    __pyx_v_is_to = ((struct PyPetscISObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(31, 27, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_from), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec_from", 0))) __PYX_ERR(31, 27, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_is_from), __pyx_ptype_8petsc4py_5PETSc_IS, 1, "is_from", 0))) __PYX_ERR(31, 27, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_to), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec_to", 0))) __PYX_ERR(31, 28, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_is_to), __pyx_ptype_8petsc4py_5PETSc_IS, 1, "is_to", 0))) __PYX_ERR(31, 28, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter_8create(((struct PyPetscScatterObject *)__pyx_v_self), __pyx_v_vec_from, __pyx_v_is_from, __pyx_v_vec_to, __pyx_v_is_to);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_8create(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec_from, struct PyPetscISObject *__pyx_v_is_from, struct PyPetscVecObject *__pyx_v_vec_to, struct PyPetscISObject *__pyx_v_is_to) {
  IS __pyx_v_cisfrom;
  IS __pyx_v_cisto;
  VecScatter __pyx_v_newsct;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  IS __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/Scatter.pyx":29
 *     def create(self, Vec vec_from not None, IS is_from,
 *                Vec vec_to not None, IS is_to):
 *         cdef PetscIS cisfrom = NULL, cisto = NULL             # <<<<<<<<<<<<<<
 *         if is_from is not None: cisfrom = is_from.iset
 *         if is_to   is not None: cisto   = is_to.iset
 */
  __pyx_v_cisfrom = NULL;
  __pyx_v_cisto = NULL;

  /* "PETSc/Scatter.pyx":30
 *                Vec vec_to not None, IS is_to):
 *         cdef PetscIS cisfrom = NULL, cisto = NULL
 *         if is_from is not None: cisfrom = is_from.iset             # <<<<<<<<<<<<<<
 *         if is_to   is not None: cisto   = is_to.iset
 *         cdef PetscScatter newsct = NULL
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_is_from) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_is_from->iset;
    __pyx_v_cisfrom = __pyx_t_3;
  }

  /* "PETSc/Scatter.pyx":31
 *         cdef PetscIS cisfrom = NULL, cisto = NULL
 *         if is_from is not None: cisfrom = is_from.iset
 *         if is_to   is not None: cisto   = is_to.iset             # <<<<<<<<<<<<<<
 *         cdef PetscScatter newsct = NULL
 *         CHKERR( VecScatterCreate(
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_is_to) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_is_to->iset;
    __pyx_v_cisto = __pyx_t_3;
  }

  /* "PETSc/Scatter.pyx":32
 *         if is_from is not None: cisfrom = is_from.iset
 *         if is_to   is not None: cisto   = is_to.iset
 *         cdef PetscScatter newsct = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( VecScatterCreate(
 *                 vec_from.vec, cisfrom, vec_to.vec, cisto, &newsct) )
 */
  __pyx_v_newsct = NULL;

  /* "PETSc/Scatter.pyx":33
 *         if is_to   is not None: cisto   = is_to.iset
 *         cdef PetscScatter newsct = NULL
 *         CHKERR( VecScatterCreate(             # <<<<<<<<<<<<<<
 *                 vec_from.vec, cisfrom, vec_to.vec, cisto, &newsct) )
 *         PetscCLEAR(self.obj); self.sct = newsct
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScatterCreate(__pyx_v_vec_from->vec, __pyx_v_cisfrom, __pyx_v_vec_to->vec, __pyx_v_cisto, (&__pyx_v_newsct))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(31, 33, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":35
 *         CHKERR( VecScatterCreate(
 *                 vec_from.vec, cisfrom, vec_to.vec, cisto, &newsct) )
 *         PetscCLEAR(self.obj); self.sct = newsct             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->sct = __pyx_v_newsct;

  /* "PETSc/Scatter.pyx":36
 *                 vec_from.vec, cisfrom, vec_to.vec, cisto, &newsct) )
 *         PetscCLEAR(self.obj); self.sct = newsct
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Scatter.pyx":27
 *         return self
 * 
 *     def create(self, Vec vec_from not None, IS is_from,             # <<<<<<<<<<<<<<
 *                Vec vec_to not None, IS is_to):
 *         cdef PetscIS cisfrom = NULL, cisto = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Scatter.pyx":38
 *         return self
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef Scatter scatter = Scatter()
 *         CHKERR( VecScatterCopy(self.sct, &scatter.sct) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_11copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Scatter_10copy[] = "Scatter.copy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_11copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter_10copy(((struct PyPetscScatterObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_10copy(struct PyPetscScatterObject *__pyx_v_self) {
  struct PyPetscScatterObject *__pyx_v_scatter = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "PETSc/Scatter.pyx":39
 * 
 *     def copy(self):
 *         cdef Scatter scatter = Scatter()             # <<<<<<<<<<<<<<
 *         CHKERR( VecScatterCopy(self.sct, &scatter.sct) )
 *         return scatter
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Scatter), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(31, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_scatter = ((struct PyPetscScatterObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Scatter.pyx":40
 *     def copy(self):
 *         cdef Scatter scatter = Scatter()
 *         CHKERR( VecScatterCopy(self.sct, &scatter.sct) )             # <<<<<<<<<<<<<<
 *         return scatter
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScatterCopy(__pyx_v_self->sct, (&__pyx_v_scatter->sct))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(31, 40, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":41
 *         cdef Scatter scatter = Scatter()
 *         CHKERR( VecScatterCopy(self.sct, &scatter.sct) )
 *         return scatter             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_scatter));
  __pyx_r = ((PyObject *)__pyx_v_scatter);
  goto __pyx_L0;

  /* "PETSc/Scatter.pyx":38
 *         return self
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef Scatter scatter = Scatter()
 *         CHKERR( VecScatterCopy(self.sct, &scatter.sct) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_scatter);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Scatter.pyx":44
 * 
 *     @classmethod
 *     def toAll(cls, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef Scatter scatter = Scatter()
 *         cdef Vec ovec = Vec()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_13toAll(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Scatter_12toAll[] = "Scatter.toAll(type cls, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_13toAll(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("toAll (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "toAll") < 0)) __PYX_ERR(31, 44, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("toAll", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(31, 44, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.toAll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(31, 44, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter_12toAll(((PyTypeObject*)__pyx_v_cls), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_12toAll(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, struct PyPetscVecObject *__pyx_v_vec) {
  struct PyPetscScatterObject *__pyx_v_scatter = 0;
  struct PyPetscVecObject *__pyx_v_ovec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("toAll", 0);

  /* "PETSc/Scatter.pyx":45
 *     @classmethod
 *     def toAll(cls, Vec vec not None):
 *         cdef Scatter scatter = Scatter()             # <<<<<<<<<<<<<<
 *         cdef Vec ovec = Vec()
 *         CHKERR( VecScatterCreateToAll(
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Scatter), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(31, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_scatter = ((struct PyPetscScatterObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Scatter.pyx":46
 *     def toAll(cls, Vec vec not None):
 *         cdef Scatter scatter = Scatter()
 *         cdef Vec ovec = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( VecScatterCreateToAll(
 *             vec.vec, &scatter.sct, &ovec.vec) )
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(31, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ovec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Scatter.pyx":47
 *         cdef Scatter scatter = Scatter()
 *         cdef Vec ovec = Vec()
 *         CHKERR( VecScatterCreateToAll(             # <<<<<<<<<<<<<<
 *             vec.vec, &scatter.sct, &ovec.vec) )
 *         return (scatter, ovec)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScatterCreateToAll(__pyx_v_vec->vec, (&__pyx_v_scatter->sct), (&__pyx_v_ovec->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(31, 47, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":49
 *         CHKERR( VecScatterCreateToAll(
 *             vec.vec, &scatter.sct, &ovec.vec) )
 *         return (scatter, ovec)             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(31, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_scatter));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_scatter));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_scatter));
  __Pyx_INCREF(((PyObject *)__pyx_v_ovec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ovec));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_ovec));
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Scatter.pyx":44
 * 
 *     @classmethod
 *     def toAll(cls, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef Scatter scatter = Scatter()
 *         cdef Vec ovec = Vec()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.toAll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_scatter);
  __Pyx_XDECREF((PyObject *)__pyx_v_ovec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Scatter.pyx":52
 * 
 *     @classmethod
 *     def toZero(cls, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef Scatter scatter = Scatter()
 *         cdef Vec ovec = Vec()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_15toZero(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Scatter_14toZero[] = "Scatter.toZero(type cls, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_15toZero(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("toZero (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "toZero") < 0)) __PYX_ERR(31, 52, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("toZero", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(31, 52, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.toZero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(31, 52, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter_14toZero(((PyTypeObject*)__pyx_v_cls), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_14toZero(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, struct PyPetscVecObject *__pyx_v_vec) {
  struct PyPetscScatterObject *__pyx_v_scatter = 0;
  struct PyPetscVecObject *__pyx_v_ovec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("toZero", 0);

  /* "PETSc/Scatter.pyx":53
 *     @classmethod
 *     def toZero(cls, Vec vec not None):
 *         cdef Scatter scatter = Scatter()             # <<<<<<<<<<<<<<
 *         cdef Vec ovec = Vec()
 *         CHKERR( VecScatterCreateToZero(
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Scatter), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(31, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_scatter = ((struct PyPetscScatterObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Scatter.pyx":54
 *     def toZero(cls, Vec vec not None):
 *         cdef Scatter scatter = Scatter()
 *         cdef Vec ovec = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( VecScatterCreateToZero(
 *             vec.vec, &scatter.sct, &ovec.vec) )
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(31, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ovec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Scatter.pyx":55
 *         cdef Scatter scatter = Scatter()
 *         cdef Vec ovec = Vec()
 *         CHKERR( VecScatterCreateToZero(             # <<<<<<<<<<<<<<
 *             vec.vec, &scatter.sct, &ovec.vec) )
 *         return (scatter, ovec)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScatterCreateToZero(__pyx_v_vec->vec, (&__pyx_v_scatter->sct), (&__pyx_v_ovec->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(31, 55, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":57
 *         CHKERR( VecScatterCreateToZero(
 *             vec.vec, &scatter.sct, &ovec.vec) )
 *         return (scatter, ovec)             # <<<<<<<<<<<<<<
 *     #
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(31, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_scatter));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_scatter));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_scatter));
  __Pyx_INCREF(((PyObject *)__pyx_v_ovec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ovec));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_ovec));
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Scatter.pyx":52
 * 
 *     @classmethod
 *     def toZero(cls, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef Scatter scatter = Scatter()
 *         cdef Vec ovec = Vec()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.toZero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_scatter);
  __Pyx_XDECREF((PyObject *)__pyx_v_ovec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Scatter.pyx":60
 *     #
 * 
 *     def begin(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *               addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_17begin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Scatter_16begin[] = "Scatter.begin(self, Vec vec_from, Vec vec_to, addv=None, mode=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_17begin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec_from = 0;
  struct PyPetscVecObject *__pyx_v_vec_to = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("begin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec_from,&__pyx_n_s_vec_to,&__pyx_n_s_addv,&__pyx_n_s_mode,0};
    PyObject* values[4] = {0,0,0,0};

    /* "PETSc/Scatter.pyx":61
 * 
 *     def begin(self, Vec vec_from not None, Vec vec_to not None,
 *               addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 */
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vec_from)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vec_to)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("begin", 0, 2, 4, 1); __PYX_ERR(31, 60, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "begin") < 0)) __PYX_ERR(31, 60, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_vec_from = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_vec_to = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_addv = values[2];
    __pyx_v_mode = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("begin", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(31, 60, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.begin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_from), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec_from", 0))) __PYX_ERR(31, 60, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_to), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec_to", 0))) __PYX_ERR(31, 60, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter_16begin(((struct PyPetscScatterObject *)__pyx_v_self), __pyx_v_vec_from, __pyx_v_vec_to, __pyx_v_addv, __pyx_v_mode);

  /* "PETSc/Scatter.pyx":60
 *     #
 * 
 *     def begin(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *               addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_16begin(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec_from, struct PyPetscVecObject *__pyx_v_vec_to, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode) {
  InsertMode __pyx_v_caddv;
  ScatterMode __pyx_v_csctm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  ScatterMode __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("begin", 0);

  /* "PETSc/Scatter.pyx":62
 *     def begin(self, Vec vec_from not None, Vec vec_to not None,
 *               addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecScatterBegin(self.sct, vec_from.vec, vec_to.vec,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(31, 62, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_1;

  /* "PETSc/Scatter.pyx":63
 *               addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)             # <<<<<<<<<<<<<<
 *         CHKERR( VecScatterBegin(self.sct, vec_from.vec, vec_to.vec,
 *                                 caddv, csctm) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_scattermode(__pyx_v_mode); if (unlikely(__pyx_t_2 == ((ScatterMode)-1L))) __PYX_ERR(31, 63, __pyx_L1_error)
  __pyx_v_csctm = __pyx_t_2;

  /* "PETSc/Scatter.pyx":64
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecScatterBegin(self.sct, vec_from.vec, vec_to.vec,             # <<<<<<<<<<<<<<
 *                                 caddv, csctm) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScatterBegin(__pyx_v_self->sct, __pyx_v_vec_from->vec, __pyx_v_vec_to->vec, __pyx_v_caddv, __pyx_v_csctm)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(31, 64, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":60
 *     #
 * 
 *     def begin(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *               addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.begin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Scatter.pyx":67
 *                                 caddv, csctm) )
 * 
 *     def end(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *             addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_19end(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Scatter_18end[] = "Scatter.end(self, Vec vec_from, Vec vec_to, addv=None, mode=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_19end(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec_from = 0;
  struct PyPetscVecObject *__pyx_v_vec_to = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("end (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec_from,&__pyx_n_s_vec_to,&__pyx_n_s_addv,&__pyx_n_s_mode,0};
    PyObject* values[4] = {0,0,0,0};

    /* "PETSc/Scatter.pyx":68
 * 
 *     def end(self, Vec vec_from not None, Vec vec_to not None,
 *             addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 */
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vec_from)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vec_to)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("end", 0, 2, 4, 1); __PYX_ERR(31, 67, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "end") < 0)) __PYX_ERR(31, 67, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_vec_from = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_vec_to = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_addv = values[2];
    __pyx_v_mode = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("end", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(31, 67, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_from), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec_from", 0))) __PYX_ERR(31, 67, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_to), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec_to", 0))) __PYX_ERR(31, 67, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter_18end(((struct PyPetscScatterObject *)__pyx_v_self), __pyx_v_vec_from, __pyx_v_vec_to, __pyx_v_addv, __pyx_v_mode);

  /* "PETSc/Scatter.pyx":67
 *                                 caddv, csctm) )
 * 
 *     def end(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *             addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_18end(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec_from, struct PyPetscVecObject *__pyx_v_vec_to, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode) {
  InsertMode __pyx_v_caddv;
  ScatterMode __pyx_v_csctm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  ScatterMode __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("end", 0);

  /* "PETSc/Scatter.pyx":69
 *     def end(self, Vec vec_from not None, Vec vec_to not None,
 *             addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecScatterEnd(self.sct, vec_from.vec, vec_to.vec,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(31, 69, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_1;

  /* "PETSc/Scatter.pyx":70
 *             addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)             # <<<<<<<<<<<<<<
 *         CHKERR( VecScatterEnd(self.sct, vec_from.vec, vec_to.vec,
 *                               caddv, csctm) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_scattermode(__pyx_v_mode); if (unlikely(__pyx_t_2 == ((ScatterMode)-1L))) __PYX_ERR(31, 70, __pyx_L1_error)
  __pyx_v_csctm = __pyx_t_2;

  /* "PETSc/Scatter.pyx":71
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecScatterEnd(self.sct, vec_from.vec, vec_to.vec,             # <<<<<<<<<<<<<<
 *                               caddv, csctm) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScatterEnd(__pyx_v_self->sct, __pyx_v_vec_from->vec, __pyx_v_vec_to->vec, __pyx_v_caddv, __pyx_v_csctm)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(31, 71, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":67
 *                                 caddv, csctm) )
 * 
 *     def end(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *             addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Scatter.pyx":76
 *     #
 * 
 *     def scatterBegin(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *                      addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_21scatterBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Scatter_20scatterBegin[] = "Scatter.scatterBegin(self, Vec vec_from, Vec vec_to, addv=None, mode=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_21scatterBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec_from = 0;
  struct PyPetscVecObject *__pyx_v_vec_to = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scatterBegin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec_from,&__pyx_n_s_vec_to,&__pyx_n_s_addv,&__pyx_n_s_mode,0};
    PyObject* values[4] = {0,0,0,0};

    /* "PETSc/Scatter.pyx":77
 * 
 *     def scatterBegin(self, Vec vec_from not None, Vec vec_to not None,
 *                      addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 */
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vec_from)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vec_to)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scatterBegin", 0, 2, 4, 1); __PYX_ERR(31, 76, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scatterBegin") < 0)) __PYX_ERR(31, 76, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_vec_from = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_vec_to = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_addv = values[2];
    __pyx_v_mode = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scatterBegin", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(31, 76, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.scatterBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_from), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec_from", 0))) __PYX_ERR(31, 76, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_to), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec_to", 0))) __PYX_ERR(31, 76, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter_20scatterBegin(((struct PyPetscScatterObject *)__pyx_v_self), __pyx_v_vec_from, __pyx_v_vec_to, __pyx_v_addv, __pyx_v_mode);

  /* "PETSc/Scatter.pyx":76
 *     #
 * 
 *     def scatterBegin(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *                      addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_20scatterBegin(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec_from, struct PyPetscVecObject *__pyx_v_vec_to, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode) {
  InsertMode __pyx_v_caddv;
  ScatterMode __pyx_v_csctm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  ScatterMode __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("scatterBegin", 0);

  /* "PETSc/Scatter.pyx":78
 *     def scatterBegin(self, Vec vec_from not None, Vec vec_to not None,
 *                      addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecScatterBegin(self.sct, vec_from.vec, vec_to.vec,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(31, 78, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_1;

  /* "PETSc/Scatter.pyx":79
 *                      addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)             # <<<<<<<<<<<<<<
 *         CHKERR( VecScatterBegin(self.sct, vec_from.vec, vec_to.vec,
 *                                 caddv, csctm) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_scattermode(__pyx_v_mode); if (unlikely(__pyx_t_2 == ((ScatterMode)-1L))) __PYX_ERR(31, 79, __pyx_L1_error)
  __pyx_v_csctm = __pyx_t_2;

  /* "PETSc/Scatter.pyx":80
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecScatterBegin(self.sct, vec_from.vec, vec_to.vec,             # <<<<<<<<<<<<<<
 *                                 caddv, csctm) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScatterBegin(__pyx_v_self->sct, __pyx_v_vec_from->vec, __pyx_v_vec_to->vec, __pyx_v_caddv, __pyx_v_csctm)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(31, 80, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":76
 *     #
 * 
 *     def scatterBegin(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *                      addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.scatterBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Scatter.pyx":83
 *                                 caddv, csctm) )
 * 
 *     def scatterEnd(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *                    addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_23scatterEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Scatter_22scatterEnd[] = "Scatter.scatterEnd(self, Vec vec_from, Vec vec_to, addv=None, mode=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_23scatterEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec_from = 0;
  struct PyPetscVecObject *__pyx_v_vec_to = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scatterEnd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec_from,&__pyx_n_s_vec_to,&__pyx_n_s_addv,&__pyx_n_s_mode,0};
    PyObject* values[4] = {0,0,0,0};

    /* "PETSc/Scatter.pyx":84
 * 
 *     def scatterEnd(self, Vec vec_from not None, Vec vec_to not None,
 *                    addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 */
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vec_from)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vec_to)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scatterEnd", 0, 2, 4, 1); __PYX_ERR(31, 83, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scatterEnd") < 0)) __PYX_ERR(31, 83, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_vec_from = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_vec_to = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_addv = values[2];
    __pyx_v_mode = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scatterEnd", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(31, 83, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.scatterEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_from), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec_from", 0))) __PYX_ERR(31, 83, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_to), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec_to", 0))) __PYX_ERR(31, 83, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter_22scatterEnd(((struct PyPetscScatterObject *)__pyx_v_self), __pyx_v_vec_from, __pyx_v_vec_to, __pyx_v_addv, __pyx_v_mode);

  /* "PETSc/Scatter.pyx":83
 *                                 caddv, csctm) )
 * 
 *     def scatterEnd(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *                    addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_22scatterEnd(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec_from, struct PyPetscVecObject *__pyx_v_vec_to, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode) {
  InsertMode __pyx_v_caddv;
  ScatterMode __pyx_v_csctm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  ScatterMode __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("scatterEnd", 0);

  /* "PETSc/Scatter.pyx":85
 *     def scatterEnd(self, Vec vec_from not None, Vec vec_to not None,
 *                    addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecScatterEnd(self.sct, vec_from.vec, vec_to.vec,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(31, 85, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_1;

  /* "PETSc/Scatter.pyx":86
 *                    addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)             # <<<<<<<<<<<<<<
 *         CHKERR( VecScatterEnd(self.sct, vec_from.vec, vec_to.vec,
 *                               caddv, csctm) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_scattermode(__pyx_v_mode); if (unlikely(__pyx_t_2 == ((ScatterMode)-1L))) __PYX_ERR(31, 86, __pyx_L1_error)
  __pyx_v_csctm = __pyx_t_2;

  /* "PETSc/Scatter.pyx":87
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecScatterEnd(self.sct, vec_from.vec, vec_to.vec,             # <<<<<<<<<<<<<<
 *                               caddv, csctm) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScatterEnd(__pyx_v_self->sct, __pyx_v_vec_from->vec, __pyx_v_vec_to->vec, __pyx_v_caddv, __pyx_v_csctm)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(31, 87, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":83
 *                                 caddv, csctm) )
 * 
 *     def scatterEnd(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *                    addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.scatterEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Scatter.pyx":90
 *                               caddv, csctm) )
 * 
 *     def scatter(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *                 addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_25scatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Scatter_24scatter[] = "Scatter.scatter(self, Vec vec_from, Vec vec_to, addv=None, mode=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Scatter_25scatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec_from = 0;
  struct PyPetscVecObject *__pyx_v_vec_to = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scatter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec_from,&__pyx_n_s_vec_to,&__pyx_n_s_addv,&__pyx_n_s_mode,0};
    PyObject* values[4] = {0,0,0,0};

    /* "PETSc/Scatter.pyx":91
 * 
 *     def scatter(self, Vec vec_from not None, Vec vec_to not None,
 *                 addv=None, mode=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 */
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vec_from)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vec_to)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scatter", 0, 2, 4, 1); __PYX_ERR(31, 90, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scatter") < 0)) __PYX_ERR(31, 90, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_vec_from = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_vec_to = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_addv = values[2];
    __pyx_v_mode = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scatter", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(31, 90, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.scatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_from), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec_from", 0))) __PYX_ERR(31, 90, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_to), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec_to", 0))) __PYX_ERR(31, 90, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Scatter_24scatter(((struct PyPetscScatterObject *)__pyx_v_self), __pyx_v_vec_from, __pyx_v_vec_to, __pyx_v_addv, __pyx_v_mode);

  /* "PETSc/Scatter.pyx":90
 *                               caddv, csctm) )
 * 
 *     def scatter(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *                 addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Scatter_24scatter(struct PyPetscScatterObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec_from, struct PyPetscVecObject *__pyx_v_vec_to, PyObject *__pyx_v_addv, PyObject *__pyx_v_mode) {
  InsertMode __pyx_v_caddv;
  ScatterMode __pyx_v_csctm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  ScatterMode __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("scatter", 0);

  /* "PETSc/Scatter.pyx":92
 *     def scatter(self, Vec vec_from not None, Vec vec_to not None,
 *                 addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecScatterBegin(self.sct, vec_from.vec, vec_to.vec,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(31, 92, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_1;

  /* "PETSc/Scatter.pyx":93
 *                 addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)             # <<<<<<<<<<<<<<
 *         CHKERR( VecScatterBegin(self.sct, vec_from.vec, vec_to.vec,
 *                                 caddv, csctm) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_scattermode(__pyx_v_mode); if (unlikely(__pyx_t_2 == ((ScatterMode)-1L))) __PYX_ERR(31, 93, __pyx_L1_error)
  __pyx_v_csctm = __pyx_t_2;

  /* "PETSc/Scatter.pyx":94
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 *         cdef PetscScatterMode csctm = scattermode(mode)
 *         CHKERR( VecScatterBegin(self.sct, vec_from.vec, vec_to.vec,             # <<<<<<<<<<<<<<
 *                                 caddv, csctm) )
 *         CHKERR( VecScatterEnd(self.sct, vec_from.vec, vec_to.vec,
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScatterBegin(__pyx_v_self->sct, __pyx_v_vec_from->vec, __pyx_v_vec_to->vec, __pyx_v_caddv, __pyx_v_csctm)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(31, 94, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":96
 *         CHKERR( VecScatterBegin(self.sct, vec_from.vec, vec_to.vec,
 *                                 caddv, csctm) )
 *         CHKERR( VecScatterEnd(self.sct, vec_from.vec, vec_to.vec,             # <<<<<<<<<<<<<<
 *                               caddv, csctm) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecScatterEnd(__pyx_v_self->sct, __pyx_v_vec_from->vec, __pyx_v_vec_to->vec, __pyx_v_caddv, __pyx_v_csctm)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(31, 96, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":90
 *                               caddv, csctm) )
 * 
 *     def scatter(self, Vec vec_from not None, Vec vec_to not None,             # <<<<<<<<<<<<<<
 *                 addv=None, mode=None):
 *         cdef PetscInsertMode  caddv = insertmode(addv)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Scatter.scatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":5
 * cdef class Section(Object):
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.sec
 *         self.sec  = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_7Section_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_7Section_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section___cinit__(((struct PyPetscSectionObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_7Section___cinit__(struct PyPetscSectionObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Section.pyx":6
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.sec             # <<<<<<<<<<<<<<
 *         self.sec  = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->sec));

  /* "PETSc/Section.pyx":7
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.sec
 *         self.sec  = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->sec = NULL;

  /* "PETSc/Section.pyx":5
 * cdef class Section(Object):
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.sec
 *         self.sec  = NULL
 */

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

/* "PETSc/Section.pyx":9
 *         self.sec  = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionDestroy(&self.sec) )
 *         self.sec = NULL
 */

/* Python wrapper */
static void __pyx_pw_8petsc4py_5PETSc_7Section_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8petsc4py_5PETSc_7Section_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8petsc4py_5PETSc_7Section_2__dealloc__(((struct PyPetscSectionObject *)__pyx_v_self));

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

static void __pyx_pf_8petsc4py_5PETSc_7Section_2__dealloc__(struct PyPetscSectionObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "PETSc/Section.pyx":10
 * 
 *     def __dealloc__(self):
 *         CHKERR( PetscSectionDestroy(&self.sec) )             # <<<<<<<<<<<<<<
 *         self.sec = NULL
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionDestroy((&__pyx_v_self->sec))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(32, 10, __pyx_L1_error)

  /* "PETSc/Section.pyx":11
 *     def __dealloc__(self):
 *         CHKERR( PetscSectionDestroy(&self.sec) )
 *         self.sec = NULL             # <<<<<<<<<<<<<<
 * 
 *     def view(self, Viewer viewer=None):
 */
  __pyx_v_self->sec = NULL;

  /* "PETSc/Section.pyx":9
 *         self.sec  = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionDestroy(&self.sec) )
 *         self.sec = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("petsc4py.PETSc.Section.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PETSc/Section.pyx":13
 *         self.sec = NULL
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_4view[] = "Section.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(32, 13, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 13, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(32, 13, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_4view(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_4view(struct PyPetscSectionObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/Section.pyx":14
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PetscSectionView(self.sec, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/Section.pyx":15
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionView(self.sec, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/Section.pyx":16
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PetscSectionView(self.sec, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionView(__pyx_v_self->sec, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(32, 16, __pyx_L1_error)

  /* "PETSc/Section.pyx":13
 *         self.sec = NULL
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":18
 *         CHKERR( PetscSectionView(self.sec, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionDestroy(&self.sec) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_6destroy[] = "Section.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_6destroy(((struct PyPetscSectionObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_6destroy(struct PyPetscSectionObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/Section.pyx":19
 * 
 *     def destroy(self):
 *         CHKERR( PetscSectionDestroy(&self.sec) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionDestroy((&__pyx_v_self->sec))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(32, 19, __pyx_L1_error)

  /* "PETSc/Section.pyx":20
 *     def destroy(self):
 *         CHKERR( PetscSectionDestroy(&self.sec) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Section.pyx":18
 *         CHKERR( PetscSectionView(self.sec, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionDestroy(&self.sec) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":22
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSection newsec = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_8create[] = "Section.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(32, 22, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 22, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_8create(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_8create(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscSection __pyx_v_newsec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/Section.pyx":23
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscSection newsec = NULL
 *         CHKERR( PetscSectionCreate(ccomm, &newsec) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(32, 23, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Section.pyx":24
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSection newsec = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionCreate(ccomm, &newsec) )
 *         PetscCLEAR(self.obj); self.sec = newsec
 */
  __pyx_v_newsec = NULL;

  /* "PETSc/Section.pyx":25
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSection newsec = NULL
 *         CHKERR( PetscSectionCreate(ccomm, &newsec) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.sec = newsec
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionCreate(__pyx_v_ccomm, (&__pyx_v_newsec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 25, __pyx_L1_error)

  /* "PETSc/Section.pyx":26
 *         cdef PetscSection newsec = NULL
 *         CHKERR( PetscSectionCreate(ccomm, &newsec) )
 *         PetscCLEAR(self.obj); self.sec = newsec             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->sec = __pyx_v_newsec;

  /* "PETSc/Section.pyx":27
 *         CHKERR( PetscSectionCreate(ccomm, &newsec) )
 *         PetscCLEAR(self.obj); self.sec = newsec
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def clone(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Section.pyx":22
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSection newsec = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":29
 *         return self
 * 
 *     def clone(self):             # <<<<<<<<<<<<<<
 *         cdef Section sec = <Section>type(self)()
 *         CHKERR( PetscSectionClone(self.sec, &sec.sec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_11clone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_10clone[] = "Section.clone(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_11clone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clone (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("clone", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clone", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_10clone(((struct PyPetscSectionObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_10clone(struct PyPetscSectionObject *__pyx_v_self) {
  struct PyPetscSectionObject *__pyx_v_sec = 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;
  __Pyx_RefNannySetupContext("clone", 0);

  /* "PETSc/Section.pyx":30
 * 
 *     def clone(self):
 *         cdef Section sec = <Section>type(self)()             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionClone(self.sec, &sec.sec) )
 *         return sec
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __pyx_t_2 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(32, 30, __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(32, 30, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sec = ((struct PyPetscSectionObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Section.pyx":31
 *     def clone(self):
 *         cdef Section sec = <Section>type(self)()
 *         CHKERR( PetscSectionClone(self.sec, &sec.sec) )             # <<<<<<<<<<<<<<
 *         return sec
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionClone(__pyx_v_self->sec, (&__pyx_v_sec->sec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(32, 31, __pyx_L1_error)

  /* "PETSc/Section.pyx":32
 *         cdef Section sec = <Section>type(self)()
 *         CHKERR( PetscSectionClone(self.sec, &sec.sec) )
 *         return sec             # <<<<<<<<<<<<<<
 * 
 *     def setUp(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_sec));
  __pyx_r = ((PyObject *)__pyx_v_sec);
  goto __pyx_L0;

  /* "PETSc/Section.pyx":29
 *         return self
 * 
 *     def clone(self):             # <<<<<<<<<<<<<<
 *         cdef Section sec = <Section>type(self)()
 *         CHKERR( PetscSectionClone(self.sec, &sec.sec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":34
 *         return sec
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetUp(self.sec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_13setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_12setUp[] = "Section.setUp(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_13setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUp (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUp", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUp", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_12setUp(((struct PyPetscSectionObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_12setUp(struct PyPetscSectionObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUp", 0);

  /* "PETSc/Section.pyx":35
 * 
 *     def setUp(self):
 *         CHKERR( PetscSectionSetUp(self.sec) )             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetUp(__pyx_v_self->sec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(32, 35, __pyx_L1_error)

  /* "PETSc/Section.pyx":34
 *         return sec
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetUp(self.sec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":37
 *         CHKERR( PetscSectionSetUp(self.sec) )
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionReset(self.sec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_15reset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_14reset[] = "Section.reset(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_15reset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("reset", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "reset", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_14reset(((struct PyPetscSectionObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_14reset(struct PyPetscSectionObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "PETSc/Section.pyx":38
 * 
 *     def reset(self):
 *         CHKERR( PetscSectionReset(self.sec) )             # <<<<<<<<<<<<<<
 * 
 *     def getNumFields(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionReset(__pyx_v_self->sec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(32, 38, __pyx_L1_error)

  /* "PETSc/Section.pyx":37
 *         CHKERR( PetscSectionSetUp(self.sec) )
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionReset(self.sec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":40
 *         CHKERR( PetscSectionReset(self.sec) )
 * 
 *     def getNumFields(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt numFields = 0
 *         CHKERR( PetscSectionGetNumFields(self.sec, &numFields) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_17getNumFields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_16getNumFields[] = "Section.getNumFields(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_17getNumFields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getNumFields (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getNumFields", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getNumFields", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_16getNumFields(((struct PyPetscSectionObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_16getNumFields(struct PyPetscSectionObject *__pyx_v_self) {
  PetscInt __pyx_v_numFields;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getNumFields", 0);

  /* "PETSc/Section.pyx":41
 * 
 *     def getNumFields(self):
 *         cdef PetscInt numFields = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetNumFields(self.sec, &numFields) )
 *         return toInt(numFields)
 */
  __pyx_v_numFields = 0;

  /* "PETSc/Section.pyx":42
 *     def getNumFields(self):
 *         cdef PetscInt numFields = 0
 *         CHKERR( PetscSectionGetNumFields(self.sec, &numFields) )             # <<<<<<<<<<<<<<
 *         return toInt(numFields)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetNumFields(__pyx_v_self->sec, (&__pyx_v_numFields))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(32, 42, __pyx_L1_error)

  /* "PETSc/Section.pyx":43
 *         cdef PetscInt numFields = 0
 *         CHKERR( PetscSectionGetNumFields(self.sec, &numFields) )
 *         return toInt(numFields)             # <<<<<<<<<<<<<<
 * 
 *     def setNumFields(self,numFields):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_numFields); if (unlikely(!__pyx_t_2)) __PYX_ERR(32, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":40
 *         CHKERR( PetscSectionReset(self.sec) )
 * 
 *     def getNumFields(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt numFields = 0
 *         CHKERR( PetscSectionGetNumFields(self.sec, &numFields) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getNumFields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":45
 *         return toInt(numFields)
 * 
 *     def setNumFields(self,numFields):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumFields = asInt(numFields)
 *         CHKERR( PetscSectionSetNumFields(self.sec, cnumFields) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_19setNumFields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_18setNumFields[] = "Section.setNumFields(self, numFields)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_19setNumFields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_numFields = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setNumFields (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_numFields,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);
        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_numFields)) != 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, "setNumFields") < 0)) __PYX_ERR(32, 45, __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_numFields = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setNumFields", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 45, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setNumFields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_18setNumFields(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_numFields);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_18setNumFields(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_numFields) {
  PetscInt __pyx_v_cnumFields;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setNumFields", 0);

  /* "PETSc/Section.pyx":46
 * 
 *     def setNumFields(self,numFields):
 *         cdef PetscInt cnumFields = asInt(numFields)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetNumFields(self.sec, cnumFields) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_numFields); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 46, __pyx_L1_error)
  __pyx_v_cnumFields = __pyx_t_1;

  /* "PETSc/Section.pyx":47
 *     def setNumFields(self,numFields):
 *         cdef PetscInt cnumFields = asInt(numFields)
 *         CHKERR( PetscSectionSetNumFields(self.sec, cnumFields) )             # <<<<<<<<<<<<<<
 * 
 *     def getFieldName(self,field):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetNumFields(__pyx_v_self->sec, __pyx_v_cnumFields)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 47, __pyx_L1_error)

  /* "PETSc/Section.pyx":45
 *         return toInt(numFields)
 * 
 *     def setNumFields(self,numFields):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumFields = asInt(numFields)
 *         CHKERR( PetscSectionSetNumFields(self.sec, cnumFields) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setNumFields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":49
 *         CHKERR( PetscSectionSetNumFields(self.sec, cnumFields) )
 * 
 *     def getFieldName(self,field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         cdef const_char *fieldName = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_21getFieldName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_20getFieldName[] = "Section.getFieldName(self, field)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_21getFieldName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFieldName (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,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);
        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_field)) != 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, "getFieldName") < 0)) __PYX_ERR(32, 49, __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_field = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFieldName", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 49, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getFieldName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_20getFieldName(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_field);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_20getFieldName(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_field) {
  PetscInt __pyx_v_cfield;
  const char *__pyx_v_fieldName;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getFieldName", 0);

  /* "PETSc/Section.pyx":50
 * 
 *     def getFieldName(self,field):
 *         cdef PetscInt cfield = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef const_char *fieldName = NULL
 *         CHKERR( PetscSectionGetFieldName(self.sec,cfield,&fieldName) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 50, __pyx_L1_error)
  __pyx_v_cfield = __pyx_t_1;

  /* "PETSc/Section.pyx":51
 *     def getFieldName(self,field):
 *         cdef PetscInt cfield = asInt(field)
 *         cdef const_char *fieldName = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetFieldName(self.sec,cfield,&fieldName) )
 *         return bytes2str(fieldName)
 */
  __pyx_v_fieldName = NULL;

  /* "PETSc/Section.pyx":52
 *         cdef PetscInt cfield = asInt(field)
 *         cdef const_char *fieldName = NULL
 *         CHKERR( PetscSectionGetFieldName(self.sec,cfield,&fieldName) )             # <<<<<<<<<<<<<<
 *         return bytes2str(fieldName)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetFieldName(__pyx_v_self->sec, __pyx_v_cfield, (&__pyx_v_fieldName))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 52, __pyx_L1_error)

  /* "PETSc/Section.pyx":53
 *         cdef const_char *fieldName = NULL
 *         CHKERR( PetscSectionGetFieldName(self.sec,cfield,&fieldName) )
 *         return bytes2str(fieldName)             # <<<<<<<<<<<<<<
 * 
 *     def setFieldName(self,field,fieldName):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_fieldName); if (unlikely(!__pyx_t_3)) __PYX_ERR(32, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":49
 *         CHKERR( PetscSectionSetNumFields(self.sec, cnumFields) )
 * 
 *     def getFieldName(self,field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         cdef const_char *fieldName = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getFieldName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":55
 *         return bytes2str(fieldName)
 * 
 *     def setFieldName(self,field,fieldName):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_23setFieldName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_22setFieldName[] = "Section.setFieldName(self, field, fieldName)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_23setFieldName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_v_fieldName = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFieldName (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,&__pyx_n_s_fieldName,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_field)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fieldName)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFieldName", 1, 2, 2, 1); __PYX_ERR(32, 55, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFieldName") < 0)) __PYX_ERR(32, 55, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_field = values[0];
    __pyx_v_fieldName = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFieldName", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 55, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setFieldName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_22setFieldName(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_field, __pyx_v_fieldName);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_22setFieldName(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_fieldName) {
  PetscInt __pyx_v_cfield;
  const char *__pyx_v_cname;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setFieldName", 0);
  __Pyx_INCREF(__pyx_v_fieldName);

  /* "PETSc/Section.pyx":56
 * 
 *     def setFieldName(self,field,fieldName):
 *         cdef PetscInt cfield = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         fieldName = str2bytes(fieldName, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 56, __pyx_L1_error)
  __pyx_v_cfield = __pyx_t_1;

  /* "PETSc/Section.pyx":57
 *     def setFieldName(self,field,fieldName):
 *         cdef PetscInt cfield = asInt(field)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         fieldName = str2bytes(fieldName, &cname)
 *         CHKERR( PetscSectionSetFieldName(self.sec,cfield,cname) )
 */
  __pyx_v_cname = NULL;

  /* "PETSc/Section.pyx":58
 *         cdef PetscInt cfield = asInt(field)
 *         cdef const_char *cname = NULL
 *         fieldName = str2bytes(fieldName, &cname)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetFieldName(self.sec,cfield,cname) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_fieldName, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(32, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_fieldName, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Section.pyx":59
 *         cdef const_char *cname = NULL
 *         fieldName = str2bytes(fieldName, &cname)
 *         CHKERR( PetscSectionSetFieldName(self.sec,cfield,cname) )             # <<<<<<<<<<<<<<
 * 
 *     def getFieldComponents(self,field):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetFieldName(__pyx_v_self->sec, __pyx_v_cfield, __pyx_v_cname)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(32, 59, __pyx_L1_error)

  /* "PETSc/Section.pyx":55
 *         return bytes2str(fieldName)
 * 
 *     def setFieldName(self,field,fieldName):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         cdef const_char *cname = 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("petsc4py.PETSc.Section.setFieldName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fieldName);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":61
 *         CHKERR( PetscSectionSetFieldName(self.sec,cfield,cname) )
 * 
 *     def getFieldComponents(self,field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field), cnumComp = 0
 *         CHKERR( PetscSectionGetFieldComponents(self.sec,cfield,&cnumComp) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_25getFieldComponents(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_24getFieldComponents[] = "Section.getFieldComponents(self, field)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_25getFieldComponents(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFieldComponents (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,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);
        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_field)) != 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, "getFieldComponents") < 0)) __PYX_ERR(32, 61, __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_field = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFieldComponents", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 61, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getFieldComponents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_24getFieldComponents(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_field);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_24getFieldComponents(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_field) {
  PetscInt __pyx_v_cfield;
  PetscInt __pyx_v_cnumComp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getFieldComponents", 0);

  /* "PETSc/Section.pyx":62
 * 
 *     def getFieldComponents(self,field):
 *         cdef PetscInt cfield = asInt(field), cnumComp = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetFieldComponents(self.sec,cfield,&cnumComp) )
 *         return toInt(cnumComp)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 62, __pyx_L1_error)
  __pyx_v_cfield = __pyx_t_1;
  __pyx_v_cnumComp = 0;

  /* "PETSc/Section.pyx":63
 *     def getFieldComponents(self,field):
 *         cdef PetscInt cfield = asInt(field), cnumComp = 0
 *         CHKERR( PetscSectionGetFieldComponents(self.sec,cfield,&cnumComp) )             # <<<<<<<<<<<<<<
 *         return toInt(cnumComp)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetFieldComponents(__pyx_v_self->sec, __pyx_v_cfield, (&__pyx_v_cnumComp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 63, __pyx_L1_error)

  /* "PETSc/Section.pyx":64
 *         cdef PetscInt cfield = asInt(field), cnumComp = 0
 *         CHKERR( PetscSectionGetFieldComponents(self.sec,cfield,&cnumComp) )
 *         return toInt(cnumComp)             # <<<<<<<<<<<<<<
 * 
 *     def setFieldComponents(self,field,numComp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_cnumComp); if (unlikely(!__pyx_t_3)) __PYX_ERR(32, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":61
 *         CHKERR( PetscSectionSetFieldName(self.sec,cfield,cname) )
 * 
 *     def getFieldComponents(self,field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field), cnumComp = 0
 *         CHKERR( PetscSectionGetFieldComponents(self.sec,cfield,&cnumComp) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getFieldComponents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":66
 *         return toInt(cnumComp)
 * 
 *     def setFieldComponents(self,field,numComp):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumComp = asInt(numComp)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_27setFieldComponents(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_26setFieldComponents[] = "Section.setFieldComponents(self, field, numComp)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_27setFieldComponents(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_v_numComp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFieldComponents (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,&__pyx_n_s_numComp,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_field)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_numComp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFieldComponents", 1, 2, 2, 1); __PYX_ERR(32, 66, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFieldComponents") < 0)) __PYX_ERR(32, 66, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_field = values[0];
    __pyx_v_numComp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFieldComponents", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 66, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setFieldComponents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_26setFieldComponents(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_field, __pyx_v_numComp);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_26setFieldComponents(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_numComp) {
  PetscInt __pyx_v_cfield;
  PetscInt __pyx_v_cnumComp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFieldComponents", 0);

  /* "PETSc/Section.pyx":67
 * 
 *     def setFieldComponents(self,field,numComp):
 *         cdef PetscInt cfield = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumComp = asInt(numComp)
 *         CHKERR( PetscSectionSetFieldComponents(self.sec,cfield,cnumComp) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 67, __pyx_L1_error)
  __pyx_v_cfield = __pyx_t_1;

  /* "PETSc/Section.pyx":68
 *     def setFieldComponents(self,field,numComp):
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumComp = asInt(numComp)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetFieldComponents(self.sec,cfield,cnumComp) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_numComp); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 68, __pyx_L1_error)
  __pyx_v_cnumComp = __pyx_t_1;

  /* "PETSc/Section.pyx":69
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumComp = asInt(numComp)
 *         CHKERR( PetscSectionSetFieldComponents(self.sec,cfield,cnumComp) )             # <<<<<<<<<<<<<<
 * 
 *     def getChart(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetFieldComponents(__pyx_v_self->sec, __pyx_v_cfield, __pyx_v_cnumComp)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 69, __pyx_L1_error)

  /* "PETSc/Section.pyx":66
 *         return toInt(cnumComp)
 * 
 *     def setFieldComponents(self,field,numComp):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumComp = asInt(numComp)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setFieldComponents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":71
 *         CHKERR( PetscSectionSetFieldComponents(self.sec,cfield,cnumComp) )
 * 
 *     def getChart(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( PetscSectionGetChart(self.sec, &pStart, &pEnd) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_29getChart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_28getChart[] = "Section.getChart(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_29getChart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getChart (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getChart", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getChart", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_28getChart(((struct PyPetscSectionObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_28getChart(struct PyPetscSectionObject *__pyx_v_self) {
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  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;
  __Pyx_RefNannySetupContext("getChart", 0);

  /* "PETSc/Section.pyx":72
 * 
 *     def getChart(self):
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetChart(self.sec, &pStart, &pEnd) )
 *         return toInt(pStart), toInt(pEnd)
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/Section.pyx":73
 *     def getChart(self):
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( PetscSectionGetChart(self.sec, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         return toInt(pStart), toInt(pEnd)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetChart(__pyx_v_self->sec, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(32, 73, __pyx_L1_error)

  /* "PETSc/Section.pyx":74
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( PetscSectionGetChart(self.sec, &pStart, &pEnd) )
 *         return toInt(pStart), toInt(pEnd)             # <<<<<<<<<<<<<<
 * 
 *     def setChart(self, pStart, pEnd):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_pStart); if (unlikely(!__pyx_t_2)) __PYX_ERR(32, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_pEnd); if (unlikely(!__pyx_t_3)) __PYX_ERR(32, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(32, 74, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":71
 *         CHKERR( PetscSectionSetFieldComponents(self.sec,cfield,cnumComp) )
 * 
 *     def getChart(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( PetscSectionGetChart(self.sec, &pStart, &pEnd) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getChart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":76
 *         return toInt(pStart), toInt(pEnd)
 * 
 *     def setChart(self, pStart, pEnd):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cStart = asInt(pStart)
 *         cdef PetscInt cEnd   = asInt(pEnd)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_31setChart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_30setChart[] = "Section.setChart(self, pStart, pEnd)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_31setChart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pStart = 0;
  PyObject *__pyx_v_pEnd = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setChart (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pStart,&__pyx_n_s_pEnd,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_pStart)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pEnd)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setChart", 1, 2, 2, 1); __PYX_ERR(32, 76, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setChart") < 0)) __PYX_ERR(32, 76, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pStart = values[0];
    __pyx_v_pEnd = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setChart", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 76, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setChart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_30setChart(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_pStart, __pyx_v_pEnd);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_30setChart(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_pStart, PyObject *__pyx_v_pEnd) {
  PetscInt __pyx_v_cStart;
  PetscInt __pyx_v_cEnd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setChart", 0);

  /* "PETSc/Section.pyx":77
 * 
 *     def setChart(self, pStart, pEnd):
 *         cdef PetscInt cStart = asInt(pStart)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cEnd   = asInt(pEnd)
 *         CHKERR( PetscSectionSetChart(self.sec, cStart, cEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_pStart); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 77, __pyx_L1_error)
  __pyx_v_cStart = __pyx_t_1;

  /* "PETSc/Section.pyx":78
 *     def setChart(self, pStart, pEnd):
 *         cdef PetscInt cStart = asInt(pStart)
 *         cdef PetscInt cEnd   = asInt(pEnd)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetChart(self.sec, cStart, cEnd) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_pEnd); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 78, __pyx_L1_error)
  __pyx_v_cEnd = __pyx_t_1;

  /* "PETSc/Section.pyx":79
 *         cdef PetscInt cStart = asInt(pStart)
 *         cdef PetscInt cEnd   = asInt(pEnd)
 *         CHKERR( PetscSectionSetChart(self.sec, cStart, cEnd) )             # <<<<<<<<<<<<<<
 * 
 *     def getDof(self,point):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetChart(__pyx_v_self->sec, __pyx_v_cStart, __pyx_v_cEnd)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 79, __pyx_L1_error)

  /* "PETSc/Section.pyx":76
 *         return toInt(pStart), toInt(pEnd)
 * 
 *     def setChart(self, pStart, pEnd):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cStart = asInt(pStart)
 *         cdef PetscInt cEnd   = asInt(pEnd)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setChart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":81
 *         CHKERR( PetscSectionSetChart(self.sec, cStart, cEnd) )
 * 
 *     def getDof(self,point):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         CHKERR( PetscSectionGetDof(self.sec,cpoint,&cnumDof) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_33getDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_32getDof[] = "Section.getDof(self, point)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_33getDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,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);
        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_point)) != 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, "getDof") < 0)) __PYX_ERR(32, 81, __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_point = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getDof", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 81, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_32getDof(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_32getDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cnumDof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getDof", 0);

  /* "PETSc/Section.pyx":82
 * 
 *     def getDof(self,point):
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetDof(self.sec,cpoint,&cnumDof) )
 *         return toInt(cnumDof)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 82, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;
  __pyx_v_cnumDof = 0;

  /* "PETSc/Section.pyx":83
 *     def getDof(self,point):
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         CHKERR( PetscSectionGetDof(self.sec,cpoint,&cnumDof) )             # <<<<<<<<<<<<<<
 *         return toInt(cnumDof)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetDof(__pyx_v_self->sec, __pyx_v_cpoint, (&__pyx_v_cnumDof))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 83, __pyx_L1_error)

  /* "PETSc/Section.pyx":84
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         CHKERR( PetscSectionGetDof(self.sec,cpoint,&cnumDof) )
 *         return toInt(cnumDof)             # <<<<<<<<<<<<<<
 * 
 *     def setDof(self,point,numDof):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_cnumDof); if (unlikely(!__pyx_t_3)) __PYX_ERR(32, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":81
 *         CHKERR( PetscSectionSetChart(self.sec, cStart, cEnd) )
 * 
 *     def getDof(self,point):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         CHKERR( PetscSectionGetDof(self.sec,cpoint,&cnumDof) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":86
 *         return toInt(cnumDof)
 * 
 *     def setDof(self,point,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_35setDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_34setDof[] = "Section.setDof(self, point, numDof)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_35setDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_numDof = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_numDof,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_numDof)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setDof", 1, 2, 2, 1); __PYX_ERR(32, 86, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setDof") < 0)) __PYX_ERR(32, 86, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_point = values[0];
    __pyx_v_numDof = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDof", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 86, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_34setDof(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_numDof);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_34setDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_numDof) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cnumDof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setDof", 0);

  /* "PETSc/Section.pyx":87
 * 
 *     def setDof(self,point,numDof):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionSetDof(self.sec,cpoint,cnumDof) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 87, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":88
 *     def setDof(self,point,numDof):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetDof(self.sec,cpoint,cnumDof) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_numDof); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 88, __pyx_L1_error)
  __pyx_v_cnumDof = __pyx_t_1;

  /* "PETSc/Section.pyx":89
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionSetDof(self.sec,cpoint,cnumDof) )             # <<<<<<<<<<<<<<
 * 
 *     def addDof(self,point,numDof):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cnumDof)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 89, __pyx_L1_error)

  /* "PETSc/Section.pyx":86
 *         return toInt(cnumDof)
 * 
 *     def setDof(self,point,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":91
 *         CHKERR( PetscSectionSetDof(self.sec,cpoint,cnumDof) )
 * 
 *     def addDof(self,point,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_37addDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_36addDof[] = "Section.addDof(self, point, numDof)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_37addDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_numDof = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_numDof,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_numDof)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addDof", 1, 2, 2, 1); __PYX_ERR(32, 91, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "addDof") < 0)) __PYX_ERR(32, 91, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_point = values[0];
    __pyx_v_numDof = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addDof", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 91, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.addDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_36addDof(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_numDof);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_36addDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_numDof) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cnumDof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("addDof", 0);

  /* "PETSc/Section.pyx":92
 * 
 *     def addDof(self,point,numDof):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionAddDof(self.sec,cpoint,cnumDof) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 92, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":93
 *     def addDof(self,point,numDof):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionAddDof(self.sec,cpoint,cnumDof) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_numDof); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 93, __pyx_L1_error)
  __pyx_v_cnumDof = __pyx_t_1;

  /* "PETSc/Section.pyx":94
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionAddDof(self.sec,cpoint,cnumDof) )             # <<<<<<<<<<<<<<
 * 
 *     def getFieldDof(self,point,field):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionAddDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cnumDof)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 94, __pyx_L1_error)

  /* "PETSc/Section.pyx":91
 *         CHKERR( PetscSectionSetDof(self.sec,cpoint,cnumDof) )
 * 
 *     def addDof(self,point,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.addDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":96
 *         CHKERR( PetscSectionAddDof(self.sec,cpoint,cnumDof) )
 * 
 *     def getFieldDof(self,point,field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         cdef PetscInt cfield = asInt(field)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_39getFieldDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_38getFieldDof[] = "Section.getFieldDof(self, point, field)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_39getFieldDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFieldDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_field,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getFieldDof", 1, 2, 2, 1); __PYX_ERR(32, 96, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getFieldDof") < 0)) __PYX_ERR(32, 96, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_point = values[0];
    __pyx_v_field = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFieldDof", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 96, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getFieldDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_38getFieldDof(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_field);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_38getFieldDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cnumDof;
  PetscInt __pyx_v_cfield;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getFieldDof", 0);

  /* "PETSc/Section.pyx":97
 * 
 *     def getFieldDof(self,point,field):
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         CHKERR( PetscSectionGetFieldDof(self.sec,cpoint,cfield,&cnumDof) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 97, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;
  __pyx_v_cnumDof = 0;

  /* "PETSc/Section.pyx":98
 *     def getFieldDof(self,point,field):
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         cdef PetscInt cfield = asInt(field)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetFieldDof(self.sec,cpoint,cfield,&cnumDof) )
 *         return toInt(cnumDof)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 98, __pyx_L1_error)
  __pyx_v_cfield = __pyx_t_1;

  /* "PETSc/Section.pyx":99
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         cdef PetscInt cfield = asInt(field)
 *         CHKERR( PetscSectionGetFieldDof(self.sec,cpoint,cfield,&cnumDof) )             # <<<<<<<<<<<<<<
 *         return toInt(cnumDof)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetFieldDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cfield, (&__pyx_v_cnumDof))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 99, __pyx_L1_error)

  /* "PETSc/Section.pyx":100
 *         cdef PetscInt cfield = asInt(field)
 *         CHKERR( PetscSectionGetFieldDof(self.sec,cpoint,cfield,&cnumDof) )
 *         return toInt(cnumDof)             # <<<<<<<<<<<<<<
 * 
 *     def setFieldDof(self,point,field,numDof):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_cnumDof); if (unlikely(!__pyx_t_3)) __PYX_ERR(32, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":96
 *         CHKERR( PetscSectionAddDof(self.sec,cpoint,cnumDof) )
 * 
 *     def getFieldDof(self,point,field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         cdef PetscInt cfield = asInt(field)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getFieldDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":102
 *         return toInt(cnumDof)
 * 
 *     def setFieldDof(self,point,field,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_41setFieldDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_40setFieldDof[] = "Section.setFieldDof(self, point, field, numDof)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_41setFieldDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_v_numDof = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFieldDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_field,&__pyx_n_s_numDof,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFieldDof", 1, 3, 3, 1); __PYX_ERR(32, 102, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_numDof)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFieldDof", 1, 3, 3, 2); __PYX_ERR(32, 102, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFieldDof") < 0)) __PYX_ERR(32, 102, __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_point = values[0];
    __pyx_v_field = values[1];
    __pyx_v_numDof = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFieldDof", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 102, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setFieldDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_40setFieldDof(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_field, __pyx_v_numDof);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_40setFieldDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field, PyObject *__pyx_v_numDof) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cfield;
  PetscInt __pyx_v_cnumDof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFieldDof", 0);

  /* "PETSc/Section.pyx":103
 * 
 *     def setFieldDof(self,point,field,numDof):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumDof = asInt(numDof)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 103, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":104
 *     def setFieldDof(self,point,field,numDof):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionSetFieldDof(self.sec,cpoint,cfield,cnumDof) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 104, __pyx_L1_error)
  __pyx_v_cfield = __pyx_t_1;

  /* "PETSc/Section.pyx":105
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumDof = asInt(numDof)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetFieldDof(self.sec,cpoint,cfield,cnumDof) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_numDof); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 105, __pyx_L1_error)
  __pyx_v_cnumDof = __pyx_t_1;

  /* "PETSc/Section.pyx":106
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionSetFieldDof(self.sec,cpoint,cfield,cnumDof) )             # <<<<<<<<<<<<<<
 * 
 *     def addFieldDof(self,point,field,numDof):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetFieldDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cfield, __pyx_v_cnumDof)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 106, __pyx_L1_error)

  /* "PETSc/Section.pyx":102
 *         return toInt(cnumDof)
 * 
 *     def setFieldDof(self,point,field,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setFieldDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":108
 *         CHKERR( PetscSectionSetFieldDof(self.sec,cpoint,cfield,cnumDof) )
 * 
 *     def addFieldDof(self,point,field,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_43addFieldDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_42addFieldDof[] = "Section.addFieldDof(self, point, field, numDof)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_43addFieldDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_v_numDof = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addFieldDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_field,&__pyx_n_s_numDof,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addFieldDof", 1, 3, 3, 1); __PYX_ERR(32, 108, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_numDof)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addFieldDof", 1, 3, 3, 2); __PYX_ERR(32, 108, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "addFieldDof") < 0)) __PYX_ERR(32, 108, __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_point = values[0];
    __pyx_v_field = values[1];
    __pyx_v_numDof = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addFieldDof", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 108, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.addFieldDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_42addFieldDof(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_field, __pyx_v_numDof);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_42addFieldDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field, PyObject *__pyx_v_numDof) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cfield;
  PetscInt __pyx_v_cnumDof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("addFieldDof", 0);

  /* "PETSc/Section.pyx":109
 * 
 *     def addFieldDof(self,point,field,numDof):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumDof = asInt(numDof)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 109, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":110
 *     def addFieldDof(self,point,field,numDof):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionAddFieldDof(self.sec,cpoint,cfield,cnumDof) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 110, __pyx_L1_error)
  __pyx_v_cfield = __pyx_t_1;

  /* "PETSc/Section.pyx":111
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumDof = asInt(numDof)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionAddFieldDof(self.sec,cpoint,cfield,cnumDof) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_numDof); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 111, __pyx_L1_error)
  __pyx_v_cnumDof = __pyx_t_1;

  /* "PETSc/Section.pyx":112
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionAddFieldDof(self.sec,cpoint,cfield,cnumDof) )             # <<<<<<<<<<<<<<
 * 
 *     def getConstraintDof(self,point):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionAddFieldDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cfield, __pyx_v_cnumDof)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 112, __pyx_L1_error)

  /* "PETSc/Section.pyx":108
 *         CHKERR( PetscSectionSetFieldDof(self.sec,cpoint,cfield,cnumDof) )
 * 
 *     def addFieldDof(self,point,field,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.addFieldDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":114
 *         CHKERR( PetscSectionAddFieldDof(self.sec,cpoint,cfield,cnumDof) )
 * 
 *     def getConstraintDof(self,point):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         CHKERR( PetscSectionGetConstraintDof(self.sec,cpoint,&cnumDof) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_45getConstraintDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_44getConstraintDof[] = "Section.getConstraintDof(self, point)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_45getConstraintDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConstraintDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,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);
        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_point)) != 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, "getConstraintDof") < 0)) __PYX_ERR(32, 114, __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_point = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConstraintDof", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 114, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getConstraintDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_44getConstraintDof(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_44getConstraintDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cnumDof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getConstraintDof", 0);

  /* "PETSc/Section.pyx":115
 * 
 *     def getConstraintDof(self,point):
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetConstraintDof(self.sec,cpoint,&cnumDof) )
 *         return toInt(cnumDof)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 115, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;
  __pyx_v_cnumDof = 0;

  /* "PETSc/Section.pyx":116
 *     def getConstraintDof(self,point):
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         CHKERR( PetscSectionGetConstraintDof(self.sec,cpoint,&cnumDof) )             # <<<<<<<<<<<<<<
 *         return toInt(cnumDof)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetConstraintDof(__pyx_v_self->sec, __pyx_v_cpoint, (&__pyx_v_cnumDof))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 116, __pyx_L1_error)

  /* "PETSc/Section.pyx":117
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         CHKERR( PetscSectionGetConstraintDof(self.sec,cpoint,&cnumDof) )
 *         return toInt(cnumDof)             # <<<<<<<<<<<<<<
 * 
 *     def setConstraintDof(self,point,numDof):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_cnumDof); if (unlikely(!__pyx_t_3)) __PYX_ERR(32, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":114
 *         CHKERR( PetscSectionAddFieldDof(self.sec,cpoint,cfield,cnumDof) )
 * 
 *     def getConstraintDof(self,point):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         CHKERR( PetscSectionGetConstraintDof(self.sec,cpoint,&cnumDof) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getConstraintDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":119
 *         return toInt(cnumDof)
 * 
 *     def setConstraintDof(self,point,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_47setConstraintDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_46setConstraintDof[] = "Section.setConstraintDof(self, point, numDof)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_47setConstraintDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_numDof = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConstraintDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_numDof,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_numDof)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConstraintDof", 1, 2, 2, 1); __PYX_ERR(32, 119, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConstraintDof") < 0)) __PYX_ERR(32, 119, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_point = values[0];
    __pyx_v_numDof = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConstraintDof", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 119, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setConstraintDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_46setConstraintDof(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_numDof);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_46setConstraintDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_numDof) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cnumDof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setConstraintDof", 0);

  /* "PETSc/Section.pyx":120
 * 
 *     def setConstraintDof(self,point,numDof):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionSetConstraintDof(self.sec,cpoint,cnumDof) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 120, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":121
 *     def setConstraintDof(self,point,numDof):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetConstraintDof(self.sec,cpoint,cnumDof) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_numDof); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 121, __pyx_L1_error)
  __pyx_v_cnumDof = __pyx_t_1;

  /* "PETSc/Section.pyx":122
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionSetConstraintDof(self.sec,cpoint,cnumDof) )             # <<<<<<<<<<<<<<
 * 
 *     def addConstraintDof(self,point,numDof):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetConstraintDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cnumDof)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 122, __pyx_L1_error)

  /* "PETSc/Section.pyx":119
 *         return toInt(cnumDof)
 * 
 *     def setConstraintDof(self,point,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setConstraintDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":124
 *         CHKERR( PetscSectionSetConstraintDof(self.sec,cpoint,cnumDof) )
 * 
 *     def addConstraintDof(self,point,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_49addConstraintDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_48addConstraintDof[] = "Section.addConstraintDof(self, point, numDof)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_49addConstraintDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_numDof = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addConstraintDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_numDof,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_numDof)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addConstraintDof", 1, 2, 2, 1); __PYX_ERR(32, 124, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "addConstraintDof") < 0)) __PYX_ERR(32, 124, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_point = values[0];
    __pyx_v_numDof = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addConstraintDof", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 124, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.addConstraintDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_48addConstraintDof(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_numDof);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_48addConstraintDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_numDof) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cnumDof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("addConstraintDof", 0);

  /* "PETSc/Section.pyx":125
 * 
 *     def addConstraintDof(self,point,numDof):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionAddConstraintDof(self.sec,cpoint,cnumDof) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 125, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":126
 *     def addConstraintDof(self,point,numDof):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionAddConstraintDof(self.sec,cpoint,cnumDof) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_numDof); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 126, __pyx_L1_error)
  __pyx_v_cnumDof = __pyx_t_1;

  /* "PETSc/Section.pyx":127
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionAddConstraintDof(self.sec,cpoint,cnumDof) )             # <<<<<<<<<<<<<<
 * 
 *     def getFieldConstraintDof(self,point,field):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionAddConstraintDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cnumDof)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 127, __pyx_L1_error)

  /* "PETSc/Section.pyx":124
 *         CHKERR( PetscSectionSetConstraintDof(self.sec,cpoint,cnumDof) )
 * 
 *     def addConstraintDof(self,point,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cnumDof = asInt(numDof)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.addConstraintDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":129
 *         CHKERR( PetscSectionAddConstraintDof(self.sec,cpoint,cnumDof) )
 * 
 *     def getFieldConstraintDof(self,point,field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         cdef PetscInt cfield = asInt(field)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_51getFieldConstraintDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_50getFieldConstraintDof[] = "Section.getFieldConstraintDof(self, point, field)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_51getFieldConstraintDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFieldConstraintDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_field,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getFieldConstraintDof", 1, 2, 2, 1); __PYX_ERR(32, 129, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getFieldConstraintDof") < 0)) __PYX_ERR(32, 129, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_point = values[0];
    __pyx_v_field = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFieldConstraintDof", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 129, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getFieldConstraintDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_50getFieldConstraintDof(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_field);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_50getFieldConstraintDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cnumDof;
  PetscInt __pyx_v_cfield;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getFieldConstraintDof", 0);

  /* "PETSc/Section.pyx":130
 * 
 *     def getFieldConstraintDof(self,point,field):
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         CHKERR( PetscSectionGetFieldConstraintDof(self.sec,cpoint,cfield,&cnumDof) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 130, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;
  __pyx_v_cnumDof = 0;

  /* "PETSc/Section.pyx":131
 *     def getFieldConstraintDof(self,point,field):
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         cdef PetscInt cfield = asInt(field)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetFieldConstraintDof(self.sec,cpoint,cfield,&cnumDof) )
 *         return toInt(cnumDof)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 131, __pyx_L1_error)
  __pyx_v_cfield = __pyx_t_1;

  /* "PETSc/Section.pyx":132
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         cdef PetscInt cfield = asInt(field)
 *         CHKERR( PetscSectionGetFieldConstraintDof(self.sec,cpoint,cfield,&cnumDof) )             # <<<<<<<<<<<<<<
 *         return toInt(cnumDof)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetFieldConstraintDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cfield, (&__pyx_v_cnumDof))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 132, __pyx_L1_error)

  /* "PETSc/Section.pyx":133
 *         cdef PetscInt cfield = asInt(field)
 *         CHKERR( PetscSectionGetFieldConstraintDof(self.sec,cpoint,cfield,&cnumDof) )
 *         return toInt(cnumDof)             # <<<<<<<<<<<<<<
 * 
 *     def setFieldConstraintDof(self,point,field,numDof):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_cnumDof); if (unlikely(!__pyx_t_3)) __PYX_ERR(32, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":129
 *         CHKERR( PetscSectionAddConstraintDof(self.sec,cpoint,cnumDof) )
 * 
 *     def getFieldConstraintDof(self,point,field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), cnumDof = 0
 *         cdef PetscInt cfield = asInt(field)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getFieldConstraintDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":135
 *         return toInt(cnumDof)
 * 
 *     def setFieldConstraintDof(self,point,field,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_53setFieldConstraintDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_52setFieldConstraintDof[] = "Section.setFieldConstraintDof(self, point, field, numDof)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_53setFieldConstraintDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_v_numDof = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFieldConstraintDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_field,&__pyx_n_s_numDof,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFieldConstraintDof", 1, 3, 3, 1); __PYX_ERR(32, 135, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_numDof)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFieldConstraintDof", 1, 3, 3, 2); __PYX_ERR(32, 135, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFieldConstraintDof") < 0)) __PYX_ERR(32, 135, __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_point = values[0];
    __pyx_v_field = values[1];
    __pyx_v_numDof = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFieldConstraintDof", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 135, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setFieldConstraintDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_52setFieldConstraintDof(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_field, __pyx_v_numDof);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_52setFieldConstraintDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field, PyObject *__pyx_v_numDof) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cfield;
  PetscInt __pyx_v_cnumDof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFieldConstraintDof", 0);

  /* "PETSc/Section.pyx":136
 * 
 *     def setFieldConstraintDof(self,point,field,numDof):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumDof = asInt(numDof)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 136, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":137
 *     def setFieldConstraintDof(self,point,field,numDof):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionSetFieldConstraintDof(self.sec,cpoint,cfield,cnumDof) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 137, __pyx_L1_error)
  __pyx_v_cfield = __pyx_t_1;

  /* "PETSc/Section.pyx":138
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumDof = asInt(numDof)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetFieldConstraintDof(self.sec,cpoint,cfield,cnumDof) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_numDof); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 138, __pyx_L1_error)
  __pyx_v_cnumDof = __pyx_t_1;

  /* "PETSc/Section.pyx":139
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionSetFieldConstraintDof(self.sec,cpoint,cfield,cnumDof) )             # <<<<<<<<<<<<<<
 * 
 *     def addFieldConstraintDof(self,point,field,numDof):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetFieldConstraintDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cfield, __pyx_v_cnumDof)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 139, __pyx_L1_error)

  /* "PETSc/Section.pyx":135
 *         return toInt(cnumDof)
 * 
 *     def setFieldConstraintDof(self,point,field,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setFieldConstraintDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":141
 *         CHKERR( PetscSectionSetFieldConstraintDof(self.sec,cpoint,cfield,cnumDof) )
 * 
 *     def addFieldConstraintDof(self,point,field,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_55addFieldConstraintDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_54addFieldConstraintDof[] = "Section.addFieldConstraintDof(self, point, field, numDof)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_55addFieldConstraintDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_v_numDof = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addFieldConstraintDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_field,&__pyx_n_s_numDof,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addFieldConstraintDof", 1, 3, 3, 1); __PYX_ERR(32, 141, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_numDof)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addFieldConstraintDof", 1, 3, 3, 2); __PYX_ERR(32, 141, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "addFieldConstraintDof") < 0)) __PYX_ERR(32, 141, __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_point = values[0];
    __pyx_v_field = values[1];
    __pyx_v_numDof = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addFieldConstraintDof", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 141, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.addFieldConstraintDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_54addFieldConstraintDof(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_field, __pyx_v_numDof);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_54addFieldConstraintDof(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field, PyObject *__pyx_v_numDof) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cfield;
  PetscInt __pyx_v_cnumDof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("addFieldConstraintDof", 0);

  /* "PETSc/Section.pyx":142
 * 
 *     def addFieldConstraintDof(self,point,field,numDof):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumDof = asInt(numDof)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 142, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":143
 *     def addFieldConstraintDof(self,point,field,numDof):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionAddFieldConstraintDof(self.sec,cpoint,cfield,cnumDof) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 143, __pyx_L1_error)
  __pyx_v_cfield = __pyx_t_1;

  /* "PETSc/Section.pyx":144
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumDof = asInt(numDof)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionAddFieldConstraintDof(self.sec,cpoint,cfield,cnumDof) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_numDof); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 144, __pyx_L1_error)
  __pyx_v_cnumDof = __pyx_t_1;

  /* "PETSc/Section.pyx":145
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt cnumDof = asInt(numDof)
 *         CHKERR( PetscSectionAddFieldConstraintDof(self.sec,cpoint,cfield,cnumDof) )             # <<<<<<<<<<<<<<
 * 
 *     def getConstraintIndices(self,point):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionAddFieldConstraintDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cfield, __pyx_v_cnumDof)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 145, __pyx_L1_error)

  /* "PETSc/Section.pyx":141
 *         CHKERR( PetscSectionSetFieldConstraintDof(self.sec,cpoint,cfield,cnumDof) )
 * 
 *     def addFieldConstraintDof(self,point,field,numDof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.addFieldConstraintDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":147
 *         CHKERR( PetscSectionAddFieldConstraintDof(self.sec,cpoint,cfield,cnumDof) )
 * 
 *     def getConstraintIndices(self,point):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt nindex = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_57getConstraintIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_56getConstraintIndices[] = "Section.getConstraintIndices(self, point)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_57getConstraintIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConstraintIndices (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,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);
        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_point)) != 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, "getConstraintIndices") < 0)) __PYX_ERR(32, 147, __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_point = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConstraintIndices", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 147, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getConstraintIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_56getConstraintIndices(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_56getConstraintIndices(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_nindex;
  const PetscInt *__pyx_v_indices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getConstraintIndices", 0);

  /* "PETSc/Section.pyx":148
 * 
 *     def getConstraintIndices(self,point):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt nindex = 0
 *         cdef const_PetscInt *indices = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 148, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":149
 *     def getConstraintIndices(self,point):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt nindex = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( PetscSectionGetConstraintDof(self.sec, cpoint, &nindex) )
 */
  __pyx_v_nindex = 0;

  /* "PETSc/Section.pyx":150
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt nindex = 0
 *         cdef const_PetscInt *indices = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetConstraintDof(self.sec, cpoint, &nindex) )
 *         CHKERR( PetscSectionGetConstraintIndices(self.sec, cpoint, &indices) )
 */
  __pyx_v_indices = NULL;

  /* "PETSc/Section.pyx":151
 *         cdef PetscInt nindex = 0
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( PetscSectionGetConstraintDof(self.sec, cpoint, &nindex) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetConstraintIndices(self.sec, cpoint, &indices) )
 *         return array_i(nindex, indices)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetConstraintDof(__pyx_v_self->sec, __pyx_v_cpoint, (&__pyx_v_nindex))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 151, __pyx_L1_error)

  /* "PETSc/Section.pyx":152
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( PetscSectionGetConstraintDof(self.sec, cpoint, &nindex) )
 *         CHKERR( PetscSectionGetConstraintIndices(self.sec, cpoint, &indices) )             # <<<<<<<<<<<<<<
 *         return array_i(nindex, indices)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetConstraintIndices(__pyx_v_self->sec, __pyx_v_cpoint, (&__pyx_v_indices))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 152, __pyx_L1_error)

  /* "PETSc/Section.pyx":153
 *         CHKERR( PetscSectionGetConstraintDof(self.sec, cpoint, &nindex) )
 *         CHKERR( PetscSectionGetConstraintIndices(self.sec, cpoint, &indices) )
 *         return array_i(nindex, indices)             # <<<<<<<<<<<<<<
 * 
 *     def setConstraintIndices(self,point,indices):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_nindex, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(32, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":147
 *         CHKERR( PetscSectionAddFieldConstraintDof(self.sec,cpoint,cfield,cnumDof) )
 * 
 *     def getConstraintIndices(self,point):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt nindex = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getConstraintIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":155
 *         return array_i(nindex, indices)
 * 
 *     def setConstraintIndices(self,point,indices):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt nindex = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_59setConstraintIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_58setConstraintIndices[] = "Section.setConstraintIndices(self, point, indices)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_59setConstraintIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConstraintIndices (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_indices,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConstraintIndices", 1, 2, 2, 1); __PYX_ERR(32, 155, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConstraintIndices") < 0)) __PYX_ERR(32, 155, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_point = values[0];
    __pyx_v_indices = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConstraintIndices", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 155, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setConstraintIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_58setConstraintIndices(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_indices);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_58setConstraintIndices(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_indices) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_nindex;
  PetscInt *__pyx_v_cindices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setConstraintIndices", 0);
  __Pyx_INCREF(__pyx_v_indices);

  /* "PETSc/Section.pyx":156
 * 
 *     def setConstraintIndices(self,point,indices):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt nindex = 0
 *         cdef PetscInt *cindices = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 156, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":157
 *     def setConstraintIndices(self,point,indices):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt nindex = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *cindices = NULL
 *         indices = iarray_i(indices, &nindex, &cindices)
 */
  __pyx_v_nindex = 0;

  /* "PETSc/Section.pyx":158
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt nindex = 0
 *         cdef PetscInt *cindices = NULL             # <<<<<<<<<<<<<<
 *         indices = iarray_i(indices, &nindex, &cindices)
 *         CHKERR( PetscSectionSetConstraintDof(self.sec,cpoint,nindex) )
 */
  __pyx_v_cindices = NULL;

  /* "PETSc/Section.pyx":159
 *         cdef PetscInt nindex = 0
 *         cdef PetscInt *cindices = NULL
 *         indices = iarray_i(indices, &nindex, &cindices)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetConstraintDof(self.sec,cpoint,nindex) )
 *         CHKERR( PetscSectionSetConstraintIndices(self.sec,cpoint,cindices) )
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_indices, (&__pyx_v_nindex), (&__pyx_v_cindices))); if (unlikely(!__pyx_t_2)) __PYX_ERR(32, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Section.pyx":160
 *         cdef PetscInt *cindices = NULL
 *         indices = iarray_i(indices, &nindex, &cindices)
 *         CHKERR( PetscSectionSetConstraintDof(self.sec,cpoint,nindex) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetConstraintIndices(self.sec,cpoint,cindices) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetConstraintDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_nindex)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(32, 160, __pyx_L1_error)

  /* "PETSc/Section.pyx":161
 *         indices = iarray_i(indices, &nindex, &cindices)
 *         CHKERR( PetscSectionSetConstraintDof(self.sec,cpoint,nindex) )
 *         CHKERR( PetscSectionSetConstraintIndices(self.sec,cpoint,cindices) )             # <<<<<<<<<<<<<<
 * 
 *     def getFieldConstraintIndices(self,point,field):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetConstraintIndices(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cindices)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(32, 161, __pyx_L1_error)

  /* "PETSc/Section.pyx":155
 *         return array_i(nindex, indices)
 * 
 *     def setConstraintIndices(self,point,indices):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt nindex = 0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setConstraintIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":163
 *         CHKERR( PetscSectionSetConstraintIndices(self.sec,cpoint,cindices) )
 * 
 *     def getFieldConstraintIndices(self,point,field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_61getFieldConstraintIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_60getFieldConstraintIndices[] = "Section.getFieldConstraintIndices(self, point, field)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_61getFieldConstraintIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFieldConstraintIndices (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_field,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getFieldConstraintIndices", 1, 2, 2, 1); __PYX_ERR(32, 163, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getFieldConstraintIndices") < 0)) __PYX_ERR(32, 163, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_point = values[0];
    __pyx_v_field = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFieldConstraintIndices", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 163, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getFieldConstraintIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_60getFieldConstraintIndices(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_field);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_60getFieldConstraintIndices(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cfield;
  PetscInt __pyx_v_nindex;
  const PetscInt *__pyx_v_indices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getFieldConstraintIndices", 0);

  /* "PETSc/Section.pyx":164
 * 
 *     def getFieldConstraintIndices(self,point,field):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt nindex = 0
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 164, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":165
 *     def getFieldConstraintIndices(self,point,field):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscInt nindex = 0
 *         cdef const_PetscInt *indices = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 165, __pyx_L1_error)
  __pyx_v_cfield = __pyx_t_1;

  /* "PETSc/Section.pyx":166
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt nindex = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( PetscSectionGetFieldConstraintDof(self.sec,cpoint,cfield,&nindex) )
 */
  __pyx_v_nindex = 0;

  /* "PETSc/Section.pyx":167
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt nindex = 0
 *         cdef const_PetscInt *indices = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetFieldConstraintDof(self.sec,cpoint,cfield,&nindex) )
 *         CHKERR( PetscSectionGetFieldConstraintIndices(self.sec,cpoint,cfield,&indices) )
 */
  __pyx_v_indices = NULL;

  /* "PETSc/Section.pyx":168
 *         cdef PetscInt nindex = 0
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( PetscSectionGetFieldConstraintDof(self.sec,cpoint,cfield,&nindex) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetFieldConstraintIndices(self.sec,cpoint,cfield,&indices) )
 *         return array_i(nindex, indices)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetFieldConstraintDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cfield, (&__pyx_v_nindex))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 168, __pyx_L1_error)

  /* "PETSc/Section.pyx":169
 *         cdef const_PetscInt *indices = NULL
 *         CHKERR( PetscSectionGetFieldConstraintDof(self.sec,cpoint,cfield,&nindex) )
 *         CHKERR( PetscSectionGetFieldConstraintIndices(self.sec,cpoint,cfield,&indices) )             # <<<<<<<<<<<<<<
 *         return array_i(nindex, indices)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetFieldConstraintIndices(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cfield, (&__pyx_v_indices))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 169, __pyx_L1_error)

  /* "PETSc/Section.pyx":170
 *         CHKERR( PetscSectionGetFieldConstraintDof(self.sec,cpoint,cfield,&nindex) )
 *         CHKERR( PetscSectionGetFieldConstraintIndices(self.sec,cpoint,cfield,&indices) )
 *         return array_i(nindex, indices)             # <<<<<<<<<<<<<<
 * 
 *     def setFieldConstraintIndices(self,point,field,indices):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_nindex, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(32, 170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":163
 *         CHKERR( PetscSectionSetConstraintIndices(self.sec,cpoint,cindices) )
 * 
 *     def getFieldConstraintIndices(self,point,field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getFieldConstraintIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":172
 *         return array_i(nindex, indices)
 * 
 *     def setFieldConstraintIndices(self,point,field,indices):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_63setFieldConstraintIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_62setFieldConstraintIndices[] = "Section.setFieldConstraintIndices(self, point, field, indices)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_63setFieldConstraintIndices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFieldConstraintIndices (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_field,&__pyx_n_s_indices,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFieldConstraintIndices", 1, 3, 3, 1); __PYX_ERR(32, 172, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFieldConstraintIndices", 1, 3, 3, 2); __PYX_ERR(32, 172, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFieldConstraintIndices") < 0)) __PYX_ERR(32, 172, __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_point = values[0];
    __pyx_v_field = values[1];
    __pyx_v_indices = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFieldConstraintIndices", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 172, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setFieldConstraintIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_62setFieldConstraintIndices(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_field, __pyx_v_indices);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_62setFieldConstraintIndices(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_field, PyObject *__pyx_v_indices) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cfield;
  PetscInt __pyx_v_nindex;
  PetscInt *__pyx_v_cindices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setFieldConstraintIndices", 0);
  __Pyx_INCREF(__pyx_v_indices);

  /* "PETSc/Section.pyx":173
 * 
 *     def setFieldConstraintIndices(self,point,field,indices):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt nindex = 0
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 173, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":174
 *     def setFieldConstraintIndices(self,point,field,indices):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef PetscInt nindex = 0
 *         cdef PetscInt *cindices = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 174, __pyx_L1_error)
  __pyx_v_cfield = __pyx_t_1;

  /* "PETSc/Section.pyx":175
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt nindex = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *cindices = NULL
 *         indices = iarray_i(indices, &nindex, &cindices)
 */
  __pyx_v_nindex = 0;

  /* "PETSc/Section.pyx":176
 *         cdef PetscInt cfield = asInt(field)
 *         cdef PetscInt nindex = 0
 *         cdef PetscInt *cindices = NULL             # <<<<<<<<<<<<<<
 *         indices = iarray_i(indices, &nindex, &cindices)
 *         CHKERR( PetscSectionSetFieldConstraintDof(self.sec,cpoint,cfield,nindex) )
 */
  __pyx_v_cindices = NULL;

  /* "PETSc/Section.pyx":177
 *         cdef PetscInt nindex = 0
 *         cdef PetscInt *cindices = NULL
 *         indices = iarray_i(indices, &nindex, &cindices)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetFieldConstraintDof(self.sec,cpoint,cfield,nindex) )
 *         CHKERR( PetscSectionSetFieldConstraintIndices(self.sec,cpoint,cfield,cindices) )
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_indices, (&__pyx_v_nindex), (&__pyx_v_cindices))); if (unlikely(!__pyx_t_2)) __PYX_ERR(32, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Section.pyx":178
 *         cdef PetscInt *cindices = NULL
 *         indices = iarray_i(indices, &nindex, &cindices)
 *         CHKERR( PetscSectionSetFieldConstraintDof(self.sec,cpoint,cfield,nindex) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetFieldConstraintIndices(self.sec,cpoint,cfield,cindices) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetFieldConstraintDof(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cfield, __pyx_v_nindex)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(32, 178, __pyx_L1_error)

  /* "PETSc/Section.pyx":179
 *         indices = iarray_i(indices, &nindex, &cindices)
 *         CHKERR( PetscSectionSetFieldConstraintDof(self.sec,cpoint,cfield,nindex) )
 *         CHKERR( PetscSectionSetFieldConstraintIndices(self.sec,cpoint,cfield,cindices) )             # <<<<<<<<<<<<<<
 * 
 *     def getMaxDof(self):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetFieldConstraintIndices(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_cfield, __pyx_v_cindices)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(32, 179, __pyx_L1_error)

  /* "PETSc/Section.pyx":172
 *         return array_i(nindex, indices)
 * 
 *     def setFieldConstraintIndices(self,point,field,indices):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt cfield = asInt(field)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setFieldConstraintIndices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":181
 *         CHKERR( PetscSectionSetFieldConstraintIndices(self.sec,cpoint,cfield,cindices) )
 * 
 *     def getMaxDof(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt maxDof = 0
 *         CHKERR( PetscSectionGetMaxDof(self.sec,&maxDof) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_65getMaxDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_64getMaxDof[] = "Section.getMaxDof(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_65getMaxDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMaxDof (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMaxDof", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMaxDof", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_64getMaxDof(((struct PyPetscSectionObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_64getMaxDof(struct PyPetscSectionObject *__pyx_v_self) {
  PetscInt __pyx_v_maxDof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getMaxDof", 0);

  /* "PETSc/Section.pyx":182
 * 
 *     def getMaxDof(self):
 *         cdef PetscInt maxDof = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetMaxDof(self.sec,&maxDof) )
 *         return toInt(maxDof)
 */
  __pyx_v_maxDof = 0;

  /* "PETSc/Section.pyx":183
 *     def getMaxDof(self):
 *         cdef PetscInt maxDof = 0
 *         CHKERR( PetscSectionGetMaxDof(self.sec,&maxDof) )             # <<<<<<<<<<<<<<
 *         return toInt(maxDof)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetMaxDof(__pyx_v_self->sec, (&__pyx_v_maxDof))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(32, 183, __pyx_L1_error)

  /* "PETSc/Section.pyx":184
 *         cdef PetscInt maxDof = 0
 *         CHKERR( PetscSectionGetMaxDof(self.sec,&maxDof) )
 *         return toInt(maxDof)             # <<<<<<<<<<<<<<
 * 
 *     def getStorageSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_maxDof); if (unlikely(!__pyx_t_2)) __PYX_ERR(32, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":181
 *         CHKERR( PetscSectionSetFieldConstraintIndices(self.sec,cpoint,cfield,cindices) )
 * 
 *     def getMaxDof(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt maxDof = 0
 *         CHKERR( PetscSectionGetMaxDof(self.sec,&maxDof) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getMaxDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":186
 *         return toInt(maxDof)
 * 
 *     def getStorageSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0
 *         CHKERR( PetscSectionGetStorageSize(self.sec,&size) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_67getStorageSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_66getStorageSize[] = "Section.getStorageSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_67getStorageSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getStorageSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getStorageSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getStorageSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_66getStorageSize(((struct PyPetscSectionObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_66getStorageSize(struct PyPetscSectionObject *__pyx_v_self) {
  PetscInt __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getStorageSize", 0);

  /* "PETSc/Section.pyx":187
 * 
 *     def getStorageSize(self):
 *         cdef PetscInt size = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetStorageSize(self.sec,&size) )
 *         return toInt(size)
 */
  __pyx_v_size = 0;

  /* "PETSc/Section.pyx":188
 *     def getStorageSize(self):
 *         cdef PetscInt size = 0
 *         CHKERR( PetscSectionGetStorageSize(self.sec,&size) )             # <<<<<<<<<<<<<<
 *         return toInt(size)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetStorageSize(__pyx_v_self->sec, (&__pyx_v_size))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(32, 188, __pyx_L1_error)

  /* "PETSc/Section.pyx":189
 *         cdef PetscInt size = 0
 *         CHKERR( PetscSectionGetStorageSize(self.sec,&size) )
 *         return toInt(size)             # <<<<<<<<<<<<<<
 * 
 *     def getConstrainedStorageSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(32, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":186
 *         return toInt(maxDof)
 * 
 *     def getStorageSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0
 *         CHKERR( PetscSectionGetStorageSize(self.sec,&size) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getStorageSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":191
 *         return toInt(size)
 * 
 *     def getConstrainedStorageSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0
 *         CHKERR( PetscSectionGetConstrainedStorageSize(self.sec,&size) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_69getConstrainedStorageSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_68getConstrainedStorageSize[] = "Section.getConstrainedStorageSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_69getConstrainedStorageSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConstrainedStorageSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getConstrainedStorageSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getConstrainedStorageSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_68getConstrainedStorageSize(((struct PyPetscSectionObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_68getConstrainedStorageSize(struct PyPetscSectionObject *__pyx_v_self) {
  PetscInt __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConstrainedStorageSize", 0);

  /* "PETSc/Section.pyx":192
 * 
 *     def getConstrainedStorageSize(self):
 *         cdef PetscInt size = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetConstrainedStorageSize(self.sec,&size) )
 *         return toInt(size)
 */
  __pyx_v_size = 0;

  /* "PETSc/Section.pyx":193
 *     def getConstrainedStorageSize(self):
 *         cdef PetscInt size = 0
 *         CHKERR( PetscSectionGetConstrainedStorageSize(self.sec,&size) )             # <<<<<<<<<<<<<<
 *         return toInt(size)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetConstrainedStorageSize(__pyx_v_self->sec, (&__pyx_v_size))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(32, 193, __pyx_L1_error)

  /* "PETSc/Section.pyx":194
 *         cdef PetscInt size = 0
 *         CHKERR( PetscSectionGetConstrainedStorageSize(self.sec,&size) )
 *         return toInt(size)             # <<<<<<<<<<<<<<
 * 
 *     def getOffset(self,point):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(32, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":191
 *         return toInt(size)
 * 
 *     def getConstrainedStorageSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0
 *         CHKERR( PetscSectionGetConstrainedStorageSize(self.sec,&size) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getConstrainedStorageSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":196
 *         return toInt(size)
 * 
 *     def getOffset(self,point):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), offset = 0
 *         CHKERR( PetscSectionGetOffset(self.sec,cpoint,&offset) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_71getOffset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_70getOffset[] = "Section.getOffset(self, point)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_71getOffset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOffset (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,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);
        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_point)) != 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, "getOffset") < 0)) __PYX_ERR(32, 196, __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_point = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getOffset", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 196, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getOffset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_70getOffset(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_70getOffset(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_offset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getOffset", 0);

  /* "PETSc/Section.pyx":197
 * 
 *     def getOffset(self,point):
 *         cdef PetscInt cpoint = asInt(point), offset = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetOffset(self.sec,cpoint,&offset) )
 *         return toInt(offset)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 197, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;
  __pyx_v_offset = 0;

  /* "PETSc/Section.pyx":198
 *     def getOffset(self,point):
 *         cdef PetscInt cpoint = asInt(point), offset = 0
 *         CHKERR( PetscSectionGetOffset(self.sec,cpoint,&offset) )             # <<<<<<<<<<<<<<
 *         return toInt(offset)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetOffset(__pyx_v_self->sec, __pyx_v_cpoint, (&__pyx_v_offset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 198, __pyx_L1_error)

  /* "PETSc/Section.pyx":199
 *         cdef PetscInt cpoint = asInt(point), offset = 0
 *         CHKERR( PetscSectionGetOffset(self.sec,cpoint,&offset) )
 *         return toInt(offset)             # <<<<<<<<<<<<<<
 * 
 *     def setOffset(self,point,offset):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(32, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":196
 *         return toInt(size)
 * 
 *     def getOffset(self,point):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), offset = 0
 *         CHKERR( PetscSectionGetOffset(self.sec,cpoint,&offset) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getOffset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":201
 *         return toInt(offset)
 * 
 *     def setOffset(self,point,offset):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt coffset = asInt(offset)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_73setOffset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_72setOffset[] = "Section.setOffset(self, point, offset)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_73setOffset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_offset = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOffset (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_point,&__pyx_n_s_offset,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_point)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setOffset", 1, 2, 2, 1); __PYX_ERR(32, 201, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setOffset") < 0)) __PYX_ERR(32, 201, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_point = values[0];
    __pyx_v_offset = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOffset", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 201, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setOffset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_72setOffset(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_point, __pyx_v_offset);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_72setOffset(struct PyPetscSectionObject *__pyx_v_self, PyObject *__pyx_v_point, PyObject *__pyx_v_offset) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_coffset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setOffset", 0);

  /* "PETSc/Section.pyx":202
 * 
 *     def setOffset(self,point,offset):
 *         cdef PetscInt cpoint = asInt(point)             # <<<<<<<<<<<<<<
 *         cdef PetscInt coffset = asInt(offset)
 *         CHKERR( PetscSectionSetOffset(self.sec,cpoint,coffset) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 202, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;

  /* "PETSc/Section.pyx":203
 *     def setOffset(self,point,offset):
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt coffset = asInt(offset)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionSetOffset(self.sec,cpoint,coffset) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_offset); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(32, 203, __pyx_L1_error)
  __pyx_v_coffset = __pyx_t_1;

  /* "PETSc/Section.pyx":204
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt coffset = asInt(offset)
 *         CHKERR( PetscSectionSetOffset(self.sec,cpoint,coffset) )             # <<<<<<<<<<<<<<
 * 
 *     def getOffsetRange(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionSetOffset(__pyx_v_self->sec, __pyx_v_cpoint, __pyx_v_coffset)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 204, __pyx_L1_error)

  /* "PETSc/Section.pyx":201
 *         return toInt(offset)
 * 
 *     def setOffset(self,point,offset):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point)
 *         cdef PetscInt coffset = asInt(offset)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.setOffset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":206
 *         CHKERR( PetscSectionSetOffset(self.sec,cpoint,coffset) )
 * 
 *     def getOffsetRange(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt oStart = 0, oEnd = 0
 *         CHKERR( PetscSectionGetOffsetRange(self.sec,&oStart,&oEnd) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_75getOffsetRange(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_74getOffsetRange[] = "Section.getOffsetRange(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_75getOffsetRange(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOffsetRange (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOffsetRange", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOffsetRange", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_74getOffsetRange(((struct PyPetscSectionObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_74getOffsetRange(struct PyPetscSectionObject *__pyx_v_self) {
  PetscInt __pyx_v_oStart;
  PetscInt __pyx_v_oEnd;
  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;
  __Pyx_RefNannySetupContext("getOffsetRange", 0);

  /* "PETSc/Section.pyx":207
 * 
 *     def getOffsetRange(self):
 *         cdef PetscInt oStart = 0, oEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionGetOffsetRange(self.sec,&oStart,&oEnd) )
 *         return toInt(oStart),toInt(oEnd)
 */
  __pyx_v_oStart = 0;
  __pyx_v_oEnd = 0;

  /* "PETSc/Section.pyx":208
 *     def getOffsetRange(self):
 *         cdef PetscInt oStart = 0, oEnd = 0
 *         CHKERR( PetscSectionGetOffsetRange(self.sec,&oStart,&oEnd) )             # <<<<<<<<<<<<<<
 *         return toInt(oStart),toInt(oEnd)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionGetOffsetRange(__pyx_v_self->sec, (&__pyx_v_oStart), (&__pyx_v_oEnd))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(32, 208, __pyx_L1_error)

  /* "PETSc/Section.pyx":209
 *         cdef PetscInt oStart = 0, oEnd = 0
 *         CHKERR( PetscSectionGetOffsetRange(self.sec,&oStart,&oEnd) )
 *         return toInt(oStart),toInt(oEnd)             # <<<<<<<<<<<<<<
 * 
 *     def createGlobalSection(self, SF sf not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_oStart); if (unlikely(!__pyx_t_2)) __PYX_ERR(32, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_oEnd); if (unlikely(!__pyx_t_3)) __PYX_ERR(32, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(32, 209, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Section.pyx":206
 *         CHKERR( PetscSectionSetOffset(self.sec,cpoint,coffset) )
 * 
 *     def getOffsetRange(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt oStart = 0, oEnd = 0
 *         CHKERR( PetscSectionGetOffsetRange(self.sec,&oStart,&oEnd) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.getOffsetRange", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Section.pyx":211
 *         return toInt(oStart),toInt(oEnd)
 * 
 *     def createGlobalSection(self, SF sf not None):             # <<<<<<<<<<<<<<
 *         cdef Section gsec = Section()
 *         CHKERR( PetscSectionCreateGlobalSection(self.sec,sf.sf,PETSC_FALSE,PETSC_FALSE,&gsec.sec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_77createGlobalSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7Section_76createGlobalSection[] = "Section.createGlobalSection(self, SF sf)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7Section_77createGlobalSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscSFObject *__pyx_v_sf = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createGlobalSection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sf,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);
        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_sf)) != 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, "createGlobalSection") < 0)) __PYX_ERR(32, 211, __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_sf = ((struct PyPetscSFObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createGlobalSection", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(32, 211, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Section.createGlobalSection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sf), __pyx_ptype_8petsc4py_5PETSc_SF, 0, "sf", 0))) __PYX_ERR(32, 211, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7Section_76createGlobalSection(((struct PyPetscSectionObject *)__pyx_v_self), __pyx_v_sf);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_7Section_76createGlobalSection(struct PyPetscSectionObject *__pyx_v_self, struct PyPetscSFObject *__pyx_v_sf) {
  struct PyPetscSectionObject *__pyx_v_gsec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createGlobalSection", 0);

  /* "PETSc/Section.pyx":212
 * 
 *     def createGlobalSection(self, SF sf not None):
 *         cdef Section gsec = Section()             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSectionCreateGlobalSection(self.sec,sf.sf,PETSC_FALSE,PETSC_FALSE,&gsec.sec) )
 *         return gsec
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Section), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(32, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_gsec = ((struct PyPetscSectionObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Section.pyx":213
 *     def createGlobalSection(self, SF sf not None):
 *         cdef Section gsec = Section()
 *         CHKERR( PetscSectionCreateGlobalSection(self.sec,sf.sf,PETSC_FALSE,PETSC_FALSE,&gsec.sec) )             # <<<<<<<<<<<<<<
 *         return gsec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionCreateGlobalSection(__pyx_v_self->sec, __pyx_v_sf->sf, PETSC_FALSE, PETSC_FALSE, (&__pyx_v_gsec->sec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(32, 213, __pyx_L1_error)

  /* "PETSc/Section.pyx":214
 *         cdef Section gsec = Section()
 *         CHKERR( PetscSectionCreateGlobalSection(self.sec,sf.sf,PETSC_FALSE,PETSC_FALSE,&gsec.sec) )
 *         return gsec             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_gsec));
  __pyx_r = ((PyObject *)__pyx_v_gsec);
  goto __pyx_L0;

  /* "PETSc/Section.pyx":211
 *         return toInt(oStart),toInt(oEnd)
 * 
 *     def createGlobalSection(self, SF sf not None):             # <<<<<<<<<<<<<<
 *         cdef Section gsec = Section()
 *         CHKERR( PetscSectionCreateGlobalSection(self.sec,sf.sf,PETSC_FALSE,PETSC_FALSE,&gsec.sec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Section.createGlobalSection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_gsec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":160
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.mat
 *         self.mat = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3Mat_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3Mat_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat___cinit__(((struct PyPetscMatObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_3Mat___cinit__(struct PyPetscMatObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Mat.pyx":161
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.mat             # <<<<<<<<<<<<<<
 *         self.mat = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->mat));

  /* "PETSc/Mat.pyx":162
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.mat
 *         self.mat = NULL             # <<<<<<<<<<<<<<
 * 
 *     # unary operations
 */
  __pyx_v_self->mat = NULL;

  /* "PETSc/Mat.pyx":160
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.mat
 *         self.mat = NULL
 */

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

/* "PETSc/Mat.pyx":166
 *     # unary operations
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         return mat_pos(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_3__pos__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_3__pos__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pos__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_2__pos__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_2__pos__(struct PyPetscMatObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pos__", 0);

  /* "PETSc/Mat.pyx":167
 * 
 *     def __pos__(self):
 *         return mat_pos(self)             # <<<<<<<<<<<<<<
 * 
 *     def __neg__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_pos(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":166
 *     # unary operations
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         return mat_pos(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__pos__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":169
 *         return mat_pos(self)
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         return mat_neg(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_5__neg__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_5__neg__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_4__neg__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_4__neg__(struct PyPetscMatObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__neg__", 0);

  /* "PETSc/Mat.pyx":170
 * 
 *     def __neg__(self):
 *         return mat_neg(self)             # <<<<<<<<<<<<<<
 * 
 *     # inplace binary operations
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_neg(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":169
 *         return mat_pos(self)
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         return mat_neg(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":174
 *     # inplace binary operations
 * 
 *     def __iadd__(self, other):             # <<<<<<<<<<<<<<
 *         return mat_iadd(self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_7__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_7__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_6__iadd__(((struct PyPetscMatObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_6__iadd__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__iadd__", 0);

  /* "PETSc/Mat.pyx":175
 * 
 *     def __iadd__(self, other):
 *         return mat_iadd(self, other)             # <<<<<<<<<<<<<<
 * 
 *     def __isub__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_iadd(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":174
 *     # inplace binary operations
 * 
 *     def __iadd__(self, other):             # <<<<<<<<<<<<<<
 *         return mat_iadd(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__iadd__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":177
 *         return mat_iadd(self, other)
 * 
 *     def __isub__(self, other):             # <<<<<<<<<<<<<<
 *         return mat_isub(self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_9__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_9__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_8__isub__(((struct PyPetscMatObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_8__isub__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__isub__", 0);

  /* "PETSc/Mat.pyx":178
 * 
 *     def __isub__(self, other):
 *         return mat_isub(self, other)             # <<<<<<<<<<<<<<
 * 
 *     def __imul__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_isub(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":177
 *         return mat_iadd(self, other)
 * 
 *     def __isub__(self, other):             # <<<<<<<<<<<<<<
 *         return mat_isub(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__isub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":180
 *         return mat_isub(self, other)
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         return mat_imul(self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_11__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_11__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__imul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_10__imul__(((struct PyPetscMatObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_10__imul__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__imul__", 0);

  /* "PETSc/Mat.pyx":181
 * 
 *     def __imul__(self, other):
 *         return mat_imul(self, other)             # <<<<<<<<<<<<<<
 * 
 *     def __idiv__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_imul(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":180
 *         return mat_isub(self, other)
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         return mat_imul(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__imul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":183
 *         return mat_imul(self, other)
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         return mat_idiv(self, other)
 * 
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_13__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_13__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__idiv__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_12__idiv__(((struct PyPetscMatObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY)*/

#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_12__idiv__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__idiv__", 0);

  /* "PETSc/Mat.pyx":184
 * 
 *     def __idiv__(self, other):
 *         return mat_idiv(self, other)             # <<<<<<<<<<<<<<
 * 
 *     def __itruediv__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_idiv(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":183
 *         return mat_imul(self, other)
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         return mat_idiv(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__idiv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY)*/

/* "PETSc/Mat.pyx":186
 *         return mat_idiv(self, other)
 * 
 *     def __itruediv__(self, other):             # <<<<<<<<<<<<<<
 *         return mat_idiv(self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_15__itruediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_15__itruediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__itruediv__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_14__itruediv__(((struct PyPetscMatObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_14__itruediv__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__itruediv__", 0);

  /* "PETSc/Mat.pyx":187
 * 
 *     def __itruediv__(self, other):
 *         return mat_idiv(self, other)             # <<<<<<<<<<<<<<
 * 
 *     # binary operations
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_idiv(__pyx_v_self, __pyx_v_other)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":186
 *         return mat_idiv(self, other)
 * 
 *     def __itruediv__(self, other):             # <<<<<<<<<<<<<<
 *         return mat_idiv(self, other)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__itruediv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":191
 *     # binary operations
 * 
 *     def __add__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Mat):
 *             return mat_add(self, other)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_17__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_17__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_16__add__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_16__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__add__", 0);

  /* "PETSc/Mat.pyx":192
 * 
 *     def __add__(self, other):
 *         if isinstance(self, Mat):             # <<<<<<<<<<<<<<
 *             return mat_add(self, other)
 *         else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Mat); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":193
 *     def __add__(self, other):
 *         if isinstance(self, Mat):
 *             return mat_add(self, other)             # <<<<<<<<<<<<<<
 *         else:
 *             return mat_radd(other, self)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 193, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_add(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_other)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/Mat.pyx":192
 * 
 *     def __add__(self, other):
 *         if isinstance(self, Mat):             # <<<<<<<<<<<<<<
 *             return mat_add(self, other)
 *         else:
 */
  }

  /* "PETSc/Mat.pyx":195
 *             return mat_add(self, other)
 *         else:
 *             return mat_radd(other, self)             # <<<<<<<<<<<<<<
 * 
 *     def __sub__(self, other):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 195, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_radd(((struct PyPetscMatObject *)__pyx_v_other), __pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Mat.pyx":191
 *     # binary operations
 * 
 *     def __add__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Mat):
 *             return mat_add(self, other)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":197
 *             return mat_radd(other, self)
 * 
 *     def __sub__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Mat):
 *             return mat_sub(self, other)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_19__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_19__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_18__sub__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_18__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__sub__", 0);

  /* "PETSc/Mat.pyx":198
 * 
 *     def __sub__(self, other):
 *         if isinstance(self, Mat):             # <<<<<<<<<<<<<<
 *             return mat_sub(self, other)
 *         else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Mat); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":199
 *     def __sub__(self, other):
 *         if isinstance(self, Mat):
 *             return mat_sub(self, other)             # <<<<<<<<<<<<<<
 *         else:
 *             return mat_rsub(other, self)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 199, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_sub(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_other)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/Mat.pyx":198
 * 
 *     def __sub__(self, other):
 *         if isinstance(self, Mat):             # <<<<<<<<<<<<<<
 *             return mat_sub(self, other)
 *         else:
 */
  }

  /* "PETSc/Mat.pyx":201
 *             return mat_sub(self, other)
 *         else:
 *             return mat_rsub(other, self)             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(self, other):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 201, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_rsub(((struct PyPetscMatObject *)__pyx_v_other), __pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Mat.pyx":197
 *             return mat_radd(other, self)
 * 
 *     def __sub__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Mat):
 *             return mat_sub(self, other)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":203
 *             return mat_rsub(other, self)
 * 
 *     def __mul__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Mat):
 *             if isinstance(other, Vec):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_21__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_21__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_20__mul__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_20__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__mul__", 0);

  /* "PETSc/Mat.pyx":204
 * 
 *     def __mul__(self, other):
 *         if isinstance(self, Mat):             # <<<<<<<<<<<<<<
 *             if isinstance(other, Vec):
 *                 return mat_mul_vec(self, other)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Mat); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":205
 *     def __mul__(self, other):
 *         if isinstance(self, Mat):
 *             if isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *                 return mat_mul_vec(self, other)
 *             else:
 */
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec); 
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "PETSc/Mat.pyx":206
 *         if isinstance(self, Mat):
 *             if isinstance(other, Vec):
 *                 return mat_mul_vec(self, other)             # <<<<<<<<<<<<<<
 *             else:
 *                 return mat_mul(self, other)
 */
      __Pyx_XDECREF(__pyx_r);
      if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 206, __pyx_L1_error)
      if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Vec))))) __PYX_ERR(33, 206, __pyx_L1_error)
      __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_mul_vec(((struct PyPetscMatObject *)__pyx_v_self), ((struct PyPetscVecObject *)__pyx_v_other))); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 206, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "PETSc/Mat.pyx":205
 *     def __mul__(self, other):
 *         if isinstance(self, Mat):
 *             if isinstance(other, Vec):             # <<<<<<<<<<<<<<
 *                 return mat_mul_vec(self, other)
 *             else:
 */
    }

    /* "PETSc/Mat.pyx":208
 *                 return mat_mul_vec(self, other)
 *             else:
 *                 return mat_mul(self, other)             # <<<<<<<<<<<<<<
 *         else:
 *             return mat_rmul(other, self)
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 208, __pyx_L1_error)
      __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_mul(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_other)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }

    /* "PETSc/Mat.pyx":204
 * 
 *     def __mul__(self, other):
 *         if isinstance(self, Mat):             # <<<<<<<<<<<<<<
 *             if isinstance(other, Vec):
 *                 return mat_mul_vec(self, other)
 */
  }

  /* "PETSc/Mat.pyx":210
 *                 return mat_mul(self, other)
 *         else:
 *             return mat_rmul(other, self)             # <<<<<<<<<<<<<<
 * 
 *     def __div__(self, other):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 210, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_rmul(((struct PyPetscMatObject *)__pyx_v_other), __pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 210, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Mat.pyx":203
 *             return mat_rsub(other, self)
 * 
 *     def __mul__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Mat):
 *             if isinstance(other, Vec):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":212
 *             return mat_rmul(other, self)
 * 
 *     def __div__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Mat):
 *             return mat_div(self, other)
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_23__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_23__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__div__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_22__div__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY)*/

#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_22__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__div__", 0);

  /* "PETSc/Mat.pyx":213
 * 
 *     def __div__(self, other):
 *         if isinstance(self, Mat):             # <<<<<<<<<<<<<<
 *             return mat_div(self, other)
 *         else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Mat); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":214
 *     def __div__(self, other):
 *         if isinstance(self, Mat):
 *             return mat_div(self, other)             # <<<<<<<<<<<<<<
 *         else:
 *             return mat_rdiv(other, self)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 214, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_div(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_other)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/Mat.pyx":213
 * 
 *     def __div__(self, other):
 *         if isinstance(self, Mat):             # <<<<<<<<<<<<<<
 *             return mat_div(self, other)
 *         else:
 */
  }

  /* "PETSc/Mat.pyx":216
 *             return mat_div(self, other)
 *         else:
 *             return mat_rdiv(other, self)             # <<<<<<<<<<<<<<
 * 
 *     def __truediv__(self, other):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 216, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_rdiv(((struct PyPetscMatObject *)__pyx_v_other), __pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Mat.pyx":212
 *             return mat_rmul(other, self)
 * 
 *     def __div__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Mat):
 *             return mat_div(self, other)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY)*/

/* "PETSc/Mat.pyx":218
 *             return mat_rdiv(other, self)
 * 
 *     def __truediv__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Mat):
 *             return mat_div(self, other)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_25__truediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_25__truediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__truediv__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_24__truediv__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_24__truediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__truediv__", 0);

  /* "PETSc/Mat.pyx":219
 * 
 *     def __truediv__(self, other):
 *         if isinstance(self, Mat):             # <<<<<<<<<<<<<<
 *             return mat_div(self, other)
 *         else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Mat); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":220
 *     def __truediv__(self, other):
 *         if isinstance(self, Mat):
 *             return mat_div(self, other)             # <<<<<<<<<<<<<<
 *         else:
 *             return mat_rdiv(other, self)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 220, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_div(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_other)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/Mat.pyx":219
 * 
 *     def __truediv__(self, other):
 *         if isinstance(self, Mat):             # <<<<<<<<<<<<<<
 *             return mat_div(self, other)
 *         else:
 */
  }

  /* "PETSc/Mat.pyx":222
 *             return mat_div(self, other)
 *         else:
 *             return mat_rdiv(other, self)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 222, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_mat_rdiv(((struct PyPetscMatObject *)__pyx_v_other), __pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Mat.pyx":218
 *             return mat_rdiv(other, self)
 * 
 *     def __truediv__(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Mat):
 *             return mat_div(self, other)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__truediv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":226
 *     #
 * 
 *     def __getitem__(self, ij):             # <<<<<<<<<<<<<<
 *         return mat_getitem(self, ij)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_ij); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_ij) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_26__getitem__(((struct PyPetscMatObject *)__pyx_v_self), ((PyObject *)__pyx_v_ij));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_26__getitem__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_ij) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "PETSc/Mat.pyx":227
 * 
 *     def __getitem__(self, ij):
 *         return mat_getitem(self, ij)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, ij, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_mat_getitem(__pyx_v_self, __pyx_v_ij); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":226
 *     #
 * 
 *     def __getitem__(self, ij):             # <<<<<<<<<<<<<<
 *         return mat_getitem(self, ij)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":229
 *         return mat_getitem(self, ij)
 * 
 *     def __setitem__(self, ij, v):             # <<<<<<<<<<<<<<
 *         mat_setitem(self, ij, v)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3Mat_29__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_ij, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3Mat_29__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_ij, PyObject *__pyx_v_v) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_28__setitem__(((struct PyPetscMatObject *)__pyx_v_self), ((PyObject *)__pyx_v_ij), ((PyObject *)__pyx_v_v));

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

static int __pyx_pf_8petsc4py_5PETSc_3Mat_28__setitem__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_ij, PyObject *__pyx_v_v) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "PETSc/Mat.pyx":230
 * 
 *     def __setitem__(self, ij, v):
 *         mat_setitem(self, ij, v)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, x, y=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_mat_setitem(__pyx_v_self, __pyx_v_ij, __pyx_v_v); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 230, __pyx_L1_error)

  /* "PETSc/Mat.pyx":229
 *         return mat_getitem(self, ij)
 * 
 *     def __setitem__(self, ij, v):             # <<<<<<<<<<<<<<
 *         mat_setitem(self, ij, v)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":232
 *         mat_setitem(self, ij, v)
 * 
 *     def __call__(self, x, y=None):             # <<<<<<<<<<<<<<
 *         if y is None:
 *             y = self.createVecLeft()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_31__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_31__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(33, 232, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 232, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_30__call__(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_30__call__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  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;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__call__", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "PETSc/Mat.pyx":233
 * 
 *     def __call__(self, x, y=None):
 *         if y is None:             # <<<<<<<<<<<<<<
 *             y = self.createVecLeft()
 *         self.mult(x, y)
 */
  __pyx_t_1 = (__pyx_v_y == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":234
 *     def __call__(self, x, y=None):
 *         if y is None:
 *             y = self.createVecLeft()             # <<<<<<<<<<<<<<
 *         self.mult(x, y)
 *         return y
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_createVecLeft); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 234, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 234, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/Mat.pyx":233
 * 
 *     def __call__(self, x, y=None):
 *         if y is None:             # <<<<<<<<<<<<<<
 *             y = self.createVecLeft()
 *         self.mult(x, y)
 */
  }

  /* "PETSc/Mat.pyx":235
 *         if y is None:
 *             y = self.createVecLeft()
 *         self.mult(x, y)             # <<<<<<<<<<<<<<
 *         return y
 *     #
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_mult); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(33, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_y);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 235, __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;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/Mat.pyx":236
 *             y = self.createVecLeft()
 *         self.mult(x, y)
 *         return y             # <<<<<<<<<<<<<<
 *     #
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_y);
  __pyx_r = __pyx_v_y;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":232
 *         mat_setitem(self, ij, v)
 * 
 *     def __call__(self, x, y=None):             # <<<<<<<<<<<<<<
 *         if y is None:
 *             y = self.createVecLeft()
 */

  /* 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_7);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":239
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_33view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_32view[] = "Mat.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_33view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(33, 239, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 239, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(33, 239, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_32view(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_32view(struct PyPetscMatObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/Mat.pyx":240
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( MatView(self.mat, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/Mat.pyx":241
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( MatView(self.mat, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/Mat.pyx":242
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( MatView(self.mat, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatView(__pyx_v_self->mat, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 242, __pyx_L1_error)

  /* "PETSc/Mat.pyx":239
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":244
 *         CHKERR( MatView(self.mat, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatDestroy(&self.mat) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_35destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_34destroy[] = "Mat.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_35destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_34destroy(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_34destroy(struct PyPetscMatObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/Mat.pyx":245
 * 
 *     def destroy(self):
 *         CHKERR( MatDestroy(&self.mat) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDestroy((&__pyx_v_self->mat))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 245, __pyx_L1_error)

  /* "PETSc/Mat.pyx":246
 *     def destroy(self):
 *         CHKERR( MatDestroy(&self.mat) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":244
 *         CHKERR( MatView(self.mat, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatDestroy(&self.mat) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":248
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscMat newmat = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_37create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_36create[] = "Mat.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_37create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(33, 248, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 248, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_36create(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_36create(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/Mat.pyx":249
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreate(ccomm, &newmat) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 249, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Mat.pyx":250
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatCreate(ccomm, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":251
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreate(ccomm, &newmat) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreate(__pyx_v_ccomm, (&__pyx_v_newmat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 251, __pyx_L1_error)

  /* "PETSc/Mat.pyx":252
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreate(ccomm, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":253
 *         CHKERR( MatCreate(ccomm, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, mat_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":248
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscMat newmat = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":255
 *         return self
 * 
 *     def setType(self, mat_type):             # <<<<<<<<<<<<<<
 *         cdef PetscMatType cval = NULL
 *         mat_type = str2bytes(mat_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_39setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_38setType[] = "Mat.setType(self, mat_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_39setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mat_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat_type,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);
        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_mat_type)) != 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, "setType") < 0)) __PYX_ERR(33, 255, __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_mat_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 255, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_38setType(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_38setType(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_mat_type) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_mat_type);

  /* "PETSc/Mat.pyx":256
 * 
 *     def setType(self, mat_type):
 *         cdef PetscMatType cval = NULL             # <<<<<<<<<<<<<<
 *         mat_type = str2bytes(mat_type, &cval)
 *         CHKERR( MatSetType(self.mat, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Mat.pyx":257
 *     def setType(self, mat_type):
 *         cdef PetscMatType cval = NULL
 *         mat_type = str2bytes(mat_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetType(self.mat, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_mat_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mat_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":258
 *         cdef PetscMatType cval = NULL
 *         mat_type = str2bytes(mat_type, &cval)
 *         CHKERR( MatSetType(self.mat, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def setSizes(self, size, bsize=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetType(__pyx_v_self->mat, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 258, __pyx_L1_error)

  /* "PETSc/Mat.pyx":255
 *         return self
 * 
 *     def setType(self, mat_type):             # <<<<<<<<<<<<<<
 *         cdef PetscMatType cval = NULL
 *         mat_type = str2bytes(mat_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mat_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":260
 *         CHKERR( MatSetType(self.mat, cval) )
 * 
 *     def setSizes(self, size, bsize=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 *         Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_41setSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_40setSizes[] = "Mat.setSizes(self, size, bsize=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_41setSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setSizes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_bsize,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSizes") < 0)) __PYX_ERR(33, 260, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_size = values[0];
    __pyx_v_bsize = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setSizes", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 260, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_40setSizes(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_size, __pyx_v_bsize);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_40setSizes(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize) {
  PetscInt __pyx_v_rbs;
  PetscInt __pyx_v_cbs;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_M;
  PetscInt __pyx_v_N;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setSizes", 0);

  /* "PETSc/Mat.pyx":261
 * 
 *     def setSizes(self, size, bsize=None):
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0             # <<<<<<<<<<<<<<
 *         Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)
 *         CHKERR( MatSetSizes(self.mat, m, n, M, N) )
 */
  __pyx_v_rbs = 0;
  __pyx_v_cbs = 0;
  __pyx_v_m = 0;
  __pyx_v_n = 0;
  __pyx_v_M = 0;
  __pyx_v_N = 0;

  /* "PETSc/Mat.pyx":262
 *     def setSizes(self, size, bsize=None):
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 *         Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetSizes(self.mat, m, n, M, N) )
 *         if rbs != PETSC_DECIDE:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Mat_Sizes(__pyx_v_size, __pyx_v_bsize, (&__pyx_v_rbs), (&__pyx_v_cbs), (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_M), (&__pyx_v_N)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 262, __pyx_L1_error)

  /* "PETSc/Mat.pyx":263
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 *         Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)
 *         CHKERR( MatSetSizes(self.mat, m, n, M, N) )             # <<<<<<<<<<<<<<
 *         if rbs != PETSC_DECIDE:
 *             if cbs != PETSC_DECIDE:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetSizes(__pyx_v_self->mat, __pyx_v_m, __pyx_v_n, __pyx_v_M, __pyx_v_N)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 263, __pyx_L1_error)

  /* "PETSc/Mat.pyx":264
 *         Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)
 *         CHKERR( MatSetSizes(self.mat, m, n, M, N) )
 *         if rbs != PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             if cbs != PETSC_DECIDE:
 *                 CHKERR( MatSetBlockSizes(self.mat, rbs, cbs) )
 */
  __pyx_t_2 = ((__pyx_v_rbs != PETSC_DECIDE) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":265
 *         CHKERR( MatSetSizes(self.mat, m, n, M, N) )
 *         if rbs != PETSC_DECIDE:
 *             if cbs != PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *                 CHKERR( MatSetBlockSizes(self.mat, rbs, cbs) )
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_cbs != PETSC_DECIDE) != 0);
    if (__pyx_t_2) {

      /* "PETSc/Mat.pyx":266
 *         if rbs != PETSC_DECIDE:
 *             if cbs != PETSC_DECIDE:
 *                 CHKERR( MatSetBlockSizes(self.mat, rbs, cbs) )             # <<<<<<<<<<<<<<
 *             else:
 *                 CHKERR( MatSetBlockSize(self.mat, rbs) )
 */
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetBlockSizes(__pyx_v_self->mat, __pyx_v_rbs, __pyx_v_cbs)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 266, __pyx_L1_error)

      /* "PETSc/Mat.pyx":265
 *         CHKERR( MatSetSizes(self.mat, m, n, M, N) )
 *         if rbs != PETSC_DECIDE:
 *             if cbs != PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *                 CHKERR( MatSetBlockSizes(self.mat, rbs, cbs) )
 *             else:
 */
      goto __pyx_L4;
    }

    /* "PETSc/Mat.pyx":268
 *                 CHKERR( MatSetBlockSizes(self.mat, rbs, cbs) )
 *             else:
 *                 CHKERR( MatSetBlockSize(self.mat, rbs) )             # <<<<<<<<<<<<<<
 * 
 *     def setBlockSize(self, bsize):
 */
    /*else*/ {
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetBlockSize(__pyx_v_self->mat, __pyx_v_rbs)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 268, __pyx_L1_error)
    }
    __pyx_L4:;

    /* "PETSc/Mat.pyx":264
 *         Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)
 *         CHKERR( MatSetSizes(self.mat, m, n, M, N) )
 *         if rbs != PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             if cbs != PETSC_DECIDE:
 *                 CHKERR( MatSetBlockSizes(self.mat, rbs, cbs) )
 */
  }

  /* "PETSc/Mat.pyx":260
 *         CHKERR( MatSetType(self.mat, cval) )
 * 
 *     def setSizes(self, size, bsize=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 *         Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":270
 *                 CHKERR( MatSetBlockSize(self.mat, rbs) )
 * 
 *     def setBlockSize(self, bsize):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = asInt(bsize)
 *         CHKERR( MatSetBlockSize(self.mat, bs) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_43setBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_42setBlockSize[] = "Mat.setBlockSize(self, bsize)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_43setBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setBlockSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bsize,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);
        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_bsize)) != 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, "setBlockSize") < 0)) __PYX_ERR(33, 270, __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_bsize = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setBlockSize", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 270, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setBlockSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_42setBlockSize(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_bsize);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_42setBlockSize(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_bsize) {
  PetscInt __pyx_v_bs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setBlockSize", 0);

  /* "PETSc/Mat.pyx":271
 * 
 *     def setBlockSize(self, bsize):
 *         cdef PetscInt bs = asInt(bsize)             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetBlockSize(self.mat, bs) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_bsize); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 271, __pyx_L1_error)
  __pyx_v_bs = __pyx_t_1;

  /* "PETSc/Mat.pyx":272
 *     def setBlockSize(self, bsize):
 *         cdef PetscInt bs = asInt(bsize)
 *         CHKERR( MatSetBlockSize(self.mat, bs) )             # <<<<<<<<<<<<<<
 * 
 *     def setBlockSizes(self, row_bsize, col_bsize):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetBlockSize(__pyx_v_self->mat, __pyx_v_bs)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 272, __pyx_L1_error)

  /* "PETSc/Mat.pyx":270
 *                 CHKERR( MatSetBlockSize(self.mat, rbs) )
 * 
 *     def setBlockSize(self, bsize):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = asInt(bsize)
 *         CHKERR( MatSetBlockSize(self.mat, bs) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setBlockSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":274
 *         CHKERR( MatSetBlockSize(self.mat, bs) )
 * 
 *     def setBlockSizes(self, row_bsize, col_bsize):             # <<<<<<<<<<<<<<
 *         cdef PetscInt rbs = asInt(row_bsize)
 *         cdef PetscInt cbs = asInt(col_bsize)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_45setBlockSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_44setBlockSizes[] = "Mat.setBlockSizes(self, row_bsize, col_bsize)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_45setBlockSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_row_bsize = 0;
  PyObject *__pyx_v_col_bsize = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setBlockSizes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_row_bsize,&__pyx_n_s_col_bsize,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_row_bsize)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_col_bsize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setBlockSizes", 1, 2, 2, 1); __PYX_ERR(33, 274, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setBlockSizes") < 0)) __PYX_ERR(33, 274, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_row_bsize = values[0];
    __pyx_v_col_bsize = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setBlockSizes", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 274, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setBlockSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_44setBlockSizes(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_row_bsize, __pyx_v_col_bsize);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_44setBlockSizes(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row_bsize, PyObject *__pyx_v_col_bsize) {
  PetscInt __pyx_v_rbs;
  PetscInt __pyx_v_cbs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setBlockSizes", 0);

  /* "PETSc/Mat.pyx":275
 * 
 *     def setBlockSizes(self, row_bsize, col_bsize):
 *         cdef PetscInt rbs = asInt(row_bsize)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cbs = asInt(col_bsize)
 *         CHKERR( MatSetBlockSizes(self.mat, rbs, cbs) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_row_bsize); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 275, __pyx_L1_error)
  __pyx_v_rbs = __pyx_t_1;

  /* "PETSc/Mat.pyx":276
 *     def setBlockSizes(self, row_bsize, col_bsize):
 *         cdef PetscInt rbs = asInt(row_bsize)
 *         cdef PetscInt cbs = asInt(col_bsize)             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetBlockSizes(self.mat, rbs, cbs) )
 *     #
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_col_bsize); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 276, __pyx_L1_error)
  __pyx_v_cbs = __pyx_t_1;

  /* "PETSc/Mat.pyx":277
 *         cdef PetscInt rbs = asInt(row_bsize)
 *         cdef PetscInt cbs = asInt(col_bsize)
 *         CHKERR( MatSetBlockSizes(self.mat, rbs, cbs) )             # <<<<<<<<<<<<<<
 *     #
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetBlockSizes(__pyx_v_self->mat, __pyx_v_rbs, __pyx_v_cbs)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 277, __pyx_L1_error)

  /* "PETSc/Mat.pyx":274
 *         CHKERR( MatSetBlockSize(self.mat, bs) )
 * 
 *     def setBlockSizes(self, row_bsize, col_bsize):             # <<<<<<<<<<<<<<
 *         cdef PetscInt rbs = asInt(row_bsize)
 *         cdef PetscInt cbs = asInt(col_bsize)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setBlockSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":280
 *     #
 * 
 *     def createAIJ(self, size, bsize=None, nnz=None, csr=None, comm=None):             # <<<<<<<<<<<<<<
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_47createAIJ(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_46createAIJ[] = "Mat.createAIJ(self, size, bsize=None, nnz=None, csr=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_47createAIJ(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_nnz = 0;
  PyObject *__pyx_v_csr = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createAIJ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_bsize,&__pyx_n_s_nnz,&__pyx_n_s_csr,&__pyx_n_s_comm,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nnz);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_csr);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createAIJ") < 0)) __PYX_ERR(33, 280, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_size = values[0];
    __pyx_v_bsize = values[1];
    __pyx_v_nnz = values[2];
    __pyx_v_csr = values[3];
    __pyx_v_comm = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createAIJ", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 280, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createAIJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_46createAIJ(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_size, __pyx_v_bsize, __pyx_v_nnz, __pyx_v_csr, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_46createAIJ(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_nnz, PyObject *__pyx_v_csr, PyObject *__pyx_v_comm) {
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("createAIJ", 0);

  /* "PETSc/Mat.pyx":282
 *     def createAIJ(self, size, bsize=None, nnz=None, csr=None, comm=None):
 *         # create matrix
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         Mat_Create(MATAIJ, comm, size, bsize, &newmat)
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":283
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 *         Mat_Create(MATAIJ, comm, size, bsize, &newmat)             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         # preallocate matrix
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Mat_Create(MATAIJ, __pyx_v_comm, __pyx_v_size, __pyx_v_bsize, (&__pyx_v_newmat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 283, __pyx_L1_error)

  /* "PETSc/Mat.pyx":284
 *         cdef PetscMat newmat = NULL
 *         Mat_Create(MATAIJ, comm, size, bsize, &newmat)
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         # preallocate matrix
 *         Mat_AllocAIJ(self.mat, nnz, csr)
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":286
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         # preallocate matrix
 *         Mat_AllocAIJ(self.mat, nnz, csr)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ(__pyx_v_self->mat, __pyx_v_nnz, __pyx_v_csr); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 286, __pyx_L1_error)

  /* "PETSc/Mat.pyx":287
 *         # preallocate matrix
 *         Mat_AllocAIJ(self.mat, nnz, csr)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createBAIJ(self, size, bsize, nnz=None, csr=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":280
 *     #
 * 
 *     def createAIJ(self, size, bsize=None, nnz=None, csr=None, comm=None):             # <<<<<<<<<<<<<<
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createAIJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":289
 *         return self
 * 
 *     def createBAIJ(self, size, bsize, nnz=None, csr=None, comm=None):             # <<<<<<<<<<<<<<
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_49createBAIJ(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_48createBAIJ[] = "Mat.createBAIJ(self, size, bsize, nnz=None, csr=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_49createBAIJ(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_nnz = 0;
  PyObject *__pyx_v_csr = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createBAIJ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_bsize,&__pyx_n_s_nnz,&__pyx_n_s_csr,&__pyx_n_s_comm,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createBAIJ", 0, 2, 5, 1); __PYX_ERR(33, 289, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nnz);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_csr);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createBAIJ") < 0)) __PYX_ERR(33, 289, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_size = values[0];
    __pyx_v_bsize = values[1];
    __pyx_v_nnz = values[2];
    __pyx_v_csr = values[3];
    __pyx_v_comm = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createBAIJ", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 289, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createBAIJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_48createBAIJ(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_size, __pyx_v_bsize, __pyx_v_nnz, __pyx_v_csr, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_48createBAIJ(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_nnz, PyObject *__pyx_v_csr, PyObject *__pyx_v_comm) {
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("createBAIJ", 0);

  /* "PETSc/Mat.pyx":291
 *     def createBAIJ(self, size, bsize, nnz=None, csr=None, comm=None):
 *         # create matrix
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         Mat_Create(MATBAIJ, comm, size, bsize, &newmat)
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":292
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 *         Mat_Create(MATBAIJ, comm, size, bsize, &newmat)             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         # preallocate matrix
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Mat_Create(MATBAIJ, __pyx_v_comm, __pyx_v_size, __pyx_v_bsize, (&__pyx_v_newmat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 292, __pyx_L1_error)

  /* "PETSc/Mat.pyx":293
 *         cdef PetscMat newmat = NULL
 *         Mat_Create(MATBAIJ, comm, size, bsize, &newmat)
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         # preallocate matrix
 *         Mat_AllocAIJ(self.mat, nnz, csr)
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":295
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         # preallocate matrix
 *         Mat_AllocAIJ(self.mat, nnz, csr)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ(__pyx_v_self->mat, __pyx_v_nnz, __pyx_v_csr); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 295, __pyx_L1_error)

  /* "PETSc/Mat.pyx":296
 *         # preallocate matrix
 *         Mat_AllocAIJ(self.mat, nnz, csr)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createSBAIJ(self, size, bsize, nnz=None, csr=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":289
 *         return self
 * 
 *     def createBAIJ(self, size, bsize, nnz=None, csr=None, comm=None):             # <<<<<<<<<<<<<<
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createBAIJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":298
 *         return self
 * 
 *     def createSBAIJ(self, size, bsize, nnz=None, csr=None, comm=None):             # <<<<<<<<<<<<<<
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_51createSBAIJ(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_50createSBAIJ[] = "Mat.createSBAIJ(self, size, bsize, nnz=None, csr=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_51createSBAIJ(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_nnz = 0;
  PyObject *__pyx_v_csr = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createSBAIJ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_bsize,&__pyx_n_s_nnz,&__pyx_n_s_csr,&__pyx_n_s_comm,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createSBAIJ", 0, 2, 5, 1); __PYX_ERR(33, 298, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nnz);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_csr);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createSBAIJ") < 0)) __PYX_ERR(33, 298, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_size = values[0];
    __pyx_v_bsize = values[1];
    __pyx_v_nnz = values[2];
    __pyx_v_csr = values[3];
    __pyx_v_comm = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createSBAIJ", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 298, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createSBAIJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_50createSBAIJ(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_size, __pyx_v_bsize, __pyx_v_nnz, __pyx_v_csr, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_50createSBAIJ(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_nnz, PyObject *__pyx_v_csr, PyObject *__pyx_v_comm) {
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("createSBAIJ", 0);

  /* "PETSc/Mat.pyx":300
 *     def createSBAIJ(self, size, bsize, nnz=None, csr=None, comm=None):
 *         # create matrix
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         Mat_Create(MATSBAIJ, comm, size, bsize, &newmat)
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":301
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 *         Mat_Create(MATSBAIJ, comm, size, bsize, &newmat)             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         # preallocate matrix
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Mat_Create(MATSBAIJ, __pyx_v_comm, __pyx_v_size, __pyx_v_bsize, (&__pyx_v_newmat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 301, __pyx_L1_error)

  /* "PETSc/Mat.pyx":302
 *         cdef PetscMat newmat = NULL
 *         Mat_Create(MATSBAIJ, comm, size, bsize, &newmat)
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         # preallocate matrix
 *         Mat_AllocAIJ(self.mat, nnz, csr)
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":304
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         # preallocate matrix
 *         Mat_AllocAIJ(self.mat, nnz, csr)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ(__pyx_v_self->mat, __pyx_v_nnz, __pyx_v_csr); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 304, __pyx_L1_error)

  /* "PETSc/Mat.pyx":305
 *         # preallocate matrix
 *         Mat_AllocAIJ(self.mat, nnz, csr)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createAIJCRL(self, size, bsize=None, nnz=None, csr=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":298
 *         return self
 * 
 *     def createSBAIJ(self, size, bsize, nnz=None, csr=None, comm=None):             # <<<<<<<<<<<<<<
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createSBAIJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":307
 *         return self
 * 
 *     def createAIJCRL(self, size, bsize=None, nnz=None, csr=None, comm=None):             # <<<<<<<<<<<<<<
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_53createAIJCRL(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_52createAIJCRL[] = "Mat.createAIJCRL(self, size, bsize=None, nnz=None, csr=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_53createAIJCRL(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_nnz = 0;
  PyObject *__pyx_v_csr = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createAIJCRL (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_bsize,&__pyx_n_s_nnz,&__pyx_n_s_csr,&__pyx_n_s_comm,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nnz);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_csr);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createAIJCRL") < 0)) __PYX_ERR(33, 307, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_size = values[0];
    __pyx_v_bsize = values[1];
    __pyx_v_nnz = values[2];
    __pyx_v_csr = values[3];
    __pyx_v_comm = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createAIJCRL", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 307, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createAIJCRL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_52createAIJCRL(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_size, __pyx_v_bsize, __pyx_v_nnz, __pyx_v_csr, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_52createAIJCRL(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_nnz, PyObject *__pyx_v_csr, PyObject *__pyx_v_comm) {
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("createAIJCRL", 0);

  /* "PETSc/Mat.pyx":309
 *     def createAIJCRL(self, size, bsize=None, nnz=None, csr=None, comm=None):
 *         # create matrix
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         Mat_Create(MATAIJCRL, comm, size, bsize, &newmat)
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":310
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 *         Mat_Create(MATAIJCRL, comm, size, bsize, &newmat)             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         # preallocate matrix
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Mat_Create(MATAIJCRL, __pyx_v_comm, __pyx_v_size, __pyx_v_bsize, (&__pyx_v_newmat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 310, __pyx_L1_error)

  /* "PETSc/Mat.pyx":311
 *         cdef PetscMat newmat = NULL
 *         Mat_Create(MATAIJCRL, comm, size, bsize, &newmat)
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         # preallocate matrix
 *         Mat_AllocAIJ(self.mat, nnz, csr)
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":313
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         # preallocate matrix
 *         Mat_AllocAIJ(self.mat, nnz, csr)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ(__pyx_v_self->mat, __pyx_v_nnz, __pyx_v_csr); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 313, __pyx_L1_error)

  /* "PETSc/Mat.pyx":314
 *         # preallocate matrix
 *         Mat_AllocAIJ(self.mat, nnz, csr)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setPreallocationNNZ(self, nnz):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":307
 *         return self
 * 
 *     def createAIJCRL(self, size, bsize=None, nnz=None, csr=None, comm=None):             # <<<<<<<<<<<<<<
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createAIJCRL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":316
 *         return self
 * 
 *     def setPreallocationNNZ(self, nnz):             # <<<<<<<<<<<<<<
 *         cdef PetscBool done = PETSC_FALSE
 *         CHKERR( MatIsPreallocated(self.mat, &done) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_55setPreallocationNNZ(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_54setPreallocationNNZ[] = "Mat.setPreallocationNNZ(self, nnz)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_55setPreallocationNNZ(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nnz = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPreallocationNNZ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nnz,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);
        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_nnz)) != 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, "setPreallocationNNZ") < 0)) __PYX_ERR(33, 316, __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_nnz = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPreallocationNNZ", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 316, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setPreallocationNNZ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_54setPreallocationNNZ(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_nnz);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_54setPreallocationNNZ(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_nnz) {
  PetscBool __pyx_v_done;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setPreallocationNNZ", 0);

  /* "PETSc/Mat.pyx":317
 * 
 *     def setPreallocationNNZ(self, nnz):
 *         cdef PetscBool done = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatIsPreallocated(self.mat, &done) )
 *         # if done: raise Error(PETSC_ERR_ORDER)
 */
  __pyx_v_done = PETSC_FALSE;

  /* "PETSc/Mat.pyx":318
 *     def setPreallocationNNZ(self, nnz):
 *         cdef PetscBool done = PETSC_FALSE
 *         CHKERR( MatIsPreallocated(self.mat, &done) )             # <<<<<<<<<<<<<<
 *         # if done: raise Error(PETSC_ERR_ORDER)
 *         Mat_AllocAIJ_NNZ(self.mat, nnz)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatIsPreallocated(__pyx_v_self->mat, (&__pyx_v_done))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 318, __pyx_L1_error)

  /* "PETSc/Mat.pyx":320
 *         CHKERR( MatIsPreallocated(self.mat, &done) )
 *         # if done: raise Error(PETSC_ERR_ORDER)
 *         Mat_AllocAIJ_NNZ(self.mat, nnz)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ_NNZ(__pyx_v_self->mat, __pyx_v_nnz); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 320, __pyx_L1_error)

  /* "PETSc/Mat.pyx":321
 *         # if done: raise Error(PETSC_ERR_ORDER)
 *         Mat_AllocAIJ_NNZ(self.mat, nnz)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setPreallocationCSR(self, csr):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":316
 *         return self
 * 
 *     def setPreallocationNNZ(self, nnz):             # <<<<<<<<<<<<<<
 *         cdef PetscBool done = PETSC_FALSE
 *         CHKERR( MatIsPreallocated(self.mat, &done) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setPreallocationNNZ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":323
 *         return self
 * 
 *     def setPreallocationCSR(self, csr):             # <<<<<<<<<<<<<<
 *         cdef PetscBool done = PETSC_FALSE
 *         CHKERR( MatIsPreallocated(self.mat, &done) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_57setPreallocationCSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_56setPreallocationCSR[] = "Mat.setPreallocationCSR(self, csr)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_57setPreallocationCSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_csr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPreallocationCSR (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_csr,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);
        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_csr)) != 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, "setPreallocationCSR") < 0)) __PYX_ERR(33, 323, __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_csr = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPreallocationCSR", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 323, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setPreallocationCSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_56setPreallocationCSR(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_csr);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_56setPreallocationCSR(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_csr) {
  PetscBool __pyx_v_done;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setPreallocationCSR", 0);

  /* "PETSc/Mat.pyx":324
 * 
 *     def setPreallocationCSR(self, csr):
 *         cdef PetscBool done = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatIsPreallocated(self.mat, &done) )
 *         # if done: raise Error(PETSC_ERR_ORDER)
 */
  __pyx_v_done = PETSC_FALSE;

  /* "PETSc/Mat.pyx":325
 *     def setPreallocationCSR(self, csr):
 *         cdef PetscBool done = PETSC_FALSE
 *         CHKERR( MatIsPreallocated(self.mat, &done) )             # <<<<<<<<<<<<<<
 *         # if done: raise Error(PETSC_ERR_ORDER)
 *         Mat_AllocAIJ_CSR(self.mat, csr)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatIsPreallocated(__pyx_v_self->mat, (&__pyx_v_done))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 325, __pyx_L1_error)

  /* "PETSc/Mat.pyx":327
 *         CHKERR( MatIsPreallocated(self.mat, &done) )
 *         # if done: raise Error(PETSC_ERR_ORDER)
 *         Mat_AllocAIJ_CSR(self.mat, csr)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Mat_AllocAIJ_CSR(__pyx_v_self->mat, __pyx_v_csr); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 327, __pyx_L1_error)

  /* "PETSc/Mat.pyx":328
 *         # if done: raise Error(PETSC_ERR_ORDER)
 *         Mat_AllocAIJ_CSR(self.mat, csr)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createAIJWithArrays(self, size, csr, bsize=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":323
 *         return self
 * 
 *     def setPreallocationCSR(self, csr):             # <<<<<<<<<<<<<<
 *         cdef PetscBool done = PETSC_FALSE
 *         CHKERR( MatIsPreallocated(self.mat, &done) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setPreallocationCSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":330
 *         return self
 * 
 *     def createAIJWithArrays(self, size, csr, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         # communicator
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_59createAIJWithArrays(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_58createAIJWithArrays[] = "Mat.createAIJWithArrays(self, size, csr, bsize=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_59createAIJWithArrays(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_csr = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createAIJWithArrays (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_csr,&__pyx_n_s_bsize,&__pyx_n_s_comm,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_csr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createAIJWithArrays", 0, 2, 4, 1); __PYX_ERR(33, 330, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createAIJWithArrays") < 0)) __PYX_ERR(33, 330, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_size = values[0];
    __pyx_v_csr = values[1];
    __pyx_v_bsize = values[2];
    __pyx_v_comm = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createAIJWithArrays", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 330, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createAIJWithArrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_58createAIJWithArrays(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_size, __pyx_v_csr, __pyx_v_bsize, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_58createAIJWithArrays(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_csr, PyObject *__pyx_v_bsize, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_rbs;
  PetscInt __pyx_v_cbs;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_M;
  PetscInt __pyx_v_N;
  PyObject *__pyx_v_pi = 0;
  PyObject *__pyx_v_pj = 0;
  PyObject *__pyx_v_pv = 0;
  PyObject *__pyx_v_poi = 0;
  PyObject *__pyx_v_poj = 0;
  PyObject *__pyx_v_pov = 0;
  PetscInt __pyx_v_ni;
  PetscInt __pyx_v_noi;
  PetscInt *__pyx_v_i;
  PetscInt *__pyx_v_oi;
  PetscInt __pyx_v_nj;
  PetscInt __pyx_v_noj;
  PetscInt *__pyx_v_j;
  PetscInt *__pyx_v_oj;
  PetscInt __pyx_v_nv;
  PetscInt __pyx_v_nov;
  PetscScalar *__pyx_v_v;
  PetscScalar *__pyx_v_ov;
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  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 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_t_16;
  __Pyx_RefNannySetupContext("createAIJWithArrays", 0);
  __Pyx_INCREF(__pyx_v_csr);

  /* "PETSc/Mat.pyx":332
 *     def createAIJWithArrays(self, size, csr, bsize=None, comm=None):
 *         # communicator
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         # sizes and block sizes
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 332, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Mat.pyx":334
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         # sizes and block sizes
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0             # <<<<<<<<<<<<<<
 *         Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)
 *         if rbs == PETSC_DECIDE: rbs = 1
 */
  __pyx_v_rbs = 0;
  __pyx_v_cbs = 0;
  __pyx_v_m = 0;
  __pyx_v_n = 0;
  __pyx_v_M = 0;
  __pyx_v_N = 0;

  /* "PETSc/Mat.pyx":335
 *         # sizes and block sizes
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 *         Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)             # <<<<<<<<<<<<<<
 *         if rbs == PETSC_DECIDE: rbs = 1
 *         if cbs == PETSC_DECIDE: cbs = rbs
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Mat_Sizes(__pyx_v_size, __pyx_v_bsize, (&__pyx_v_rbs), (&__pyx_v_cbs), (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_M), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 335, __pyx_L1_error)

  /* "PETSc/Mat.pyx":336
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 *         Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)
 *         if rbs == PETSC_DECIDE: rbs = 1             # <<<<<<<<<<<<<<
 *         if cbs == PETSC_DECIDE: cbs = rbs
 *         Sys_Layout(ccomm, rbs, &m, &M)
 */
  __pyx_t_3 = ((__pyx_v_rbs == PETSC_DECIDE) != 0);
  if (__pyx_t_3) {
    __pyx_v_rbs = 1;
  }

  /* "PETSc/Mat.pyx":337
 *         Mat_Sizes(size, bsize, &rbs, &cbs, &m, &n, &M, &N)
 *         if rbs == PETSC_DECIDE: rbs = 1
 *         if cbs == PETSC_DECIDE: cbs = rbs             # <<<<<<<<<<<<<<
 *         Sys_Layout(ccomm, rbs, &m, &M)
 *         Sys_Layout(ccomm, cbs, &n, &N)
 */
  __pyx_t_3 = ((__pyx_v_cbs == PETSC_DECIDE) != 0);
  if (__pyx_t_3) {
    __pyx_v_cbs = __pyx_v_rbs;
  }

  /* "PETSc/Mat.pyx":338
 *         if rbs == PETSC_DECIDE: rbs = 1
 *         if cbs == PETSC_DECIDE: cbs = rbs
 *         Sys_Layout(ccomm, rbs, &m, &M)             # <<<<<<<<<<<<<<
 *         Sys_Layout(ccomm, cbs, &n, &N)
 *         # unpack CSR argument
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Sys_Layout(__pyx_v_ccomm, __pyx_v_rbs, (&__pyx_v_m), (&__pyx_v_M)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 338, __pyx_L1_error)

  /* "PETSc/Mat.pyx":339
 *         if cbs == PETSC_DECIDE: cbs = rbs
 *         Sys_Layout(ccomm, rbs, &m, &M)
 *         Sys_Layout(ccomm, cbs, &n, &N)             # <<<<<<<<<<<<<<
 *         # unpack CSR argument
 *         cdef object pi, pj, pv, poi, poj, pov
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Sys_Layout(__pyx_v_ccomm, __pyx_v_cbs, (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 339, __pyx_L1_error)

  /* "PETSc/Mat.pyx":342
 *         # unpack CSR argument
 *         cdef object pi, pj, pv, poi, poj, pov
 *         try:             # <<<<<<<<<<<<<<
 *             (pi, pj, pv), (poi, poj, pov) = csr
 *         except (TypeError, ValueError):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "PETSc/Mat.pyx":343
 *         cdef object pi, pj, pv, poi, poj, pov
 *         try:
 *             (pi, pj, pv), (poi, poj, pov) = csr             # <<<<<<<<<<<<<<
 *         except (TypeError, ValueError):
 *             pi, pj, pv = csr
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_csr))) || (PyList_CheckExact(__pyx_v_csr))) {
        PyObject* sequence = __pyx_v_csr;
        #if CYTHON_COMPILING_IN_CPYTHON
        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(33, 343, __pyx_L5_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        #else
        __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(33, 343, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 343, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_9 = PyObject_GetIter(__pyx_v_csr); if (unlikely(!__pyx_t_9)) __PYX_ERR(33, 343, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
        index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(33, 343, __pyx_L5_error)
        __pyx_t_10 = 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_10 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(33, 343, __pyx_L5_error)
        __pyx_L14_unpacking_done:;
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
        PyObject* sequence = __pyx_t_7;
        #if CYTHON_COMPILING_IN_CPYTHON
        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(33, 343, __pyx_L5_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_12 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_12);
        #else
        __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(33, 343, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(33, 343, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_12)) __PYX_ERR(33, 343, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_12);
        #endif
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_13 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(33, 343, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_10 = Py_TYPE(__pyx_t_13)->tp_iternext;
        index = 0; __pyx_t_9 = __pyx_t_10(__pyx_t_13); if (unlikely(!__pyx_t_9)) goto __pyx_L15_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 1; __pyx_t_11 = __pyx_t_10(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L15_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        index = 2; __pyx_t_12 = __pyx_t_10(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L15_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_13), 3) < 0) __PYX_ERR(33, 343, __pyx_L5_error)
        __pyx_t_10 = NULL;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L16_unpacking_done;
        __pyx_L15_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_10 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(33, 343, __pyx_L5_error)
        __pyx_L16_unpacking_done:;
      }
      __pyx_v_pi = __pyx_t_9;
      __pyx_t_9 = 0;
      __pyx_v_pj = __pyx_t_11;
      __pyx_t_11 = 0;
      __pyx_v_pv = __pyx_t_12;
      __pyx_t_12 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
        PyObject* sequence = __pyx_t_8;
        #if CYTHON_COMPILING_IN_CPYTHON
        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(33, 343, __pyx_L5_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_12 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(33, 343, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(33, 343, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(33, 343, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_13 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(33, 343, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_10 = Py_TYPE(__pyx_t_13)->tp_iternext;
        index = 0; __pyx_t_12 = __pyx_t_10(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L17_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        index = 1; __pyx_t_11 = __pyx_t_10(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L17_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        index = 2; __pyx_t_9 = __pyx_t_10(__pyx_t_13); if (unlikely(!__pyx_t_9)) goto __pyx_L17_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_13), 3) < 0) __PYX_ERR(33, 343, __pyx_L5_error)
        __pyx_t_10 = NULL;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L18_unpacking_done;
        __pyx_L17_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_10 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(33, 343, __pyx_L5_error)
        __pyx_L18_unpacking_done:;
      }
      __pyx_v_poi = __pyx_t_12;
      __pyx_t_12 = 0;
      __pyx_v_poj = __pyx_t_11;
      __pyx_t_11 = 0;
      __pyx_v_pov = __pyx_t_9;
      __pyx_t_9 = 0;

      /* "PETSc/Mat.pyx":342
 *         # unpack CSR argument
 *         cdef object pi, pj, pv, poi, poj, pov
 *         try:             # <<<<<<<<<<<<<<
 *             (pi, pj, pv), (poi, poj, pov) = csr
 *         except (TypeError, ValueError):
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_PyThreadState_assign
    __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;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "PETSc/Mat.pyx":344
 *         try:
 *             (pi, pj, pv), (poi, poj, pov) = csr
 *         except (TypeError, ValueError):             # <<<<<<<<<<<<<<
 *             pi, pj, pv = csr
 *             poi = poj = pov = None
 */
    __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("petsc4py.PETSc.Mat.createAIJWithArrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_9) < 0) __PYX_ERR(33, 344, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_9);

      /* "PETSc/Mat.pyx":345
 *             (pi, pj, pv), (poi, poj, pov) = csr
 *         except (TypeError, ValueError):
 *             pi, pj, pv = csr             # <<<<<<<<<<<<<<
 *             poi = poj = pov = None
 *         # rows, cols, and values
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_csr))) || (PyList_CheckExact(__pyx_v_csr))) {
        PyObject* sequence = __pyx_v_csr;
        #if CYTHON_COMPILING_IN_CPYTHON
        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(33, 345, __pyx_L7_except_error)
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_13 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_13 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_13);
        #else
        __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(33, 345, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(33, 345, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_13)) __PYX_ERR(33, 345, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_13);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_14 = PyObject_GetIter(__pyx_v_csr); if (unlikely(!__pyx_t_14)) __PYX_ERR(33, 345, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_10 = Py_TYPE(__pyx_t_14)->tp_iternext;
        index = 0; __pyx_t_11 = __pyx_t_10(__pyx_t_14); if (unlikely(!__pyx_t_11)) goto __pyx_L21_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        index = 1; __pyx_t_12 = __pyx_t_10(__pyx_t_14); if (unlikely(!__pyx_t_12)) goto __pyx_L21_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        index = 2; __pyx_t_13 = __pyx_t_10(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L21_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_13);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_14), 3) < 0) __PYX_ERR(33, 345, __pyx_L7_except_error)
        __pyx_t_10 = NULL;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L22_unpacking_done;
        __pyx_L21_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_10 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(33, 345, __pyx_L7_except_error)
        __pyx_L22_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_pi, __pyx_t_11);
      __pyx_t_11 = 0;
      __Pyx_XDECREF_SET(__pyx_v_pj, __pyx_t_12);
      __pyx_t_12 = 0;
      __Pyx_XDECREF_SET(__pyx_v_pv, __pyx_t_13);
      __pyx_t_13 = 0;

      /* "PETSc/Mat.pyx":346
 *         except (TypeError, ValueError):
 *             pi, pj, pv = csr
 *             poi = poj = pov = None             # <<<<<<<<<<<<<<
 *         # rows, cols, and values
 *         cdef PetscInt ni=0, noi=0, *i=NULL, *oi=NULL
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_poi, Py_None);
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_poj, Py_None);
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_pov, Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6_exception_handled;
    }
    goto __pyx_L7_except_error;
    __pyx_L7_except_error:;

    /* "PETSc/Mat.pyx":342
 *         # unpack CSR argument
 *         cdef object pi, pj, pv, poi, poj, pov
 *         try:             # <<<<<<<<<<<<<<
 *             (pi, pj, pv), (poi, poj, pov) = csr
 *         except (TypeError, ValueError):
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L12_try_end:;
  }

  /* "PETSc/Mat.pyx":348
 *             poi = poj = pov = None
 *         # rows, cols, and values
 *         cdef PetscInt ni=0, noi=0, *i=NULL, *oi=NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt nj=0, noj=0, *j=NULL, *oj=NULL
 *         pi = iarray_i(pi, &ni, &i) # Row pointers (diagonal)
 */
  __pyx_v_ni = 0;
  __pyx_v_noi = 0;
  __pyx_v_i = NULL;
  __pyx_v_oi = NULL;

  /* "PETSc/Mat.pyx":349
 *         # rows, cols, and values
 *         cdef PetscInt ni=0, noi=0, *i=NULL, *oi=NULL
 *         cdef PetscInt nj=0, noj=0, *j=NULL, *oj=NULL             # <<<<<<<<<<<<<<
 *         pi = iarray_i(pi, &ni, &i) # Row pointers (diagonal)
 *         pj = iarray_i(pj, &nj, &j) # Column indices (diagonal)
 */
  __pyx_v_nj = 0;
  __pyx_v_noj = 0;
  __pyx_v_j = NULL;
  __pyx_v_oj = NULL;

  /* "PETSc/Mat.pyx":350
 *         cdef PetscInt ni=0, noi=0, *i=NULL, *oi=NULL
 *         cdef PetscInt nj=0, noj=0, *j=NULL, *oj=NULL
 *         pi = iarray_i(pi, &ni, &i) # Row pointers (diagonal)             # <<<<<<<<<<<<<<
 *         pj = iarray_i(pj, &nj, &j) # Column indices (diagonal)
 *         if ni != m+1:  raise ValueError(
 */
  __pyx_t_9 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_pi, (&__pyx_v_ni), (&__pyx_v_i))); if (unlikely(!__pyx_t_9)) __PYX_ERR(33, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF_SET(__pyx_v_pi, __pyx_t_9);
  __pyx_t_9 = 0;

  /* "PETSc/Mat.pyx":351
 *         cdef PetscInt nj=0, noj=0, *j=NULL, *oj=NULL
 *         pi = iarray_i(pi, &ni, &i) # Row pointers (diagonal)
 *         pj = iarray_i(pj, &nj, &j) # Column indices (diagonal)             # <<<<<<<<<<<<<<
 *         if ni != m+1:  raise ValueError(
 *             "A matrix with %d rows requires a row pointer of length %d (given: %d)" %
 */
  __pyx_t_9 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_pj, (&__pyx_v_nj), (&__pyx_v_j))); if (unlikely(!__pyx_t_9)) __PYX_ERR(33, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF_SET(__pyx_v_pj, __pyx_t_9);
  __pyx_t_9 = 0;

  /* "PETSc/Mat.pyx":352
 *         pi = iarray_i(pi, &ni, &i) # Row pointers (diagonal)
 *         pj = iarray_i(pj, &nj, &j) # Column indices (diagonal)
 *         if ni != m+1:  raise ValueError(             # <<<<<<<<<<<<<<
 *             "A matrix with %d rows requires a row pointer of length %d (given: %d)" %
 *             (toInt(m), toInt(m+1), toInt(ni)))
 */
  __pyx_t_3 = ((__pyx_v_ni != (__pyx_v_m + 1)) != 0);
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":354
 *         if ni != m+1:  raise ValueError(
 *             "A matrix with %d rows requires a row pointer of length %d (given: %d)" %
 *             (toInt(m), toInt(m+1), toInt(ni)))             # <<<<<<<<<<<<<<
 *         if poi is not None and poj is not None:
 *             poi = iarray_i(poi, &noi, &oi) # Row pointers (off-diagonal)
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_m); if (unlikely(!__pyx_t_9)) __PYX_ERR(33, 354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_m + 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(33, 354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ni); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(33, 354, __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_7);
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_8);
    __pyx_t_9 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;

    /* "PETSc/Mat.pyx":353
 *         pj = iarray_i(pj, &nj, &j) # Column indices (diagonal)
 *         if ni != m+1:  raise ValueError(
 *             "A matrix with %d rows requires a row pointer of length %d (given: %d)" %             # <<<<<<<<<<<<<<
 *             (toInt(m), toInt(m+1), toInt(ni)))
 *         if poi is not None and poj is not None:
 */
    __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_A_matrix_with_d_rows_requires_a, __pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "PETSc/Mat.pyx":352
 *         pi = iarray_i(pi, &ni, &i) # Row pointers (diagonal)
 *         pj = iarray_i(pj, &nj, &j) # Column indices (diagonal)
 *         if ni != m+1:  raise ValueError(             # <<<<<<<<<<<<<<
 *             "A matrix with %d rows requires a row pointer of length %d (given: %d)" %
 *             (toInt(m), toInt(m+1), toInt(ni)))
 */
    __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(33, 352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(33, 352, __pyx_L1_error)
  }

  /* "PETSc/Mat.pyx":355
 *             "A matrix with %d rows requires a row pointer of length %d (given: %d)" %
 *             (toInt(m), toInt(m+1), toInt(ni)))
 *         if poi is not None and poj is not None:             # <<<<<<<<<<<<<<
 *             poi = iarray_i(poi, &noi, &oi) # Row pointers (off-diagonal)
 *             poj = iarray_i(poj, &noj, &oj) # Column indices (off-diagonal)
 */
  __pyx_t_15 = (__pyx_v_poi != Py_None);
  __pyx_t_16 = (__pyx_t_15 != 0);
  if (__pyx_t_16) {
  } else {
    __pyx_t_3 = __pyx_t_16;
    goto __pyx_L25_bool_binop_done;
  }
  __pyx_t_16 = (__pyx_v_poj != Py_None);
  __pyx_t_15 = (__pyx_t_16 != 0);
  __pyx_t_3 = __pyx_t_15;
  __pyx_L25_bool_binop_done:;
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":356
 *             (toInt(m), toInt(m+1), toInt(ni)))
 *         if poi is not None and poj is not None:
 *             poi = iarray_i(poi, &noi, &oi) # Row pointers (off-diagonal)             # <<<<<<<<<<<<<<
 *             poj = iarray_i(poj, &noj, &oj) # Column indices (off-diagonal)
 *         cdef PetscInt nv=0, nov=0
 */
    __pyx_t_8 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_poi, (&__pyx_v_noi), (&__pyx_v_oi))); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF_SET(__pyx_v_poi, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "PETSc/Mat.pyx":357
 *         if poi is not None and poj is not None:
 *             poi = iarray_i(poi, &noi, &oi) # Row pointers (off-diagonal)
 *             poj = iarray_i(poj, &noj, &oj) # Column indices (off-diagonal)             # <<<<<<<<<<<<<<
 *         cdef PetscInt nv=0, nov=0
 *         cdef PetscScalar *v=NULL, *ov=NULL
 */
    __pyx_t_8 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_poj, (&__pyx_v_noj), (&__pyx_v_oj))); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 357, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF_SET(__pyx_v_poj, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "PETSc/Mat.pyx":355
 *             "A matrix with %d rows requires a row pointer of length %d (given: %d)" %
 *             (toInt(m), toInt(m+1), toInt(ni)))
 *         if poi is not None and poj is not None:             # <<<<<<<<<<<<<<
 *             poi = iarray_i(poi, &noi, &oi) # Row pointers (off-diagonal)
 *             poj = iarray_i(poj, &noj, &oj) # Column indices (off-diagonal)
 */
  }

  /* "PETSc/Mat.pyx":358
 *             poi = iarray_i(poi, &noi, &oi) # Row pointers (off-diagonal)
 *             poj = iarray_i(poj, &noj, &oj) # Column indices (off-diagonal)
 *         cdef PetscInt nv=0, nov=0             # <<<<<<<<<<<<<<
 *         cdef PetscScalar *v=NULL, *ov=NULL
 *         pv = iarray_s(pv, &nv, &v) # Non-zero values (diagonal)
 */
  __pyx_v_nv = 0;
  __pyx_v_nov = 0;

  /* "PETSc/Mat.pyx":359
 *             poj = iarray_i(poj, &noj, &oj) # Column indices (off-diagonal)
 *         cdef PetscInt nv=0, nov=0
 *         cdef PetscScalar *v=NULL, *ov=NULL             # <<<<<<<<<<<<<<
 *         pv = iarray_s(pv, &nv, &v) # Non-zero values (diagonal)
 *         if nj != nv:  raise ValueError(
 */
  __pyx_v_v = NULL;
  __pyx_v_ov = NULL;

  /* "PETSc/Mat.pyx":360
 *         cdef PetscInt nv=0, nov=0
 *         cdef PetscScalar *v=NULL, *ov=NULL
 *         pv = iarray_s(pv, &nv, &v) # Non-zero values (diagonal)             # <<<<<<<<<<<<<<
 *         if nj != nv:  raise ValueError(
 *             "Given %d column indices but %d non-zero values" %
 */
  __pyx_t_8 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_s(__pyx_v_pv, (&__pyx_v_nv), (&__pyx_v_v))); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF_SET(__pyx_v_pv, __pyx_t_8);
  __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":361
 *         cdef PetscScalar *v=NULL, *ov=NULL
 *         pv = iarray_s(pv, &nv, &v) # Non-zero values (diagonal)
 *         if nj != nv:  raise ValueError(             # <<<<<<<<<<<<<<
 *             "Given %d column indices but %d non-zero values" %
 *             (toInt(nj), toInt(nv)))
 */
  __pyx_t_3 = ((__pyx_v_nj != __pyx_v_nv) != 0);
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":363
 *         if nj != nv:  raise ValueError(
 *             "Given %d column indices but %d non-zero values" %
 *             (toInt(nj), toInt(nv)))             # <<<<<<<<<<<<<<
 *         if pov is not None:
 *             pov = iarray_s(pov, &nov, &ov) # Non-zero values (off-diagonal)
 */
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nj); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_13 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nv); if (unlikely(!__pyx_t_13)) __PYX_ERR(33, 363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(33, 363, __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_13);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_13);
    __pyx_t_8 = 0;
    __pyx_t_13 = 0;

    /* "PETSc/Mat.pyx":362
 *         pv = iarray_s(pv, &nv, &v) # Non-zero values (diagonal)
 *         if nj != nv:  raise ValueError(
 *             "Given %d column indices but %d non-zero values" %             # <<<<<<<<<<<<<<
 *             (toInt(nj), toInt(nv)))
 *         if pov is not None:
 */
    __pyx_t_13 = __Pyx_PyString_Format(__pyx_kp_s_Given_d_column_indices_but_d_non, __pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(33, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "PETSc/Mat.pyx":361
 *         cdef PetscScalar *v=NULL, *ov=NULL
 *         pv = iarray_s(pv, &nv, &v) # Non-zero values (diagonal)
 *         if nj != nv:  raise ValueError(             # <<<<<<<<<<<<<<
 *             "Given %d column indices but %d non-zero values" %
 *             (toInt(nj), toInt(nv)))
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(33, 361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_13);
    __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(33, 361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_Raise(__pyx_t_13, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __PYX_ERR(33, 361, __pyx_L1_error)
  }

  /* "PETSc/Mat.pyx":364
 *             "Given %d column indices but %d non-zero values" %
 *             (toInt(nj), toInt(nv)))
 *         if pov is not None:             # <<<<<<<<<<<<<<
 *             pov = iarray_s(pov, &nov, &ov) # Non-zero values (off-diagonal)
 *         # create matrix
 */
  __pyx_t_3 = (__pyx_v_pov != Py_None);
  __pyx_t_15 = (__pyx_t_3 != 0);
  if (__pyx_t_15) {

    /* "PETSc/Mat.pyx":365
 *             (toInt(nj), toInt(nv)))
 *         if pov is not None:
 *             pov = iarray_s(pov, &nov, &ov) # Non-zero values (off-diagonal)             # <<<<<<<<<<<<<<
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 */
    __pyx_t_13 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_s(__pyx_v_pov, (&__pyx_v_nov), (&__pyx_v_ov))); if (unlikely(!__pyx_t_13)) __PYX_ERR(33, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF_SET(__pyx_v_pov, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "PETSc/Mat.pyx":364
 *             "Given %d column indices but %d non-zero values" %
 *             (toInt(nj), toInt(nv)))
 *         if pov is not None:             # <<<<<<<<<<<<<<
 *             pov = iarray_s(pov, &nov, &ov) # Non-zero values (off-diagonal)
 *         # create matrix
 */
  }

  /* "PETSc/Mat.pyx":367
 *             pov = iarray_s(pov, &nov, &ov) # Non-zero values (off-diagonal)
 *         # create matrix
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         if comm_size(ccomm) == 1:
 *             CHKERR( MatCreateSeqAIJWithArrays(
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":368
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 *         if comm_size(ccomm) == 1:             # <<<<<<<<<<<<<<
 *             CHKERR( MatCreateSeqAIJWithArrays(
 *                 ccomm, m, n, i, j, v, &newmat) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_comm_size(__pyx_v_ccomm); if (unlikely(__pyx_t_2 == -1 && PyErr_Occurred())) __PYX_ERR(33, 368, __pyx_L1_error)
  __pyx_t_15 = ((__pyx_t_2 == 1) != 0);
  if (__pyx_t_15) {

    /* "PETSc/Mat.pyx":369
 *         cdef PetscMat newmat = NULL
 *         if comm_size(ccomm) == 1:
 *             CHKERR( MatCreateSeqAIJWithArrays(             # <<<<<<<<<<<<<<
 *                 ccomm, m, n, i, j, v, &newmat) )
 *             csr = (pi, pj, pv)
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateSeqAIJWithArrays(__pyx_v_ccomm, __pyx_v_m, __pyx_v_n, __pyx_v_i, __pyx_v_j, __pyx_v_v, (&__pyx_v_newmat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 369, __pyx_L1_error)

    /* "PETSc/Mat.pyx":371
 *             CHKERR( MatCreateSeqAIJWithArrays(
 *                 ccomm, m, n, i, j, v, &newmat) )
 *             csr = (pi, pj, pv)             # <<<<<<<<<<<<<<
 *         else:
 *             if oi != NULL and oj != NULL and ov != NULL:
 */
    __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(33, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_INCREF(__pyx_v_pi);
    __Pyx_GIVEREF(__pyx_v_pi);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_pi);
    __Pyx_INCREF(__pyx_v_pj);
    __Pyx_GIVEREF(__pyx_v_pj);
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_pj);
    __Pyx_INCREF(__pyx_v_pv);
    __Pyx_GIVEREF(__pyx_v_pv);
    PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_pv);
    __Pyx_DECREF_SET(__pyx_v_csr, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "PETSc/Mat.pyx":368
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 *         if comm_size(ccomm) == 1:             # <<<<<<<<<<<<<<
 *             CHKERR( MatCreateSeqAIJWithArrays(
 *                 ccomm, m, n, i, j, v, &newmat) )
 */
    goto __pyx_L29;
  }

  /* "PETSc/Mat.pyx":373
 *             csr = (pi, pj, pv)
 *         else:
 *             if oi != NULL and oj != NULL and ov != NULL:             # <<<<<<<<<<<<<<
 *                 CHKERR( MatCreateMPIAIJWithSplitArrays(
 *                     ccomm, m, n, M, N, i, j, v, oi, oj, ov, &newmat) )
 */
  /*else*/ {
    __pyx_t_3 = ((__pyx_v_oi != NULL) != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_15 = __pyx_t_3;
      goto __pyx_L31_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_oj != NULL) != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_15 = __pyx_t_3;
      goto __pyx_L31_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_ov != NULL) != 0);
    __pyx_t_15 = __pyx_t_3;
    __pyx_L31_bool_binop_done:;
    if (__pyx_t_15) {

      /* "PETSc/Mat.pyx":374
 *         else:
 *             if oi != NULL and oj != NULL and ov != NULL:
 *                 CHKERR( MatCreateMPIAIJWithSplitArrays(             # <<<<<<<<<<<<<<
 *                     ccomm, m, n, M, N, i, j, v, oi, oj, ov, &newmat) )
 *                 csr = ((pi, pj, pv), (poi, poj, pov))
 */
      __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateMPIAIJWithSplitArrays(__pyx_v_ccomm, __pyx_v_m, __pyx_v_n, __pyx_v_M, __pyx_v_N, __pyx_v_i, __pyx_v_j, __pyx_v_v, __pyx_v_oi, __pyx_v_oj, __pyx_v_ov, (&__pyx_v_newmat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 374, __pyx_L1_error)

      /* "PETSc/Mat.pyx":376
 *                 CHKERR( MatCreateMPIAIJWithSplitArrays(
 *                     ccomm, m, n, M, N, i, j, v, oi, oj, ov, &newmat) )
 *                 csr = ((pi, pj, pv), (poi, poj, pov))             # <<<<<<<<<<<<<<
 *             else:
 *                 CHKERR( MatCreateMPIAIJWithArrays(
 */
      __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(33, 376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_v_pi);
      __Pyx_GIVEREF(__pyx_v_pi);
      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_pi);
      __Pyx_INCREF(__pyx_v_pj);
      __Pyx_GIVEREF(__pyx_v_pj);
      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_pj);
      __Pyx_INCREF(__pyx_v_pv);
      __Pyx_GIVEREF(__pyx_v_pv);
      PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_pv);
      __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(33, 376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_poi);
      __Pyx_GIVEREF(__pyx_v_poi);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_poi);
      __Pyx_INCREF(__pyx_v_poj);
      __Pyx_GIVEREF(__pyx_v_poj);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_poj);
      __Pyx_INCREF(__pyx_v_pov);
      __Pyx_GIVEREF(__pyx_v_pov);
      PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_pov);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
      __pyx_t_13 = 0;
      __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_csr, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "PETSc/Mat.pyx":373
 *             csr = (pi, pj, pv)
 *         else:
 *             if oi != NULL and oj != NULL and ov != NULL:             # <<<<<<<<<<<<<<
 *                 CHKERR( MatCreateMPIAIJWithSplitArrays(
 *                     ccomm, m, n, M, N, i, j, v, oi, oj, ov, &newmat) )
 */
      goto __pyx_L30;
    }

    /* "PETSc/Mat.pyx":378
 *                 csr = ((pi, pj, pv), (poi, poj, pov))
 *             else:
 *                 CHKERR( MatCreateMPIAIJWithArrays(             # <<<<<<<<<<<<<<
 *                     ccomm, m, n, M, N, i, j, v, &newmat) )
 *                 csr = None
 */
    /*else*/ {

      /* "PETSc/Mat.pyx":379
 *             else:
 *                 CHKERR( MatCreateMPIAIJWithArrays(
 *                     ccomm, m, n, M, N, i, j, v, &newmat) )             # <<<<<<<<<<<<<<
 *                 csr = None
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
      __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateMPIAIJWithArrays(__pyx_v_ccomm, __pyx_v_m, __pyx_v_n, __pyx_v_M, __pyx_v_N, __pyx_v_i, __pyx_v_j, __pyx_v_v, (&__pyx_v_newmat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 378, __pyx_L1_error)

      /* "PETSc/Mat.pyx":380
 *                 CHKERR( MatCreateMPIAIJWithArrays(
 *                     ccomm, m, n, M, N, i, j, v, &newmat) )
 *                 csr = None             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         self.set_attr('__csr__', csr)
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_csr, Py_None);
    }
    __pyx_L30:;
  }
  __pyx_L29:;

  /* "PETSc/Mat.pyx":381
 *                     ccomm, m, n, M, N, i, j, v, &newmat) )
 *                 csr = None
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         self.set_attr('__csr__', csr)
 *         return self
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":382
 *                 csr = None
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         self.set_attr('__csr__', csr)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_8 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Mat *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__csr__"), __pyx_v_csr); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":383
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         self.set_attr('__csr__', csr)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":330
 *         return self
 * 
 *     def createAIJWithArrays(self, size, csr, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         # communicator
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createAIJWithArrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pi);
  __Pyx_XDECREF(__pyx_v_pj);
  __Pyx_XDECREF(__pyx_v_pv);
  __Pyx_XDECREF(__pyx_v_poi);
  __Pyx_XDECREF(__pyx_v_poj);
  __Pyx_XDECREF(__pyx_v_pov);
  __Pyx_XDECREF(__pyx_v_csr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":387
 *     #
 * 
 *     def createDense(self, size, bsize=None, array=None, comm=None):             # <<<<<<<<<<<<<<
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_61createDense(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_60createDense[] = "Mat.createDense(self, size, bsize=None, array=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_61createDense(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_array = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createDense (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_bsize,&__pyx_n_s_array,&__pyx_n_s_comm,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_array);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createDense") < 0)) __PYX_ERR(33, 387, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_size = values[0];
    __pyx_v_bsize = values[1];
    __pyx_v_array = values[2];
    __pyx_v_comm = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createDense", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 387, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createDense", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_60createDense(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_size, __pyx_v_bsize, __pyx_v_array, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_60createDense(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_bsize, PyObject *__pyx_v_array, PyObject *__pyx_v_comm) {
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("createDense", 0);
  __Pyx_INCREF(__pyx_v_array);

  /* "PETSc/Mat.pyx":389
 *     def createDense(self, size, bsize=None, array=None, comm=None):
 *         # create matrix
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         Mat_Create(MATDENSE, comm, size, bsize, &newmat)
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":390
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 *         Mat_Create(MATDENSE, comm, size, bsize, &newmat)             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         # preallocate matrix
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_Mat_Create(MATDENSE, __pyx_v_comm, __pyx_v_size, __pyx_v_bsize, (&__pyx_v_newmat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 390, __pyx_L1_error)

  /* "PETSc/Mat.pyx":391
 *         cdef PetscMat newmat = NULL
 *         Mat_Create(MATDENSE, comm, size, bsize, &newmat)
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         # preallocate matrix
 *         if array is not None:
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":393
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         # preallocate matrix
 *         if array is not None:             # <<<<<<<<<<<<<<
 *             array = Mat_AllocDense(self.mat, array)
 *             self.set_attr('__array__', array)
 */
  __pyx_t_2 = (__pyx_v_array != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":394
 *         # preallocate matrix
 *         if array is not None:
 *             array = Mat_AllocDense(self.mat, array)             # <<<<<<<<<<<<<<
 *             self.set_attr('__array__', array)
 *         return self
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_Mat_AllocDense(__pyx_v_self->mat, __pyx_v_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_array, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/Mat.pyx":395
 *         if array is not None:
 *             array = Mat_AllocDense(self.mat, array)
 *             self.set_attr('__array__', array)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Mat *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__array__"), __pyx_v_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 395, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/Mat.pyx":393
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         # preallocate matrix
 *         if array is not None:             # <<<<<<<<<<<<<<
 *             array = Mat_AllocDense(self.mat, array)
 *             self.set_attr('__array__', array)
 */
  }

  /* "PETSc/Mat.pyx":396
 *             array = Mat_AllocDense(self.mat, array)
 *             self.set_attr('__array__', array)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setPreallocationDense(self, array):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":387
 *     #
 * 
 *     def createDense(self, size, bsize=None, array=None, comm=None):             # <<<<<<<<<<<<<<
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createDense", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":398
 *         return self
 * 
 *     def setPreallocationDense(self, array):             # <<<<<<<<<<<<<<
 *         cdef PetscBool done = PETSC_FALSE
 *         CHKERR( MatIsPreallocated(self.mat, &done) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_63setPreallocationDense(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_62setPreallocationDense[] = "Mat.setPreallocationDense(self, array)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_63setPreallocationDense(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_array = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPreallocationDense (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_array,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);
        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_array)) != 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, "setPreallocationDense") < 0)) __PYX_ERR(33, 398, __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_array = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPreallocationDense", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 398, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setPreallocationDense", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_62setPreallocationDense(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_array);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_62setPreallocationDense(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_array) {
  PetscBool __pyx_v_done;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("setPreallocationDense", 0);
  __Pyx_INCREF(__pyx_v_array);

  /* "PETSc/Mat.pyx":399
 * 
 *     def setPreallocationDense(self, array):
 *         cdef PetscBool done = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatIsPreallocated(self.mat, &done) )
 *         # if done: raise Error(PETSC_ERR_ORDER)
 */
  __pyx_v_done = PETSC_FALSE;

  /* "PETSc/Mat.pyx":400
 *     def setPreallocationDense(self, array):
 *         cdef PetscBool done = PETSC_FALSE
 *         CHKERR( MatIsPreallocated(self.mat, &done) )             # <<<<<<<<<<<<<<
 *         # if done: raise Error(PETSC_ERR_ORDER)
 *         array = Mat_AllocDense(self.mat, array)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatIsPreallocated(__pyx_v_self->mat, (&__pyx_v_done))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 400, __pyx_L1_error)

  /* "PETSc/Mat.pyx":402
 *         CHKERR( MatIsPreallocated(self.mat, &done) )
 *         # if done: raise Error(PETSC_ERR_ORDER)
 *         array = Mat_AllocDense(self.mat, array)             # <<<<<<<<<<<<<<
 *         self.set_attr('__array__', array)
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Mat_AllocDense(__pyx_v_self->mat, __pyx_v_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_array, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Mat.pyx":403
 *         # if done: raise Error(PETSC_ERR_ORDER)
 *         array = Mat_AllocDense(self.mat, array)
 *         self.set_attr('__array__', array)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_Mat *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__array__"), __pyx_v_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/Mat.pyx":404
 *         array = Mat_AllocDense(self.mat, array)
 *         self.set_attr('__array__', array)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":398
 *         return self
 * 
 *     def setPreallocationDense(self, array):             # <<<<<<<<<<<<<<
 *         cdef PetscBool done = PETSC_FALSE
 *         CHKERR( MatIsPreallocated(self.mat, &done) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setPreallocationDense", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":408
 *     #
 * 
 *     def createScatter(self, Scatter scatter not None, comm=None):             # <<<<<<<<<<<<<<
 *         if comm is None: comm = scatter.getComm()
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_65createScatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_64createScatter[] = "Mat.createScatter(self, Scatter scatter, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_65createScatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscScatterObject *__pyx_v_scatter = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createScatter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_scatter,&__pyx_n_s_comm,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_scatter)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createScatter") < 0)) __PYX_ERR(33, 408, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_scatter = ((struct PyPetscScatterObject *)values[0]);
    __pyx_v_comm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createScatter", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 408, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createScatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scatter), __pyx_ptype_8petsc4py_5PETSc_Scatter, 0, "scatter", 0))) __PYX_ERR(33, 408, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_64createScatter(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_scatter, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_64createScatter(struct PyPetscMatObject *__pyx_v_self, struct PyPetscScatterObject *__pyx_v_scatter, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  Mat __pyx_v_newmat;
  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;
  MPI_Comm __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("createScatter", 0);
  __Pyx_INCREF(__pyx_v_comm);

  /* "PETSc/Mat.pyx":409
 * 
 *     def createScatter(self, Scatter scatter not None, comm=None):
 *         if comm is None: comm = scatter.getComm()             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscMat newmat = NULL
 */
  __pyx_t_1 = (__pyx_v_comm == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_scatter), __pyx_n_s_getComm); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 409, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 409, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_comm, __pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "PETSc/Mat.pyx":410
 *     def createScatter(self, Scatter scatter not None, comm=None):
 *         if comm is None: comm = scatter.getComm()
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateScatter(ccomm, scatter.sct, &newmat) )
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 410, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_6;

  /* "PETSc/Mat.pyx":411
 *         if comm is None: comm = scatter.getComm()
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatCreateScatter(ccomm, scatter.sct, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":412
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateScatter(ccomm, scatter.sct, &newmat) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateScatter(__pyx_v_ccomm, __pyx_v_scatter->sct, (&__pyx_v_newmat))); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(33, 412, __pyx_L1_error)

  /* "PETSc/Mat.pyx":413
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateScatter(ccomm, scatter.sct, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":414
 *         CHKERR( MatCreateScatter(ccomm, scatter.sct, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createNormal(self, Mat mat not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":408
 *     #
 * 
 *     def createScatter(self, Scatter scatter not None, comm=None):             # <<<<<<<<<<<<<<
 *         if comm is None: comm = scatter.getComm()
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createScatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_comm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":416
 *         return self
 * 
 *     def createNormal(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateNormal(mat.mat, &newmat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_67createNormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_66createNormal[] = "Mat.createNormal(self, Mat mat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_67createNormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createNormal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,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);
        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_mat)) != 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, "createNormal") < 0)) __PYX_ERR(33, 416, __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_mat = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createNormal", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 416, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createNormal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(33, 416, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_66createNormal(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_66createNormal(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat) {
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("createNormal", 0);

  /* "PETSc/Mat.pyx":417
 * 
 *     def createNormal(self, Mat mat not None):
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatCreateNormal(mat.mat, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":418
 *     def createNormal(self, Mat mat not None):
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateNormal(mat.mat, &newmat) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateNormal(__pyx_v_mat->mat, (&__pyx_v_newmat))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 418, __pyx_L1_error)

  /* "PETSc/Mat.pyx":419
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateNormal(mat.mat, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":420
 *         CHKERR( MatCreateNormal(mat.mat, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createTranspose(self, Mat mat not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":416
 *         return self
 * 
 *     def createNormal(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateNormal(mat.mat, &newmat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createNormal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":422
 *         return self
 * 
 *     def createTranspose(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateTranspose(mat.mat, &newmat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_69createTranspose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_68createTranspose[] = "Mat.createTranspose(self, Mat mat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_69createTranspose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createTranspose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,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);
        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_mat)) != 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, "createTranspose") < 0)) __PYX_ERR(33, 422, __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_mat = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createTranspose", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 422, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createTranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(33, 422, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_68createTranspose(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_68createTranspose(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat) {
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("createTranspose", 0);

  /* "PETSc/Mat.pyx":423
 * 
 *     def createTranspose(self, Mat mat not None):
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatCreateTranspose(mat.mat, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":424
 *     def createTranspose(self, Mat mat not None):
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateTranspose(mat.mat, &newmat) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateTranspose(__pyx_v_mat->mat, (&__pyx_v_newmat))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 424, __pyx_L1_error)

  /* "PETSc/Mat.pyx":425
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateTranspose(mat.mat, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":426
 *         CHKERR( MatCreateTranspose(mat.mat, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createLRC(self, Mat A not None, Mat U not None, Mat V not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":422
 *         return self
 * 
 *     def createTranspose(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateTranspose(mat.mat, &newmat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createTranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":428
 *         return self
 * 
 *     def createLRC(self, Mat A not None, Mat U not None, Mat V not None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateLRC(A.mat, U.mat, V.mat, &newmat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_71createLRC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_70createLRC[] = "Mat.createLRC(self, Mat A, Mat U, Mat V)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_71createLRC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_A = 0;
  struct PyPetscMatObject *__pyx_v_U = 0;
  struct PyPetscMatObject *__pyx_v_V = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createLRC (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_U,&__pyx_n_s_V,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_U)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createLRC", 1, 3, 3, 1); __PYX_ERR(33, 428, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createLRC", 1, 3, 3, 2); __PYX_ERR(33, 428, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createLRC") < 0)) __PYX_ERR(33, 428, __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_A = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_U = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_V = ((struct PyPetscMatObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createLRC", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 428, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createLRC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_A), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "A", 0))) __PYX_ERR(33, 428, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_U), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "U", 0))) __PYX_ERR(33, 428, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_V), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "V", 0))) __PYX_ERR(33, 428, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_70createLRC(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_A, __pyx_v_U, __pyx_v_V);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_70createLRC(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_A, struct PyPetscMatObject *__pyx_v_U, struct PyPetscMatObject *__pyx_v_V) {
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("createLRC", 0);

  /* "PETSc/Mat.pyx":429
 * 
 *     def createLRC(self, Mat A not None, Mat U not None, Mat V not None):
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatCreateLRC(A.mat, U.mat, V.mat, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":430
 *     def createLRC(self, Mat A not None, Mat U not None, Mat V not None):
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateLRC(A.mat, U.mat, V.mat, &newmat) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateLRC(__pyx_v_A->mat, __pyx_v_U->mat, __pyx_v_V->mat, (&__pyx_v_newmat))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 430, __pyx_L1_error)

  /* "PETSc/Mat.pyx":431
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateLRC(A.mat, U.mat, V.mat, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":432
 *         CHKERR( MatCreateLRC(A.mat, U.mat, V.mat, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createSubMatrix(self, Mat A not None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":428
 *         return self
 * 
 *     def createLRC(self, Mat A not None, Mat U not None, Mat V not None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateLRC(A.mat, U.mat, V.mat, &newmat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createLRC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":434
 *         return self
 * 
 *     def createSubMatrix(self, Mat A not None,             # <<<<<<<<<<<<<<
 *                         IS isrow not None, IS iscol=None):
 *         if iscol is None: iscol = isrow
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_73createSubMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_72createSubMatrix[] = "Mat.createSubMatrix(self, Mat A, IS isrow, IS iscol=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_73createSubMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_A = 0;
  struct PyPetscISObject *__pyx_v_isrow = 0;
  struct PyPetscISObject *__pyx_v_iscol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createSubMatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_isrow,&__pyx_n_s_iscol,0};
    PyObject* values[3] = {0,0,0};

    /* "PETSc/Mat.pyx":435
 * 
 *     def createSubMatrix(self, Mat A not None,
 *                         IS isrow not None, IS iscol=None):             # <<<<<<<<<<<<<<
 *         if iscol is None: iscol = isrow
 *         cdef PetscMat newmat = NULL
 */
    values[2] = (PyObject *)((struct PyPetscISObject *)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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_isrow)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createSubMatrix", 0, 2, 3, 1); __PYX_ERR(33, 434, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscol);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createSubMatrix") < 0)) __PYX_ERR(33, 434, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_A = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_isrow = ((struct PyPetscISObject *)values[1]);
    __pyx_v_iscol = ((struct PyPetscISObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createSubMatrix", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 434, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createSubMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_A), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "A", 0))) __PYX_ERR(33, 434, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isrow), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isrow", 0))) __PYX_ERR(33, 435, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iscol), __pyx_ptype_8petsc4py_5PETSc_IS, 1, "iscol", 0))) __PYX_ERR(33, 435, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_72createSubMatrix(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_A, __pyx_v_isrow, __pyx_v_iscol);

  /* "PETSc/Mat.pyx":434
 *         return self
 * 
 *     def createSubMatrix(self, Mat A not None,             # <<<<<<<<<<<<<<
 *                         IS isrow not None, IS iscol=None):
 *         if iscol is None: iscol = isrow
 */

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_72createSubMatrix(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_A, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol) {
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("createSubMatrix", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_iscol);

  /* "PETSc/Mat.pyx":436
 *     def createSubMatrix(self, Mat A not None,
 *                         IS isrow not None, IS iscol=None):
 *         if iscol is None: iscol = isrow             # <<<<<<<<<<<<<<
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateSubMatrix(A.mat, isrow.iset, iscol.iset, &newmat) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_iscol) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_INCREF(((PyObject *)__pyx_v_isrow));
    __Pyx_DECREF_SET(__pyx_v_iscol, __pyx_v_isrow);
  }

  /* "PETSc/Mat.pyx":437
 *                         IS isrow not None, IS iscol=None):
 *         if iscol is None: iscol = isrow
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatCreateSubMatrix(A.mat, isrow.iset, iscol.iset, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":438
 *         if iscol is None: iscol = isrow
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateSubMatrix(A.mat, isrow.iset, iscol.iset, &newmat) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateSubMatrix(__pyx_v_A->mat, __pyx_v_isrow->iset, __pyx_v_iscol->iset, (&__pyx_v_newmat))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 438, __pyx_L1_error)

  /* "PETSc/Mat.pyx":439
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateSubMatrix(A.mat, isrow.iset, iscol.iset, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":440
 *         CHKERR( MatCreateSubMatrix(A.mat, isrow.iset, iscol.iset, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createNest(self, mats, isrows=None, iscols=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":434
 *         return self
 * 
 *     def createSubMatrix(self, Mat A not None,             # <<<<<<<<<<<<<<
 *                         IS isrow not None, IS iscol=None):
 *         if iscol is None: iscol = isrow
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createSubMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_iscol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":442
 *         return self
 * 
 *     def createNest(self, mats, isrows=None, iscols=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef object mat
 *         mats = [list(mat) for mat in mats]
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_75createNest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_74createNest[] = "Mat.createNest(self, mats, isrows=None, iscols=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_75createNest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mats = 0;
  PyObject *__pyx_v_isrows = 0;
  PyObject *__pyx_v_iscols = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createNest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mats,&__pyx_n_s_isrows,&__pyx_n_s_iscols,&__pyx_n_s_comm,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_mats)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_isrows);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscols);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createNest") < 0)) __PYX_ERR(33, 442, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mats = values[0];
    __pyx_v_isrows = values[1];
    __pyx_v_iscols = values[2];
    __pyx_v_comm = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createNest", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 442, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createNest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_74createNest(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mats, __pyx_v_isrows, __pyx_v_iscols, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_74createNest(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_mats, PyObject *__pyx_v_isrows, PyObject *__pyx_v_iscols, PyObject *__pyx_v_comm) {
  PyObject *__pyx_v_mat = 0;
  MPI_Comm __pyx_v_ccomm;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_mr;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_mc;
  PetscInt __pyx_v_nr;
  PetscInt __pyx_v_nc;
  Mat *__pyx_v_cmats;
  IS *__pyx_v_cisrows;
  IS *__pyx_v_ciscols;
  CYTHON_UNUSED PyObject *__pyx_v_tmp1 = 0;
  CYTHON_UNUSED PyObject *__pyx_v_tmp2 = 0;
  CYTHON_UNUSED PyObject *__pyx_v_tmp3 = 0;
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  MPI_Comm __pyx_t_8;
  Mat __pyx_t_9;
  int __pyx_t_10;
  IS __pyx_t_11;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("createNest", 0);
  __Pyx_INCREF(__pyx_v_mats);
  __Pyx_INCREF(__pyx_v_isrows);
  __Pyx_INCREF(__pyx_v_iscols);

  /* "PETSc/Mat.pyx":444
 *     def createNest(self, mats, isrows=None, iscols=None, comm=None):
 *         cdef object mat
 *         mats = [list(mat) for mat in mats]             # <<<<<<<<<<<<<<
 *         if isrows:
 *             isrows = list(isrows)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_v_mats)) || PyTuple_CheckExact(__pyx_v_mats)) {
    __pyx_t_2 = __pyx_v_mats; __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_mats); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 444, __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(33, 444, __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_COMPILING_IN_CPYTHON
        __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(33, 444, __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(33, 444, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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(33, 444, __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(33, 444, __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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(33, 444, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_mat, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = PySequence_List(__pyx_v_mat); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(33, 444, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_mats, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":445
 *         cdef object mat
 *         mats = [list(mat) for mat in mats]
 *         if isrows:             # <<<<<<<<<<<<<<
 *             isrows = list(isrows)
 *             assert len(isrows) == len(mats)
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_isrows); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(33, 445, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "PETSc/Mat.pyx":446
 *         mats = [list(mat) for mat in mats]
 *         if isrows:
 *             isrows = list(isrows)             # <<<<<<<<<<<<<<
 *             assert len(isrows) == len(mats)
 *         else:
 */
    __pyx_t_1 = PySequence_List(__pyx_v_isrows); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 446, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_isrows, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "PETSc/Mat.pyx":447
 *         if isrows:
 *             isrows = list(isrows)
 *             assert len(isrows) == len(mats)             # <<<<<<<<<<<<<<
 *         else:
 *             isrows = None
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_3 = PyObject_Length(__pyx_v_isrows); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 447, __pyx_L1_error)
      __pyx_t_7 = PyObject_Length(__pyx_v_mats); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(33, 447, __pyx_L1_error)
      if (unlikely(!((__pyx_t_3 == __pyx_t_7) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(33, 447, __pyx_L1_error)
      }
    }
    #endif

    /* "PETSc/Mat.pyx":445
 *         cdef object mat
 *         mats = [list(mat) for mat in mats]
 *         if isrows:             # <<<<<<<<<<<<<<
 *             isrows = list(isrows)
 *             assert len(isrows) == len(mats)
 */
    goto __pyx_L5;
  }

  /* "PETSc/Mat.pyx":449
 *             assert len(isrows) == len(mats)
 *         else:
 *             isrows = None             # <<<<<<<<<<<<<<
 *         if iscols:
 *             iscols = list(iscols)
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_isrows, Py_None);
  }
  __pyx_L5:;

  /* "PETSc/Mat.pyx":450
 *         else:
 *             isrows = None
 *         if iscols:             # <<<<<<<<<<<<<<
 *             iscols = list(iscols)
 *             assert len(iscols) == len(mats[0])
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_iscols); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(33, 450, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "PETSc/Mat.pyx":451
 *             isrows = None
 *         if iscols:
 *             iscols = list(iscols)             # <<<<<<<<<<<<<<
 *             assert len(iscols) == len(mats[0])
 *         else:
 */
    __pyx_t_1 = PySequence_List(__pyx_v_iscols); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_iscols, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "PETSc/Mat.pyx":452
 *         if iscols:
 *             iscols = list(iscols)
 *             assert len(iscols) == len(mats[0])             # <<<<<<<<<<<<<<
 *         else:
 *             iscols = None
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_7 = PyObject_Length(__pyx_v_iscols); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(33, 452, __pyx_L1_error)
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_mats, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 452, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 452, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!((__pyx_t_7 == __pyx_t_3) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(33, 452, __pyx_L1_error)
      }
    }
    #endif

    /* "PETSc/Mat.pyx":450
 *         else:
 *             isrows = None
 *         if iscols:             # <<<<<<<<<<<<<<
 *             iscols = list(iscols)
 *             assert len(iscols) == len(mats[0])
 */
    goto __pyx_L6;
  }

  /* "PETSc/Mat.pyx":454
 *             assert len(iscols) == len(mats[0])
 *         else:
 *             iscols = None             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Py_ssize_t i, mr = len(mats)
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_iscols, Py_None);
  }
  __pyx_L6:;

  /* "PETSc/Mat.pyx":455
 *         else:
 *             iscols = None
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i, mr = len(mats)
 *         cdef Py_ssize_t j, mc = len(mats[0])
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 455, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_8;

  /* "PETSc/Mat.pyx":456
 *             iscols = None
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Py_ssize_t i, mr = len(mats)             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t j, mc = len(mats[0])
 *         cdef PetscInt nr = <PetscInt>mr
 */
  __pyx_t_3 = PyObject_Length(__pyx_v_mats); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 456, __pyx_L1_error)
  __pyx_v_mr = __pyx_t_3;

  /* "PETSc/Mat.pyx":457
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Py_ssize_t i, mr = len(mats)
 *         cdef Py_ssize_t j, mc = len(mats[0])             # <<<<<<<<<<<<<<
 *         cdef PetscInt nr = <PetscInt>mr
 *         cdef PetscInt nc = <PetscInt>mc
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_mats, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 457, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_mc = __pyx_t_3;

  /* "PETSc/Mat.pyx":458
 *         cdef Py_ssize_t i, mr = len(mats)
 *         cdef Py_ssize_t j, mc = len(mats[0])
 *         cdef PetscInt nr = <PetscInt>mr             # <<<<<<<<<<<<<<
 *         cdef PetscInt nc = <PetscInt>mc
 *         cdef PetscMat *cmats   = NULL
 */
  __pyx_v_nr = ((PetscInt)__pyx_v_mr);

  /* "PETSc/Mat.pyx":459
 *         cdef Py_ssize_t j, mc = len(mats[0])
 *         cdef PetscInt nr = <PetscInt>mr
 *         cdef PetscInt nc = <PetscInt>mc             # <<<<<<<<<<<<<<
 *         cdef PetscMat *cmats   = NULL
 *         cdef PetscIS  *cisrows = NULL
 */
  __pyx_v_nc = ((PetscInt)__pyx_v_mc);

  /* "PETSc/Mat.pyx":460
 *         cdef PetscInt nr = <PetscInt>mr
 *         cdef PetscInt nc = <PetscInt>mc
 *         cdef PetscMat *cmats   = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscIS  *cisrows = NULL
 *         cdef PetscIS  *ciscols = NULL
 */
  __pyx_v_cmats = NULL;

  /* "PETSc/Mat.pyx":461
 *         cdef PetscInt nc = <PetscInt>mc
 *         cdef PetscMat *cmats   = NULL
 *         cdef PetscIS  *cisrows = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscIS  *ciscols = NULL
 *         cdef object tmp1, tmp2, tmp3
 */
  __pyx_v_cisrows = NULL;

  /* "PETSc/Mat.pyx":462
 *         cdef PetscMat *cmats   = NULL
 *         cdef PetscIS  *cisrows = NULL
 *         cdef PetscIS  *ciscols = NULL             # <<<<<<<<<<<<<<
 *         cdef object tmp1, tmp2, tmp3
 *         tmp1 = oarray_p(empty_p(nr*nc), NULL, <void**>&cmats)
 */
  __pyx_v_ciscols = NULL;

  /* "PETSc/Mat.pyx":464
 *         cdef PetscIS  *ciscols = NULL
 *         cdef object tmp1, tmp2, tmp3
 *         tmp1 = oarray_p(empty_p(nr*nc), NULL, <void**>&cmats)             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < mr:
 *             for j from 0 <= j < mc:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p((__pyx_v_nr * __pyx_v_nc))); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_1, NULL, ((void **)(&__pyx_v_cmats)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_tmp1 = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/Mat.pyx":465
 *         cdef object tmp1, tmp2, tmp3
 *         tmp1 = oarray_p(empty_p(nr*nc), NULL, <void**>&cmats)
 *         for i from 0 <= i < mr:             # <<<<<<<<<<<<<<
 *             for j from 0 <= j < mc:
 *                 mat = mats[i][j]
 */
  __pyx_t_3 = __pyx_v_mr;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

    /* "PETSc/Mat.pyx":466
 *         tmp1 = oarray_p(empty_p(nr*nc), NULL, <void**>&cmats)
 *         for i from 0 <= i < mr:
 *             for j from 0 <= j < mc:             # <<<<<<<<<<<<<<
 *                 mat = mats[i][j]
 *                 cmats[i*mc+j] = (<Mat?>mat).mat if mat is not None else NULL
 */
    __pyx_t_7 = __pyx_v_mc;
    for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_7; __pyx_v_j++) {

      /* "PETSc/Mat.pyx":467
 *         for i from 0 <= i < mr:
 *             for j from 0 <= j < mc:
 *                 mat = mats[i][j]             # <<<<<<<<<<<<<<
 *                 cmats[i*mc+j] = (<Mat?>mat).mat if mat is not None else NULL
 *         if isrows is not None:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mats, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_j, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_mat, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "PETSc/Mat.pyx":468
 *             for j from 0 <= j < mc:
 *                 mat = mats[i][j]
 *                 cmats[i*mc+j] = (<Mat?>mat).mat if mat is not None else NULL             # <<<<<<<<<<<<<<
 *         if isrows is not None:
 *             tmp2 = oarray_p(empty_p(nr), NULL, <void**>&cisrows)
 */
      __pyx_t_6 = (__pyx_v_mat != Py_None);
      if ((__pyx_t_6 != 0)) {
        if (!(likely(__Pyx_TypeTest(__pyx_v_mat, __pyx_ptype_8petsc4py_5PETSc_Mat)))) __PYX_ERR(33, 468, __pyx_L1_error)
        __pyx_t_9 = ((struct PyPetscMatObject *)__pyx_v_mat)->mat;
      } else {
        __pyx_t_9 = NULL;
      }
      (__pyx_v_cmats[((__pyx_v_i * __pyx_v_mc) + __pyx_v_j)]) = __pyx_t_9;
    }
  }

  /* "PETSc/Mat.pyx":469
 *                 mat = mats[i][j]
 *                 cmats[i*mc+j] = (<Mat?>mat).mat if mat is not None else NULL
 *         if isrows is not None:             # <<<<<<<<<<<<<<
 *             tmp2 = oarray_p(empty_p(nr), NULL, <void**>&cisrows)
 *             for i from 0 <= i < mr: cisrows[i] = (<IS?>isrows[i]).iset
 */
  __pyx_t_6 = (__pyx_v_isrows != Py_None);
  __pyx_t_10 = (__pyx_t_6 != 0);
  if (__pyx_t_10) {

    /* "PETSc/Mat.pyx":470
 *                 cmats[i*mc+j] = (<Mat?>mat).mat if mat is not None else NULL
 *         if isrows is not None:
 *             tmp2 = oarray_p(empty_p(nr), NULL, <void**>&cisrows)             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < mr: cisrows[i] = (<IS?>isrows[i]).iset
 *         if iscols is not None:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_nr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_1, NULL, ((void **)(&__pyx_v_cisrows)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_tmp2 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "PETSc/Mat.pyx":471
 *         if isrows is not None:
 *             tmp2 = oarray_p(empty_p(nr), NULL, <void**>&cisrows)
 *             for i from 0 <= i < mr: cisrows[i] = (<IS?>isrows[i]).iset             # <<<<<<<<<<<<<<
 *         if iscols is not None:
 *             tmp3 = oarray_p(empty_p(nc), NULL, <void**>&ciscols)
 */
    __pyx_t_3 = __pyx_v_mr;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_isrows, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(33, 471, __pyx_L1_error)
      __pyx_t_11 = ((struct PyPetscISObject *)__pyx_t_2)->iset;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      (__pyx_v_cisrows[__pyx_v_i]) = __pyx_t_11;
    }

    /* "PETSc/Mat.pyx":469
 *                 mat = mats[i][j]
 *                 cmats[i*mc+j] = (<Mat?>mat).mat if mat is not None else NULL
 *         if isrows is not None:             # <<<<<<<<<<<<<<
 *             tmp2 = oarray_p(empty_p(nr), NULL, <void**>&cisrows)
 *             for i from 0 <= i < mr: cisrows[i] = (<IS?>isrows[i]).iset
 */
  }

  /* "PETSc/Mat.pyx":472
 *             tmp2 = oarray_p(empty_p(nr), NULL, <void**>&cisrows)
 *             for i from 0 <= i < mr: cisrows[i] = (<IS?>isrows[i]).iset
 *         if iscols is not None:             # <<<<<<<<<<<<<<
 *             tmp3 = oarray_p(empty_p(nc), NULL, <void**>&ciscols)
 *             for j from 0 <= j < mc: ciscols[j] = (<IS?>iscols[j]).iset
 */
  __pyx_t_10 = (__pyx_v_iscols != Py_None);
  __pyx_t_6 = (__pyx_t_10 != 0);
  if (__pyx_t_6) {

    /* "PETSc/Mat.pyx":473
 *             for i from 0 <= i < mr: cisrows[i] = (<IS?>isrows[i]).iset
 *         if iscols is not None:
 *             tmp3 = oarray_p(empty_p(nc), NULL, <void**>&ciscols)             # <<<<<<<<<<<<<<
 *             for j from 0 <= j < mc: ciscols[j] = (<IS?>iscols[j]).iset
 *         cdef PetscMat newmat = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_nc)); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_2, NULL, ((void **)(&__pyx_v_ciscols)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_tmp3 = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "PETSc/Mat.pyx":474
 *         if iscols is not None:
 *             tmp3 = oarray_p(empty_p(nc), NULL, <void**>&ciscols)
 *             for j from 0 <= j < mc: ciscols[j] = (<IS?>iscols[j]).iset             # <<<<<<<<<<<<<<
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateNest(ccomm, nr, cisrows, nc, ciscols, cmats, &newmat) )
 */
    __pyx_t_3 = __pyx_v_mc;
    for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) {
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_iscols, __pyx_v_j, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(33, 474, __pyx_L1_error)
      __pyx_t_11 = ((struct PyPetscISObject *)__pyx_t_1)->iset;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      (__pyx_v_ciscols[__pyx_v_j]) = __pyx_t_11;
    }

    /* "PETSc/Mat.pyx":472
 *             tmp2 = oarray_p(empty_p(nr), NULL, <void**>&cisrows)
 *             for i from 0 <= i < mr: cisrows[i] = (<IS?>isrows[i]).iset
 *         if iscols is not None:             # <<<<<<<<<<<<<<
 *             tmp3 = oarray_p(empty_p(nc), NULL, <void**>&ciscols)
 *             for j from 0 <= j < mc: ciscols[j] = (<IS?>iscols[j]).iset
 */
  }

  /* "PETSc/Mat.pyx":475
 *             tmp3 = oarray_p(empty_p(nc), NULL, <void**>&ciscols)
 *             for j from 0 <= j < mc: ciscols[j] = (<IS?>iscols[j]).iset
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatCreateNest(ccomm, nr, cisrows, nc, ciscols, cmats, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":476
 *             for j from 0 <= j < mc: ciscols[j] = (<IS?>iscols[j]).iset
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateNest(ccomm, nr, cisrows, nc, ciscols, cmats, &newmat) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self
 */
  __pyx_t_12 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateNest(__pyx_v_ccomm, __pyx_v_nr, __pyx_v_cisrows, __pyx_v_nc, __pyx_v_ciscols, __pyx_v_cmats, (&__pyx_v_newmat))); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(33, 476, __pyx_L1_error)

  /* "PETSc/Mat.pyx":477
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreateNest(ccomm, nr, cisrows, nc, ciscols, cmats, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":478
 *         CHKERR( MatCreateNest(ccomm, nr, cisrows, nc, ciscols, cmats, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     ##def createIS(self, size, LGMap lgmap not None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":442
 *         return self
 * 
 *     def createNest(self, mats, isrows=None, iscols=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef object mat
 *         mats = [list(mat) for mat in mats]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createNest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mat);
  __Pyx_XDECREF(__pyx_v_tmp1);
  __Pyx_XDECREF(__pyx_v_tmp2);
  __Pyx_XDECREF(__pyx_v_tmp3);
  __Pyx_XDECREF(__pyx_v_mats);
  __Pyx_XDECREF(__pyx_v_isrows);
  __Pyx_XDECREF(__pyx_v_iscols);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":494
 *     ##    return self
 * 
 *     def createPython(self, size, context=None, comm=None):             # <<<<<<<<<<<<<<
 *         # communicator and sizes
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_77createPython(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_76createPython[] = "Mat.createPython(self, size, context=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_77createPython(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createPython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_context,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createPython") < 0)) __PYX_ERR(33, 494, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_size = values[0];
    __pyx_v_context = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createPython", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 494, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createPython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_76createPython(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_size, __pyx_v_context, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_76createPython(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_size, PyObject *__pyx_v_context, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscInt __pyx_v_rbs;
  PetscInt __pyx_v_cbs;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_M;
  PetscInt __pyx_v_N;
  Mat __pyx_v_newmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createPython", 0);

  /* "PETSc/Mat.pyx":496
 *     def createPython(self, size, context=None, comm=None):
 *         # communicator and sizes
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 *         Mat_Sizes(size, None, &rbs, &cbs, &m, &n, &M, &N)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 496, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Mat.pyx":497
 *         # communicator and sizes
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0             # <<<<<<<<<<<<<<
 *         Mat_Sizes(size, None, &rbs, &cbs, &m, &n, &M, &N)
 *         Sys_Layout(ccomm, rbs, &m, &M)
 */
  __pyx_v_rbs = 0;
  __pyx_v_cbs = 0;
  __pyx_v_m = 0;
  __pyx_v_n = 0;
  __pyx_v_M = 0;
  __pyx_v_N = 0;

  /* "PETSc/Mat.pyx":498
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 *         Mat_Sizes(size, None, &rbs, &cbs, &m, &n, &M, &N)             # <<<<<<<<<<<<<<
 *         Sys_Layout(ccomm, rbs, &m, &M)
 *         Sys_Layout(ccomm, cbs, &n, &N)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Mat_Sizes(__pyx_v_size, Py_None, (&__pyx_v_rbs), (&__pyx_v_cbs), (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_M), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 498, __pyx_L1_error)

  /* "PETSc/Mat.pyx":499
 *         cdef PetscInt rbs = 0, cbs = 0, m = 0, n = 0, M = 0, N = 0
 *         Mat_Sizes(size, None, &rbs, &cbs, &m, &n, &M, &N)
 *         Sys_Layout(ccomm, rbs, &m, &M)             # <<<<<<<<<<<<<<
 *         Sys_Layout(ccomm, cbs, &n, &N)
 *         # create matrix
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Sys_Layout(__pyx_v_ccomm, __pyx_v_rbs, (&__pyx_v_m), (&__pyx_v_M)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 499, __pyx_L1_error)

  /* "PETSc/Mat.pyx":500
 *         Mat_Sizes(size, None, &rbs, &cbs, &m, &n, &M, &N)
 *         Sys_Layout(ccomm, rbs, &m, &M)
 *         Sys_Layout(ccomm, cbs, &n, &N)             # <<<<<<<<<<<<<<
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_Sys_Layout(__pyx_v_ccomm, __pyx_v_cbs, (&__pyx_v_n), (&__pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 500, __pyx_L1_error)

  /* "PETSc/Mat.pyx":502
 *         Sys_Layout(ccomm, cbs, &n, &N)
 *         # create matrix
 *         cdef PetscMat newmat = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatCreate(ccomm, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 */
  __pyx_v_newmat = NULL;

  /* "PETSc/Mat.pyx":503
 *         # create matrix
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreate(ccomm, &newmat) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         CHKERR( MatSetSizes(self.mat, m, n, M, N) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreate(__pyx_v_ccomm, (&__pyx_v_newmat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 503, __pyx_L1_error)

  /* "PETSc/Mat.pyx":504
 *         cdef PetscMat newmat = NULL
 *         CHKERR( MatCreate(ccomm, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetSizes(self.mat, m, n, M, N) )
 *         CHKERR( MatSetType(self.mat, MATPYTHON) )
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->mat = __pyx_v_newmat;

  /* "PETSc/Mat.pyx":505
 *         CHKERR( MatCreate(ccomm, &newmat) )
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         CHKERR( MatSetSizes(self.mat, m, n, M, N) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetType(self.mat, MATPYTHON) )
 *         CHKERR( MatPythonSetContext(self.mat, <void*>context) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetSizes(__pyx_v_self->mat, __pyx_v_m, __pyx_v_n, __pyx_v_M, __pyx_v_N)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 505, __pyx_L1_error)

  /* "PETSc/Mat.pyx":506
 *         PetscCLEAR(self.obj); self.mat = newmat
 *         CHKERR( MatSetSizes(self.mat, m, n, M, N) )
 *         CHKERR( MatSetType(self.mat, MATPYTHON) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatPythonSetContext(self.mat, <void*>context) )
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetType(__pyx_v_self->mat, MATPYTHON)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 506, __pyx_L1_error)

  /* "PETSc/Mat.pyx":507
 *         CHKERR( MatSetSizes(self.mat, m, n, M, N) )
 *         CHKERR( MatSetType(self.mat, MATPYTHON) )
 *         CHKERR( MatPythonSetContext(self.mat, <void*>context) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatPythonSetContext(__pyx_v_self->mat, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 507, __pyx_L1_error)

  /* "PETSc/Mat.pyx":508
 *         CHKERR( MatSetType(self.mat, MATPYTHON) )
 *         CHKERR( MatPythonSetContext(self.mat, <void*>context) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setPythonContext(self, context):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":494
 *     ##    return self
 * 
 *     def createPython(self, size, context=None, comm=None):             # <<<<<<<<<<<<<<
 *         # communicator and sizes
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createPython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":510
 *         return self
 * 
 *     def setPythonContext(self, context):             # <<<<<<<<<<<<<<
 *         CHKERR( MatPythonSetContext(self.mat, <void*>context) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_79setPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_78setPythonContext[] = "Mat.setPythonContext(self, context)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_79setPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPythonContext (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,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);
        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_context)) != 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, "setPythonContext") < 0)) __PYX_ERR(33, 510, __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_context = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPythonContext", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 510, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_78setPythonContext(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_context);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_78setPythonContext(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_context) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setPythonContext", 0);

  /* "PETSc/Mat.pyx":511
 * 
 *     def setPythonContext(self, context):
 *         CHKERR( MatPythonSetContext(self.mat, <void*>context) )             # <<<<<<<<<<<<<<
 * 
 *     def getPythonContext(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatPythonSetContext(__pyx_v_self->mat, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 511, __pyx_L1_error)

  /* "PETSc/Mat.pyx":510
 *         return self
 * 
 *     def setPythonContext(self, context):             # <<<<<<<<<<<<<<
 *         CHKERR( MatPythonSetContext(self.mat, <void*>context) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":513
 *         CHKERR( MatPythonSetContext(self.mat, <void*>context) )
 * 
 *     def getPythonContext(self):             # <<<<<<<<<<<<<<
 *         cdef void *context = NULL
 *         CHKERR( MatPythonGetContext(self.mat, &context) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_81getPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_80getPythonContext[] = "Mat.getPythonContext(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_81getPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPythonContext (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getPythonContext", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getPythonContext", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_80getPythonContext(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_80getPythonContext(struct PyPetscMatObject *__pyx_v_self) {
  void *__pyx_v_context;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getPythonContext", 0);

  /* "PETSc/Mat.pyx":514
 * 
 *     def getPythonContext(self):
 *         cdef void *context = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatPythonGetContext(self.mat, &context) )
 *         if context == NULL: return None
 */
  __pyx_v_context = NULL;

  /* "PETSc/Mat.pyx":515
 *     def getPythonContext(self):
 *         cdef void *context = NULL
 *         CHKERR( MatPythonGetContext(self.mat, &context) )             # <<<<<<<<<<<<<<
 *         if context == NULL: return None
 *         else: return <object> context
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatPythonGetContext(__pyx_v_self->mat, (&__pyx_v_context))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 515, __pyx_L1_error)

  /* "PETSc/Mat.pyx":516
 *         cdef void *context = NULL
 *         CHKERR( MatPythonGetContext(self.mat, &context) )
 *         if context == NULL: return None             # <<<<<<<<<<<<<<
 *         else: return <object> context
 * 
 */
  __pyx_t_2 = ((__pyx_v_context == NULL) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "PETSc/Mat.pyx":517
 *         CHKERR( MatPythonGetContext(self.mat, &context) )
 *         if context == NULL: return None
 *         else: return <object> context             # <<<<<<<<<<<<<<
 * 
 *     def setPythonType(self, py_type):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_context));
    __pyx_r = ((PyObject *)__pyx_v_context);
    goto __pyx_L0;
  }

  /* "PETSc/Mat.pyx":513
 *         CHKERR( MatPythonSetContext(self.mat, <void*>context) )
 * 
 *     def getPythonContext(self):             # <<<<<<<<<<<<<<
 *         cdef void *context = NULL
 *         CHKERR( MatPythonGetContext(self.mat, &context) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":519
 *         else: return <object> context
 * 
 *     def setPythonType(self, py_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_83setPythonType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_82setPythonType[] = "Mat.setPythonType(self, py_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_83setPythonType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_py_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPythonType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_py_type,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);
        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_py_type)) != 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, "setPythonType") < 0)) __PYX_ERR(33, 519, __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_py_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPythonType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 519, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setPythonType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_82setPythonType(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_py_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_82setPythonType(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_py_type) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setPythonType", 0);
  __Pyx_INCREF(__pyx_v_py_type);

  /* "PETSc/Mat.pyx":520
 * 
 *     def setPythonType(self, py_type):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         py_type = str2bytes(py_type, &cval)
 *         CHKERR( MatPythonSetType(self.mat, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Mat.pyx":521
 *     def setPythonType(self, py_type):
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( MatPythonSetType(self.mat, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_py_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_py_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":522
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 *         CHKERR( MatPythonSetType(self.mat, cval) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatPythonSetType(__pyx_v_self->mat, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 522, __pyx_L1_error)

  /* "PETSc/Mat.pyx":519
 *         else: return <object> context
 * 
 *     def setPythonType(self, py_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setPythonType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":526
 *     #
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_85setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_84setOptionsPrefix[] = "Mat.setOptionsPrefix(self, prefix)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_85setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOptionsPrefix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,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);
        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_prefix)) != 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, "setOptionsPrefix") < 0)) __PYX_ERR(33, 526, __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_prefix = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOptionsPrefix", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 526, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_84setOptionsPrefix(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_prefix);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_84setOptionsPrefix(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setOptionsPrefix", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "PETSc/Mat.pyx":527
 * 
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( MatSetOptionsPrefix(self.mat, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Mat.pyx":528
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetOptionsPrefix(self.mat, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_prefix, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":529
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( MatSetOptionsPrefix(self.mat, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getOptionsPrefix(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetOptionsPrefix(__pyx_v_self->mat, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 529, __pyx_L1_error)

  /* "PETSc/Mat.pyx":526
 *     #
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":531
 *         CHKERR( MatSetOptionsPrefix(self.mat, cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( MatGetOptionsPrefix(self.mat, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_87getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_86getOptionsPrefix[] = "Mat.getOptionsPrefix(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_87getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOptionsPrefix (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOptionsPrefix", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOptionsPrefix", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_86getOptionsPrefix(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_86getOptionsPrefix(struct PyPetscMatObject *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getOptionsPrefix", 0);

  /* "PETSc/Mat.pyx":532
 * 
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetOptionsPrefix(self.mat, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Mat.pyx":533
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( MatGetOptionsPrefix(self.mat, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetOptionsPrefix(__pyx_v_self->mat, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 533, __pyx_L1_error)

  /* "PETSc/Mat.pyx":534
 *         cdef const_char *cval = NULL
 *         CHKERR( MatGetOptionsPrefix(self.mat, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":531
 *         CHKERR( MatSetOptionsPrefix(self.mat, cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( MatGetOptionsPrefix(self.mat, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":536
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetFromOptions(self.mat) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_89setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_88setFromOptions[] = "Mat.setFromOptions(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_89setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_88setFromOptions(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_88setFromOptions(struct PyPetscMatObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/Mat.pyx":537
 * 
 *     def setFromOptions(self):
 *         CHKERR( MatSetFromOptions(self.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def setUp(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetFromOptions(__pyx_v_self->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 537, __pyx_L1_error)

  /* "PETSc/Mat.pyx":536
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetFromOptions(self.mat) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":539
 *         CHKERR( MatSetFromOptions(self.mat) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetUp(self.mat) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_91setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_90setUp[] = "Mat.setUp(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_91setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUp (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUp", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUp", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_90setUp(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_90setUp(struct PyPetscMatObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUp", 0);

  /* "PETSc/Mat.pyx":540
 * 
 *     def setUp(self):
 *         CHKERR( MatSetUp(self.mat) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetUp(__pyx_v_self->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 540, __pyx_L1_error)

  /* "PETSc/Mat.pyx":541
 *     def setUp(self):
 *         CHKERR( MatSetUp(self.mat) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setOption(self, option, flag):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":539
 *         CHKERR( MatSetFromOptions(self.mat) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetUp(self.mat) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":543
 *         return self
 * 
 *     def setOption(self, option, flag):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetOption(self.mat, option, flag) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_93setOption(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_92setOption[] = "Mat.setOption(self, option, flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_93setOption(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_option = 0;
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOption (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_option,&__pyx_n_s_flag,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_option)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flag)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setOption", 1, 2, 2, 1); __PYX_ERR(33, 543, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setOption") < 0)) __PYX_ERR(33, 543, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_option = values[0];
    __pyx_v_flag = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOption", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 543, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setOption", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_92setOption(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_option, __pyx_v_flag);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_92setOption(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_option, PyObject *__pyx_v_flag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MatOption __pyx_t_1;
  PetscBool __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setOption", 0);

  /* "PETSc/Mat.pyx":544
 * 
 *     def setOption(self, option, flag):
 *         CHKERR( MatSetOption(self.mat, option, flag) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_1 = ((MatOption)__Pyx_PyInt_As_MatOption(__pyx_v_option)); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 544, __pyx_L1_error)
  __pyx_t_2 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_flag)); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 544, __pyx_L1_error)
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetOption(__pyx_v_self->mat, __pyx_t_1, __pyx_t_2)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 544, __pyx_L1_error)

  /* "PETSc/Mat.pyx":543
 *         return self
 * 
 *     def setOption(self, option, flag):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetOption(self.mat, option, flag) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setOption", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":546
 *         CHKERR( MatSetOption(self.mat, option, flag) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscMatType cval = NULL
 *         CHKERR( MatGetType(self.mat, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_95getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_94getType[] = "Mat.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_95getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_94getType(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_94getType(struct PyPetscMatObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/Mat.pyx":547
 * 
 *     def getType(self):
 *         cdef PetscMatType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetType(self.mat, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Mat.pyx":548
 *     def getType(self):
 *         cdef PetscMatType cval = NULL
 *         CHKERR( MatGetType(self.mat, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetType(__pyx_v_self->mat, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 548, __pyx_L1_error)

  /* "PETSc/Mat.pyx":549
 *         cdef PetscMatType cval = NULL
 *         CHKERR( MatGetType(self.mat, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def getSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":546
 *         CHKERR( MatSetOption(self.mat, option, flag) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscMatType cval = NULL
 *         CHKERR( MatGetType(self.mat, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":551
 *         return bytes2str(cval)
 * 
 *     def getSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt M = 0, N = 0
 *         CHKERR( MatGetSize(self.mat, &M, &N) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_97getSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_96getSize[] = "Mat.getSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_97getSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_96getSize(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_96getSize(struct PyPetscMatObject *__pyx_v_self) {
  PetscInt __pyx_v_M;
  PetscInt __pyx_v_N;
  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;
  __Pyx_RefNannySetupContext("getSize", 0);

  /* "PETSc/Mat.pyx":552
 * 
 *     def getSize(self):
 *         cdef PetscInt M = 0, N = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSize(self.mat, &M, &N) )
 *         return (toInt(M), toInt(N))
 */
  __pyx_v_M = 0;
  __pyx_v_N = 0;

  /* "PETSc/Mat.pyx":553
 *     def getSize(self):
 *         cdef PetscInt M = 0, N = 0
 *         CHKERR( MatGetSize(self.mat, &M, &N) )             # <<<<<<<<<<<<<<
 *         return (toInt(M), toInt(N))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetSize(__pyx_v_self->mat, (&__pyx_v_M), (&__pyx_v_N))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 553, __pyx_L1_error)

  /* "PETSc/Mat.pyx":554
 *         cdef PetscInt M = 0, N = 0
 *         CHKERR( MatGetSize(self.mat, &M, &N) )
 *         return (toInt(M), toInt(N))             # <<<<<<<<<<<<<<
 * 
 *     def getLocalSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_M); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 554, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":551
 *         return bytes2str(cval)
 * 
 *     def getSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt M = 0, N = 0
 *         CHKERR( MatGetSize(self.mat, &M, &N) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":556
 *         return (toInt(M), toInt(N))
 * 
 *     def getLocalSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt m = 0, n = 0
 *         CHKERR( MatGetLocalSize(self.mat, &m, &n) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_99getLocalSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_98getLocalSize[] = "Mat.getLocalSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_99getLocalSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLocalSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getLocalSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getLocalSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_98getLocalSize(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_98getLocalSize(struct PyPetscMatObject *__pyx_v_self) {
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  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;
  __Pyx_RefNannySetupContext("getLocalSize", 0);

  /* "PETSc/Mat.pyx":557
 * 
 *     def getLocalSize(self):
 *         cdef PetscInt m = 0, n = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetLocalSize(self.mat, &m, &n) )
 *         return (toInt(m), toInt(n))
 */
  __pyx_v_m = 0;
  __pyx_v_n = 0;

  /* "PETSc/Mat.pyx":558
 *     def getLocalSize(self):
 *         cdef PetscInt m = 0, n = 0
 *         CHKERR( MatGetLocalSize(self.mat, &m, &n) )             # <<<<<<<<<<<<<<
 *         return (toInt(m), toInt(n))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetLocalSize(__pyx_v_self->mat, (&__pyx_v_m), (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 558, __pyx_L1_error)

  /* "PETSc/Mat.pyx":559
 *         cdef PetscInt m = 0, n = 0
 *         CHKERR( MatGetLocalSize(self.mat, &m, &n) )
 *         return (toInt(m), toInt(n))             # <<<<<<<<<<<<<<
 * 
 *     def getSizes(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_m); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 559, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":556
 *         return (toInt(M), toInt(N))
 * 
 *     def getLocalSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt m = 0, n = 0
 *         CHKERR( MatGetLocalSize(self.mat, &m, &n) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getLocalSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":561
 *         return (toInt(m), toInt(n))
 * 
 *     def getSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt m = 0, n = 0
 *         cdef PetscInt M = 0, N = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_101getSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_100getSizes[] = "Mat.getSizes(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_101getSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSizes (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSizes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSizes", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_100getSizes(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_100getSizes(struct PyPetscMatObject *__pyx_v_self) {
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_M;
  PetscInt __pyx_v_N;
  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;
  __Pyx_RefNannySetupContext("getSizes", 0);

  /* "PETSc/Mat.pyx":562
 * 
 *     def getSizes(self):
 *         cdef PetscInt m = 0, n = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt M = 0, N = 0
 *         CHKERR( MatGetLocalSize(self.mat, &m, &n) )
 */
  __pyx_v_m = 0;
  __pyx_v_n = 0;

  /* "PETSc/Mat.pyx":563
 *     def getSizes(self):
 *         cdef PetscInt m = 0, n = 0
 *         cdef PetscInt M = 0, N = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetLocalSize(self.mat, &m, &n) )
 *         CHKERR( MatGetSize(self.mat, &M, &N) )
 */
  __pyx_v_M = 0;
  __pyx_v_N = 0;

  /* "PETSc/Mat.pyx":564
 *         cdef PetscInt m = 0, n = 0
 *         cdef PetscInt M = 0, N = 0
 *         CHKERR( MatGetLocalSize(self.mat, &m, &n) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSize(self.mat, &M, &N) )
 *         return ((toInt(m), toInt(M)), (toInt(n), toInt(N)))
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetLocalSize(__pyx_v_self->mat, (&__pyx_v_m), (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 564, __pyx_L1_error)

  /* "PETSc/Mat.pyx":565
 *         cdef PetscInt M = 0, N = 0
 *         CHKERR( MatGetLocalSize(self.mat, &m, &n) )
 *         CHKERR( MatGetSize(self.mat, &M, &N) )             # <<<<<<<<<<<<<<
 *         return ((toInt(m), toInt(M)), (toInt(n), toInt(N)))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetSize(__pyx_v_self->mat, (&__pyx_v_M), (&__pyx_v_N))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 565, __pyx_L1_error)

  /* "PETSc/Mat.pyx":566
 *         CHKERR( MatGetLocalSize(self.mat, &m, &n) )
 *         CHKERR( MatGetSize(self.mat, &M, &N) )
 *         return ((toInt(m), toInt(M)), (toInt(n), toInt(N)))             # <<<<<<<<<<<<<<
 * 
 *     def getBlockSize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_m); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_M); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 566, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_N); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 566, __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_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":561
 *         return (toInt(m), toInt(n))
 * 
 *     def getSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt m = 0, n = 0
 *         cdef PetscInt M = 0, N = 0
 */

  /* 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("petsc4py.PETSc.Mat.getSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":568
 *         return ((toInt(m), toInt(M)), (toInt(n), toInt(N)))
 * 
 *     def getBlockSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = 0
 *         CHKERR( MatGetBlockSize(self.mat, &bs) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_103getBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_102getBlockSize[] = "Mat.getBlockSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_103getBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBlockSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getBlockSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getBlockSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_102getBlockSize(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_102getBlockSize(struct PyPetscMatObject *__pyx_v_self) {
  PetscInt __pyx_v_bs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getBlockSize", 0);

  /* "PETSc/Mat.pyx":569
 * 
 *     def getBlockSize(self):
 *         cdef PetscInt bs = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetBlockSize(self.mat, &bs) )
 *         return toInt(bs)
 */
  __pyx_v_bs = 0;

  /* "PETSc/Mat.pyx":570
 *     def getBlockSize(self):
 *         cdef PetscInt bs = 0
 *         CHKERR( MatGetBlockSize(self.mat, &bs) )             # <<<<<<<<<<<<<<
 *         return toInt(bs)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetBlockSize(__pyx_v_self->mat, (&__pyx_v_bs))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 570, __pyx_L1_error)

  /* "PETSc/Mat.pyx":571
 *         cdef PetscInt bs = 0
 *         CHKERR( MatGetBlockSize(self.mat, &bs) )
 *         return toInt(bs)             # <<<<<<<<<<<<<<
 * 
 *     def getBlockSizes(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_bs); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":568
 *         return ((toInt(m), toInt(M)), (toInt(n), toInt(N)))
 * 
 *     def getBlockSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = 0
 *         CHKERR( MatGetBlockSize(self.mat, &bs) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getBlockSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":573
 *         return toInt(bs)
 * 
 *     def getBlockSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt rbs = 0, cbs = 0
 *         CHKERR( MatGetBlockSizes(self.mat, &rbs, &cbs) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_105getBlockSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_104getBlockSizes[] = "Mat.getBlockSizes(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_105getBlockSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBlockSizes (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getBlockSizes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getBlockSizes", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_104getBlockSizes(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_104getBlockSizes(struct PyPetscMatObject *__pyx_v_self) {
  PetscInt __pyx_v_rbs;
  PetscInt __pyx_v_cbs;
  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;
  __Pyx_RefNannySetupContext("getBlockSizes", 0);

  /* "PETSc/Mat.pyx":574
 * 
 *     def getBlockSizes(self):
 *         cdef PetscInt rbs = 0, cbs = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetBlockSizes(self.mat, &rbs, &cbs) )
 *         return (toInt(rbs), toInt(cbs))
 */
  __pyx_v_rbs = 0;
  __pyx_v_cbs = 0;

  /* "PETSc/Mat.pyx":575
 *     def getBlockSizes(self):
 *         cdef PetscInt rbs = 0, cbs = 0
 *         CHKERR( MatGetBlockSizes(self.mat, &rbs, &cbs) )             # <<<<<<<<<<<<<<
 *         return (toInt(rbs), toInt(cbs))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetBlockSizes(__pyx_v_self->mat, (&__pyx_v_rbs), (&__pyx_v_cbs))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 575, __pyx_L1_error)

  /* "PETSc/Mat.pyx":576
 *         cdef PetscInt rbs = 0, cbs = 0
 *         CHKERR( MatGetBlockSizes(self.mat, &rbs, &cbs) )
 *         return (toInt(rbs), toInt(cbs))             # <<<<<<<<<<<<<<
 * 
 *     def getOwnershipRange(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_rbs); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_cbs); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 576, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":573
 *         return toInt(bs)
 * 
 *     def getBlockSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt rbs = 0, cbs = 0
 *         CHKERR( MatGetBlockSizes(self.mat, &rbs, &cbs) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getBlockSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":578
 *         return (toInt(rbs), toInt(cbs))
 * 
 *     def getOwnershipRange(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival1 = 0, ival2 = 0
 *         CHKERR( MatGetOwnershipRange(self.mat, &ival1, &ival2) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_107getOwnershipRange(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_106getOwnershipRange[] = "Mat.getOwnershipRange(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_107getOwnershipRange(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOwnershipRange (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOwnershipRange", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOwnershipRange", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_106getOwnershipRange(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_106getOwnershipRange(struct PyPetscMatObject *__pyx_v_self) {
  PetscInt __pyx_v_ival1;
  PetscInt __pyx_v_ival2;
  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;
  __Pyx_RefNannySetupContext("getOwnershipRange", 0);

  /* "PETSc/Mat.pyx":579
 * 
 *     def getOwnershipRange(self):
 *         cdef PetscInt ival1 = 0, ival2 = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetOwnershipRange(self.mat, &ival1, &ival2) )
 *         return (toInt(ival1), toInt(ival2))
 */
  __pyx_v_ival1 = 0;
  __pyx_v_ival2 = 0;

  /* "PETSc/Mat.pyx":580
 *     def getOwnershipRange(self):
 *         cdef PetscInt ival1 = 0, ival2 = 0
 *         CHKERR( MatGetOwnershipRange(self.mat, &ival1, &ival2) )             # <<<<<<<<<<<<<<
 *         return (toInt(ival1), toInt(ival2))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetOwnershipRange(__pyx_v_self->mat, (&__pyx_v_ival1), (&__pyx_v_ival2))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 580, __pyx_L1_error)

  /* "PETSc/Mat.pyx":581
 *         cdef PetscInt ival1 = 0, ival2 = 0
 *         CHKERR( MatGetOwnershipRange(self.mat, &ival1, &ival2) )
 *         return (toInt(ival1), toInt(ival2))             # <<<<<<<<<<<<<<
 * 
 *     def getOwnershipRanges(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival1); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival2); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 581, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":578
 *         return (toInt(rbs), toInt(cbs))
 * 
 *     def getOwnershipRange(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival1 = 0, ival2 = 0
 *         CHKERR( MatGetOwnershipRange(self.mat, &ival1, &ival2) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getOwnershipRange", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":583
 *         return (toInt(ival1), toInt(ival2))
 * 
 *     def getOwnershipRanges(self):             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *rowrng = NULL
 *         CHKERR( MatGetOwnershipRanges(self.mat, &rowrng) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_109getOwnershipRanges(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_108getOwnershipRanges[] = "Mat.getOwnershipRanges(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_109getOwnershipRanges(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOwnershipRanges (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOwnershipRanges", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOwnershipRanges", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_108getOwnershipRanges(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_108getOwnershipRanges(struct PyPetscMatObject *__pyx_v_self) {
  const PetscInt *__pyx_v_rowrng;
  MPI_Comm __pyx_v_comm;
  int __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getOwnershipRanges", 0);

  /* "PETSc/Mat.pyx":584
 * 
 *     def getOwnershipRanges(self):
 *         cdef const_PetscInt *rowrng = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetOwnershipRanges(self.mat, &rowrng) )
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 */
  __pyx_v_rowrng = NULL;

  /* "PETSc/Mat.pyx":585
 *     def getOwnershipRanges(self):
 *         cdef const_PetscInt *rowrng = NULL
 *         CHKERR( MatGetOwnershipRanges(self.mat, &rowrng) )             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.mat, &comm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetOwnershipRanges(__pyx_v_self->mat, (&__pyx_v_rowrng))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 585, __pyx_L1_error)

  /* "PETSc/Mat.pyx":586
 *         cdef const_PetscInt *rowrng = NULL
 *         CHKERR( MatGetOwnershipRanges(self.mat, &rowrng) )
 *         cdef MPI_Comm comm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.mat, &comm) )
 *         cdef int size = -1
 */
  __pyx_v_comm = MPI_COMM_NULL;

  /* "PETSc/Mat.pyx":587
 *         CHKERR( MatGetOwnershipRanges(self.mat, &rowrng) )
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.mat, &comm) )             # <<<<<<<<<<<<<<
 *         cdef int size = -1
 *         CHKERR( MPI_Comm_size(comm, &size) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetComm(((PetscObject)__pyx_v_self->mat), (&__pyx_v_comm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 587, __pyx_L1_error)

  /* "PETSc/Mat.pyx":588
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.mat, &comm) )
 *         cdef int size = -1             # <<<<<<<<<<<<<<
 *         CHKERR( MPI_Comm_size(comm, &size) )
 *         return array_i(size+1, rowrng)
 */
  __pyx_v_size = -1;

  /* "PETSc/Mat.pyx":589
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.mat, &comm) )
 *         cdef int size = -1
 *         CHKERR( MPI_Comm_size(comm, &size) )             # <<<<<<<<<<<<<<
 *         return array_i(size+1, rowrng)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MPI_Comm_size(__pyx_v_comm, (&__pyx_v_size))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 589, __pyx_L1_error)

  /* "PETSc/Mat.pyx":590
 *         cdef int size = -1
 *         CHKERR( MPI_Comm_size(comm, &size) )
 *         return array_i(size+1, rowrng)             # <<<<<<<<<<<<<<
 * 
 *     def getOwnershipRangeColumn(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((__pyx_v_size + 1), __pyx_v_rowrng)); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":583
 *         return (toInt(ival1), toInt(ival2))
 * 
 *     def getOwnershipRanges(self):             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *rowrng = NULL
 *         CHKERR( MatGetOwnershipRanges(self.mat, &rowrng) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getOwnershipRanges", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":592
 *         return array_i(size+1, rowrng)
 * 
 *     def getOwnershipRangeColumn(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival1 = 0, ival2 = 0
 *         CHKERR( MatGetOwnershipRangeColumn(self.mat, &ival1, &ival2) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_111getOwnershipRangeColumn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_110getOwnershipRangeColumn[] = "Mat.getOwnershipRangeColumn(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_111getOwnershipRangeColumn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOwnershipRangeColumn (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOwnershipRangeColumn", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOwnershipRangeColumn", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_110getOwnershipRangeColumn(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_110getOwnershipRangeColumn(struct PyPetscMatObject *__pyx_v_self) {
  PetscInt __pyx_v_ival1;
  PetscInt __pyx_v_ival2;
  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;
  __Pyx_RefNannySetupContext("getOwnershipRangeColumn", 0);

  /* "PETSc/Mat.pyx":593
 * 
 *     def getOwnershipRangeColumn(self):
 *         cdef PetscInt ival1 = 0, ival2 = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetOwnershipRangeColumn(self.mat, &ival1, &ival2) )
 *         return (toInt(ival1), toInt(ival2))
 */
  __pyx_v_ival1 = 0;
  __pyx_v_ival2 = 0;

  /* "PETSc/Mat.pyx":594
 *     def getOwnershipRangeColumn(self):
 *         cdef PetscInt ival1 = 0, ival2 = 0
 *         CHKERR( MatGetOwnershipRangeColumn(self.mat, &ival1, &ival2) )             # <<<<<<<<<<<<<<
 *         return (toInt(ival1), toInt(ival2))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetOwnershipRangeColumn(__pyx_v_self->mat, (&__pyx_v_ival1), (&__pyx_v_ival2))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 594, __pyx_L1_error)

  /* "PETSc/Mat.pyx":595
 *         cdef PetscInt ival1 = 0, ival2 = 0
 *         CHKERR( MatGetOwnershipRangeColumn(self.mat, &ival1, &ival2) )
 *         return (toInt(ival1), toInt(ival2))             # <<<<<<<<<<<<<<
 * 
 *     def getOwnershipRangesColumn(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival1); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival2); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 595, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":592
 *         return array_i(size+1, rowrng)
 * 
 *     def getOwnershipRangeColumn(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival1 = 0, ival2 = 0
 *         CHKERR( MatGetOwnershipRangeColumn(self.mat, &ival1, &ival2) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getOwnershipRangeColumn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":597
 *         return (toInt(ival1), toInt(ival2))
 * 
 *     def getOwnershipRangesColumn(self):             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *colrng = NULL
 *         CHKERR( MatGetOwnershipRangesColumn(self.mat, &colrng) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_113getOwnershipRangesColumn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_112getOwnershipRangesColumn[] = "Mat.getOwnershipRangesColumn(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_113getOwnershipRangesColumn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOwnershipRangesColumn (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOwnershipRangesColumn", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOwnershipRangesColumn", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_112getOwnershipRangesColumn(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_112getOwnershipRangesColumn(struct PyPetscMatObject *__pyx_v_self) {
  const PetscInt *__pyx_v_colrng;
  MPI_Comm __pyx_v_comm;
  int __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getOwnershipRangesColumn", 0);

  /* "PETSc/Mat.pyx":598
 * 
 *     def getOwnershipRangesColumn(self):
 *         cdef const_PetscInt *colrng = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetOwnershipRangesColumn(self.mat, &colrng) )
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 */
  __pyx_v_colrng = NULL;

  /* "PETSc/Mat.pyx":599
 *     def getOwnershipRangesColumn(self):
 *         cdef const_PetscInt *colrng = NULL
 *         CHKERR( MatGetOwnershipRangesColumn(self.mat, &colrng) )             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.mat, &comm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetOwnershipRangesColumn(__pyx_v_self->mat, (&__pyx_v_colrng))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 599, __pyx_L1_error)

  /* "PETSc/Mat.pyx":600
 *         cdef const_PetscInt *colrng = NULL
 *         CHKERR( MatGetOwnershipRangesColumn(self.mat, &colrng) )
 *         cdef MPI_Comm comm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.mat, &comm) )
 *         cdef int size = -1
 */
  __pyx_v_comm = MPI_COMM_NULL;

  /* "PETSc/Mat.pyx":601
 *         CHKERR( MatGetOwnershipRangesColumn(self.mat, &colrng) )
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.mat, &comm) )             # <<<<<<<<<<<<<<
 *         cdef int size = -1
 *         CHKERR( MPI_Comm_size(comm, &size) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetComm(((PetscObject)__pyx_v_self->mat), (&__pyx_v_comm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 601, __pyx_L1_error)

  /* "PETSc/Mat.pyx":602
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.mat, &comm) )
 *         cdef int size = -1             # <<<<<<<<<<<<<<
 *         CHKERR( MPI_Comm_size(comm, &size) )
 *         return array_i(size+1, colrng)
 */
  __pyx_v_size = -1;

  /* "PETSc/Mat.pyx":603
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.mat, &comm) )
 *         cdef int size = -1
 *         CHKERR( MPI_Comm_size(comm, &size) )             # <<<<<<<<<<<<<<
 *         return array_i(size+1, colrng)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MPI_Comm_size(__pyx_v_comm, (&__pyx_v_size))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 603, __pyx_L1_error)

  /* "PETSc/Mat.pyx":604
 *         cdef int size = -1
 *         CHKERR( MPI_Comm_size(comm, &size) )
 *         return array_i(size+1, colrng)             # <<<<<<<<<<<<<<
 * 
 *     def getOwnershipIS(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((__pyx_v_size + 1), __pyx_v_colrng)); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":597
 *         return (toInt(ival1), toInt(ival2))
 * 
 *     def getOwnershipRangesColumn(self):             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *colrng = NULL
 *         CHKERR( MatGetOwnershipRangesColumn(self.mat, &colrng) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getOwnershipRangesColumn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":606
 *         return array_i(size+1, colrng)
 * 
 *     def getOwnershipIS(self):             # <<<<<<<<<<<<<<
 *         cdef IS rows = IS()
 *         cdef IS cols = IS()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_115getOwnershipIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_114getOwnershipIS[] = "Mat.getOwnershipIS(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_115getOwnershipIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOwnershipIS (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOwnershipIS", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOwnershipIS", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_114getOwnershipIS(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_114getOwnershipIS(struct PyPetscMatObject *__pyx_v_self) {
  struct PyPetscISObject *__pyx_v_rows = 0;
  struct PyPetscISObject *__pyx_v_cols = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getOwnershipIS", 0);

  /* "PETSc/Mat.pyx":607
 * 
 *     def getOwnershipIS(self):
 *         cdef IS rows = IS()             # <<<<<<<<<<<<<<
 *         cdef IS cols = IS()
 *         CHKERR( MatGetOwnershipIS(self.mat, &rows.iset, &cols.iset) )
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rows = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":608
 *     def getOwnershipIS(self):
 *         cdef IS rows = IS()
 *         cdef IS cols = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetOwnershipIS(self.mat, &rows.iset, &cols.iset) )
 *         return (rows, cols)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cols = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":609
 *         cdef IS rows = IS()
 *         cdef IS cols = IS()
 *         CHKERR( MatGetOwnershipIS(self.mat, &rows.iset, &cols.iset) )             # <<<<<<<<<<<<<<
 *         return (rows, cols)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetOwnershipIS(__pyx_v_self->mat, (&__pyx_v_rows->iset), (&__pyx_v_cols->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 609, __pyx_L1_error)

  /* "PETSc/Mat.pyx":610
 *         cdef IS cols = IS()
 *         CHKERR( MatGetOwnershipIS(self.mat, &rows.iset, &cols.iset) )
 *         return (rows, cols)             # <<<<<<<<<<<<<<
 * 
 *     def getInfo(self, info=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_rows));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rows));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_rows));
  __Pyx_INCREF(((PyObject *)__pyx_v_cols));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_cols));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_cols));
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":606
 *         return array_i(size+1, colrng)
 * 
 *     def getOwnershipIS(self):             # <<<<<<<<<<<<<<
 *         cdef IS rows = IS()
 *         cdef IS cols = IS()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getOwnershipIS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rows);
  __Pyx_XDECREF((PyObject *)__pyx_v_cols);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":612
 *         return (rows, cols)
 * 
 *     def getInfo(self, info=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatInfoType itype = infotype(info)
 *         cdef PetscMatInfo cinfo
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_117getInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_116getInfo[] = "Mat.getInfo(self, info=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_117getInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_info = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getInfo (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_info,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_info);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getInfo") < 0)) __PYX_ERR(33, 612, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_info = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getInfo", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 612, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_116getInfo(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_info);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_116getInfo(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_info) {
  MatInfoType __pyx_v_itype;
  MatInfo __pyx_v_cinfo;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MatInfoType __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getInfo", 0);

  /* "PETSc/Mat.pyx":613
 * 
 *     def getInfo(self, info=None):
 *         cdef PetscMatInfoType itype = infotype(info)             # <<<<<<<<<<<<<<
 *         cdef PetscMatInfo cinfo
 *         CHKERR( MatGetInfo(self.mat, itype, &cinfo) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_infotype(__pyx_v_info); if (unlikely(__pyx_t_1 == ((MatInfoType)-1L))) __PYX_ERR(33, 613, __pyx_L1_error)
  __pyx_v_itype = __pyx_t_1;

  /* "PETSc/Mat.pyx":615
 *         cdef PetscMatInfoType itype = infotype(info)
 *         cdef PetscMatInfo cinfo
 *         CHKERR( MatGetInfo(self.mat, itype, &cinfo) )             # <<<<<<<<<<<<<<
 *         return cinfo
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetInfo(__pyx_v_self->mat, __pyx_v_itype, (&__pyx_v_cinfo))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 615, __pyx_L1_error)

  /* "PETSc/Mat.pyx":616
 *         cdef PetscMatInfo cinfo
 *         CHKERR( MatGetInfo(self.mat, itype, &cinfo) )
 *         return cinfo             # <<<<<<<<<<<<<<
 * 
 *     def duplicate(self, copy=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_convert__to_py_MatInfo(__pyx_v_cinfo); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":612
 *         return (rows, cols)
 * 
 *     def getInfo(self, info=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatInfoType itype = infotype(info)
 *         cdef PetscMatInfo cinfo
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":618
 *         return cinfo
 * 
 *     def duplicate(self, copy=False):             # <<<<<<<<<<<<<<
 *         cdef PetscMatDuplicateOption flag = MAT_DO_NOT_COPY_VALUES
 *         if copy: flag = MAT_COPY_VALUES
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_119duplicate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_118duplicate[] = "Mat.duplicate(self, copy=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_119duplicate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_copy = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("duplicate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_copy,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_copy);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "duplicate") < 0)) __PYX_ERR(33, 618, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_copy = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("duplicate", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 618, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.duplicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_118duplicate(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_copy);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_118duplicate(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_copy) {
  MatDuplicateOption __pyx_v_flag;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  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;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("duplicate", 0);

  /* "PETSc/Mat.pyx":619
 * 
 *     def duplicate(self, copy=False):
 *         cdef PetscMatDuplicateOption flag = MAT_DO_NOT_COPY_VALUES             # <<<<<<<<<<<<<<
 *         if copy: flag = MAT_COPY_VALUES
 *         cdef Mat mat = type(self)()
 */
  __pyx_v_flag = MAT_DO_NOT_COPY_VALUES;

  /* "PETSc/Mat.pyx":620
 *     def duplicate(self, copy=False):
 *         cdef PetscMatDuplicateOption flag = MAT_DO_NOT_COPY_VALUES
 *         if copy: flag = MAT_COPY_VALUES             # <<<<<<<<<<<<<<
 *         cdef Mat mat = type(self)()
 *         CHKERR( MatDuplicate(self.mat, flag, &mat.mat) )
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(33, 620, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_v_flag = MAT_COPY_VALUES;
  }

  /* "PETSc/Mat.pyx":621
 *         cdef PetscMatDuplicateOption flag = MAT_DO_NOT_COPY_VALUES
 *         if copy: flag = MAT_COPY_VALUES
 *         cdef Mat mat = type(self)()             # <<<<<<<<<<<<<<
 *         CHKERR( MatDuplicate(self.mat, flag, &mat.mat) )
 *         return mat
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __pyx_t_3 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 621, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 621, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 621, __pyx_L1_error)
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Mat.pyx":622
 *         if copy: flag = MAT_COPY_VALUES
 *         cdef Mat mat = type(self)()
 *         CHKERR( MatDuplicate(self.mat, flag, &mat.mat) )             # <<<<<<<<<<<<<<
 *         return mat
 * 
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDuplicate(__pyx_v_self->mat, __pyx_v_flag, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 622, __pyx_L1_error)

  /* "PETSc/Mat.pyx":623
 *         cdef Mat mat = type(self)()
 *         CHKERR( MatDuplicate(self.mat, flag, &mat.mat) )
 *         return mat             # <<<<<<<<<<<<<<
 * 
 *     def copy(self, Mat result=None, structure=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = ((PyObject *)__pyx_v_mat);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":618
 *         return cinfo
 * 
 *     def duplicate(self, copy=False):             # <<<<<<<<<<<<<<
 *         cdef PetscMatDuplicateOption flag = MAT_DO_NOT_COPY_VALUES
 *         if copy: flag = MAT_COPY_VALUES
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.duplicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":625
 *         return mat
 * 
 *     def copy(self, Mat result=None, structure=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatDuplicateOption copy = MAT_COPY_VALUES
 *         cdef PetscMatStructure mstr = matstructure(structure)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_121copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_120copy[] = "Mat.copy(self, Mat result=None, structure=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_121copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_result = 0;
  PyObject *__pyx_v_structure = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_result,&__pyx_n_s_structure,0};
    PyObject* values[2] = {0,0};
    values[0] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_structure);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy") < 0)) __PYX_ERR(33, 625, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_result = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_structure = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 625, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "result", 0))) __PYX_ERR(33, 625, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_120copy(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_result, __pyx_v_structure);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_120copy(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_result, PyObject *__pyx_v_structure) {
  MatDuplicateOption __pyx_v_copy;
  MatStructure __pyx_v_mstr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MatStructure __pyx_t_1;
  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;
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_result);

  /* "PETSc/Mat.pyx":626
 * 
 *     def copy(self, Mat result=None, structure=None):
 *         cdef PetscMatDuplicateOption copy = MAT_COPY_VALUES             # <<<<<<<<<<<<<<
 *         cdef PetscMatStructure mstr = matstructure(structure)
 *         if result is None:
 */
  __pyx_v_copy = MAT_COPY_VALUES;

  /* "PETSc/Mat.pyx":627
 *     def copy(self, Mat result=None, structure=None):
 *         cdef PetscMatDuplicateOption copy = MAT_COPY_VALUES
 *         cdef PetscMatStructure mstr = matstructure(structure)             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = type(self)()
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matstructure(__pyx_v_structure); if (unlikely(__pyx_t_1 == ((MatStructure)-1L))) __PYX_ERR(33, 627, __pyx_L1_error)
  __pyx_v_mstr = __pyx_t_1;

  /* "PETSc/Mat.pyx":628
 *         cdef PetscMatDuplicateOption copy = MAT_COPY_VALUES
 *         cdef PetscMatStructure mstr = matstructure(structure)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = type(self)()
 *         if result.mat == NULL:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_result) == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":629
 *         cdef PetscMatStructure mstr = matstructure(structure)
 *         if result is None:
 *             result = type(self)()             # <<<<<<<<<<<<<<
 *         if result.mat == NULL:
 *             CHKERR( MatDuplicate(self.mat, copy, &result.mat) )
 */
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __pyx_t_5 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 629, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 629, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 629, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_result, ((struct PyPetscMatObject *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "PETSc/Mat.pyx":628
 *         cdef PetscMatDuplicateOption copy = MAT_COPY_VALUES
 *         cdef PetscMatStructure mstr = matstructure(structure)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = type(self)()
 *         if result.mat == NULL:
 */
  }

  /* "PETSc/Mat.pyx":630
 *         if result is None:
 *             result = type(self)()
 *         if result.mat == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatDuplicate(self.mat, copy, &result.mat) )
 *         else:
 */
  __pyx_t_3 = ((__pyx_v_result->mat == NULL) != 0);
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":631
 *             result = type(self)()
 *         if result.mat == NULL:
 *             CHKERR( MatDuplicate(self.mat, copy, &result.mat) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( MatCopy(self.mat, result.mat, mstr) )
 */
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDuplicate(__pyx_v_self->mat, __pyx_v_copy, (&__pyx_v_result->mat))); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(33, 631, __pyx_L1_error)

    /* "PETSc/Mat.pyx":630
 *         if result is None:
 *             result = type(self)()
 *         if result.mat == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatDuplicate(self.mat, copy, &result.mat) )
 *         else:
 */
    goto __pyx_L4;
  }

  /* "PETSc/Mat.pyx":633
 *             CHKERR( MatDuplicate(self.mat, copy, &result.mat) )
 *         else:
 *             CHKERR( MatCopy(self.mat, result.mat, mstr) )             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  /*else*/ {
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCopy(__pyx_v_self->mat, __pyx_v_result->mat, __pyx_v_mstr)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(33, 633, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "PETSc/Mat.pyx":634
 *         else:
 *             CHKERR( MatCopy(self.mat, result.mat, mstr) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def load(self, Viewer viewer not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":625
 *         return mat
 * 
 *     def copy(self, Mat result=None, structure=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatDuplicateOption copy = MAT_COPY_VALUES
 *         cdef PetscMatStructure mstr = matstructure(structure)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.copy", __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;
}

/* "PETSc/Mat.pyx":636
 *         return result
 * 
 *     def load(self, Viewer viewer not None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_123load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_122load[] = "Mat.load(self, Viewer viewer)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_123load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,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);
        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_viewer)) != 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, "load") < 0)) __PYX_ERR(33, 636, __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_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 636, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 0, "viewer", 0))) __PYX_ERR(33, 636, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_122load(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_122load(struct PyPetscMatObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  MPI_Comm __pyx_v_comm;
  PetscObject __pyx_v_obj;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("load", 0);

  /* "PETSc/Mat.pyx":637
 * 
 *     def load(self, Viewer viewer not None):
 *         cdef MPI_Comm comm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 *         if self.mat == NULL:
 */
  __pyx_v_comm = MPI_COMM_NULL;

  /* "PETSc/Mat.pyx":638
 *     def load(self, Viewer viewer not None):
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)             # <<<<<<<<<<<<<<
 *         if self.mat == NULL:
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 */
  __pyx_v_obj = ((PetscObject)__pyx_v_viewer->vwr);

  /* "PETSc/Mat.pyx":639
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 *         if self.mat == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 *             CHKERR( MatCreate(comm, &self.mat) )
 */
  __pyx_t_1 = ((__pyx_v_self->mat == NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Mat.pyx":640
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 *         if self.mat == NULL:
 *             CHKERR( PetscObjectGetComm(obj, &comm) )             # <<<<<<<<<<<<<<
 *             CHKERR( MatCreate(comm, &self.mat) )
 *         CHKERR( MatLoad(self.mat, viewer.vwr) )
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetComm(__pyx_v_obj, (&__pyx_v_comm))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 640, __pyx_L1_error)

    /* "PETSc/Mat.pyx":641
 *         if self.mat == NULL:
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 *             CHKERR( MatCreate(comm, &self.mat) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatLoad(self.mat, viewer.vwr) )
 *         return self
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreate(__pyx_v_comm, (&__pyx_v_self->mat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 641, __pyx_L1_error)

    /* "PETSc/Mat.pyx":639
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 *         if self.mat == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 *             CHKERR( MatCreate(comm, &self.mat) )
 */
  }

  /* "PETSc/Mat.pyx":642
 *             CHKERR( PetscObjectGetComm(obj, &comm) )
 *             CHKERR( MatCreate(comm, &self.mat) )
 *         CHKERR( MatLoad(self.mat, viewer.vwr) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatLoad(__pyx_v_self->mat, __pyx_v_viewer->vwr)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 642, __pyx_L1_error)

  /* "PETSc/Mat.pyx":643
 *             CHKERR( MatCreate(comm, &self.mat) )
 *         CHKERR( MatLoad(self.mat, viewer.vwr) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def convert(self, mat_type=None, Mat out=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":636
 *         return result
 * 
 *     def load(self, Viewer viewer not None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         cdef PetscObject obj = <PetscObject>(viewer.vwr)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":645
 *         return self
 * 
 *     def convert(self, mat_type=None, Mat out=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatType mtype = MATSAME
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_125convert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_124convert[] = "Mat.convert(self, mat_type=None, Mat out=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_125convert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mat_type = 0;
  struct PyPetscMatObject *__pyx_v_out = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat_type,&__pyx_n_s_out,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = (PyObject *)((struct PyPetscMatObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mat_type);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convert") < 0)) __PYX_ERR(33, 645, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mat_type = values[0];
    __pyx_v_out = ((struct PyPetscMatObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("convert", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 645, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.convert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "out", 0))) __PYX_ERR(33, 645, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_124convert(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat_type, __pyx_v_out);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_124convert(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_mat_type, struct PyPetscMatObject *__pyx_v_out) {
  const char* __pyx_v_mtype;
  MatReuse __pyx_v_reuse;
  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("convert", 0);
  __Pyx_INCREF(__pyx_v_mat_type);
  __Pyx_INCREF((PyObject *)__pyx_v_out);

  /* "PETSc/Mat.pyx":646
 * 
 *     def convert(self, mat_type=None, Mat out=None):
 *         cdef PetscMatType mtype = MATSAME             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         mat_type = str2bytes(mat_type, &mtype)
 */
  __pyx_v_mtype = MATSAME;

  /* "PETSc/Mat.pyx":647
 *     def convert(self, mat_type=None, Mat out=None):
 *         cdef PetscMatType mtype = MATSAME
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX             # <<<<<<<<<<<<<<
 *         mat_type = str2bytes(mat_type, &mtype)
 *         if mtype == NULL: mtype = MATSAME
 */
  __pyx_v_reuse = MAT_INITIAL_MATRIX;

  /* "PETSc/Mat.pyx":648
 *         cdef PetscMatType mtype = MATSAME
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         mat_type = str2bytes(mat_type, &mtype)             # <<<<<<<<<<<<<<
 *         if mtype == NULL: mtype = MATSAME
 *         if out is None: out = self
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_mat_type, (&__pyx_v_mtype)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mat_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":649
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         mat_type = str2bytes(mat_type, &mtype)
 *         if mtype == NULL: mtype = MATSAME             # <<<<<<<<<<<<<<
 *         if out is None: out = self
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX
 */
  __pyx_t_2 = ((__pyx_v_mtype == NULL) != 0);
  if (__pyx_t_2) {
    __pyx_v_mtype = MATSAME;
  }

  /* "PETSc/Mat.pyx":650
 *         mat_type = str2bytes(mat_type, &mtype)
 *         if mtype == NULL: mtype = MATSAME
 *         if out is None: out = self             # <<<<<<<<<<<<<<
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX
 *         CHKERR( MatConvert(self.mat, mtype, reuse, &out.mat) )
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_out) == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_DECREF_SET(__pyx_v_out, __pyx_v_self);
  }

  /* "PETSc/Mat.pyx":651
 *         if mtype == NULL: mtype = MATSAME
 *         if out is None: out = self
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX             # <<<<<<<<<<<<<<
 *         CHKERR( MatConvert(self.mat, mtype, reuse, &out.mat) )
 *         return out
 */
  __pyx_t_3 = ((__pyx_v_out->mat != NULL) != 0);
  if (__pyx_t_3) {
    __pyx_v_reuse = MAT_REUSE_MATRIX;
  }

  /* "PETSc/Mat.pyx":652
 *         if out is None: out = self
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX
 *         CHKERR( MatConvert(self.mat, mtype, reuse, &out.mat) )             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatConvert(__pyx_v_self->mat, __pyx_v_mtype, __pyx_v_reuse, (&__pyx_v_out->mat))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 652, __pyx_L1_error)

  /* "PETSc/Mat.pyx":653
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX
 *         CHKERR( MatConvert(self.mat, mtype, reuse, &out.mat) )
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def transpose(self, Mat out=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":645
 *         return self
 * 
 *     def convert(self, mat_type=None, Mat out=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatType mtype = MATSAME
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.convert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mat_type);
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":655
 *         return out
 * 
 *     def transpose(self, Mat out=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         if out is None: out = self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_127transpose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_126transpose[] = "Mat.transpose(self, Mat out=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_127transpose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_out = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transpose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_out,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscMatObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "transpose") < 0)) __PYX_ERR(33, 655, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_out = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("transpose", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 655, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.transpose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "out", 0))) __PYX_ERR(33, 655, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_126transpose(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_out);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_126transpose(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_out) {
  MatReuse __pyx_v_reuse;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("transpose", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_out);

  /* "PETSc/Mat.pyx":656
 * 
 *     def transpose(self, Mat out=None):
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX             # <<<<<<<<<<<<<<
 *         if out is None: out = self
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX
 */
  __pyx_v_reuse = MAT_INITIAL_MATRIX;

  /* "PETSc/Mat.pyx":657
 *     def transpose(self, Mat out=None):
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         if out is None: out = self             # <<<<<<<<<<<<<<
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX
 *         CHKERR( MatTranspose(self.mat, reuse, &out.mat) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_out) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_DECREF_SET(__pyx_v_out, __pyx_v_self);
  }

  /* "PETSc/Mat.pyx":658
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         if out is None: out = self
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX             # <<<<<<<<<<<<<<
 *         CHKERR( MatTranspose(self.mat, reuse, &out.mat) )
 *         return out
 */
  __pyx_t_2 = ((__pyx_v_out->mat != NULL) != 0);
  if (__pyx_t_2) {
    __pyx_v_reuse = MAT_REUSE_MATRIX;
  }

  /* "PETSc/Mat.pyx":659
 *         if out is None: out = self
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX
 *         CHKERR( MatTranspose(self.mat, reuse, &out.mat) )             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatTranspose(__pyx_v_self->mat, __pyx_v_reuse, (&__pyx_v_out->mat))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 659, __pyx_L1_error)

  /* "PETSc/Mat.pyx":660
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX
 *         CHKERR( MatTranspose(self.mat, reuse, &out.mat) )
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def realPart(self, Mat out=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":655
 *         return out
 * 
 *     def transpose(self, Mat out=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         if out is None: out = self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.transpose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":662
 *         return out
 * 
 *     def realPart(self, Mat out=None):             # <<<<<<<<<<<<<<
 *         if out is None:
 *             out = self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_129realPart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_128realPart[] = "Mat.realPart(self, Mat out=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_129realPart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_out = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("realPart (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_out,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscMatObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "realPart") < 0)) __PYX_ERR(33, 662, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_out = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("realPart", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 662, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.realPart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "out", 0))) __PYX_ERR(33, 662, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_128realPart(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_out);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_128realPart(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_out) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("realPart", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_out);

  /* "PETSc/Mat.pyx":663
 * 
 *     def realPart(self, Mat out=None):
 *         if out is None:             # <<<<<<<<<<<<<<
 *             out = self
 *         elif out.mat == NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_out) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":664
 *     def realPart(self, Mat out=None):
 *         if out is None:
 *             out = self             # <<<<<<<<<<<<<<
 *         elif out.mat == NULL:
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_DECREF_SET(__pyx_v_out, __pyx_v_self);

    /* "PETSc/Mat.pyx":663
 * 
 *     def realPart(self, Mat out=None):
 *         if out is None:             # <<<<<<<<<<<<<<
 *             out = self
 *         elif out.mat == NULL:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Mat.pyx":665
 *         if out is None:
 *             out = self
 *         elif out.mat == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 *         CHKERR( MatRealPart(out.mat) )
 */
  __pyx_t_2 = ((__pyx_v_out->mat == NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":666
 *             out = self
 *         elif out.mat == NULL:
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatRealPart(out.mat) )
 *         return out
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDuplicate(__pyx_v_self->mat, MAT_COPY_VALUES, (&__pyx_v_out->mat))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 666, __pyx_L1_error)

    /* "PETSc/Mat.pyx":665
 *         if out is None:
 *             out = self
 *         elif out.mat == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 *         CHKERR( MatRealPart(out.mat) )
 */
  }
  __pyx_L3:;

  /* "PETSc/Mat.pyx":667
 *         elif out.mat == NULL:
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 *         CHKERR( MatRealPart(out.mat) )             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatRealPart(__pyx_v_out->mat)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 667, __pyx_L1_error)

  /* "PETSc/Mat.pyx":668
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 *         CHKERR( MatRealPart(out.mat) )
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def imagPart(self, Mat out=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":662
 *         return out
 * 
 *     def realPart(self, Mat out=None):             # <<<<<<<<<<<<<<
 *         if out is None:
 *             out = self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.realPart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":670
 *         return out
 * 
 *     def imagPart(self, Mat out=None):             # <<<<<<<<<<<<<<
 *         if out is None:
 *             out = self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_131imagPart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_130imagPart[] = "Mat.imagPart(self, Mat out=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_131imagPart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_out = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("imagPart (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_out,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscMatObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "imagPart") < 0)) __PYX_ERR(33, 670, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_out = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("imagPart", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 670, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.imagPart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "out", 0))) __PYX_ERR(33, 670, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_130imagPart(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_out);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_130imagPart(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_out) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("imagPart", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_out);

  /* "PETSc/Mat.pyx":671
 * 
 *     def imagPart(self, Mat out=None):
 *         if out is None:             # <<<<<<<<<<<<<<
 *             out = self
 *         elif out.mat == NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_out) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":672
 *     def imagPart(self, Mat out=None):
 *         if out is None:
 *             out = self             # <<<<<<<<<<<<<<
 *         elif out.mat == NULL:
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_DECREF_SET(__pyx_v_out, __pyx_v_self);

    /* "PETSc/Mat.pyx":671
 * 
 *     def imagPart(self, Mat out=None):
 *         if out is None:             # <<<<<<<<<<<<<<
 *             out = self
 *         elif out.mat == NULL:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Mat.pyx":673
 *         if out is None:
 *             out = self
 *         elif out.mat == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 *         CHKERR( MatImaginaryPart(out.mat) )
 */
  __pyx_t_2 = ((__pyx_v_out->mat == NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":674
 *             out = self
 *         elif out.mat == NULL:
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatImaginaryPart(out.mat) )
 *         return out
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDuplicate(__pyx_v_self->mat, MAT_COPY_VALUES, (&__pyx_v_out->mat))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 674, __pyx_L1_error)

    /* "PETSc/Mat.pyx":673
 *         if out is None:
 *             out = self
 *         elif out.mat == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 *         CHKERR( MatImaginaryPart(out.mat) )
 */
  }
  __pyx_L3:;

  /* "PETSc/Mat.pyx":675
 *         elif out.mat == NULL:
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 *         CHKERR( MatImaginaryPart(out.mat) )             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatImaginaryPart(__pyx_v_out->mat)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 675, __pyx_L1_error)

  /* "PETSc/Mat.pyx":676
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 *         CHKERR( MatImaginaryPart(out.mat) )
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def conjugate(self, Mat out=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":670
 *         return out
 * 
 *     def imagPart(self, Mat out=None):             # <<<<<<<<<<<<<<
 *         if out is None:
 *             out = self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.imagPart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":678
 *         return out
 * 
 *     def conjugate(self, Mat out=None):             # <<<<<<<<<<<<<<
 *         if out is None:
 *             out = self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_133conjugate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_132conjugate[] = "Mat.conjugate(self, Mat out=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_133conjugate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_out = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("conjugate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_out,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscMatObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "conjugate") < 0)) __PYX_ERR(33, 678, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_out = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("conjugate", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 678, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.conjugate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "out", 0))) __PYX_ERR(33, 678, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_132conjugate(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_out);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_132conjugate(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_out) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("conjugate", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_out);

  /* "PETSc/Mat.pyx":679
 * 
 *     def conjugate(self, Mat out=None):
 *         if out is None:             # <<<<<<<<<<<<<<
 *             out = self
 *         elif out.mat == NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_out) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":680
 *     def conjugate(self, Mat out=None):
 *         if out is None:
 *             out = self             # <<<<<<<<<<<<<<
 *         elif out.mat == NULL:
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_DECREF_SET(__pyx_v_out, __pyx_v_self);

    /* "PETSc/Mat.pyx":679
 * 
 *     def conjugate(self, Mat out=None):
 *         if out is None:             # <<<<<<<<<<<<<<
 *             out = self
 *         elif out.mat == NULL:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Mat.pyx":681
 *         if out is None:
 *             out = self
 *         elif out.mat == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 *         CHKERR( MatConjugate(out.mat) )
 */
  __pyx_t_2 = ((__pyx_v_out->mat == NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":682
 *             out = self
 *         elif out.mat == NULL:
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatConjugate(out.mat) )
 *         return out
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDuplicate(__pyx_v_self->mat, MAT_COPY_VALUES, (&__pyx_v_out->mat))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 682, __pyx_L1_error)

    /* "PETSc/Mat.pyx":681
 *         if out is None:
 *             out = self
 *         elif out.mat == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 *         CHKERR( MatConjugate(out.mat) )
 */
  }
  __pyx_L3:;

  /* "PETSc/Mat.pyx":683
 *         elif out.mat == NULL:
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 *         CHKERR( MatConjugate(out.mat) )             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatConjugate(__pyx_v_out->mat)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 683, __pyx_L1_error)

  /* "PETSc/Mat.pyx":684
 *             CHKERR( MatDuplicate(self.mat, MAT_COPY_VALUES, &out.mat) )
 *         CHKERR( MatConjugate(out.mat) )
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def permute(self, IS row not None, IS col not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":678
 *         return out
 * 
 *     def conjugate(self, Mat out=None):             # <<<<<<<<<<<<<<
 *         if out is None:
 *             out = self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.conjugate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":686
 *         return out
 * 
 *     def permute(self, IS row not None, IS col not None):             # <<<<<<<<<<<<<<
 *         cdef Mat mat = Mat()
 *         CHKERR( MatPermute(self.mat, row.iset, col.iset, &mat.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_135permute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_134permute[] = "Mat.permute(self, IS row, IS col)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_135permute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_row = 0;
  struct PyPetscISObject *__pyx_v_col = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("permute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_row,&__pyx_n_s_col,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_row)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_col)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("permute", 1, 2, 2, 1); __PYX_ERR(33, 686, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "permute") < 0)) __PYX_ERR(33, 686, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_row = ((struct PyPetscISObject *)values[0]);
    __pyx_v_col = ((struct PyPetscISObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("permute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 686, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.permute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_row), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "row", 0))) __PYX_ERR(33, 686, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_col), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "col", 0))) __PYX_ERR(33, 686, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_134permute(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_row, __pyx_v_col);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_134permute(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_row, struct PyPetscISObject *__pyx_v_col) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("permute", 0);

  /* "PETSc/Mat.pyx":687
 * 
 *     def permute(self, IS row not None, IS col not None):
 *         cdef Mat mat = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( MatPermute(self.mat, row.iset, col.iset, &mat.mat) )
 *         return mat
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":688
 *     def permute(self, IS row not None, IS col not None):
 *         cdef Mat mat = Mat()
 *         CHKERR( MatPermute(self.mat, row.iset, col.iset, &mat.mat) )             # <<<<<<<<<<<<<<
 *         return mat
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatPermute(__pyx_v_self->mat, __pyx_v_row->iset, __pyx_v_col->iset, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 688, __pyx_L1_error)

  /* "PETSc/Mat.pyx":689
 *         cdef Mat mat = Mat()
 *         CHKERR( MatPermute(self.mat, row.iset, col.iset, &mat.mat) )
 *         return mat             # <<<<<<<<<<<<<<
 * 
 *     def equal(self, Mat mat not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = ((PyObject *)__pyx_v_mat);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":686
 *         return out
 * 
 *     def permute(self, IS row not None, IS col not None):             # <<<<<<<<<<<<<<
 *         cdef Mat mat = Mat()
 *         CHKERR( MatPermute(self.mat, row.iset, col.iset, &mat.mat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.permute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":691
 *         return mat
 * 
 *     def equal(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatEqual(self.mat, mat.mat, &flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_137equal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_136equal[] = "Mat.equal(self, Mat mat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_137equal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("equal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,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);
        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_mat)) != 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, "equal") < 0)) __PYX_ERR(33, 691, __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_mat = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("equal", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 691, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(33, 691, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_136equal(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_136equal(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("equal", 0);

  /* "PETSc/Mat.pyx":692
 * 
 *     def equal(self, Mat mat not None):
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatEqual(self.mat, mat.mat, &flag) )
 *         return <bint> mat
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/Mat.pyx":693
 *     def equal(self, Mat mat not None):
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatEqual(self.mat, mat.mat, &flag) )             # <<<<<<<<<<<<<<
 *         return <bint> mat
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatEqual(__pyx_v_self->mat, __pyx_v_mat->mat, (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 693, __pyx_L1_error)

  /* "PETSc/Mat.pyx":694
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatEqual(self.mat, mat.mat, &flag) )
 *         return <bint> mat             # <<<<<<<<<<<<<<
 * 
 *     def isTranspose(self, Mat mat=None, tol=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_mat)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(33, 694, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":691
 *         return mat
 * 
 *     def equal(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatEqual(self.mat, mat.mat, &flag) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":696
 *         return <bint> mat
 * 
 *     def isTranspose(self, Mat mat=None, tol=0):             # <<<<<<<<<<<<<<
 *         if mat is None: mat = self
 *         cdef PetscReal rval = asReal(tol)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_139isTranspose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_138isTranspose[] = "Mat.isTranspose(self, Mat mat=None, tol=0)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_139isTranspose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_v_tol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isTranspose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,&__pyx_n_s_tol,0};
    PyObject* values[2] = {0,0};
    values[0] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[1] = ((PyObject *)__pyx_int_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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mat);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tol);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "isTranspose") < 0)) __PYX_ERR(33, 696, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mat = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_tol = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("isTranspose", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 696, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.isTranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "mat", 0))) __PYX_ERR(33, 696, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_138isTranspose(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat, __pyx_v_tol);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_138isTranspose(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, PyObject *__pyx_v_tol) {
  PetscReal __pyx_v_rval;
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscReal __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("isTranspose", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_mat);

  /* "PETSc/Mat.pyx":697
 * 
 *     def isTranspose(self, Mat mat=None, tol=0):
 *         if mat is None: mat = self             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(tol)
 *         cdef PetscBool flag = PETSC_FALSE
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_mat) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_DECREF_SET(__pyx_v_mat, __pyx_v_self);
  }

  /* "PETSc/Mat.pyx":698
 *     def isTranspose(self, Mat mat=None, tol=0):
 *         if mat is None: mat = self
 *         cdef PetscReal rval = asReal(tol)             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatIsTranspose(self.mat, mat.mat, rval, &flag) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_tol); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(33, 698, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_3;

  /* "PETSc/Mat.pyx":699
 *         if mat is None: mat = self
 *         cdef PetscReal rval = asReal(tol)
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatIsTranspose(self.mat, mat.mat, rval, &flag) )
 *         return <bint>flag
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/Mat.pyx":700
 *         cdef PetscReal rval = asReal(tol)
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatIsTranspose(self.mat, mat.mat, rval, &flag) )             # <<<<<<<<<<<<<<
 *         return <bint>flag
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatIsTranspose(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_rval, (&__pyx_v_flag))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 700, __pyx_L1_error)

  /* "PETSc/Mat.pyx":701
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatIsTranspose(self.mat, mat.mat, rval, &flag) )
 *         return <bint>flag             # <<<<<<<<<<<<<<
 * 
 *     def isSymmetric(self, tol=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":696
 *         return <bint> mat
 * 
 *     def isTranspose(self, Mat mat=None, tol=0):             # <<<<<<<<<<<<<<
 *         if mat is None: mat = self
 *         cdef PetscReal rval = asReal(tol)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.isTranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":703
 *         return <bint>flag
 * 
 *     def isSymmetric(self, tol=0):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(tol)
 *         cdef PetscBool flag = PETSC_FALSE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_141isSymmetric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_140isSymmetric[] = "Mat.isSymmetric(self, tol=0)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_141isSymmetric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isSymmetric (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tol,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tol);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "isSymmetric") < 0)) __PYX_ERR(33, 703, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tol = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("isSymmetric", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 703, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.isSymmetric", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_140isSymmetric(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_tol);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_140isSymmetric(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_tol) {
  PetscReal __pyx_v_rval;
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("isSymmetric", 0);

  /* "PETSc/Mat.pyx":704
 * 
 *     def isSymmetric(self, tol=0):
 *         cdef PetscReal rval = asReal(tol)             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatIsSymmetric(self.mat, rval, &flag) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_tol); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(33, 704, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/Mat.pyx":705
 *     def isSymmetric(self, tol=0):
 *         cdef PetscReal rval = asReal(tol)
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatIsSymmetric(self.mat, rval, &flag) )
 *         return <bint>flag
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/Mat.pyx":706
 *         cdef PetscReal rval = asReal(tol)
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatIsSymmetric(self.mat, rval, &flag) )             # <<<<<<<<<<<<<<
 *         return <bint>flag
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatIsSymmetric(__pyx_v_self->mat, __pyx_v_rval, (&__pyx_v_flag))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 706, __pyx_L1_error)

  /* "PETSc/Mat.pyx":707
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatIsSymmetric(self.mat, rval, &flag) )
 *         return <bint>flag             # <<<<<<<<<<<<<<
 * 
 *     def isSymmetricKnown(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 707, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":703
 *         return <bint>flag
 * 
 *     def isSymmetric(self, tol=0):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(tol)
 *         cdef PetscBool flag = PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.isSymmetric", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":709
 *         return <bint>flag
 * 
 *     def isSymmetricKnown(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag1 = PETSC_FALSE
 *         cdef PetscBool flag2 = PETSC_FALSE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_143isSymmetricKnown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_142isSymmetricKnown[] = "Mat.isSymmetricKnown(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_143isSymmetricKnown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isSymmetricKnown (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("isSymmetricKnown", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "isSymmetricKnown", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_142isSymmetricKnown(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_142isSymmetricKnown(struct PyPetscMatObject *__pyx_v_self) {
  PetscBool __pyx_v_flag1;
  PetscBool __pyx_v_flag2;
  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;
  __Pyx_RefNannySetupContext("isSymmetricKnown", 0);

  /* "PETSc/Mat.pyx":710
 * 
 *     def isSymmetricKnown(self):
 *         cdef PetscBool flag1 = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag2 = PETSC_FALSE
 *         CHKERR( MatIsSymmetricKnown(self.mat, &flag1, &flag2) )
 */
  __pyx_v_flag1 = PETSC_FALSE;

  /* "PETSc/Mat.pyx":711
 *     def isSymmetricKnown(self):
 *         cdef PetscBool flag1 = PETSC_FALSE
 *         cdef PetscBool flag2 = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatIsSymmetricKnown(self.mat, &flag1, &flag2) )
 *         return (<bint>flag1, <bint>flag2)
 */
  __pyx_v_flag2 = PETSC_FALSE;

  /* "PETSc/Mat.pyx":712
 *         cdef PetscBool flag1 = PETSC_FALSE
 *         cdef PetscBool flag2 = PETSC_FALSE
 *         CHKERR( MatIsSymmetricKnown(self.mat, &flag1, &flag2) )             # <<<<<<<<<<<<<<
 *         return (<bint>flag1, <bint>flag2)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatIsSymmetricKnown(__pyx_v_self->mat, (&__pyx_v_flag1), (&__pyx_v_flag2))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 712, __pyx_L1_error)

  /* "PETSc/Mat.pyx":713
 *         cdef PetscBool flag2 = PETSC_FALSE
 *         CHKERR( MatIsSymmetricKnown(self.mat, &flag1, &flag2) )
 *         return (<bint>flag1, <bint>flag2)             # <<<<<<<<<<<<<<
 * 
 *     def isHermitian(self, tol=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag1); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag2); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 713, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":709
 *         return <bint>flag
 * 
 *     def isSymmetricKnown(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag1 = PETSC_FALSE
 *         cdef PetscBool flag2 = PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.isSymmetricKnown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":715
 *         return (<bint>flag1, <bint>flag2)
 * 
 *     def isHermitian(self, tol=0):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(tol)
 *         cdef PetscBool bval = PETSC_FALSE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_145isHermitian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_144isHermitian[] = "Mat.isHermitian(self, tol=0)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_145isHermitian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isHermitian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tol,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tol);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "isHermitian") < 0)) __PYX_ERR(33, 715, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tol = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("isHermitian", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 715, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.isHermitian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_144isHermitian(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_tol);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_144isHermitian(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_tol) {
  PetscReal __pyx_v_rval;
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("isHermitian", 0);

  /* "PETSc/Mat.pyx":716
 * 
 *     def isHermitian(self, tol=0):
 *         cdef PetscReal rval = asReal(tol)             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( MatIsHermitian(self.mat, rval, &bval) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_tol); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(33, 716, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/Mat.pyx":717
 *     def isHermitian(self, tol=0):
 *         cdef PetscReal rval = asReal(tol)
 *         cdef PetscBool bval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatIsHermitian(self.mat, rval, &bval) )
 *         return <bint>bval
 */
  __pyx_v_bval = PETSC_FALSE;

  /* "PETSc/Mat.pyx":718
 *         cdef PetscReal rval = asReal(tol)
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( MatIsHermitian(self.mat, rval, &bval) )             # <<<<<<<<<<<<<<
 *         return <bint>bval
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatIsHermitian(__pyx_v_self->mat, __pyx_v_rval, (&__pyx_v_bval))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 718, __pyx_L1_error)

  /* "PETSc/Mat.pyx":719
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( MatIsHermitian(self.mat, rval, &bval) )
 *         return <bint>bval             # <<<<<<<<<<<<<<
 * 
 *     def isHermitianKnown(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_PetscBool(__pyx_v_bval); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":715
 *         return (<bint>flag1, <bint>flag2)
 * 
 *     def isHermitian(self, tol=0):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(tol)
 *         cdef PetscBool bval = PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.isHermitian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":721
 *         return <bint>bval
 * 
 *     def isHermitianKnown(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval1 = PETSC_FALSE
 *         cdef PetscBool bval2 = PETSC_FALSE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_147isHermitianKnown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_146isHermitianKnown[] = "Mat.isHermitianKnown(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_147isHermitianKnown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isHermitianKnown (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("isHermitianKnown", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "isHermitianKnown", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_146isHermitianKnown(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_146isHermitianKnown(struct PyPetscMatObject *__pyx_v_self) {
  PetscBool __pyx_v_bval1;
  PetscBool __pyx_v_bval2;
  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;
  __Pyx_RefNannySetupContext("isHermitianKnown", 0);

  /* "PETSc/Mat.pyx":722
 * 
 *     def isHermitianKnown(self):
 *         cdef PetscBool bval1 = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval2 = PETSC_FALSE
 *         CHKERR( MatIsHermitianKnown(self.mat, &bval1, &bval2) )
 */
  __pyx_v_bval1 = PETSC_FALSE;

  /* "PETSc/Mat.pyx":723
 *     def isHermitianKnown(self):
 *         cdef PetscBool bval1 = PETSC_FALSE
 *         cdef PetscBool bval2 = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatIsHermitianKnown(self.mat, &bval1, &bval2) )
 *         return (<bint>bval1, <bint>bval2)
 */
  __pyx_v_bval2 = PETSC_FALSE;

  /* "PETSc/Mat.pyx":724
 *         cdef PetscBool bval1 = PETSC_FALSE
 *         cdef PetscBool bval2 = PETSC_FALSE
 *         CHKERR( MatIsHermitianKnown(self.mat, &bval1, &bval2) )             # <<<<<<<<<<<<<<
 *         return (<bint>bval1, <bint>bval2)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatIsHermitianKnown(__pyx_v_self->mat, (&__pyx_v_bval1), (&__pyx_v_bval2))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 724, __pyx_L1_error)

  /* "PETSc/Mat.pyx":725
 *         cdef PetscBool bval2 = PETSC_FALSE
 *         CHKERR( MatIsHermitianKnown(self.mat, &bval1, &bval2) )
 *         return (<bint>bval1, <bint>bval2)             # <<<<<<<<<<<<<<
 * 
 *     def isStructurallySymmetric(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_bval1); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_PetscBool(__pyx_v_bval2); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 725, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":721
 *         return <bint>bval
 * 
 *     def isHermitianKnown(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval1 = PETSC_FALSE
 *         cdef PetscBool bval2 = PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.isHermitianKnown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":727
 *         return (<bint>bval1, <bint>bval2)
 * 
 *     def isStructurallySymmetric(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( MatIsStructurallySymmetric(self.mat, &bval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_149isStructurallySymmetric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_148isStructurallySymmetric[] = "Mat.isStructurallySymmetric(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_149isStructurallySymmetric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isStructurallySymmetric (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("isStructurallySymmetric", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "isStructurallySymmetric", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_148isStructurallySymmetric(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_148isStructurallySymmetric(struct PyPetscMatObject *__pyx_v_self) {
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("isStructurallySymmetric", 0);

  /* "PETSc/Mat.pyx":728
 * 
 *     def isStructurallySymmetric(self):
 *         cdef PetscBool bval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatIsStructurallySymmetric(self.mat, &bval) )
 *         return <bint>bval
 */
  __pyx_v_bval = PETSC_FALSE;

  /* "PETSc/Mat.pyx":729
 *     def isStructurallySymmetric(self):
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( MatIsStructurallySymmetric(self.mat, &bval) )             # <<<<<<<<<<<<<<
 *         return <bint>bval
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatIsStructurallySymmetric(__pyx_v_self->mat, (&__pyx_v_bval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 729, __pyx_L1_error)

  /* "PETSc/Mat.pyx":730
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( MatIsStructurallySymmetric(self.mat, &bval) )
 *         return <bint>bval             # <<<<<<<<<<<<<<
 * 
 *     def zeroEntries(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_bval); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":727
 *         return (<bint>bval1, <bint>bval2)
 * 
 *     def isStructurallySymmetric(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( MatIsStructurallySymmetric(self.mat, &bval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.isStructurallySymmetric", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":732
 *         return <bint>bval
 * 
 *     def zeroEntries(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatZeroEntries(self.mat) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_151zeroEntries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_150zeroEntries[] = "Mat.zeroEntries(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_151zeroEntries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zeroEntries (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("zeroEntries", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "zeroEntries", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_150zeroEntries(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_150zeroEntries(struct PyPetscMatObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("zeroEntries", 0);

  /* "PETSc/Mat.pyx":733
 * 
 *     def zeroEntries(self):
 *         CHKERR( MatZeroEntries(self.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def getValue(self, row, col):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatZeroEntries(__pyx_v_self->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 733, __pyx_L1_error)

  /* "PETSc/Mat.pyx":732
 *         return <bint>bval
 * 
 *     def zeroEntries(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatZeroEntries(self.mat) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.zeroEntries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":735
 *         CHKERR( MatZeroEntries(self.mat) )
 * 
 *     def getValue(self, row, col):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival1 = asInt(row)
 *         cdef PetscInt    ival2 = asInt(col)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_153getValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_152getValue[] = "Mat.getValue(self, row, col)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_153getValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_row = 0;
  PyObject *__pyx_v_col = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getValue (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_row,&__pyx_n_s_col,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_row)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_col)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getValue", 1, 2, 2, 1); __PYX_ERR(33, 735, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getValue") < 0)) __PYX_ERR(33, 735, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_row = values[0];
    __pyx_v_col = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getValue", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 735, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_152getValue(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_row, __pyx_v_col);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_152getValue(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row, PyObject *__pyx_v_col) {
  PetscInt __pyx_v_ival1;
  PetscInt __pyx_v_ival2;
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getValue", 0);

  /* "PETSc/Mat.pyx":736
 * 
 *     def getValue(self, row, col):
 *         cdef PetscInt    ival1 = asInt(row)             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival2 = asInt(col)
 *         cdef PetscScalar sval  = 0
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_row); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 736, __pyx_L1_error)
  __pyx_v_ival1 = __pyx_t_1;

  /* "PETSc/Mat.pyx":737
 *     def getValue(self, row, col):
 *         cdef PetscInt    ival1 = asInt(row)
 *         cdef PetscInt    ival2 = asInt(col)             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval  = 0
 *         CHKERR( MatGetValues(self.mat, 1, &ival1, 1, &ival2, &sval) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_col); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 737, __pyx_L1_error)
  __pyx_v_ival2 = __pyx_t_1;

  /* "PETSc/Mat.pyx":738
 *         cdef PetscInt    ival1 = asInt(row)
 *         cdef PetscInt    ival2 = asInt(col)
 *         cdef PetscScalar sval  = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetValues(self.mat, 1, &ival1, 1, &ival2, &sval) )
 *         return toScalar(sval)
 */
  __pyx_v_sval = 0.0;

  /* "PETSc/Mat.pyx":739
 *         cdef PetscInt    ival2 = asInt(col)
 *         cdef PetscScalar sval  = 0
 *         CHKERR( MatGetValues(self.mat, 1, &ival1, 1, &ival2, &sval) )             # <<<<<<<<<<<<<<
 *         return toScalar(sval)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetValues(__pyx_v_self->mat, 1, (&__pyx_v_ival1), 1, (&__pyx_v_ival2), (&__pyx_v_sval))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 739, __pyx_L1_error)

  /* "PETSc/Mat.pyx":740
 *         cdef PetscScalar sval  = 0
 *         CHKERR( MatGetValues(self.mat, 1, &ival1, 1, &ival2, &sval) )
 *         return toScalar(sval)             # <<<<<<<<<<<<<<
 * 
 *     def getValues(self, rows, cols, values=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toScalar(__pyx_v_sval); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":735
 *         CHKERR( MatZeroEntries(self.mat) )
 * 
 *     def getValue(self, row, col):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival1 = asInt(row)
 *         cdef PetscInt    ival2 = asInt(col)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":742
 *         return toScalar(sval)
 * 
 *     def getValues(self, rows, cols, values=None):             # <<<<<<<<<<<<<<
 *         return matgetvalues(self.mat, rows, cols, values)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_155getValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_154getValues[] = "Mat.getValues(self, rows, cols, values=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_155getValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rows = 0;
  PyObject *__pyx_v_cols = 0;
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getValues (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rows,&__pyx_n_s_cols,&__pyx_n_s_values,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_rows)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cols)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getValues", 0, 2, 3, 1); __PYX_ERR(33, 742, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_values);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getValues") < 0)) __PYX_ERR(33, 742, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_rows = values[0];
    __pyx_v_cols = values[1];
    __pyx_v_values = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getValues", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 742, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_154getValues(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_rows, __pyx_v_cols, __pyx_v_values);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_154getValues(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_cols, PyObject *__pyx_v_values) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getValues", 0);

  /* "PETSc/Mat.pyx":743
 * 
 *     def getValues(self, rows, cols, values=None):
 *         return matgetvalues(self.mat, rows, cols, values)             # <<<<<<<<<<<<<<
 * 
 *     def getValuesCSR(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matgetvalues(__pyx_v_self->mat, __pyx_v_rows, __pyx_v_cols, __pyx_v_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":742
 *         return toScalar(sval)
 * 
 *     def getValues(self, rows, cols, values=None):             # <<<<<<<<<<<<<<
 *         return matgetvalues(self.mat, rows, cols, values)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":745
 *         return matgetvalues(self.mat, rows, cols, values)
 * 
 *     def getValuesCSR(self):             # <<<<<<<<<<<<<<
 *         # row ownership
 *         cdef PetscInt rstart=0, rend=0, nrows=0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_157getValuesCSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_156getValuesCSR[] = "Mat.getValuesCSR(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_157getValuesCSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getValuesCSR (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getValuesCSR", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getValuesCSR", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_156getValuesCSR(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_156getValuesCSR(struct PyPetscMatObject *__pyx_v_self) {
  PetscInt __pyx_v_rstart;
  PetscInt __pyx_v_rend;
  PetscInt __pyx_v_nrows;
  PetscInt *__pyx_v_AI;
  PyArrayObject *__pyx_v_ai = 0;
  PetscInt __pyx_v_irow;
  PetscInt __pyx_v_ncols;
  PetscInt *__pyx_v_AJ;
  PyArrayObject *__pyx_v_aj = 0;
  PetscScalar *__pyx_v_AV;
  PyArrayObject *__pyx_v_av = 0;
  const PetscInt *__pyx_v_cols;
  const PetscScalar *__pyx_v_vals;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PetscInt __pyx_t_4;
  __Pyx_RefNannySetupContext("getValuesCSR", 0);

  /* "PETSc/Mat.pyx":747
 *     def getValuesCSR(self):
 *         # row ownership
 *         cdef PetscInt rstart=0, rend=0, nrows=0             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetOwnershipRange(self.mat, &rstart, &rend) )
 *         nrows = rend - rstart
 */
  __pyx_v_rstart = 0;
  __pyx_v_rend = 0;
  __pyx_v_nrows = 0;

  /* "PETSc/Mat.pyx":748
 *         # row ownership
 *         cdef PetscInt rstart=0, rend=0, nrows=0
 *         CHKERR( MatGetOwnershipRange(self.mat, &rstart, &rend) )             # <<<<<<<<<<<<<<
 *         nrows = rend - rstart
 *         # first pass: row pointer array
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetOwnershipRange(__pyx_v_self->mat, (&__pyx_v_rstart), (&__pyx_v_rend))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 748, __pyx_L1_error)

  /* "PETSc/Mat.pyx":749
 *         cdef PetscInt rstart=0, rend=0, nrows=0
 *         CHKERR( MatGetOwnershipRange(self.mat, &rstart, &rend) )
 *         nrows = rend - rstart             # <<<<<<<<<<<<<<
 *         # first pass: row pointer array
 *         cdef PetscInt *AI = NULL
 */
  __pyx_v_nrows = (__pyx_v_rend - __pyx_v_rstart);

  /* "PETSc/Mat.pyx":751
 *         nrows = rend - rstart
 *         # first pass: row pointer array
 *         cdef PetscInt *AI = NULL             # <<<<<<<<<<<<<<
 *         cdef ndarray ai = oarray_i(empty_i(nrows+1), NULL, &AI)
 *         cdef PetscInt irow=0, ncols=0
 */
  __pyx_v_AI = NULL;

  /* "PETSc/Mat.pyx":752
 *         # first pass: row pointer array
 *         cdef PetscInt *AI = NULL
 *         cdef ndarray ai = oarray_i(empty_i(nrows+1), NULL, &AI)             # <<<<<<<<<<<<<<
 *         cdef PetscInt irow=0, ncols=0
 *         AI[0] = 0
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_i((__pyx_v_nrows + 1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_i(__pyx_t_2, NULL, (&__pyx_v_AI))); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_ai = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Mat.pyx":753
 *         cdef PetscInt *AI = NULL
 *         cdef ndarray ai = oarray_i(empty_i(nrows+1), NULL, &AI)
 *         cdef PetscInt irow=0, ncols=0             # <<<<<<<<<<<<<<
 *         AI[0] = 0
 *         for irow from 0 <= irow < nrows:
 */
  __pyx_v_irow = 0;
  __pyx_v_ncols = 0;

  /* "PETSc/Mat.pyx":754
 *         cdef ndarray ai = oarray_i(empty_i(nrows+1), NULL, &AI)
 *         cdef PetscInt irow=0, ncols=0
 *         AI[0] = 0             # <<<<<<<<<<<<<<
 *         for irow from 0 <= irow < nrows:
 *             CHKERR( MatGetRow(self.mat, irow+rstart, &ncols, NULL, NULL) )
 */
  (__pyx_v_AI[0]) = 0;

  /* "PETSc/Mat.pyx":755
 *         cdef PetscInt irow=0, ncols=0
 *         AI[0] = 0
 *         for irow from 0 <= irow < nrows:             # <<<<<<<<<<<<<<
 *             CHKERR( MatGetRow(self.mat, irow+rstart, &ncols, NULL, NULL) )
 *             AI[irow+1] = AI[irow] + ncols
 */
  __pyx_t_4 = __pyx_v_nrows;
  for (__pyx_v_irow = 0; __pyx_v_irow < __pyx_t_4; __pyx_v_irow++) {

    /* "PETSc/Mat.pyx":756
 *         AI[0] = 0
 *         for irow from 0 <= irow < nrows:
 *             CHKERR( MatGetRow(self.mat, irow+rstart, &ncols, NULL, NULL) )             # <<<<<<<<<<<<<<
 *             AI[irow+1] = AI[irow] + ncols
 *             CHKERR( MatRestoreRow(self.mat, irow+rstart, &ncols, NULL, NULL) )
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetRow(__pyx_v_self->mat, (__pyx_v_irow + __pyx_v_rstart), (&__pyx_v_ncols), NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 756, __pyx_L1_error)

    /* "PETSc/Mat.pyx":757
 *         for irow from 0 <= irow < nrows:
 *             CHKERR( MatGetRow(self.mat, irow+rstart, &ncols, NULL, NULL) )
 *             AI[irow+1] = AI[irow] + ncols             # <<<<<<<<<<<<<<
 *             CHKERR( MatRestoreRow(self.mat, irow+rstart, &ncols, NULL, NULL) )
 *         # second pass: column indices and values
 */
    (__pyx_v_AI[(__pyx_v_irow + 1)]) = ((__pyx_v_AI[__pyx_v_irow]) + __pyx_v_ncols);

    /* "PETSc/Mat.pyx":758
 *             CHKERR( MatGetRow(self.mat, irow+rstart, &ncols, NULL, NULL) )
 *             AI[irow+1] = AI[irow] + ncols
 *             CHKERR( MatRestoreRow(self.mat, irow+rstart, &ncols, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         # second pass: column indices and values
 *         cdef PetscInt *AJ = NULL
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatRestoreRow(__pyx_v_self->mat, (__pyx_v_irow + __pyx_v_rstart), (&__pyx_v_ncols), NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 758, __pyx_L1_error)
  }

  /* "PETSc/Mat.pyx":760
 *             CHKERR( MatRestoreRow(self.mat, irow+rstart, &ncols, NULL, NULL) )
 *         # second pass: column indices and values
 *         cdef PetscInt *AJ = NULL             # <<<<<<<<<<<<<<
 *         cdef ndarray aj = oarray_i(empty_i(AI[nrows]), NULL, &AJ)
 *         cdef PetscScalar *AV = NULL
 */
  __pyx_v_AJ = NULL;

  /* "PETSc/Mat.pyx":761
 *         # second pass: column indices and values
 *         cdef PetscInt *AJ = NULL
 *         cdef ndarray aj = oarray_i(empty_i(AI[nrows]), NULL, &AJ)             # <<<<<<<<<<<<<<
 *         cdef PetscScalar *AV = NULL
 *         cdef ndarray av = oarray_s(empty_s(AI[nrows]), NULL, &AV)
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_i((__pyx_v_AI[__pyx_v_nrows]))); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_i(__pyx_t_3, NULL, (&__pyx_v_AJ))); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_aj = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Mat.pyx":762
 *         cdef PetscInt *AJ = NULL
 *         cdef ndarray aj = oarray_i(empty_i(AI[nrows]), NULL, &AJ)
 *         cdef PetscScalar *AV = NULL             # <<<<<<<<<<<<<<
 *         cdef ndarray av = oarray_s(empty_s(AI[nrows]), NULL, &AV)
 *         cdef const_PetscInt *cols = NULL
 */
  __pyx_v_AV = NULL;

  /* "PETSc/Mat.pyx":763
 *         cdef ndarray aj = oarray_i(empty_i(AI[nrows]), NULL, &AJ)
 *         cdef PetscScalar *AV = NULL
 *         cdef ndarray av = oarray_s(empty_s(AI[nrows]), NULL, &AV)             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *cols = NULL
 *         cdef const_PetscScalar *vals = NULL
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_s((__pyx_v_AI[__pyx_v_nrows]))); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_s(__pyx_t_2, NULL, (&__pyx_v_AV))); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_av = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Mat.pyx":764
 *         cdef PetscScalar *AV = NULL
 *         cdef ndarray av = oarray_s(empty_s(AI[nrows]), NULL, &AV)
 *         cdef const_PetscInt *cols = NULL             # <<<<<<<<<<<<<<
 *         cdef const_PetscScalar *vals = NULL
 *         for irow from 0 <= irow < nrows:
 */
  __pyx_v_cols = NULL;

  /* "PETSc/Mat.pyx":765
 *         cdef ndarray av = oarray_s(empty_s(AI[nrows]), NULL, &AV)
 *         cdef const_PetscInt *cols = NULL
 *         cdef const_PetscScalar *vals = NULL             # <<<<<<<<<<<<<<
 *         for irow from 0 <= irow < nrows:
 *             CHKERR( MatGetRow(self.mat, irow+rstart, &ncols, &cols, &vals) )
 */
  __pyx_v_vals = NULL;

  /* "PETSc/Mat.pyx":766
 *         cdef const_PetscInt *cols = NULL
 *         cdef const_PetscScalar *vals = NULL
 *         for irow from 0 <= irow < nrows:             # <<<<<<<<<<<<<<
 *             CHKERR( MatGetRow(self.mat, irow+rstart, &ncols, &cols, &vals) )
 *             CHKERR( PetscMemcpy(AJ+AI[irow], cols, <size_t>ncols*sizeof(PetscInt)) )
 */
  __pyx_t_4 = __pyx_v_nrows;
  for (__pyx_v_irow = 0; __pyx_v_irow < __pyx_t_4; __pyx_v_irow++) {

    /* "PETSc/Mat.pyx":767
 *         cdef const_PetscScalar *vals = NULL
 *         for irow from 0 <= irow < nrows:
 *             CHKERR( MatGetRow(self.mat, irow+rstart, &ncols, &cols, &vals) )             # <<<<<<<<<<<<<<
 *             CHKERR( PetscMemcpy(AJ+AI[irow], cols, <size_t>ncols*sizeof(PetscInt)) )
 *             CHKERR( PetscMemcpy(AV+AI[irow], vals, <size_t>ncols*sizeof(PetscScalar)) )
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetRow(__pyx_v_self->mat, (__pyx_v_irow + __pyx_v_rstart), (&__pyx_v_ncols), (&__pyx_v_cols), (&__pyx_v_vals))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 767, __pyx_L1_error)

    /* "PETSc/Mat.pyx":768
 *         for irow from 0 <= irow < nrows:
 *             CHKERR( MatGetRow(self.mat, irow+rstart, &ncols, &cols, &vals) )
 *             CHKERR( PetscMemcpy(AJ+AI[irow], cols, <size_t>ncols*sizeof(PetscInt)) )             # <<<<<<<<<<<<<<
 *             CHKERR( PetscMemcpy(AV+AI[irow], vals, <size_t>ncols*sizeof(PetscScalar)) )
 *             CHKERR( MatRestoreRow(self.mat, irow+rstart, &ncols, &cols, &vals) )
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscMemcpy((__pyx_v_AJ + (__pyx_v_AI[__pyx_v_irow])), __pyx_v_cols, (((size_t)__pyx_v_ncols) * (sizeof(PetscInt))))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 768, __pyx_L1_error)

    /* "PETSc/Mat.pyx":769
 *             CHKERR( MatGetRow(self.mat, irow+rstart, &ncols, &cols, &vals) )
 *             CHKERR( PetscMemcpy(AJ+AI[irow], cols, <size_t>ncols*sizeof(PetscInt)) )
 *             CHKERR( PetscMemcpy(AV+AI[irow], vals, <size_t>ncols*sizeof(PetscScalar)) )             # <<<<<<<<<<<<<<
 *             CHKERR( MatRestoreRow(self.mat, irow+rstart, &ncols, &cols, &vals) )
 *         #
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscMemcpy((__pyx_v_AV + (__pyx_v_AI[__pyx_v_irow])), __pyx_v_vals, (((size_t)__pyx_v_ncols) * (sizeof(PetscScalar))))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 769, __pyx_L1_error)

    /* "PETSc/Mat.pyx":770
 *             CHKERR( PetscMemcpy(AJ+AI[irow], cols, <size_t>ncols*sizeof(PetscInt)) )
 *             CHKERR( PetscMemcpy(AV+AI[irow], vals, <size_t>ncols*sizeof(PetscScalar)) )
 *             CHKERR( MatRestoreRow(self.mat, irow+rstart, &ncols, &cols, &vals) )             # <<<<<<<<<<<<<<
 *         #
 *         return (ai, aj, av)
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatRestoreRow(__pyx_v_self->mat, (__pyx_v_irow + __pyx_v_rstart), (&__pyx_v_ncols), (&__pyx_v_cols), (&__pyx_v_vals))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 770, __pyx_L1_error)
  }

  /* "PETSc/Mat.pyx":772
 *             CHKERR( MatRestoreRow(self.mat, irow+rstart, &ncols, &cols, &vals) )
 *         #
 *         return (ai, aj, av)             # <<<<<<<<<<<<<<
 * 
 *     def getRow(self, row):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_ai));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ai));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_ai));
  __Pyx_INCREF(((PyObject *)__pyx_v_aj));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_aj));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_aj));
  __Pyx_INCREF(((PyObject *)__pyx_v_av));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_av));
  PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_av));
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":745
 *         return matgetvalues(self.mat, rows, cols, values)
 * 
 *     def getValuesCSR(self):             # <<<<<<<<<<<<<<
 *         # row ownership
 *         cdef PetscInt rstart=0, rend=0, nrows=0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getValuesCSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ai);
  __Pyx_XDECREF((PyObject *)__pyx_v_aj);
  __Pyx_XDECREF((PyObject *)__pyx_v_av);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":774
 *         return (ai, aj, av)
 * 
 *     def getRow(self, row):             # <<<<<<<<<<<<<<
 *         cdef PetscInt irow = asInt(row)
 *         cdef PetscInt ncols = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_159getRow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_158getRow[] = "Mat.getRow(self, row)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_159getRow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_row = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_row,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);
        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_row)) != 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, "getRow") < 0)) __PYX_ERR(33, 774, __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_row = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getRow", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 774, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getRow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_158getRow(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_row);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_158getRow(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row) {
  PetscInt __pyx_v_irow;
  PetscInt __pyx_v_ncols;
  const PetscInt *__pyx_v_icols;
  const PetscScalar *__pyx_v_svals;
  PyObject *__pyx_v_cols = 0;
  PyObject *__pyx_v_vals = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getRow", 0);

  /* "PETSc/Mat.pyx":775
 * 
 *     def getRow(self, row):
 *         cdef PetscInt irow = asInt(row)             # <<<<<<<<<<<<<<
 *         cdef PetscInt ncols = 0
 *         cdef const_PetscInt *icols=NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_row); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 775, __pyx_L1_error)
  __pyx_v_irow = __pyx_t_1;

  /* "PETSc/Mat.pyx":776
 *     def getRow(self, row):
 *         cdef PetscInt irow = asInt(row)
 *         cdef PetscInt ncols = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *icols=NULL
 *         cdef const_PetscScalar *svals=NULL
 */
  __pyx_v_ncols = 0;

  /* "PETSc/Mat.pyx":777
 *         cdef PetscInt irow = asInt(row)
 *         cdef PetscInt ncols = 0
 *         cdef const_PetscInt *icols=NULL             # <<<<<<<<<<<<<<
 *         cdef const_PetscScalar *svals=NULL
 *         CHKERR( MatGetRow(self.mat, irow, &ncols, &icols, &svals) )
 */
  __pyx_v_icols = NULL;

  /* "PETSc/Mat.pyx":778
 *         cdef PetscInt ncols = 0
 *         cdef const_PetscInt *icols=NULL
 *         cdef const_PetscScalar *svals=NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetRow(self.mat, irow, &ncols, &icols, &svals) )
 *         cdef object cols = array_i(ncols, icols)
 */
  __pyx_v_svals = NULL;

  /* "PETSc/Mat.pyx":779
 *         cdef const_PetscInt *icols=NULL
 *         cdef const_PetscScalar *svals=NULL
 *         CHKERR( MatGetRow(self.mat, irow, &ncols, &icols, &svals) )             # <<<<<<<<<<<<<<
 *         cdef object cols = array_i(ncols, icols)
 *         cdef object vals = array_s(ncols, svals)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetRow(__pyx_v_self->mat, __pyx_v_irow, (&__pyx_v_ncols), (&__pyx_v_icols), (&__pyx_v_svals))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 779, __pyx_L1_error)

  /* "PETSc/Mat.pyx":780
 *         cdef const_PetscScalar *svals=NULL
 *         CHKERR( MatGetRow(self.mat, irow, &ncols, &icols, &svals) )
 *         cdef object cols = array_i(ncols, icols)             # <<<<<<<<<<<<<<
 *         cdef object vals = array_s(ncols, svals)
 *         CHKERR( MatRestoreRow(self.mat, irow, &ncols, &icols, &svals) )
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_ncols, __pyx_v_icols)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_cols = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/Mat.pyx":781
 *         CHKERR( MatGetRow(self.mat, irow, &ncols, &icols, &svals) )
 *         cdef object cols = array_i(ncols, icols)
 *         cdef object vals = array_s(ncols, svals)             # <<<<<<<<<<<<<<
 *         CHKERR( MatRestoreRow(self.mat, irow, &ncols, &icols, &svals) )
 *         return (cols, vals)
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_s(__pyx_v_ncols, __pyx_v_svals)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_vals = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/Mat.pyx":782
 *         cdef object cols = array_i(ncols, icols)
 *         cdef object vals = array_s(ncols, svals)
 *         CHKERR( MatRestoreRow(self.mat, irow, &ncols, &icols, &svals) )             # <<<<<<<<<<<<<<
 *         return (cols, vals)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatRestoreRow(__pyx_v_self->mat, __pyx_v_irow, (&__pyx_v_ncols), (&__pyx_v_icols), (&__pyx_v_svals))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 782, __pyx_L1_error)

  /* "PETSc/Mat.pyx":783
 *         cdef object vals = array_s(ncols, svals)
 *         CHKERR( MatRestoreRow(self.mat, irow, &ncols, &icols, &svals) )
 *         return (cols, vals)             # <<<<<<<<<<<<<<
 * 
 *     def getRowIJ(self, symmetric=False, compressed=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_cols);
  __Pyx_GIVEREF(__pyx_v_cols);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_cols);
  __Pyx_INCREF(__pyx_v_vals);
  __Pyx_GIVEREF(__pyx_v_vals);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_vals);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":774
 *         return (ai, aj, av)
 * 
 *     def getRow(self, row):             # <<<<<<<<<<<<<<
 *         cdef PetscInt irow = asInt(row)
 *         cdef PetscInt ncols = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getRow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cols);
  __Pyx_XDECREF(__pyx_v_vals);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":785
 *         return (cols, vals)
 * 
 *     def getRowIJ(self, symmetric=False, compressed=False):             # <<<<<<<<<<<<<<
 *         cdef PetscInt shift=0
 *         cdef PetscBool symm=symmetric
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_161getRowIJ(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_160getRowIJ[] = "Mat.getRowIJ(self, symmetric=False, compressed=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_161getRowIJ(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_symmetric = 0;
  PyObject *__pyx_v_compressed = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRowIJ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_symmetric,&__pyx_n_s_compressed,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_False);
    values[1] = ((PyObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_symmetric);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compressed);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getRowIJ") < 0)) __PYX_ERR(33, 785, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_symmetric = values[0];
    __pyx_v_compressed = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getRowIJ", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 785, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getRowIJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_160getRowIJ(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_symmetric, __pyx_v_compressed);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_160getRowIJ(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_symmetric, PyObject *__pyx_v_compressed) {
  PetscInt __pyx_v_shift;
  PetscBool __pyx_v_symm;
  PetscBool __pyx_v_bcmp;
  PetscInt __pyx_v_n;
  const PetscInt *__pyx_v_ia;
  const PetscInt *__pyx_v_ja;
  PetscBool __pyx_v_done;
  PyObject *__pyx_v_ai = 0;
  PyObject *__pyx_v_aj = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("getRowIJ", 0);

  /* "PETSc/Mat.pyx":786
 * 
 *     def getRowIJ(self, symmetric=False, compressed=False):
 *         cdef PetscInt shift=0             # <<<<<<<<<<<<<<
 *         cdef PetscBool symm=symmetric
 *         cdef PetscBool bcmp=compressed
 */
  __pyx_v_shift = 0;

  /* "PETSc/Mat.pyx":787
 *     def getRowIJ(self, symmetric=False, compressed=False):
 *         cdef PetscInt shift=0
 *         cdef PetscBool symm=symmetric             # <<<<<<<<<<<<<<
 *         cdef PetscBool bcmp=compressed
 *         cdef PetscInt n=0
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_symmetric)); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 787, __pyx_L1_error)
  __pyx_v_symm = __pyx_t_1;

  /* "PETSc/Mat.pyx":788
 *         cdef PetscInt shift=0
 *         cdef PetscBool symm=symmetric
 *         cdef PetscBool bcmp=compressed             # <<<<<<<<<<<<<<
 *         cdef PetscInt n=0
 *         cdef const_PetscInt *ia=NULL
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_compressed)); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 788, __pyx_L1_error)
  __pyx_v_bcmp = __pyx_t_1;

  /* "PETSc/Mat.pyx":789
 *         cdef PetscBool symm=symmetric
 *         cdef PetscBool bcmp=compressed
 *         cdef PetscInt n=0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *ia=NULL
 *         cdef const_PetscInt *ja=NULL
 */
  __pyx_v_n = 0;

  /* "PETSc/Mat.pyx":790
 *         cdef PetscBool bcmp=compressed
 *         cdef PetscInt n=0
 *         cdef const_PetscInt *ia=NULL             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *ja=NULL
 *         cdef PetscBool done=PETSC_FALSE
 */
  __pyx_v_ia = NULL;

  /* "PETSc/Mat.pyx":791
 *         cdef PetscInt n=0
 *         cdef const_PetscInt *ia=NULL
 *         cdef const_PetscInt *ja=NULL             # <<<<<<<<<<<<<<
 *         cdef PetscBool done=PETSC_FALSE
 *         CHKERR( MatGetRowIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 */
  __pyx_v_ja = NULL;

  /* "PETSc/Mat.pyx":792
 *         cdef const_PetscInt *ia=NULL
 *         cdef const_PetscInt *ja=NULL
 *         cdef PetscBool done=PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetRowIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 *         cdef object ai=None, aj=None
 */
  __pyx_v_done = PETSC_FALSE;

  /* "PETSc/Mat.pyx":793
 *         cdef const_PetscInt *ja=NULL
 *         cdef PetscBool done=PETSC_FALSE
 *         CHKERR( MatGetRowIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )             # <<<<<<<<<<<<<<
 *         cdef object ai=None, aj=None
 *         if done != PETSC_FALSE: ai = array_i(  n+1, ia)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetRowIJ(__pyx_v_self->mat, __pyx_v_shift, __pyx_v_symm, __pyx_v_bcmp, (&__pyx_v_n), (&__pyx_v_ia), (&__pyx_v_ja), (&__pyx_v_done))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 793, __pyx_L1_error)

  /* "PETSc/Mat.pyx":794
 *         cdef PetscBool done=PETSC_FALSE
 *         CHKERR( MatGetRowIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 *         cdef object ai=None, aj=None             # <<<<<<<<<<<<<<
 *         if done != PETSC_FALSE: ai = array_i(  n+1, ia)
 *         if done != PETSC_FALSE: aj = array_i(ia[n], ja)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_ai = Py_None;
  __Pyx_INCREF(Py_None);
  __pyx_v_aj = Py_None;

  /* "PETSc/Mat.pyx":795
 *         CHKERR( MatGetRowIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 *         cdef object ai=None, aj=None
 *         if done != PETSC_FALSE: ai = array_i(  n+1, ia)             # <<<<<<<<<<<<<<
 *         if done != PETSC_FALSE: aj = array_i(ia[n], ja)
 *         CHKERR( MatRestoreRowIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 */
  __pyx_t_3 = ((__pyx_v_done != PETSC_FALSE) != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((__pyx_v_n + 1), __pyx_v_ia)); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 795, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_ai, __pyx_t_4);
    __pyx_t_4 = 0;
  }

  /* "PETSc/Mat.pyx":796
 *         cdef object ai=None, aj=None
 *         if done != PETSC_FALSE: ai = array_i(  n+1, ia)
 *         if done != PETSC_FALSE: aj = array_i(ia[n], ja)             # <<<<<<<<<<<<<<
 *         CHKERR( MatRestoreRowIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 *         return (ai, aj)
 */
  __pyx_t_3 = ((__pyx_v_done != PETSC_FALSE) != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((__pyx_v_ia[__pyx_v_n]), __pyx_v_ja)); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_aj, __pyx_t_4);
    __pyx_t_4 = 0;
  }

  /* "PETSc/Mat.pyx":797
 *         if done != PETSC_FALSE: ai = array_i(  n+1, ia)
 *         if done != PETSC_FALSE: aj = array_i(ia[n], ja)
 *         CHKERR( MatRestoreRowIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )             # <<<<<<<<<<<<<<
 *         return (ai, aj)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatRestoreRowIJ(__pyx_v_self->mat, __pyx_v_shift, __pyx_v_symm, __pyx_v_bcmp, (&__pyx_v_n), (&__pyx_v_ia), (&__pyx_v_ja), (&__pyx_v_done))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 797, __pyx_L1_error)

  /* "PETSc/Mat.pyx":798
 *         if done != PETSC_FALSE: aj = array_i(ia[n], ja)
 *         CHKERR( MatRestoreRowIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 *         return (ai, aj)             # <<<<<<<<<<<<<<
 * 
 *     def getColumnIJ(self, symmetric=False, compressed=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_ai);
  __Pyx_GIVEREF(__pyx_v_ai);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ai);
  __Pyx_INCREF(__pyx_v_aj);
  __Pyx_GIVEREF(__pyx_v_aj);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_aj);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":785
 *         return (cols, vals)
 * 
 *     def getRowIJ(self, symmetric=False, compressed=False):             # <<<<<<<<<<<<<<
 *         cdef PetscInt shift=0
 *         cdef PetscBool symm=symmetric
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getRowIJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ai);
  __Pyx_XDECREF(__pyx_v_aj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":800
 *         return (ai, aj)
 * 
 *     def getColumnIJ(self, symmetric=False, compressed=False):             # <<<<<<<<<<<<<<
 *         cdef PetscInt shift=0
 *         cdef PetscBool symm=symmetric, bcmp=compressed
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_163getColumnIJ(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_162getColumnIJ[] = "Mat.getColumnIJ(self, symmetric=False, compressed=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_163getColumnIJ(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_symmetric = 0;
  PyObject *__pyx_v_compressed = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getColumnIJ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_symmetric,&__pyx_n_s_compressed,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_False);
    values[1] = ((PyObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_symmetric);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compressed);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getColumnIJ") < 0)) __PYX_ERR(33, 800, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_symmetric = values[0];
    __pyx_v_compressed = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getColumnIJ", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 800, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getColumnIJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_162getColumnIJ(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_symmetric, __pyx_v_compressed);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_162getColumnIJ(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_symmetric, PyObject *__pyx_v_compressed) {
  PetscInt __pyx_v_shift;
  PetscBool __pyx_v_symm;
  PetscBool __pyx_v_bcmp;
  PetscInt __pyx_v_n;
  const PetscInt *__pyx_v_ia;
  const PetscInt *__pyx_v_ja;
  PetscBool __pyx_v_done;
  PyObject *__pyx_v_ai = 0;
  PyObject *__pyx_v_aj = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("getColumnIJ", 0);

  /* "PETSc/Mat.pyx":801
 * 
 *     def getColumnIJ(self, symmetric=False, compressed=False):
 *         cdef PetscInt shift=0             # <<<<<<<<<<<<<<
 *         cdef PetscBool symm=symmetric, bcmp=compressed
 *         cdef PetscInt n=0
 */
  __pyx_v_shift = 0;

  /* "PETSc/Mat.pyx":802
 *     def getColumnIJ(self, symmetric=False, compressed=False):
 *         cdef PetscInt shift=0
 *         cdef PetscBool symm=symmetric, bcmp=compressed             # <<<<<<<<<<<<<<
 *         cdef PetscInt n=0
 *         cdef const_PetscInt *ia=NULL
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_symmetric)); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 802, __pyx_L1_error)
  __pyx_v_symm = __pyx_t_1;
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_compressed)); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 802, __pyx_L1_error)
  __pyx_v_bcmp = __pyx_t_1;

  /* "PETSc/Mat.pyx":803
 *         cdef PetscInt shift=0
 *         cdef PetscBool symm=symmetric, bcmp=compressed
 *         cdef PetscInt n=0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *ia=NULL
 *         cdef const_PetscInt *ja=NULL
 */
  __pyx_v_n = 0;

  /* "PETSc/Mat.pyx":804
 *         cdef PetscBool symm=symmetric, bcmp=compressed
 *         cdef PetscInt n=0
 *         cdef const_PetscInt *ia=NULL             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *ja=NULL
 *         cdef PetscBool done=PETSC_FALSE
 */
  __pyx_v_ia = NULL;

  /* "PETSc/Mat.pyx":805
 *         cdef PetscInt n=0
 *         cdef const_PetscInt *ia=NULL
 *         cdef const_PetscInt *ja=NULL             # <<<<<<<<<<<<<<
 *         cdef PetscBool done=PETSC_FALSE
 *         CHKERR( MatGetColumnIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 */
  __pyx_v_ja = NULL;

  /* "PETSc/Mat.pyx":806
 *         cdef const_PetscInt *ia=NULL
 *         cdef const_PetscInt *ja=NULL
 *         cdef PetscBool done=PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetColumnIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 *         cdef object ai=None, aj=None
 */
  __pyx_v_done = PETSC_FALSE;

  /* "PETSc/Mat.pyx":807
 *         cdef const_PetscInt *ja=NULL
 *         cdef PetscBool done=PETSC_FALSE
 *         CHKERR( MatGetColumnIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )             # <<<<<<<<<<<<<<
 *         cdef object ai=None, aj=None
 *         if done != PETSC_FALSE: ai = array_i(  n+1, ia)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetColumnIJ(__pyx_v_self->mat, __pyx_v_shift, __pyx_v_symm, __pyx_v_bcmp, (&__pyx_v_n), (&__pyx_v_ia), (&__pyx_v_ja), (&__pyx_v_done))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 807, __pyx_L1_error)

  /* "PETSc/Mat.pyx":808
 *         cdef PetscBool done=PETSC_FALSE
 *         CHKERR( MatGetColumnIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 *         cdef object ai=None, aj=None             # <<<<<<<<<<<<<<
 *         if done != PETSC_FALSE: ai = array_i(  n+1, ia)
 *         if done != PETSC_FALSE: aj = array_i(ia[n], ja)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_ai = Py_None;
  __Pyx_INCREF(Py_None);
  __pyx_v_aj = Py_None;

  /* "PETSc/Mat.pyx":809
 *         CHKERR( MatGetColumnIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 *         cdef object ai=None, aj=None
 *         if done != PETSC_FALSE: ai = array_i(  n+1, ia)             # <<<<<<<<<<<<<<
 *         if done != PETSC_FALSE: aj = array_i(ia[n], ja)
 *         CHKERR( MatRestoreColumnIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 */
  __pyx_t_3 = ((__pyx_v_done != PETSC_FALSE) != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((__pyx_v_n + 1), __pyx_v_ia)); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_ai, __pyx_t_4);
    __pyx_t_4 = 0;
  }

  /* "PETSc/Mat.pyx":810
 *         cdef object ai=None, aj=None
 *         if done != PETSC_FALSE: ai = array_i(  n+1, ia)
 *         if done != PETSC_FALSE: aj = array_i(ia[n], ja)             # <<<<<<<<<<<<<<
 *         CHKERR( MatRestoreColumnIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 *         return (ai, aj)
 */
  __pyx_t_3 = ((__pyx_v_done != PETSC_FALSE) != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((__pyx_v_ia[__pyx_v_n]), __pyx_v_ja)); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_aj, __pyx_t_4);
    __pyx_t_4 = 0;
  }

  /* "PETSc/Mat.pyx":811
 *         if done != PETSC_FALSE: ai = array_i(  n+1, ia)
 *         if done != PETSC_FALSE: aj = array_i(ia[n], ja)
 *         CHKERR( MatRestoreColumnIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )             # <<<<<<<<<<<<<<
 *         return (ai, aj)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatRestoreColumnIJ(__pyx_v_self->mat, __pyx_v_shift, __pyx_v_symm, __pyx_v_bcmp, (&__pyx_v_n), (&__pyx_v_ia), (&__pyx_v_ja), (&__pyx_v_done))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 811, __pyx_L1_error)

  /* "PETSc/Mat.pyx":812
 *         if done != PETSC_FALSE: aj = array_i(ia[n], ja)
 *         CHKERR( MatRestoreColumnIJ(self.mat, shift, symm, bcmp, &n, &ia, &ja, &done) )
 *         return (ai, aj)             # <<<<<<<<<<<<<<
 * 
 *     def setValue(self, row, col, value, addv=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_ai);
  __Pyx_GIVEREF(__pyx_v_ai);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ai);
  __Pyx_INCREF(__pyx_v_aj);
  __Pyx_GIVEREF(__pyx_v_aj);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_aj);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":800
 *         return (ai, aj)
 * 
 *     def getColumnIJ(self, symmetric=False, compressed=False):             # <<<<<<<<<<<<<<
 *         cdef PetscInt shift=0
 *         cdef PetscBool symm=symmetric, bcmp=compressed
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getColumnIJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ai);
  __Pyx_XDECREF(__pyx_v_aj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":814
 *         return (ai, aj)
 * 
 *     def setValue(self, row, col, value, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival1 = asInt(row)
 *         cdef PetscInt    ival2 = asInt(col)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_165setValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_164setValue[] = "Mat.setValue(self, row, col, value, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_165setValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_row = 0;
  PyObject *__pyx_v_col = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValue (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_row,&__pyx_n_s_col,&__pyx_n_s_value,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_row)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_col)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValue", 0, 3, 4, 1); __PYX_ERR(33, 814, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValue", 0, 3, 4, 2); __PYX_ERR(33, 814, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValue") < 0)) __PYX_ERR(33, 814, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_row = values[0];
    __pyx_v_col = values[1];
    __pyx_v_value = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValue", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 814, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_164setValue(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_row, __pyx_v_col, __pyx_v_value, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_164setValue(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row, PyObject *__pyx_v_col, PyObject *__pyx_v_value, PyObject *__pyx_v_addv) {
  PetscInt __pyx_v_ival1;
  PetscInt __pyx_v_ival2;
  PetscScalar __pyx_v_sval;
  InsertMode __pyx_v_caddv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscScalar __pyx_t_2;
  InsertMode __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setValue", 0);

  /* "PETSc/Mat.pyx":815
 * 
 *     def setValue(self, row, col, value, addv=None):
 *         cdef PetscInt    ival1 = asInt(row)             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival2 = asInt(col)
 *         cdef PetscScalar sval  = asScalar(value)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_row); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 815, __pyx_L1_error)
  __pyx_v_ival1 = __pyx_t_1;

  /* "PETSc/Mat.pyx":816
 *     def setValue(self, row, col, value, addv=None):
 *         cdef PetscInt    ival1 = asInt(row)
 *         cdef PetscInt    ival2 = asInt(col)             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval  = asScalar(value)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_col); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 816, __pyx_L1_error)
  __pyx_v_ival2 = __pyx_t_1;

  /* "PETSc/Mat.pyx":817
 *         cdef PetscInt    ival1 = asInt(row)
 *         cdef PetscInt    ival2 = asInt(col)
 *         cdef PetscScalar sval  = asScalar(value)             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( MatSetValues(self.mat, 1, &ival1, 1, &ival2, &sval, caddv) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 817, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_2;

  /* "PETSc/Mat.pyx":818
 *         cdef PetscInt    ival2 = asInt(col)
 *         cdef PetscScalar sval  = asScalar(value)
 *         cdef PetscInsertMode caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetValues(self.mat, 1, &ival1, 1, &ival2, &sval, caddv) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_3 == ((InsertMode)-1L))) __PYX_ERR(33, 818, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_3;

  /* "PETSc/Mat.pyx":819
 *         cdef PetscScalar sval  = asScalar(value)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( MatSetValues(self.mat, 1, &ival1, 1, &ival2, &sval, caddv) )             # <<<<<<<<<<<<<<
 * 
 *     def setValues(self, rows, cols, values, addv=None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetValues(__pyx_v_self->mat, 1, (&__pyx_v_ival1), 1, (&__pyx_v_ival2), (&__pyx_v_sval), __pyx_v_caddv)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 819, __pyx_L1_error)

  /* "PETSc/Mat.pyx":814
 *         return (ai, aj)
 * 
 *     def setValue(self, row, col, value, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival1 = asInt(row)
 *         cdef PetscInt    ival2 = asInt(col)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":821
 *         CHKERR( MatSetValues(self.mat, 1, &ival1, 1, &ival2, &sval, caddv) )
 * 
 *     def setValues(self, rows, cols, values, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues(self.mat, rows, cols, values, addv, 0, 0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_167setValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_166setValues[] = "Mat.setValues(self, rows, cols, values, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_167setValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rows = 0;
  PyObject *__pyx_v_cols = 0;
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValues (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rows,&__pyx_n_s_cols,&__pyx_n_s_values,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_rows)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cols)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValues", 0, 3, 4, 1); __PYX_ERR(33, 821, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValues", 0, 3, 4, 2); __PYX_ERR(33, 821, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValues") < 0)) __PYX_ERR(33, 821, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_rows = values[0];
    __pyx_v_cols = values[1];
    __pyx_v_values = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValues", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 821, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_166setValues(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_rows, __pyx_v_cols, __pyx_v_values, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_166setValues(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_cols, PyObject *__pyx_v_values, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValues", 0);

  /* "PETSc/Mat.pyx":822
 * 
 *     def setValues(self, rows, cols, values, addv=None):
 *         matsetvalues(self.mat, rows, cols, values, addv, 0, 0)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesRCV(self, R, C, V, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues(__pyx_v_self->mat, __pyx_v_rows, __pyx_v_cols, __pyx_v_values, __pyx_v_addv, 0, 0); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 822, __pyx_L1_error)

  /* "PETSc/Mat.pyx":821
 *         CHKERR( MatSetValues(self.mat, 1, &ival1, 1, &ival2, &sval, caddv) )
 * 
 *     def setValues(self, rows, cols, values, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues(self.mat, rows, cols, values, addv, 0, 0)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":824
 *         matsetvalues(self.mat, rows, cols, values, addv, 0, 0)
 * 
 *     def setValuesRCV(self, R, C, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 0, 0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_169setValuesRCV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_168setValuesRCV[] = "Mat.setValuesRCV(self, R, C, V, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_169setValuesRCV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_R = 0;
  PyObject *__pyx_v_C = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesRCV (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_R,&__pyx_n_s_C,&__pyx_n_s_V,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_R)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_C)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesRCV", 0, 3, 4, 1); __PYX_ERR(33, 824, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesRCV", 0, 3, 4, 2); __PYX_ERR(33, 824, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesRCV") < 0)) __PYX_ERR(33, 824, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_R = values[0];
    __pyx_v_C = values[1];
    __pyx_v_V = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesRCV", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 824, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesRCV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_168setValuesRCV(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_R, __pyx_v_C, __pyx_v_V, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_168setValuesRCV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_R, PyObject *__pyx_v_C, PyObject *__pyx_v_V, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesRCV", 0);

  /* "PETSc/Mat.pyx":825
 * 
 *     def setValuesRCV(self, R, C, V, addv=None):
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 0, 0)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesIJV(self, I, J, V, addv=None, rowmap=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_rcv(__pyx_v_self->mat, __pyx_v_R, __pyx_v_C, __pyx_v_V, __pyx_v_addv, 0, 0); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 825, __pyx_L1_error)

  /* "PETSc/Mat.pyx":824
 *         matsetvalues(self.mat, rows, cols, values, addv, 0, 0)
 * 
 *     def setValuesRCV(self, R, C, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 0, 0)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesRCV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":827
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 0, 0)
 * 
 *     def setValuesIJV(self, I, J, V, addv=None, rowmap=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 0, 0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_171setValuesIJV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_170setValuesIJV[] = "Mat.setValuesIJV(self, I, J, V, addv=None, rowmap=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_171setValuesIJV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_I = 0;
  PyObject *__pyx_v_J = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_rowmap = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesIJV (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_I,&__pyx_n_s_J,&__pyx_n_s_V,&__pyx_n_s_addv,&__pyx_n_s_rowmap,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_I)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesIJV", 0, 3, 5, 1); __PYX_ERR(33, 827, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesIJV", 0, 3, 5, 2); __PYX_ERR(33, 827, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rowmap);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesIJV") < 0)) __PYX_ERR(33, 827, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_I = values[0];
    __pyx_v_J = values[1];
    __pyx_v_V = values[2];
    __pyx_v_addv = values[3];
    __pyx_v_rowmap = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesIJV", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 827, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesIJV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_170setValuesIJV(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv, __pyx_v_rowmap);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_170setValuesIJV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv, PyObject *__pyx_v_rowmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesIJV", 0);

  /* "PETSc/Mat.pyx":828
 * 
 *     def setValuesIJV(self, I, J, V, addv=None, rowmap=None):
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 0, 0)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesCSR(self, I, J, V, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_ijv(__pyx_v_self->mat, __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv, __pyx_v_rowmap, 0, 0); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 828, __pyx_L1_error)

  /* "PETSc/Mat.pyx":827
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 0, 0)
 * 
 *     def setValuesIJV(self, I, J, V, addv=None, rowmap=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 0, 0)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesIJV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":830
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 0, 0)
 * 
 *     def setValuesCSR(self, I, J, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_csr(self.mat, I, J, V, addv, 0, 0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_173setValuesCSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_172setValuesCSR[] = "Mat.setValuesCSR(self, I, J, V, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_173setValuesCSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_I = 0;
  PyObject *__pyx_v_J = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesCSR (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_I,&__pyx_n_s_J,&__pyx_n_s_V,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_I)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesCSR", 0, 3, 4, 1); __PYX_ERR(33, 830, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesCSR", 0, 3, 4, 2); __PYX_ERR(33, 830, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesCSR") < 0)) __PYX_ERR(33, 830, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_I = values[0];
    __pyx_v_J = values[1];
    __pyx_v_V = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesCSR", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 830, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesCSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_172setValuesCSR(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_172setValuesCSR(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesCSR", 0);

  /* "PETSc/Mat.pyx":831
 * 
 *     def setValuesCSR(self, I, J, V, addv=None):
 *         matsetvalues_csr(self.mat, I, J, V, addv, 0, 0)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesBlocked(self, rows, cols, values, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_csr(__pyx_v_self->mat, __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv, 0, 0); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 831, __pyx_L1_error)

  /* "PETSc/Mat.pyx":830
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 0, 0)
 * 
 *     def setValuesCSR(self, I, J, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_csr(self.mat, I, J, V, addv, 0, 0)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesCSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":833
 *         matsetvalues_csr(self.mat, I, J, V, addv, 0, 0)
 * 
 *     def setValuesBlocked(self, rows, cols, values, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues(self.mat, rows, cols, values, addv, 1, 0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_175setValuesBlocked(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_174setValuesBlocked[] = "Mat.setValuesBlocked(self, rows, cols, values, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_175setValuesBlocked(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rows = 0;
  PyObject *__pyx_v_cols = 0;
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesBlocked (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rows,&__pyx_n_s_cols,&__pyx_n_s_values,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_rows)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cols)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlocked", 0, 3, 4, 1); __PYX_ERR(33, 833, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlocked", 0, 3, 4, 2); __PYX_ERR(33, 833, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesBlocked") < 0)) __PYX_ERR(33, 833, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_rows = values[0];
    __pyx_v_cols = values[1];
    __pyx_v_values = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesBlocked", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 833, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlocked", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_174setValuesBlocked(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_rows, __pyx_v_cols, __pyx_v_values, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_174setValuesBlocked(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_cols, PyObject *__pyx_v_values, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesBlocked", 0);

  /* "PETSc/Mat.pyx":834
 * 
 *     def setValuesBlocked(self, rows, cols, values, addv=None):
 *         matsetvalues(self.mat, rows, cols, values, addv, 1, 0)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesBlockedRCV(self, R, C, V, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues(__pyx_v_self->mat, __pyx_v_rows, __pyx_v_cols, __pyx_v_values, __pyx_v_addv, 1, 0); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 834, __pyx_L1_error)

  /* "PETSc/Mat.pyx":833
 *         matsetvalues_csr(self.mat, I, J, V, addv, 0, 0)
 * 
 *     def setValuesBlocked(self, rows, cols, values, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues(self.mat, rows, cols, values, addv, 1, 0)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlocked", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":836
 *         matsetvalues(self.mat, rows, cols, values, addv, 1, 0)
 * 
 *     def setValuesBlockedRCV(self, R, C, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 1, 0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_177setValuesBlockedRCV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_176setValuesBlockedRCV[] = "Mat.setValuesBlockedRCV(self, R, C, V, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_177setValuesBlockedRCV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_R = 0;
  PyObject *__pyx_v_C = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesBlockedRCV (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_R,&__pyx_n_s_C,&__pyx_n_s_V,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_R)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_C)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedRCV", 0, 3, 4, 1); __PYX_ERR(33, 836, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedRCV", 0, 3, 4, 2); __PYX_ERR(33, 836, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesBlockedRCV") < 0)) __PYX_ERR(33, 836, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_R = values[0];
    __pyx_v_C = values[1];
    __pyx_v_V = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesBlockedRCV", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 836, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedRCV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_176setValuesBlockedRCV(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_R, __pyx_v_C, __pyx_v_V, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_176setValuesBlockedRCV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_R, PyObject *__pyx_v_C, PyObject *__pyx_v_V, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesBlockedRCV", 0);

  /* "PETSc/Mat.pyx":837
 * 
 *     def setValuesBlockedRCV(self, R, C, V, addv=None):
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 1, 0)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesBlockedIJV(self, I, J, V, addv=None, rowmap=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_rcv(__pyx_v_self->mat, __pyx_v_R, __pyx_v_C, __pyx_v_V, __pyx_v_addv, 1, 0); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 837, __pyx_L1_error)

  /* "PETSc/Mat.pyx":836
 *         matsetvalues(self.mat, rows, cols, values, addv, 1, 0)
 * 
 *     def setValuesBlockedRCV(self, R, C, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 1, 0)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedRCV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":839
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 1, 0)
 * 
 *     def setValuesBlockedIJV(self, I, J, V, addv=None, rowmap=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 1, 0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_179setValuesBlockedIJV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_178setValuesBlockedIJV[] = "Mat.setValuesBlockedIJV(self, I, J, V, addv=None, rowmap=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_179setValuesBlockedIJV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_I = 0;
  PyObject *__pyx_v_J = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_rowmap = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesBlockedIJV (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_I,&__pyx_n_s_J,&__pyx_n_s_V,&__pyx_n_s_addv,&__pyx_n_s_rowmap,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_I)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedIJV", 0, 3, 5, 1); __PYX_ERR(33, 839, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedIJV", 0, 3, 5, 2); __PYX_ERR(33, 839, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rowmap);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesBlockedIJV") < 0)) __PYX_ERR(33, 839, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_I = values[0];
    __pyx_v_J = values[1];
    __pyx_v_V = values[2];
    __pyx_v_addv = values[3];
    __pyx_v_rowmap = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesBlockedIJV", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 839, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedIJV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_178setValuesBlockedIJV(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv, __pyx_v_rowmap);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_178setValuesBlockedIJV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv, PyObject *__pyx_v_rowmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesBlockedIJV", 0);

  /* "PETSc/Mat.pyx":840
 * 
 *     def setValuesBlockedIJV(self, I, J, V, addv=None, rowmap=None):
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 1, 0)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesBlockedCSR(self, I, J, V, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_ijv(__pyx_v_self->mat, __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv, __pyx_v_rowmap, 1, 0); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 840, __pyx_L1_error)

  /* "PETSc/Mat.pyx":839
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 1, 0)
 * 
 *     def setValuesBlockedIJV(self, I, J, V, addv=None, rowmap=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 1, 0)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedIJV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":842
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 1, 0)
 * 
 *     def setValuesBlockedCSR(self, I, J, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_csr(self.mat, I, J, V, addv, 1, 0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_181setValuesBlockedCSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_180setValuesBlockedCSR[] = "Mat.setValuesBlockedCSR(self, I, J, V, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_181setValuesBlockedCSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_I = 0;
  PyObject *__pyx_v_J = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesBlockedCSR (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_I,&__pyx_n_s_J,&__pyx_n_s_V,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_I)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedCSR", 0, 3, 4, 1); __PYX_ERR(33, 842, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedCSR", 0, 3, 4, 2); __PYX_ERR(33, 842, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesBlockedCSR") < 0)) __PYX_ERR(33, 842, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_I = values[0];
    __pyx_v_J = values[1];
    __pyx_v_V = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesBlockedCSR", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 842, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedCSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_180setValuesBlockedCSR(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_180setValuesBlockedCSR(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesBlockedCSR", 0);

  /* "PETSc/Mat.pyx":843
 * 
 *     def setValuesBlockedCSR(self, I, J, V, addv=None):
 *         matsetvalues_csr(self.mat, I, J, V, addv, 1, 0)             # <<<<<<<<<<<<<<
 * 
 *     def setLGMap(self, LGMap rmap not None, LGMap cmap=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_csr(__pyx_v_self->mat, __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv, 1, 0); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 843, __pyx_L1_error)

  /* "PETSc/Mat.pyx":842
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 1, 0)
 * 
 *     def setValuesBlockedCSR(self, I, J, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_csr(self.mat, I, J, V, addv, 1, 0)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedCSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":845
 *         matsetvalues_csr(self.mat, I, J, V, addv, 1, 0)
 * 
 *     def setLGMap(self, LGMap rmap not None, LGMap cmap=None):             # <<<<<<<<<<<<<<
 *         if cmap is None: cmap = rmap
 *         CHKERR( MatSetLocalToGlobalMapping(self.mat, rmap.lgm, cmap.lgm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_183setLGMap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_182setLGMap[] = "Mat.setLGMap(self, LGMap rmap, LGMap cmap=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_183setLGMap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscLGMapObject *__pyx_v_rmap = 0;
  struct PyPetscLGMapObject *__pyx_v_cmap = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setLGMap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rmap,&__pyx_n_s_cmap,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct PyPetscLGMapObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_rmap)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cmap);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setLGMap") < 0)) __PYX_ERR(33, 845, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rmap = ((struct PyPetscLGMapObject *)values[0]);
    __pyx_v_cmap = ((struct PyPetscLGMapObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setLGMap", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 845, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setLGMap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rmap), __pyx_ptype_8petsc4py_5PETSc_LGMap, 0, "rmap", 0))) __PYX_ERR(33, 845, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cmap), __pyx_ptype_8petsc4py_5PETSc_LGMap, 1, "cmap", 0))) __PYX_ERR(33, 845, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_182setLGMap(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_rmap, __pyx_v_cmap);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_182setLGMap(struct PyPetscMatObject *__pyx_v_self, struct PyPetscLGMapObject *__pyx_v_rmap, struct PyPetscLGMapObject *__pyx_v_cmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setLGMap", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_cmap);

  /* "PETSc/Mat.pyx":846
 * 
 *     def setLGMap(self, LGMap rmap not None, LGMap cmap=None):
 *         if cmap is None: cmap = rmap             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetLocalToGlobalMapping(self.mat, rmap.lgm, cmap.lgm) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_cmap) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_INCREF(((PyObject *)__pyx_v_rmap));
    __Pyx_DECREF_SET(__pyx_v_cmap, __pyx_v_rmap);
  }

  /* "PETSc/Mat.pyx":847
 *     def setLGMap(self, LGMap rmap not None, LGMap cmap=None):
 *         if cmap is None: cmap = rmap
 *         CHKERR( MatSetLocalToGlobalMapping(self.mat, rmap.lgm, cmap.lgm) )             # <<<<<<<<<<<<<<
 * 
 *     def setValueLocal(self, row, col, value, addv=None):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetLocalToGlobalMapping(__pyx_v_self->mat, __pyx_v_rmap->lgm, __pyx_v_cmap->lgm)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 847, __pyx_L1_error)

  /* "PETSc/Mat.pyx":845
 *         matsetvalues_csr(self.mat, I, J, V, addv, 1, 0)
 * 
 *     def setLGMap(self, LGMap rmap not None, LGMap cmap=None):             # <<<<<<<<<<<<<<
 *         if cmap is None: cmap = rmap
 *         CHKERR( MatSetLocalToGlobalMapping(self.mat, rmap.lgm, cmap.lgm) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setLGMap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_cmap);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":849
 *         CHKERR( MatSetLocalToGlobalMapping(self.mat, rmap.lgm, cmap.lgm) )
 * 
 *     def setValueLocal(self, row, col, value, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival1 = asInt(row)
 *         cdef PetscInt    ival2 = asInt(col)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_185setValueLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_184setValueLocal[] = "Mat.setValueLocal(self, row, col, value, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_185setValueLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_row = 0;
  PyObject *__pyx_v_col = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValueLocal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_row,&__pyx_n_s_col,&__pyx_n_s_value,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_row)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_col)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValueLocal", 0, 3, 4, 1); __PYX_ERR(33, 849, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValueLocal", 0, 3, 4, 2); __PYX_ERR(33, 849, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValueLocal") < 0)) __PYX_ERR(33, 849, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_row = values[0];
    __pyx_v_col = values[1];
    __pyx_v_value = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValueLocal", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 849, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValueLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_184setValueLocal(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_row, __pyx_v_col, __pyx_v_value, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_184setValueLocal(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row, PyObject *__pyx_v_col, PyObject *__pyx_v_value, PyObject *__pyx_v_addv) {
  PetscInt __pyx_v_ival1;
  PetscInt __pyx_v_ival2;
  PetscScalar __pyx_v_sval;
  InsertMode __pyx_v_caddv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscScalar __pyx_t_2;
  InsertMode __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setValueLocal", 0);

  /* "PETSc/Mat.pyx":850
 * 
 *     def setValueLocal(self, row, col, value, addv=None):
 *         cdef PetscInt    ival1 = asInt(row)             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival2 = asInt(col)
 *         cdef PetscScalar sval  = asScalar(value)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_row); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 850, __pyx_L1_error)
  __pyx_v_ival1 = __pyx_t_1;

  /* "PETSc/Mat.pyx":851
 *     def setValueLocal(self, row, col, value, addv=None):
 *         cdef PetscInt    ival1 = asInt(row)
 *         cdef PetscInt    ival2 = asInt(col)             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval  = asScalar(value)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_col); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 851, __pyx_L1_error)
  __pyx_v_ival2 = __pyx_t_1;

  /* "PETSc/Mat.pyx":852
 *         cdef PetscInt    ival1 = asInt(row)
 *         cdef PetscInt    ival2 = asInt(col)
 *         cdef PetscScalar sval  = asScalar(value)             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( MatSetValuesLocal(
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 852, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_2;

  /* "PETSc/Mat.pyx":853
 *         cdef PetscInt    ival2 = asInt(col)
 *         cdef PetscScalar sval  = asScalar(value)
 *         cdef PetscInsertMode caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetValuesLocal(
 *                 self.mat, 1, &ival1, 1, &ival2, &sval, caddv) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_3 == ((InsertMode)-1L))) __PYX_ERR(33, 853, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_3;

  /* "PETSc/Mat.pyx":854
 *         cdef PetscScalar sval  = asScalar(value)
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( MatSetValuesLocal(             # <<<<<<<<<<<<<<
 *                 self.mat, 1, &ival1, 1, &ival2, &sval, caddv) )
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetValuesLocal(__pyx_v_self->mat, 1, (&__pyx_v_ival1), 1, (&__pyx_v_ival2), (&__pyx_v_sval), __pyx_v_caddv)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 854, __pyx_L1_error)

  /* "PETSc/Mat.pyx":849
 *         CHKERR( MatSetLocalToGlobalMapping(self.mat, rmap.lgm, cmap.lgm) )
 * 
 *     def setValueLocal(self, row, col, value, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt    ival1 = asInt(row)
 *         cdef PetscInt    ival2 = asInt(col)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValueLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":857
 *                 self.mat, 1, &ival1, 1, &ival2, &sval, caddv) )
 * 
 *     def setValuesLocal(self, rows, cols, values, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues(self.mat, rows, cols, values, addv, 0, 1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_187setValuesLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_186setValuesLocal[] = "Mat.setValuesLocal(self, rows, cols, values, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_187setValuesLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rows = 0;
  PyObject *__pyx_v_cols = 0;
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesLocal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rows,&__pyx_n_s_cols,&__pyx_n_s_values,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_rows)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cols)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesLocal", 0, 3, 4, 1); __PYX_ERR(33, 857, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesLocal", 0, 3, 4, 2); __PYX_ERR(33, 857, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesLocal") < 0)) __PYX_ERR(33, 857, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_rows = values[0];
    __pyx_v_cols = values[1];
    __pyx_v_values = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesLocal", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 857, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_186setValuesLocal(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_rows, __pyx_v_cols, __pyx_v_values, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_186setValuesLocal(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_cols, PyObject *__pyx_v_values, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesLocal", 0);

  /* "PETSc/Mat.pyx":858
 * 
 *     def setValuesLocal(self, rows, cols, values, addv=None):
 *         matsetvalues(self.mat, rows, cols, values, addv, 0, 1)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesLocalRCV(self, R, C, V, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues(__pyx_v_self->mat, __pyx_v_rows, __pyx_v_cols, __pyx_v_values, __pyx_v_addv, 0, 1); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 858, __pyx_L1_error)

  /* "PETSc/Mat.pyx":857
 *                 self.mat, 1, &ival1, 1, &ival2, &sval, caddv) )
 * 
 *     def setValuesLocal(self, rows, cols, values, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues(self.mat, rows, cols, values, addv, 0, 1)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":860
 *         matsetvalues(self.mat, rows, cols, values, addv, 0, 1)
 * 
 *     def setValuesLocalRCV(self, R, C, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 0, 1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_189setValuesLocalRCV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_188setValuesLocalRCV[] = "Mat.setValuesLocalRCV(self, R, C, V, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_189setValuesLocalRCV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_R = 0;
  PyObject *__pyx_v_C = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesLocalRCV (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_R,&__pyx_n_s_C,&__pyx_n_s_V,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_R)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_C)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesLocalRCV", 0, 3, 4, 1); __PYX_ERR(33, 860, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesLocalRCV", 0, 3, 4, 2); __PYX_ERR(33, 860, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesLocalRCV") < 0)) __PYX_ERR(33, 860, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_R = values[0];
    __pyx_v_C = values[1];
    __pyx_v_V = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesLocalRCV", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 860, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesLocalRCV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_188setValuesLocalRCV(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_R, __pyx_v_C, __pyx_v_V, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_188setValuesLocalRCV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_R, PyObject *__pyx_v_C, PyObject *__pyx_v_V, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesLocalRCV", 0);

  /* "PETSc/Mat.pyx":861
 * 
 *     def setValuesLocalRCV(self, R, C, V, addv=None):
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 0, 1)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesLocalIJV(self, I, J, V, addv=None, rowmap=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_rcv(__pyx_v_self->mat, __pyx_v_R, __pyx_v_C, __pyx_v_V, __pyx_v_addv, 0, 1); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 861, __pyx_L1_error)

  /* "PETSc/Mat.pyx":860
 *         matsetvalues(self.mat, rows, cols, values, addv, 0, 1)
 * 
 *     def setValuesLocalRCV(self, R, C, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 0, 1)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesLocalRCV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":863
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 0, 1)
 * 
 *     def setValuesLocalIJV(self, I, J, V, addv=None, rowmap=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 0, 1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_191setValuesLocalIJV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_190setValuesLocalIJV[] = "Mat.setValuesLocalIJV(self, I, J, V, addv=None, rowmap=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_191setValuesLocalIJV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_I = 0;
  PyObject *__pyx_v_J = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_rowmap = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesLocalIJV (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_I,&__pyx_n_s_J,&__pyx_n_s_V,&__pyx_n_s_addv,&__pyx_n_s_rowmap,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_I)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesLocalIJV", 0, 3, 5, 1); __PYX_ERR(33, 863, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesLocalIJV", 0, 3, 5, 2); __PYX_ERR(33, 863, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rowmap);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesLocalIJV") < 0)) __PYX_ERR(33, 863, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_I = values[0];
    __pyx_v_J = values[1];
    __pyx_v_V = values[2];
    __pyx_v_addv = values[3];
    __pyx_v_rowmap = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesLocalIJV", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 863, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesLocalIJV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_190setValuesLocalIJV(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv, __pyx_v_rowmap);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_190setValuesLocalIJV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv, PyObject *__pyx_v_rowmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesLocalIJV", 0);

  /* "PETSc/Mat.pyx":864
 * 
 *     def setValuesLocalIJV(self, I, J, V, addv=None, rowmap=None):
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 0, 1)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesLocalCSR(self, I, J, V, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_ijv(__pyx_v_self->mat, __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv, __pyx_v_rowmap, 0, 1); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 864, __pyx_L1_error)

  /* "PETSc/Mat.pyx":863
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 0, 1)
 * 
 *     def setValuesLocalIJV(self, I, J, V, addv=None, rowmap=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 0, 1)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesLocalIJV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":866
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 0, 1)
 * 
 *     def setValuesLocalCSR(self, I, J, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_csr(self.mat, I, J, V, addv, 0, 1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_193setValuesLocalCSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_192setValuesLocalCSR[] = "Mat.setValuesLocalCSR(self, I, J, V, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_193setValuesLocalCSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_I = 0;
  PyObject *__pyx_v_J = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesLocalCSR (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_I,&__pyx_n_s_J,&__pyx_n_s_V,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_I)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesLocalCSR", 0, 3, 4, 1); __PYX_ERR(33, 866, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesLocalCSR", 0, 3, 4, 2); __PYX_ERR(33, 866, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesLocalCSR") < 0)) __PYX_ERR(33, 866, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_I = values[0];
    __pyx_v_J = values[1];
    __pyx_v_V = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesLocalCSR", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 866, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesLocalCSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_192setValuesLocalCSR(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_192setValuesLocalCSR(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesLocalCSR", 0);

  /* "PETSc/Mat.pyx":867
 * 
 *     def setValuesLocalCSR(self, I, J, V, addv=None):
 *         matsetvalues_csr(self.mat, I, J, V, addv, 0, 1)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesBlockedLocal(self, rows, cols, values, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_csr(__pyx_v_self->mat, __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv, 0, 1); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 867, __pyx_L1_error)

  /* "PETSc/Mat.pyx":866
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 0, 1)
 * 
 *     def setValuesLocalCSR(self, I, J, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_csr(self.mat, I, J, V, addv, 0, 1)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesLocalCSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":869
 *         matsetvalues_csr(self.mat, I, J, V, addv, 0, 1)
 * 
 *     def setValuesBlockedLocal(self, rows, cols, values, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues(self.mat, rows, cols, values, addv, 1, 1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_195setValuesBlockedLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_194setValuesBlockedLocal[] = "Mat.setValuesBlockedLocal(self, rows, cols, values, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_195setValuesBlockedLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rows = 0;
  PyObject *__pyx_v_cols = 0;
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesBlockedLocal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rows,&__pyx_n_s_cols,&__pyx_n_s_values,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_rows)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cols)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocal", 0, 3, 4, 1); __PYX_ERR(33, 869, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocal", 0, 3, 4, 2); __PYX_ERR(33, 869, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesBlockedLocal") < 0)) __PYX_ERR(33, 869, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_rows = values[0];
    __pyx_v_cols = values[1];
    __pyx_v_values = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocal", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 869, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_194setValuesBlockedLocal(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_rows, __pyx_v_cols, __pyx_v_values, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_194setValuesBlockedLocal(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_cols, PyObject *__pyx_v_values, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesBlockedLocal", 0);

  /* "PETSc/Mat.pyx":870
 * 
 *     def setValuesBlockedLocal(self, rows, cols, values, addv=None):
 *         matsetvalues(self.mat, rows, cols, values, addv, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesBlockedLocalRCV(self, R, C, V, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues(__pyx_v_self->mat, __pyx_v_rows, __pyx_v_cols, __pyx_v_values, __pyx_v_addv, 1, 1); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 870, __pyx_L1_error)

  /* "PETSc/Mat.pyx":869
 *         matsetvalues_csr(self.mat, I, J, V, addv, 0, 1)
 * 
 *     def setValuesBlockedLocal(self, rows, cols, values, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues(self.mat, rows, cols, values, addv, 1, 1)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":872
 *         matsetvalues(self.mat, rows, cols, values, addv, 1, 1)
 * 
 *     def setValuesBlockedLocalRCV(self, R, C, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 1, 1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_197setValuesBlockedLocalRCV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_196setValuesBlockedLocalRCV[] = "Mat.setValuesBlockedLocalRCV(self, R, C, V, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_197setValuesBlockedLocalRCV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_R = 0;
  PyObject *__pyx_v_C = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesBlockedLocalRCV (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_R,&__pyx_n_s_C,&__pyx_n_s_V,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_R)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_C)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocalRCV", 0, 3, 4, 1); __PYX_ERR(33, 872, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocalRCV", 0, 3, 4, 2); __PYX_ERR(33, 872, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesBlockedLocalRCV") < 0)) __PYX_ERR(33, 872, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_R = values[0];
    __pyx_v_C = values[1];
    __pyx_v_V = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocalRCV", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 872, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedLocalRCV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_196setValuesBlockedLocalRCV(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_R, __pyx_v_C, __pyx_v_V, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_196setValuesBlockedLocalRCV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_R, PyObject *__pyx_v_C, PyObject *__pyx_v_V, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesBlockedLocalRCV", 0);

  /* "PETSc/Mat.pyx":873
 * 
 *     def setValuesBlockedLocalRCV(self, R, C, V, addv=None):
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesBlockedLocalIJV(self, I, J, V, addv=None, rowmap=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_rcv(__pyx_v_self->mat, __pyx_v_R, __pyx_v_C, __pyx_v_V, __pyx_v_addv, 1, 1); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 873, __pyx_L1_error)

  /* "PETSc/Mat.pyx":872
 *         matsetvalues(self.mat, rows, cols, values, addv, 1, 1)
 * 
 *     def setValuesBlockedLocalRCV(self, R, C, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 1, 1)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedLocalRCV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":875
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 1, 1)
 * 
 *     def setValuesBlockedLocalIJV(self, I, J, V, addv=None, rowmap=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 1, 1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_199setValuesBlockedLocalIJV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_198setValuesBlockedLocalIJV[] = "Mat.setValuesBlockedLocalIJV(self, I, J, V, addv=None, rowmap=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_199setValuesBlockedLocalIJV(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_I = 0;
  PyObject *__pyx_v_J = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_v_rowmap = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesBlockedLocalIJV (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_I,&__pyx_n_s_J,&__pyx_n_s_V,&__pyx_n_s_addv,&__pyx_n_s_rowmap,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_I)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocalIJV", 0, 3, 5, 1); __PYX_ERR(33, 875, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocalIJV", 0, 3, 5, 2); __PYX_ERR(33, 875, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rowmap);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesBlockedLocalIJV") < 0)) __PYX_ERR(33, 875, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_I = values[0];
    __pyx_v_J = values[1];
    __pyx_v_V = values[2];
    __pyx_v_addv = values[3];
    __pyx_v_rowmap = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocalIJV", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 875, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedLocalIJV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_198setValuesBlockedLocalIJV(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv, __pyx_v_rowmap);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_198setValuesBlockedLocalIJV(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv, PyObject *__pyx_v_rowmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesBlockedLocalIJV", 0);

  /* "PETSc/Mat.pyx":876
 * 
 *     def setValuesBlockedLocalIJV(self, I, J, V, addv=None, rowmap=None):
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *     def setValuesBlockedLocalCSR(self, I, J, V, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_ijv(__pyx_v_self->mat, __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv, __pyx_v_rowmap, 1, 1); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 876, __pyx_L1_error)

  /* "PETSc/Mat.pyx":875
 *         matsetvalues_rcv(self.mat, R, C, V, addv, 1, 1)
 * 
 *     def setValuesBlockedLocalIJV(self, I, J, V, addv=None, rowmap=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 1, 1)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedLocalIJV", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":878
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 1, 1)
 * 
 *     def setValuesBlockedLocalCSR(self, I, J, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_csr(self.mat, I, J, V, addv, 1, 1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_201setValuesBlockedLocalCSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_200setValuesBlockedLocalCSR[] = "Mat.setValuesBlockedLocalCSR(self, I, J, V, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_201setValuesBlockedLocalCSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_I = 0;
  PyObject *__pyx_v_J = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValuesBlockedLocalCSR (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_I,&__pyx_n_s_J,&__pyx_n_s_V,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_I)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocalCSR", 0, 3, 4, 1); __PYX_ERR(33, 878, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocalCSR", 0, 3, 4, 2); __PYX_ERR(33, 878, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValuesBlockedLocalCSR") < 0)) __PYX_ERR(33, 878, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_I = values[0];
    __pyx_v_J = values[1];
    __pyx_v_V = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValuesBlockedLocalCSR", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 878, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedLocalCSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_200setValuesBlockedLocalCSR(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_200setValuesBlockedLocalCSR(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_I, PyObject *__pyx_v_J, PyObject *__pyx_v_V, PyObject *__pyx_v_addv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setValuesBlockedLocalCSR", 0);

  /* "PETSc/Mat.pyx":879
 * 
 *     def setValuesBlockedLocalCSR(self, I, J, V, addv=None):
 *         matsetvalues_csr(self.mat, I, J, V, addv, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvalues_csr(__pyx_v_self->mat, __pyx_v_I, __pyx_v_J, __pyx_v_V, __pyx_v_addv, 1, 1); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 879, __pyx_L1_error)

  /* "PETSc/Mat.pyx":878
 *         matsetvalues_ijv(self.mat, I, J, V, addv, rowmap, 1, 1)
 * 
 *     def setValuesBlockedLocalCSR(self, I, J, V, addv=None):             # <<<<<<<<<<<<<<
 *         matsetvalues_csr(self.mat, I, J, V, addv, 1, 1)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValuesBlockedLocalCSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":885
 *     Stencil = _Mat_Stencil
 * 
 *     def setStencil(self, dims, starts=None, dof=1):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ndim, ndof
 *         cdef PetscInt cdims[3], cstarts[3]
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_203setStencil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_202setStencil[] = "Mat.setStencil(self, dims, starts=None, dof=1)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_203setStencil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dims = 0;
  PyObject *__pyx_v_starts = 0;
  PyObject *__pyx_v_dof = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setStencil (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dims,&__pyx_n_s_starts,&__pyx_n_s_dof,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)__pyx_int_1);
    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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_dims)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_starts);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dof);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setStencil") < 0)) __PYX_ERR(33, 885, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_dims = values[0];
    __pyx_v_starts = values[1];
    __pyx_v_dof = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setStencil", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 885, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setStencil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_202setStencil(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_dims, __pyx_v_starts, __pyx_v_dof);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_202setStencil(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_dims, PyObject *__pyx_v_starts, PyObject *__pyx_v_dof) {
  PetscInt __pyx_v_ndim;
  PetscInt __pyx_v_ndof;
  PetscInt __pyx_v_cdims[3];
  PetscInt __pyx_v_cstarts[3];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setStencil", 0);

  /* "PETSc/Mat.pyx":888
 *         cdef PetscInt ndim, ndof
 *         cdef PetscInt cdims[3], cstarts[3]
 *         cdims[0] = cdims[1] = cdims[2] = 1             # <<<<<<<<<<<<<<
 *         cstarts[0] = cstarts[1] = cstarts[2] = 0
 *         ndim = asDims(dims, &cdims[0], &cdims[1], &cdims[2])
 */
  (__pyx_v_cdims[0]) = 1;
  (__pyx_v_cdims[1]) = 1;
  (__pyx_v_cdims[2]) = 1;

  /* "PETSc/Mat.pyx":889
 *         cdef PetscInt cdims[3], cstarts[3]
 *         cdims[0] = cdims[1] = cdims[2] = 1
 *         cstarts[0] = cstarts[1] = cstarts[2] = 0             # <<<<<<<<<<<<<<
 *         ndim = asDims(dims, &cdims[0], &cdims[1], &cdims[2])
 *         ndof = asInt(dof)
 */
  (__pyx_v_cstarts[0]) = 0;
  (__pyx_v_cstarts[1]) = 0;
  (__pyx_v_cstarts[2]) = 0;

  /* "PETSc/Mat.pyx":890
 *         cdims[0] = cdims[1] = cdims[2] = 1
 *         cstarts[0] = cstarts[1] = cstarts[2] = 0
 *         ndim = asDims(dims, &cdims[0], &cdims[1], &cdims[2])             # <<<<<<<<<<<<<<
 *         ndof = asInt(dof)
 *         if starts is not None:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asDims(__pyx_v_dims, (&(__pyx_v_cdims[0])), (&(__pyx_v_cdims[1])), (&(__pyx_v_cdims[2]))); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 890, __pyx_L1_error)
  __pyx_v_ndim = __pyx_t_1;

  /* "PETSc/Mat.pyx":891
 *         cstarts[0] = cstarts[1] = cstarts[2] = 0
 *         ndim = asDims(dims, &cdims[0], &cdims[1], &cdims[2])
 *         ndof = asInt(dof)             # <<<<<<<<<<<<<<
 *         if starts is not None:
 *             asDims(dims, &cstarts[0], &cstarts[1], &cstarts[2])
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_dof); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 891, __pyx_L1_error)
  __pyx_v_ndof = __pyx_t_1;

  /* "PETSc/Mat.pyx":892
 *         ndim = asDims(dims, &cdims[0], &cdims[1], &cdims[2])
 *         ndof = asInt(dof)
 *         if starts is not None:             # <<<<<<<<<<<<<<
 *             asDims(dims, &cstarts[0], &cstarts[1], &cstarts[2])
 *         CHKERR( MatSetStencil(self.mat, ndim, cdims, cstarts, ndof) )
 */
  __pyx_t_2 = (__pyx_v_starts != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":893
 *         ndof = asInt(dof)
 *         if starts is not None:
 *             asDims(dims, &cstarts[0], &cstarts[1], &cstarts[2])             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetStencil(self.mat, ndim, cdims, cstarts, ndof) )
 * 
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asDims(__pyx_v_dims, (&(__pyx_v_cstarts[0])), (&(__pyx_v_cstarts[1])), (&(__pyx_v_cstarts[2]))); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 893, __pyx_L1_error)

    /* "PETSc/Mat.pyx":892
 *         ndim = asDims(dims, &cdims[0], &cdims[1], &cdims[2])
 *         ndof = asInt(dof)
 *         if starts is not None:             # <<<<<<<<<<<<<<
 *             asDims(dims, &cstarts[0], &cstarts[1], &cstarts[2])
 *         CHKERR( MatSetStencil(self.mat, ndim, cdims, cstarts, ndof) )
 */
  }

  /* "PETSc/Mat.pyx":894
 *         if starts is not None:
 *             asDims(dims, &cstarts[0], &cstarts[1], &cstarts[2])
 *         CHKERR( MatSetStencil(self.mat, ndim, cdims, cstarts, ndof) )             # <<<<<<<<<<<<<<
 * 
 *     def setValueStencil(self, row, col, value, addv=None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetStencil(__pyx_v_self->mat, __pyx_v_ndim, __pyx_v_cdims, __pyx_v_cstarts, __pyx_v_ndof)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 894, __pyx_L1_error)

  /* "PETSc/Mat.pyx":885
 *     Stencil = _Mat_Stencil
 * 
 *     def setStencil(self, dims, starts=None, dof=1):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ndim, ndof
 *         cdef PetscInt cdims[3], cstarts[3]
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setStencil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":896
 *         CHKERR( MatSetStencil(self.mat, ndim, cdims, cstarts, ndof) )
 * 
 *     def setValueStencil(self, row, col, value, addv=None):             # <<<<<<<<<<<<<<
 *         cdef _Mat_Stencil r = row, c = col
 *         cdef PetscInsertMode im = insertmode(addv)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_205setValueStencil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_204setValueStencil[] = "Mat.setValueStencil(self, row, col, value, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_205setValueStencil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_row = 0;
  PyObject *__pyx_v_col = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValueStencil (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_row,&__pyx_n_s_col,&__pyx_n_s_value,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_row)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_col)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValueStencil", 0, 3, 4, 1); __PYX_ERR(33, 896, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValueStencil", 0, 3, 4, 2); __PYX_ERR(33, 896, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValueStencil") < 0)) __PYX_ERR(33, 896, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_row = values[0];
    __pyx_v_col = values[1];
    __pyx_v_value = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValueStencil", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 896, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValueStencil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_204setValueStencil(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_row, __pyx_v_col, __pyx_v_value, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_204setValueStencil(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row, PyObject *__pyx_v_col, PyObject *__pyx_v_value, PyObject *__pyx_v_addv) {
  struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_r = 0;
  struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_c = 0;
  InsertMode __pyx_v_im;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  InsertMode __pyx_t_2;
  __Pyx_RefNannySetupContext("setValueStencil", 0);

  /* "PETSc/Mat.pyx":897
 * 
 *     def setValueStencil(self, row, col, value, addv=None):
 *         cdef _Mat_Stencil r = row, c = col             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode im = insertmode(addv)
 *         matsetvaluestencil(self.mat, r, c, value, im, 0)
 */
  if (!(likely(((__pyx_v_row) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_row, __pyx_ptype_8petsc4py_5PETSc__Mat_Stencil))))) __PYX_ERR(33, 897, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_row;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_r = ((struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (!(likely(((__pyx_v_col) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_col, __pyx_ptype_8petsc4py_5PETSc__Mat_Stencil))))) __PYX_ERR(33, 897, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_col;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_c = ((struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":898
 *     def setValueStencil(self, row, col, value, addv=None):
 *         cdef _Mat_Stencil r = row, c = col
 *         cdef PetscInsertMode im = insertmode(addv)             # <<<<<<<<<<<<<<
 *         matsetvaluestencil(self.mat, r, c, value, im, 0)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_2 == ((InsertMode)-1L))) __PYX_ERR(33, 898, __pyx_L1_error)
  __pyx_v_im = __pyx_t_2;

  /* "PETSc/Mat.pyx":899
 *         cdef _Mat_Stencil r = row, c = col
 *         cdef PetscInsertMode im = insertmode(addv)
 *         matsetvaluestencil(self.mat, r, c, value, im, 0)             # <<<<<<<<<<<<<<
 * 
 *     def setValueBlockedStencil(self, row, col, value, addv=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvaluestencil(__pyx_v_self->mat, __pyx_v_r, __pyx_v_c, __pyx_v_value, __pyx_v_im, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":896
 *         CHKERR( MatSetStencil(self.mat, ndim, cdims, cstarts, ndof) )
 * 
 *     def setValueStencil(self, row, col, value, addv=None):             # <<<<<<<<<<<<<<
 *         cdef _Mat_Stencil r = row, c = col
 *         cdef PetscInsertMode im = insertmode(addv)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValueStencil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_r);
  __Pyx_XDECREF((PyObject *)__pyx_v_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":901
 *         matsetvaluestencil(self.mat, r, c, value, im, 0)
 * 
 *     def setValueBlockedStencil(self, row, col, value, addv=None):             # <<<<<<<<<<<<<<
 *         cdef _Mat_Stencil r = row, c = col
 *         cdef PetscInsertMode im = insertmode(addv)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_207setValueBlockedStencil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_206setValueBlockedStencil[] = "Mat.setValueBlockedStencil(self, row, col, value, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_207setValueBlockedStencil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_row = 0;
  PyObject *__pyx_v_col = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setValueBlockedStencil (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_row,&__pyx_n_s_col,&__pyx_n_s_value,&__pyx_n_s_addv,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_row)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_col)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValueBlockedStencil", 0, 3, 4, 1); __PYX_ERR(33, 901, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setValueBlockedStencil", 0, 3, 4, 2); __PYX_ERR(33, 901, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setValueBlockedStencil") < 0)) __PYX_ERR(33, 901, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_row = values[0];
    __pyx_v_col = values[1];
    __pyx_v_value = values[2];
    __pyx_v_addv = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setValueBlockedStencil", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 901, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValueBlockedStencil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_206setValueBlockedStencil(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_row, __pyx_v_col, __pyx_v_value, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_206setValueBlockedStencil(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_row, PyObject *__pyx_v_col, PyObject *__pyx_v_value, PyObject *__pyx_v_addv) {
  struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_r = 0;
  struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *__pyx_v_c = 0;
  InsertMode __pyx_v_im;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  InsertMode __pyx_t_2;
  __Pyx_RefNannySetupContext("setValueBlockedStencil", 0);

  /* "PETSc/Mat.pyx":902
 * 
 *     def setValueBlockedStencil(self, row, col, value, addv=None):
 *         cdef _Mat_Stencil r = row, c = col             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode im = insertmode(addv)
 *         matsetvaluestencil(self.mat, r, c, value, im, 1)
 */
  if (!(likely(((__pyx_v_row) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_row, __pyx_ptype_8petsc4py_5PETSc__Mat_Stencil))))) __PYX_ERR(33, 902, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_row;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_r = ((struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (!(likely(((__pyx_v_col) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_col, __pyx_ptype_8petsc4py_5PETSc__Mat_Stencil))))) __PYX_ERR(33, 902, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_col;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_c = ((struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":903
 *     def setValueBlockedStencil(self, row, col, value, addv=None):
 *         cdef _Mat_Stencil r = row, c = col
 *         cdef PetscInsertMode im = insertmode(addv)             # <<<<<<<<<<<<<<
 *         matsetvaluestencil(self.mat, r, c, value, im, 1)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_2 == ((InsertMode)-1L))) __PYX_ERR(33, 903, __pyx_L1_error)
  __pyx_v_im = __pyx_t_2;

  /* "PETSc/Mat.pyx":904
 *         cdef _Mat_Stencil r = row, c = col
 *         cdef PetscInsertMode im = insertmode(addv)
 *         matsetvaluestencil(self.mat, r, c, value, im, 1)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matsetvaluestencil(__pyx_v_self->mat, __pyx_v_r, __pyx_v_c, __pyx_v_value, __pyx_v_im, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":901
 *         matsetvaluestencil(self.mat, r, c, value, im, 0)
 * 
 *     def setValueBlockedStencil(self, row, col, value, addv=None):             # <<<<<<<<<<<<<<
 *         cdef _Mat_Stencil r = row, c = col
 *         cdef PetscInsertMode im = insertmode(addv)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setValueBlockedStencil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_r);
  __Pyx_XDECREF((PyObject *)__pyx_v_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":908
 *     #
 * 
 *     def zeroRows(self, rows, diag=1, Vec x=None, Vec b=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ni=0, *i=NULL
 *         cdef PetscScalar sval = asScalar(diag)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_209zeroRows(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_208zeroRows[] = "Mat.zeroRows(self, rows, diag=1, Vec x=None, Vec b=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_209zeroRows(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rows = 0;
  PyObject *__pyx_v_diag = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zeroRows (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rows,&__pyx_n_s_diag,&__pyx_n_s_x,&__pyx_n_s_b,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)__pyx_int_1);
    values[2] = (PyObject *)((struct PyPetscVecObject *)Py_None);
    values[3] = (PyObject *)((struct PyPetscVecObject *)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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_rows)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diag);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zeroRows") < 0)) __PYX_ERR(33, 908, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rows = values[0];
    __pyx_v_diag = values[1];
    __pyx_v_x = ((struct PyPetscVecObject *)values[2]);
    __pyx_v_b = ((struct PyPetscVecObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zeroRows", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 908, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.zeroRows", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "x", 0))) __PYX_ERR(33, 908, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "b", 0))) __PYX_ERR(33, 908, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_208zeroRows(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_rows, __pyx_v_diag, __pyx_v_x, __pyx_v_b);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_208zeroRows(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_diag, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_b) {
  PetscInt __pyx_v_ni;
  PetscInt *__pyx_v_i;
  PetscScalar __pyx_v_sval;
  Vec __pyx_v_xvec;
  Vec __pyx_v_bvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Vec __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("zeroRows", 0);
  __Pyx_INCREF(__pyx_v_rows);

  /* "PETSc/Mat.pyx":909
 * 
 *     def zeroRows(self, rows, diag=1, Vec x=None, Vec b=None):
 *         cdef PetscInt ni=0, *i=NULL             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(diag)
 *         cdef PetscVec xvec=NULL, bvec=NULL
 */
  __pyx_v_ni = 0;
  __pyx_v_i = NULL;

  /* "PETSc/Mat.pyx":910
 *     def zeroRows(self, rows, diag=1, Vec x=None, Vec b=None):
 *         cdef PetscInt ni=0, *i=NULL
 *         cdef PetscScalar sval = asScalar(diag)             # <<<<<<<<<<<<<<
 *         cdef PetscVec xvec=NULL, bvec=NULL
 *         if x is not None: xvec = x.vec
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_diag); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 910, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Mat.pyx":911
 *         cdef PetscInt ni=0, *i=NULL
 *         cdef PetscScalar sval = asScalar(diag)
 *         cdef PetscVec xvec=NULL, bvec=NULL             # <<<<<<<<<<<<<<
 *         if x is not None: xvec = x.vec
 *         if b is not None: bvec = b.vec
 */
  __pyx_v_xvec = NULL;
  __pyx_v_bvec = NULL;

  /* "PETSc/Mat.pyx":912
 *         cdef PetscScalar sval = asScalar(diag)
 *         cdef PetscVec xvec=NULL, bvec=NULL
 *         if x is not None: xvec = x.vec             # <<<<<<<<<<<<<<
 *         if b is not None: bvec = b.vec
 *         if isinstance(rows, IS):
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_x) != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = __pyx_v_x->vec;
    __pyx_v_xvec = __pyx_t_4;
  }

  /* "PETSc/Mat.pyx":913
 *         cdef PetscVec xvec=NULL, bvec=NULL
 *         if x is not None: xvec = x.vec
 *         if b is not None: bvec = b.vec             # <<<<<<<<<<<<<<
 *         if isinstance(rows, IS):
 *             CHKERR( MatZeroRowsIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_b) != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
    __pyx_t_4 = __pyx_v_b->vec;
    __pyx_v_bvec = __pyx_t_4;
  }

  /* "PETSc/Mat.pyx":914
 *         if x is not None: xvec = x.vec
 *         if b is not None: bvec = b.vec
 *         if isinstance(rows, IS):             # <<<<<<<<<<<<<<
 *             CHKERR( MatZeroRowsIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )
 *         else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_rows, __pyx_ptype_8petsc4py_5PETSc_IS); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":915
 *         if b is not None: bvec = b.vec
 *         if isinstance(rows, IS):
 *             CHKERR( MatZeroRowsIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )             # <<<<<<<<<<<<<<
 *         else:
 *             rows = iarray_i(rows, &ni, &i)
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatZeroRowsIS(__pyx_v_self->mat, ((struct PyPetscISObject *)__pyx_v_rows)->iset, __pyx_v_sval, __pyx_v_xvec, __pyx_v_bvec)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 915, __pyx_L1_error)

    /* "PETSc/Mat.pyx":914
 *         if x is not None: xvec = x.vec
 *         if b is not None: bvec = b.vec
 *         if isinstance(rows, IS):             # <<<<<<<<<<<<<<
 *             CHKERR( MatZeroRowsIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )
 *         else:
 */
    goto __pyx_L5;
  }

  /* "PETSc/Mat.pyx":917
 *             CHKERR( MatZeroRowsIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )
 *         else:
 *             rows = iarray_i(rows, &ni, &i)             # <<<<<<<<<<<<<<
 *             CHKERR( MatZeroRows(self.mat, ni, i, sval, xvec, bvec) )
 * 
 */
  /*else*/ {
    __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_rows, (&__pyx_v_ni), (&__pyx_v_i))); if (unlikely(!__pyx_t_6)) __PYX_ERR(33, 917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF_SET(__pyx_v_rows, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "PETSc/Mat.pyx":918
 *         else:
 *             rows = iarray_i(rows, &ni, &i)
 *             CHKERR( MatZeroRows(self.mat, ni, i, sval, xvec, bvec) )             # <<<<<<<<<<<<<<
 * 
 *     def zeroRowsLocal(self, rows, diag=1, Vec x=None, Vec b=None):
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatZeroRows(__pyx_v_self->mat, __pyx_v_ni, __pyx_v_i, __pyx_v_sval, __pyx_v_xvec, __pyx_v_bvec)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 918, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "PETSc/Mat.pyx":908
 *     #
 * 
 *     def zeroRows(self, rows, diag=1, Vec x=None, Vec b=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ni=0, *i=NULL
 *         cdef PetscScalar sval = asScalar(diag)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.zeroRows", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rows);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":920
 *             CHKERR( MatZeroRows(self.mat, ni, i, sval, xvec, bvec) )
 * 
 *     def zeroRowsLocal(self, rows, diag=1, Vec x=None, Vec b=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ni=0, *i=NULL
 *         cdef PetscScalar sval = asScalar(diag)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_211zeroRowsLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_210zeroRowsLocal[] = "Mat.zeroRowsLocal(self, rows, diag=1, Vec x=None, Vec b=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_211zeroRowsLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rows = 0;
  PyObject *__pyx_v_diag = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zeroRowsLocal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rows,&__pyx_n_s_diag,&__pyx_n_s_x,&__pyx_n_s_b,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)__pyx_int_1);
    values[2] = (PyObject *)((struct PyPetscVecObject *)Py_None);
    values[3] = (PyObject *)((struct PyPetscVecObject *)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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_rows)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diag);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zeroRowsLocal") < 0)) __PYX_ERR(33, 920, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rows = values[0];
    __pyx_v_diag = values[1];
    __pyx_v_x = ((struct PyPetscVecObject *)values[2]);
    __pyx_v_b = ((struct PyPetscVecObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zeroRowsLocal", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 920, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.zeroRowsLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "x", 0))) __PYX_ERR(33, 920, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "b", 0))) __PYX_ERR(33, 920, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_210zeroRowsLocal(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_rows, __pyx_v_diag, __pyx_v_x, __pyx_v_b);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_210zeroRowsLocal(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_diag, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_b) {
  PetscInt __pyx_v_ni;
  PetscInt *__pyx_v_i;
  PetscScalar __pyx_v_sval;
  Vec __pyx_v_xvec;
  Vec __pyx_v_bvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Vec __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("zeroRowsLocal", 0);
  __Pyx_INCREF(__pyx_v_rows);

  /* "PETSc/Mat.pyx":921
 * 
 *     def zeroRowsLocal(self, rows, diag=1, Vec x=None, Vec b=None):
 *         cdef PetscInt ni=0, *i=NULL             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(diag)
 *         cdef PetscVec xvec=NULL, bvec=NULL
 */
  __pyx_v_ni = 0;
  __pyx_v_i = NULL;

  /* "PETSc/Mat.pyx":922
 *     def zeroRowsLocal(self, rows, diag=1, Vec x=None, Vec b=None):
 *         cdef PetscInt ni=0, *i=NULL
 *         cdef PetscScalar sval = asScalar(diag)             # <<<<<<<<<<<<<<
 *         cdef PetscVec xvec=NULL, bvec=NULL
 *         if x is not None: xvec = x.vec
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_diag); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 922, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Mat.pyx":923
 *         cdef PetscInt ni=0, *i=NULL
 *         cdef PetscScalar sval = asScalar(diag)
 *         cdef PetscVec xvec=NULL, bvec=NULL             # <<<<<<<<<<<<<<
 *         if x is not None: xvec = x.vec
 *         if b is not None: bvec = b.vec
 */
  __pyx_v_xvec = NULL;
  __pyx_v_bvec = NULL;

  /* "PETSc/Mat.pyx":924
 *         cdef PetscScalar sval = asScalar(diag)
 *         cdef PetscVec xvec=NULL, bvec=NULL
 *         if x is not None: xvec = x.vec             # <<<<<<<<<<<<<<
 *         if b is not None: bvec = b.vec
 *         if isinstance(rows, IS):
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_x) != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = __pyx_v_x->vec;
    __pyx_v_xvec = __pyx_t_4;
  }

  /* "PETSc/Mat.pyx":925
 *         cdef PetscVec xvec=NULL, bvec=NULL
 *         if x is not None: xvec = x.vec
 *         if b is not None: bvec = b.vec             # <<<<<<<<<<<<<<
 *         if isinstance(rows, IS):
 *             CHKERR( MatZeroRowsLocalIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_b) != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
    __pyx_t_4 = __pyx_v_b->vec;
    __pyx_v_bvec = __pyx_t_4;
  }

  /* "PETSc/Mat.pyx":926
 *         if x is not None: xvec = x.vec
 *         if b is not None: bvec = b.vec
 *         if isinstance(rows, IS):             # <<<<<<<<<<<<<<
 *             CHKERR( MatZeroRowsLocalIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )
 *         else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_rows, __pyx_ptype_8petsc4py_5PETSc_IS); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":927
 *         if b is not None: bvec = b.vec
 *         if isinstance(rows, IS):
 *             CHKERR( MatZeroRowsLocalIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )             # <<<<<<<<<<<<<<
 *         else:
 *             rows = iarray_i(rows, &ni, &i)
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatZeroRowsLocalIS(__pyx_v_self->mat, ((struct PyPetscISObject *)__pyx_v_rows)->iset, __pyx_v_sval, __pyx_v_xvec, __pyx_v_bvec)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 927, __pyx_L1_error)

    /* "PETSc/Mat.pyx":926
 *         if x is not None: xvec = x.vec
 *         if b is not None: bvec = b.vec
 *         if isinstance(rows, IS):             # <<<<<<<<<<<<<<
 *             CHKERR( MatZeroRowsLocalIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )
 *         else:
 */
    goto __pyx_L5;
  }

  /* "PETSc/Mat.pyx":929
 *             CHKERR( MatZeroRowsLocalIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )
 *         else:
 *             rows = iarray_i(rows, &ni, &i)             # <<<<<<<<<<<<<<
 *             CHKERR( MatZeroRowsLocal(self.mat, ni, i, sval, xvec, bvec) )
 * 
 */
  /*else*/ {
    __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_rows, (&__pyx_v_ni), (&__pyx_v_i))); if (unlikely(!__pyx_t_6)) __PYX_ERR(33, 929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF_SET(__pyx_v_rows, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "PETSc/Mat.pyx":930
 *         else:
 *             rows = iarray_i(rows, &ni, &i)
 *             CHKERR( MatZeroRowsLocal(self.mat, ni, i, sval, xvec, bvec) )             # <<<<<<<<<<<<<<
 * 
 *     def zeroRowsColumns(self, rows, diag=1, Vec x=None, Vec b=None):
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatZeroRowsLocal(__pyx_v_self->mat, __pyx_v_ni, __pyx_v_i, __pyx_v_sval, __pyx_v_xvec, __pyx_v_bvec)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 930, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "PETSc/Mat.pyx":920
 *             CHKERR( MatZeroRows(self.mat, ni, i, sval, xvec, bvec) )
 * 
 *     def zeroRowsLocal(self, rows, diag=1, Vec x=None, Vec b=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ni=0, *i=NULL
 *         cdef PetscScalar sval = asScalar(diag)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.zeroRowsLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rows);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":932
 *             CHKERR( MatZeroRowsLocal(self.mat, ni, i, sval, xvec, bvec) )
 * 
 *     def zeroRowsColumns(self, rows, diag=1, Vec x=None, Vec b=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ni=0, *i=NULL
 *         cdef PetscScalar sval = asScalar(diag)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_213zeroRowsColumns(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_212zeroRowsColumns[] = "Mat.zeroRowsColumns(self, rows, diag=1, Vec x=None, Vec b=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_213zeroRowsColumns(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rows = 0;
  PyObject *__pyx_v_diag = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zeroRowsColumns (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rows,&__pyx_n_s_diag,&__pyx_n_s_x,&__pyx_n_s_b,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)__pyx_int_1);
    values[2] = (PyObject *)((struct PyPetscVecObject *)Py_None);
    values[3] = (PyObject *)((struct PyPetscVecObject *)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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_rows)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diag);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zeroRowsColumns") < 0)) __PYX_ERR(33, 932, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rows = values[0];
    __pyx_v_diag = values[1];
    __pyx_v_x = ((struct PyPetscVecObject *)values[2]);
    __pyx_v_b = ((struct PyPetscVecObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zeroRowsColumns", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 932, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.zeroRowsColumns", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "x", 0))) __PYX_ERR(33, 932, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "b", 0))) __PYX_ERR(33, 932, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_212zeroRowsColumns(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_rows, __pyx_v_diag, __pyx_v_x, __pyx_v_b);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_212zeroRowsColumns(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_rows, PyObject *__pyx_v_diag, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_b) {
  PetscInt __pyx_v_ni;
  PetscInt *__pyx_v_i;
  PetscScalar __pyx_v_sval;
  Vec __pyx_v_xvec;
  Vec __pyx_v_bvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Vec __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("zeroRowsColumns", 0);
  __Pyx_INCREF(__pyx_v_rows);

  /* "PETSc/Mat.pyx":933
 * 
 *     def zeroRowsColumns(self, rows, diag=1, Vec x=None, Vec b=None):
 *         cdef PetscInt ni=0, *i=NULL             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(diag)
 *         cdef PetscVec xvec=NULL, bvec=NULL
 */
  __pyx_v_ni = 0;
  __pyx_v_i = NULL;

  /* "PETSc/Mat.pyx":934
 *     def zeroRowsColumns(self, rows, diag=1, Vec x=None, Vec b=None):
 *         cdef PetscInt ni=0, *i=NULL
 *         cdef PetscScalar sval = asScalar(diag)             # <<<<<<<<<<<<<<
 *         cdef PetscVec xvec=NULL, bvec=NULL
 *         if x is not None: xvec = x.vec
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_diag); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 934, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Mat.pyx":935
 *         cdef PetscInt ni=0, *i=NULL
 *         cdef PetscScalar sval = asScalar(diag)
 *         cdef PetscVec xvec=NULL, bvec=NULL             # <<<<<<<<<<<<<<
 *         if x is not None: xvec = x.vec
 *         if b is not None: bvec = b.vec
 */
  __pyx_v_xvec = NULL;
  __pyx_v_bvec = NULL;

  /* "PETSc/Mat.pyx":936
 *         cdef PetscScalar sval = asScalar(diag)
 *         cdef PetscVec xvec=NULL, bvec=NULL
 *         if x is not None: xvec = x.vec             # <<<<<<<<<<<<<<
 *         if b is not None: bvec = b.vec
 *         if isinstance(rows, IS):
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_x) != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = __pyx_v_x->vec;
    __pyx_v_xvec = __pyx_t_4;
  }

  /* "PETSc/Mat.pyx":937
 *         cdef PetscVec xvec=NULL, bvec=NULL
 *         if x is not None: xvec = x.vec
 *         if b is not None: bvec = b.vec             # <<<<<<<<<<<<<<
 *         if isinstance(rows, IS):
 *             CHKERR( MatZeroRowsColumnsIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_b) != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
    __pyx_t_4 = __pyx_v_b->vec;
    __pyx_v_bvec = __pyx_t_4;
  }

  /* "PETSc/Mat.pyx":938
 *         if x is not None: xvec = x.vec
 *         if b is not None: bvec = b.vec
 *         if isinstance(rows, IS):             # <<<<<<<<<<<<<<
 *             CHKERR( MatZeroRowsColumnsIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )
 *         else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_rows, __pyx_ptype_8petsc4py_5PETSc_IS); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":939
 *         if b is not None: bvec = b.vec
 *         if isinstance(rows, IS):
 *             CHKERR( MatZeroRowsColumnsIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )             # <<<<<<<<<<<<<<
 *         else:
 *             rows = iarray_i(rows, &ni, &i)
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatZeroRowsColumnsIS(__pyx_v_self->mat, ((struct PyPetscISObject *)__pyx_v_rows)->iset, __pyx_v_sval, __pyx_v_xvec, __pyx_v_bvec)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 939, __pyx_L1_error)

    /* "PETSc/Mat.pyx":938
 *         if x is not None: xvec = x.vec
 *         if b is not None: bvec = b.vec
 *         if isinstance(rows, IS):             # <<<<<<<<<<<<<<
 *             CHKERR( MatZeroRowsColumnsIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )
 *         else:
 */
    goto __pyx_L5;
  }

  /* "PETSc/Mat.pyx":941
 *             CHKERR( MatZeroRowsColumnsIS(self.mat, (<IS>rows).iset, sval, xvec, bvec) )
 *         else:
 *             rows = iarray_i(rows, &ni, &i)             # <<<<<<<<<<<<<<
 *             CHKERR( MatZeroRowsColumns(self.mat, ni, i, sval, xvec, bvec) )
 * 
 */
  /*else*/ {
    __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_rows, (&__pyx_v_ni), (&__pyx_v_i))); if (unlikely(!__pyx_t_6)) __PYX_ERR(33, 941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF_SET(__pyx_v_rows, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "PETSc/Mat.pyx":942
 *         else:
 *             rows = iarray_i(rows, &ni, &i)
 *             CHKERR( MatZeroRowsColumns(self.mat, ni, i, sval, xvec, bvec) )             # <<<<<<<<<<<<<<
 * 
 *     def storeValues(self):
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatZeroRowsColumns(__pyx_v_self->mat, __pyx_v_ni, __pyx_v_i, __pyx_v_sval, __pyx_v_xvec, __pyx_v_bvec)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 942, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "PETSc/Mat.pyx":932
 *             CHKERR( MatZeroRowsLocal(self.mat, ni, i, sval, xvec, bvec) )
 * 
 *     def zeroRowsColumns(self, rows, diag=1, Vec x=None, Vec b=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ni=0, *i=NULL
 *         cdef PetscScalar sval = asScalar(diag)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.zeroRowsColumns", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rows);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":944
 *             CHKERR( MatZeroRowsColumns(self.mat, ni, i, sval, xvec, bvec) )
 * 
 *     def storeValues(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatStoreValues(self.mat) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_215storeValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_214storeValues[] = "Mat.storeValues(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_215storeValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("storeValues (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("storeValues", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "storeValues", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_214storeValues(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_214storeValues(struct PyPetscMatObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("storeValues", 0);

  /* "PETSc/Mat.pyx":945
 * 
 *     def storeValues(self):
 *         CHKERR( MatStoreValues(self.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def retrieveValues(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatStoreValues(__pyx_v_self->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 945, __pyx_L1_error)

  /* "PETSc/Mat.pyx":944
 *             CHKERR( MatZeroRowsColumns(self.mat, ni, i, sval, xvec, bvec) )
 * 
 *     def storeValues(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatStoreValues(self.mat) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.storeValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":947
 *         CHKERR( MatStoreValues(self.mat) )
 * 
 *     def retrieveValues(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatRetrieveValues(self.mat) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_217retrieveValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_216retrieveValues[] = "Mat.retrieveValues(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_217retrieveValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("retrieveValues (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("retrieveValues", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "retrieveValues", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_216retrieveValues(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_216retrieveValues(struct PyPetscMatObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("retrieveValues", 0);

  /* "PETSc/Mat.pyx":948
 * 
 *     def retrieveValues(self):
 *         CHKERR( MatRetrieveValues(self.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def assemblyBegin(self, assembly=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatRetrieveValues(__pyx_v_self->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 948, __pyx_L1_error)

  /* "PETSc/Mat.pyx":947
 *         CHKERR( MatStoreValues(self.mat) )
 * 
 *     def retrieveValues(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatRetrieveValues(self.mat) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.retrieveValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":950
 *         CHKERR( MatRetrieveValues(self.mat) )
 * 
 *     def assemblyBegin(self, assembly=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)
 *         CHKERR( MatAssemblyBegin(self.mat, flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_219assemblyBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_218assemblyBegin[] = "Mat.assemblyBegin(self, assembly=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_219assemblyBegin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_assembly = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assemblyBegin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_assembly,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_assembly);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "assemblyBegin") < 0)) __PYX_ERR(33, 950, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_assembly = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("assemblyBegin", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 950, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.assemblyBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_218assemblyBegin(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_assembly);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_218assemblyBegin(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_assembly) {
  MatAssemblyType __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MatAssemblyType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("assemblyBegin", 0);

  /* "PETSc/Mat.pyx":951
 * 
 *     def assemblyBegin(self, assembly=None):
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)             # <<<<<<<<<<<<<<
 *         CHKERR( MatAssemblyBegin(self.mat, flag) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_assemblytype(__pyx_v_assembly); if (unlikely(__pyx_t_1 == ((MatAssemblyType)-1L))) __PYX_ERR(33, 951, __pyx_L1_error)
  __pyx_v_flag = __pyx_t_1;

  /* "PETSc/Mat.pyx":952
 *     def assemblyBegin(self, assembly=None):
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)
 *         CHKERR( MatAssemblyBegin(self.mat, flag) )             # <<<<<<<<<<<<<<
 * 
 *     def assemblyEnd(self, assembly=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatAssemblyBegin(__pyx_v_self->mat, __pyx_v_flag)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 952, __pyx_L1_error)

  /* "PETSc/Mat.pyx":950
 *         CHKERR( MatRetrieveValues(self.mat) )
 * 
 *     def assemblyBegin(self, assembly=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)
 *         CHKERR( MatAssemblyBegin(self.mat, flag) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.assemblyBegin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":954
 *         CHKERR( MatAssemblyBegin(self.mat, flag) )
 * 
 *     def assemblyEnd(self, assembly=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)
 *         CHKERR( MatAssemblyEnd(self.mat, flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_221assemblyEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_220assemblyEnd[] = "Mat.assemblyEnd(self, assembly=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_221assemblyEnd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_assembly = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assemblyEnd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_assembly,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_assembly);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "assemblyEnd") < 0)) __PYX_ERR(33, 954, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_assembly = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("assemblyEnd", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 954, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.assemblyEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_220assemblyEnd(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_assembly);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_220assemblyEnd(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_assembly) {
  MatAssemblyType __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MatAssemblyType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("assemblyEnd", 0);

  /* "PETSc/Mat.pyx":955
 * 
 *     def assemblyEnd(self, assembly=None):
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)             # <<<<<<<<<<<<<<
 *         CHKERR( MatAssemblyEnd(self.mat, flag) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_assemblytype(__pyx_v_assembly); if (unlikely(__pyx_t_1 == ((MatAssemblyType)-1L))) __PYX_ERR(33, 955, __pyx_L1_error)
  __pyx_v_flag = __pyx_t_1;

  /* "PETSc/Mat.pyx":956
 *     def assemblyEnd(self, assembly=None):
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)
 *         CHKERR( MatAssemblyEnd(self.mat, flag) )             # <<<<<<<<<<<<<<
 * 
 *     def assemble(self, assembly=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatAssemblyEnd(__pyx_v_self->mat, __pyx_v_flag)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 956, __pyx_L1_error)

  /* "PETSc/Mat.pyx":954
 *         CHKERR( MatAssemblyBegin(self.mat, flag) )
 * 
 *     def assemblyEnd(self, assembly=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)
 *         CHKERR( MatAssemblyEnd(self.mat, flag) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.assemblyEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":958
 *         CHKERR( MatAssemblyEnd(self.mat, flag) )
 * 
 *     def assemble(self, assembly=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)
 *         CHKERR( MatAssemblyBegin(self.mat, flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_223assemble(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_222assemble[] = "Mat.assemble(self, assembly=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_223assemble(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_assembly = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assemble (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_assembly,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_assembly);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "assemble") < 0)) __PYX_ERR(33, 958, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_assembly = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("assemble", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 958, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.assemble", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_222assemble(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_assembly);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_222assemble(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_assembly) {
  MatAssemblyType __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MatAssemblyType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("assemble", 0);

  /* "PETSc/Mat.pyx":959
 * 
 *     def assemble(self, assembly=None):
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)             # <<<<<<<<<<<<<<
 *         CHKERR( MatAssemblyBegin(self.mat, flag) )
 *         CHKERR( MatAssemblyEnd(self.mat, flag) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_assemblytype(__pyx_v_assembly); if (unlikely(__pyx_t_1 == ((MatAssemblyType)-1L))) __PYX_ERR(33, 959, __pyx_L1_error)
  __pyx_v_flag = __pyx_t_1;

  /* "PETSc/Mat.pyx":960
 *     def assemble(self, assembly=None):
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)
 *         CHKERR( MatAssemblyBegin(self.mat, flag) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatAssemblyEnd(self.mat, flag) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatAssemblyBegin(__pyx_v_self->mat, __pyx_v_flag)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 960, __pyx_L1_error)

  /* "PETSc/Mat.pyx":961
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)
 *         CHKERR( MatAssemblyBegin(self.mat, flag) )
 *         CHKERR( MatAssemblyEnd(self.mat, flag) )             # <<<<<<<<<<<<<<
 * 
 *     def isAssembled(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatAssemblyEnd(__pyx_v_self->mat, __pyx_v_flag)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 961, __pyx_L1_error)

  /* "PETSc/Mat.pyx":958
 *         CHKERR( MatAssemblyEnd(self.mat, flag) )
 * 
 *     def assemble(self, assembly=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatAssemblyType flag = assemblytype(assembly)
 *         CHKERR( MatAssemblyBegin(self.mat, flag) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.assemble", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":963
 *         CHKERR( MatAssemblyEnd(self.mat, flag) )
 * 
 *     def isAssembled(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool assembled = PETSC_FALSE
 *         CHKERR( MatAssembled(self.mat, &assembled) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_225isAssembled(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_224isAssembled[] = "Mat.isAssembled(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_225isAssembled(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isAssembled (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("isAssembled", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "isAssembled", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_224isAssembled(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_224isAssembled(struct PyPetscMatObject *__pyx_v_self) {
  PetscBool __pyx_v_assembled;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("isAssembled", 0);

  /* "PETSc/Mat.pyx":964
 * 
 *     def isAssembled(self):
 *         cdef PetscBool assembled = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatAssembled(self.mat, &assembled) )
 *         return <bint> assembled
 */
  __pyx_v_assembled = PETSC_FALSE;

  /* "PETSc/Mat.pyx":965
 *     def isAssembled(self):
 *         cdef PetscBool assembled = PETSC_FALSE
 *         CHKERR( MatAssembled(self.mat, &assembled) )             # <<<<<<<<<<<<<<
 *         return <bint> assembled
 *     #
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatAssembled(__pyx_v_self->mat, (&__pyx_v_assembled))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 965, __pyx_L1_error)

  /* "PETSc/Mat.pyx":966
 *         cdef PetscBool assembled = PETSC_FALSE
 *         CHKERR( MatAssembled(self.mat, &assembled) )
 *         return <bint> assembled             # <<<<<<<<<<<<<<
 *     #
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_assembled); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":963
 *         CHKERR( MatAssemblyEnd(self.mat, flag) )
 * 
 *     def isAssembled(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool assembled = PETSC_FALSE
 *         CHKERR( MatAssembled(self.mat, &assembled) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.isAssembled", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":969
 *     #
 * 
 *     def createVecs(self, side=None):             # <<<<<<<<<<<<<<
 *         cdef Vec vecr, vecl
 *         if side is None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_227createVecs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_226createVecs[] = "Mat.createVecs(self, side=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_227createVecs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_side = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createVecs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_side,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_side);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createVecs") < 0)) __PYX_ERR(33, 969, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_side = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createVecs", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 969, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createVecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_226createVecs(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_side);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_226createVecs(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_side) {
  struct PyPetscVecObject *__pyx_v_vecr = 0;
  struct PyPetscVecObject *__pyx_v_vecl = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("createVecs", 0);

  /* "PETSc/Mat.pyx":971
 *     def createVecs(self, side=None):
 *         cdef Vec vecr, vecl
 *         if side is None:             # <<<<<<<<<<<<<<
 *             vecr = Vec(); vecl = Vec();
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, &vecl.vec) )
 */
  __pyx_t_1 = (__pyx_v_side == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":972
 *         cdef Vec vecr, vecl
 *         if side is None:
 *             vecr = Vec(); vecl = Vec();             # <<<<<<<<<<<<<<
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, &vecl.vec) )
 *             return (vecr, vecl)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_vecr = ((struct PyPetscVecObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_vecl = ((struct PyPetscVecObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/Mat.pyx":973
 *         if side is None:
 *             vecr = Vec(); vecl = Vec();
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, &vecl.vec) )             # <<<<<<<<<<<<<<
 *             return (vecr, vecl)
 *         elif side in ('r', 'R', 'right', 'Right', 'RIGHT'):
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateVecs(__pyx_v_self->mat, (&__pyx_v_vecr->vec), (&__pyx_v_vecl->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 973, __pyx_L1_error)

    /* "PETSc/Mat.pyx":974
 *             vecr = Vec(); vecl = Vec();
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, &vecl.vec) )
 *             return (vecr, vecl)             # <<<<<<<<<<<<<<
 *         elif side in ('r', 'R', 'right', 'Right', 'RIGHT'):
 *             vecr = Vec()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_vecr));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_vecr));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_vecr));
    __Pyx_INCREF(((PyObject *)__pyx_v_vecl));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_vecl));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_vecl));
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "PETSc/Mat.pyx":971
 *     def createVecs(self, side=None):
 *         cdef Vec vecr, vecl
 *         if side is None:             # <<<<<<<<<<<<<<
 *             vecr = Vec(); vecl = Vec();
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, &vecl.vec) )
 */
  }

  /* "PETSc/Mat.pyx":975
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, &vecl.vec) )
 *             return (vecr, vecl)
 *         elif side in ('r', 'R', 'right', 'Right', 'RIGHT'):             # <<<<<<<<<<<<<<
 *             vecr = Vec()
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, NULL) )
 */
  __Pyx_INCREF(__pyx_v_side);
  __pyx_t_3 = __pyx_v_side;
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_r, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(33, 975, __pyx_L1_error)
  if (!__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_R, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(33, 975, __pyx_L1_error)
  if (!__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_right, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(33, 975, __pyx_L1_error)
  if (!__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_Right, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(33, 975, __pyx_L1_error)
  if (!__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_RIGHT, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(33, 975, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/Mat.pyx":976
 *             return (vecr, vecl)
 *         elif side in ('r', 'R', 'right', 'Right', 'RIGHT'):
 *             vecr = Vec()             # <<<<<<<<<<<<<<
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, NULL) )
 *             return vecr
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_vecr = ((struct PyPetscVecObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/Mat.pyx":977
 *         elif side in ('r', 'R', 'right', 'Right', 'RIGHT'):
 *             vecr = Vec()
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, NULL) )             # <<<<<<<<<<<<<<
 *             return vecr
 *         elif side in ('l', 'L', 'left',  'Left', 'LEFT'):
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateVecs(__pyx_v_self->mat, (&__pyx_v_vecr->vec), NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 977, __pyx_L1_error)

    /* "PETSc/Mat.pyx":978
 *             vecr = Vec()
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, NULL) )
 *             return vecr             # <<<<<<<<<<<<<<
 *         elif side in ('l', 'L', 'left',  'Left', 'LEFT'):
 *             vecl = Vec()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_vecr));
    __pyx_r = ((PyObject *)__pyx_v_vecr);
    goto __pyx_L0;

    /* "PETSc/Mat.pyx":975
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, &vecl.vec) )
 *             return (vecr, vecl)
 *         elif side in ('r', 'R', 'right', 'Right', 'RIGHT'):             # <<<<<<<<<<<<<<
 *             vecr = Vec()
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, NULL) )
 */
  }

  /* "PETSc/Mat.pyx":979
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, NULL) )
 *             return vecr
 *         elif side in ('l', 'L', 'left',  'Left', 'LEFT'):             # <<<<<<<<<<<<<<
 *             vecl = Vec()
 *             CHKERR( MatCreateVecs(self.mat, NULL, &vecl.vec) )
 */
  __Pyx_INCREF(__pyx_v_side);
  __pyx_t_3 = __pyx_v_side;
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_l, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(33, 979, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_L, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(33, 979, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_left, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(33, 979, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_Left, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(33, 979, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_LEFT, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(33, 979, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L9_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":980
 *             return vecr
 *         elif side in ('l', 'L', 'left',  'Left', 'LEFT'):
 *             vecl = Vec()             # <<<<<<<<<<<<<<
 *             CHKERR( MatCreateVecs(self.mat, NULL, &vecl.vec) )
 *             return vecl
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_vecl = ((struct PyPetscVecObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/Mat.pyx":981
 *         elif side in ('l', 'L', 'left',  'Left', 'LEFT'):
 *             vecl = Vec()
 *             CHKERR( MatCreateVecs(self.mat, NULL, &vecl.vec) )             # <<<<<<<<<<<<<<
 *             return vecl
 *         else:
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateVecs(__pyx_v_self->mat, NULL, (&__pyx_v_vecl->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 981, __pyx_L1_error)

    /* "PETSc/Mat.pyx":982
 *             vecl = Vec()
 *             CHKERR( MatCreateVecs(self.mat, NULL, &vecl.vec) )
 *             return vecl             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("side '%r' not understood" % side)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_vecl));
    __pyx_r = ((PyObject *)__pyx_v_vecl);
    goto __pyx_L0;

    /* "PETSc/Mat.pyx":979
 *             CHKERR( MatCreateVecs(self.mat, &vecr.vec, NULL) )
 *             return vecr
 *         elif side in ('l', 'L', 'left',  'Left', 'LEFT'):             # <<<<<<<<<<<<<<
 *             vecl = Vec()
 *             CHKERR( MatCreateVecs(self.mat, NULL, &vecl.vec) )
 */
  }

  /* "PETSc/Mat.pyx":984
 *             return vecl
 *         else:
 *             raise ValueError("side '%r' not understood" % side)             # <<<<<<<<<<<<<<
 * 
 *     def createVecRight(self):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_side_r_not_understood, __pyx_v_side); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 984, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(33, 984, __pyx_L1_error)
  }

  /* "PETSc/Mat.pyx":969
 *     #
 * 
 *     def createVecs(self, side=None):             # <<<<<<<<<<<<<<
 *         cdef Vec vecr, vecl
 *         if side is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createVecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vecr);
  __Pyx_XDECREF((PyObject *)__pyx_v_vecl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":986
 *             raise ValueError("side '%r' not understood" % side)
 * 
 *     def createVecRight(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vecr = Vec()
 *         CHKERR( MatCreateVecs(self.mat, &vecr.vec, NULL) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_229createVecRight(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_228createVecRight[] = "Mat.createVecRight(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_229createVecRight(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createVecRight (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("createVecRight", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "createVecRight", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_228createVecRight(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_228createVecRight(struct PyPetscMatObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vecr = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createVecRight", 0);

  /* "PETSc/Mat.pyx":987
 * 
 *     def createVecRight(self):
 *         cdef Vec vecr = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( MatCreateVecs(self.mat, &vecr.vec, NULL) )
 *         return vecr
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vecr = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":988
 *     def createVecRight(self):
 *         cdef Vec vecr = Vec()
 *         CHKERR( MatCreateVecs(self.mat, &vecr.vec, NULL) )             # <<<<<<<<<<<<<<
 *         return vecr
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateVecs(__pyx_v_self->mat, (&__pyx_v_vecr->vec), NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 988, __pyx_L1_error)

  /* "PETSc/Mat.pyx":989
 *         cdef Vec vecr = Vec()
 *         CHKERR( MatCreateVecs(self.mat, &vecr.vec, NULL) )
 *         return vecr             # <<<<<<<<<<<<<<
 * 
 *     def createVecLeft(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vecr));
  __pyx_r = ((PyObject *)__pyx_v_vecr);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":986
 *             raise ValueError("side '%r' not understood" % side)
 * 
 *     def createVecRight(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vecr = Vec()
 *         CHKERR( MatCreateVecs(self.mat, &vecr.vec, NULL) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createVecRight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vecr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":991
 *         return vecr
 * 
 *     def createVecLeft(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vecl = Vec()
 *         CHKERR( MatCreateVecs(self.mat, NULL, &vecl.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_231createVecLeft(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_230createVecLeft[] = "Mat.createVecLeft(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_231createVecLeft(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createVecLeft (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("createVecLeft", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "createVecLeft", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_230createVecLeft(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_230createVecLeft(struct PyPetscMatObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vecl = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createVecLeft", 0);

  /* "PETSc/Mat.pyx":992
 * 
 *     def createVecLeft(self):
 *         cdef Vec vecl = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( MatCreateVecs(self.mat, NULL, &vecl.vec) )
 *         return vecl
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vecl = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":993
 *     def createVecLeft(self):
 *         cdef Vec vecl = Vec()
 *         CHKERR( MatCreateVecs(self.mat, NULL, &vecl.vec) )             # <<<<<<<<<<<<<<
 *         return vecl
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateVecs(__pyx_v_self->mat, NULL, (&__pyx_v_vecl->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 993, __pyx_L1_error)

  /* "PETSc/Mat.pyx":994
 *         cdef Vec vecl = Vec()
 *         CHKERR( MatCreateVecs(self.mat, NULL, &vecl.vec) )
 *         return vecl             # <<<<<<<<<<<<<<
 * 
 *     getVecs = createVecs
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vecl));
  __pyx_r = ((PyObject *)__pyx_v_vecl);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":991
 *         return vecr
 * 
 *     def createVecLeft(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vecl = Vec()
 *         CHKERR( MatCreateVecs(self.mat, NULL, &vecl.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.createVecLeft", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vecl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1002
 *     #
 * 
 *     def getColumnVector(self, column, Vec result=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(column)
 *         if result is None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_233getColumnVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_232getColumnVector[] = "Mat.getColumnVector(self, column, Vec result=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_233getColumnVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_column = 0;
  struct PyPetscVecObject *__pyx_v_result = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getColumnVector (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_column,&__pyx_n_s_result,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct PyPetscVecObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_column)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getColumnVector") < 0)) __PYX_ERR(33, 1002, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_column = values[0];
    __pyx_v_result = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getColumnVector", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1002, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getColumnVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "result", 0))) __PYX_ERR(33, 1002, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_232getColumnVector(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_column, __pyx_v_result);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_232getColumnVector(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_column, struct PyPetscVecObject *__pyx_v_result) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("getColumnVector", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_result);

  /* "PETSc/Mat.pyx":1003
 * 
 *     def getColumnVector(self, column, Vec result=None):
 *         cdef PetscInt ival = asInt(column)             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = Vec()
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_column); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1003, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/Mat.pyx":1004
 *     def getColumnVector(self, column, Vec result=None):
 *         cdef PetscInt ival = asInt(column)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Vec()
 *         if result.vec == NULL:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_result) == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":1005
 *         cdef PetscInt ival = asInt(column)
 *         if result is None:
 *             result = Vec()             # <<<<<<<<<<<<<<
 *         if result.vec == NULL:
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 */
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_result, ((struct PyPetscVecObject *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "PETSc/Mat.pyx":1004
 *     def getColumnVector(self, column, Vec result=None):
 *         cdef PetscInt ival = asInt(column)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Vec()
 *         if result.vec == NULL:
 */
  }

  /* "PETSc/Mat.pyx":1006
 *         if result is None:
 *             result = Vec()
 *         if result.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 *         CHKERR( MatGetColumnVector(self.mat, result.vec, ival) )
 */
  __pyx_t_3 = ((__pyx_v_result->vec == NULL) != 0);
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":1007
 *             result = Vec()
 *         if result.vec == NULL:
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetColumnVector(self.mat, result.vec, ival) )
 *         return result
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateVecs(__pyx_v_self->mat, NULL, (&__pyx_v_result->vec))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 1007, __pyx_L1_error)

    /* "PETSc/Mat.pyx":1006
 *         if result is None:
 *             result = Vec()
 *         if result.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 *         CHKERR( MatGetColumnVector(self.mat, result.vec, ival) )
 */
  }

  /* "PETSc/Mat.pyx":1008
 *         if result.vec == NULL:
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 *         CHKERR( MatGetColumnVector(self.mat, result.vec, ival) )             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetColumnVector(__pyx_v_self->mat, __pyx_v_result->vec, __pyx_v_ival)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 1008, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1009
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 *         CHKERR( MatGetColumnVector(self.mat, result.vec, ival) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def getRedundantMatrix(self, nsubcomm, subcomm=None, Mat out=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1002
 *     #
 * 
 *     def getColumnVector(self, column, Vec result=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(column)
 *         if result is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getColumnVector", __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;
}

/* "PETSc/Mat.pyx":1011
 *         return result
 * 
 *     def getRedundantMatrix(self, nsubcomm, subcomm=None, Mat out=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _nsubcomm   = asInt(nsubcomm)
 *         cdef MPI_Comm _subcomm    = MPI_COMM_NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_235getRedundantMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_234getRedundantMatrix[] = "Mat.getRedundantMatrix(self, nsubcomm, subcomm=None, Mat out=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_235getRedundantMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nsubcomm = 0;
  PyObject *__pyx_v_subcomm = 0;
  struct PyPetscMatObject *__pyx_v_out = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRedundantMatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nsubcomm,&__pyx_n_s_subcomm,&__pyx_n_s_out,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = (PyObject *)((struct PyPetscMatObject *)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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_nsubcomm)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_subcomm);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getRedundantMatrix") < 0)) __PYX_ERR(33, 1011, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_nsubcomm = values[0];
    __pyx_v_subcomm = values[1];
    __pyx_v_out = ((struct PyPetscMatObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getRedundantMatrix", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1011, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getRedundantMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "out", 0))) __PYX_ERR(33, 1011, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_234getRedundantMatrix(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_nsubcomm, __pyx_v_subcomm, __pyx_v_out);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_234getRedundantMatrix(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_nsubcomm, PyObject *__pyx_v_subcomm, struct PyPetscMatObject *__pyx_v_out) {
  PetscInt __pyx_v__nsubcomm;
  MPI_Comm __pyx_v__subcomm;
  MatReuse __pyx_v_reuse;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  MPI_Comm __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("getRedundantMatrix", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_out);

  /* "PETSc/Mat.pyx":1012
 * 
 *     def getRedundantMatrix(self, nsubcomm, subcomm=None, Mat out=None):
 *         cdef PetscInt _nsubcomm   = asInt(nsubcomm)             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm _subcomm    = MPI_COMM_NULL
 *         if subcomm:   _subcomm    = def_Comm(subcomm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_nsubcomm); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1012, __pyx_L1_error)
  __pyx_v__nsubcomm = __pyx_t_1;

  /* "PETSc/Mat.pyx":1013
 *     def getRedundantMatrix(self, nsubcomm, subcomm=None, Mat out=None):
 *         cdef PetscInt _nsubcomm   = asInt(nsubcomm)
 *         cdef MPI_Comm _subcomm    = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         if subcomm:   _subcomm    = def_Comm(subcomm, PETSC_COMM_DEFAULT)
 *         cdef PetscMatReuse reuse  = MAT_INITIAL_MATRIX
 */
  __pyx_v__subcomm = MPI_COMM_NULL;

  /* "PETSc/Mat.pyx":1014
 *         cdef PetscInt _nsubcomm   = asInt(nsubcomm)
 *         cdef MPI_Comm _subcomm    = MPI_COMM_NULL
 *         if subcomm:   _subcomm    = def_Comm(subcomm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse  = MAT_INITIAL_MATRIX
 *         if out is None: out       = Mat()
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_subcomm); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(33, 1014, __pyx_L1_error)
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_subcomm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 1014, __pyx_L1_error)
    __pyx_v__subcomm = __pyx_t_3;
  }

  /* "PETSc/Mat.pyx":1015
 *         cdef MPI_Comm _subcomm    = MPI_COMM_NULL
 *         if subcomm:   _subcomm    = def_Comm(subcomm, PETSC_COMM_DEFAULT)
 *         cdef PetscMatReuse reuse  = MAT_INITIAL_MATRIX             # <<<<<<<<<<<<<<
 *         if out is None: out       = Mat()
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX
 */
  __pyx_v_reuse = MAT_INITIAL_MATRIX;

  /* "PETSc/Mat.pyx":1016
 *         if subcomm:   _subcomm    = def_Comm(subcomm, PETSC_COMM_DEFAULT)
 *         cdef PetscMatReuse reuse  = MAT_INITIAL_MATRIX
 *         if out is None: out       = Mat()             # <<<<<<<<<<<<<<
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX
 *         CHKERR( MatCreateRedundantMatrix(self.mat, _nsubcomm, _subcomm, reuse, &out.mat))
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_out) == Py_None);
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 1016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_out, ((struct PyPetscMatObject *)__pyx_t_5));
    __pyx_t_5 = 0;
  }

  /* "PETSc/Mat.pyx":1017
 *         cdef PetscMatReuse reuse  = MAT_INITIAL_MATRIX
 *         if out is None: out       = Mat()
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX             # <<<<<<<<<<<<<<
 *         CHKERR( MatCreateRedundantMatrix(self.mat, _nsubcomm, _subcomm, reuse, &out.mat))
 *         return out
 */
  __pyx_t_4 = ((__pyx_v_out->mat != NULL) != 0);
  if (__pyx_t_4) {
    __pyx_v_reuse = MAT_REUSE_MATRIX;
  }

  /* "PETSc/Mat.pyx":1018
 *         if out is None: out       = Mat()
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX
 *         CHKERR( MatCreateRedundantMatrix(self.mat, _nsubcomm, _subcomm, reuse, &out.mat))             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateRedundantMatrix(__pyx_v_self->mat, __pyx_v__nsubcomm, __pyx_v__subcomm, __pyx_v_reuse, (&__pyx_v_out->mat))); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(33, 1018, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1019
 *         if out.mat != NULL: reuse = MAT_REUSE_MATRIX
 *         CHKERR( MatCreateRedundantMatrix(self.mat, _nsubcomm, _subcomm, reuse, &out.mat))
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def getDiagonal(self, Vec result=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1011
 *         return result
 * 
 *     def getRedundantMatrix(self, nsubcomm, subcomm=None, Mat out=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _nsubcomm   = asInt(nsubcomm)
 *         cdef MPI_Comm _subcomm    = MPI_COMM_NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getRedundantMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1021
 *         return out
 * 
 *     def getDiagonal(self, Vec result=None):             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = Vec()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_237getDiagonal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_236getDiagonal[] = "Mat.getDiagonal(self, Vec result=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_237getDiagonal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_result = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDiagonal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_result,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscVecObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getDiagonal") < 0)) __PYX_ERR(33, 1021, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_result = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getDiagonal", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1021, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getDiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "result", 0))) __PYX_ERR(33, 1021, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_236getDiagonal(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_result);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_236getDiagonal(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_result) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("getDiagonal", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_result);

  /* "PETSc/Mat.pyx":1022
 * 
 *     def getDiagonal(self, Vec result=None):
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Vec()
 *         if result.vec == NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_result) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1023
 *     def getDiagonal(self, Vec result=None):
 *         if result is None:
 *             result = Vec()             # <<<<<<<<<<<<<<
 *         if result.vec == NULL:
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1023, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_result, ((struct PyPetscVecObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/Mat.pyx":1022
 * 
 *     def getDiagonal(self, Vec result=None):
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Vec()
 *         if result.vec == NULL:
 */
  }

  /* "PETSc/Mat.pyx":1024
 *         if result is None:
 *             result = Vec()
 *         if result.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 *         CHKERR( MatGetDiagonal(self.mat, result.vec) )
 */
  __pyx_t_2 = ((__pyx_v_result->vec == NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1025
 *             result = Vec()
 *         if result.vec == NULL:
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetDiagonal(self.mat, result.vec) )
 *         return result
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateVecs(__pyx_v_self->mat, NULL, (&__pyx_v_result->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1025, __pyx_L1_error)

    /* "PETSc/Mat.pyx":1024
 *         if result is None:
 *             result = Vec()
 *         if result.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 *         CHKERR( MatGetDiagonal(self.mat, result.vec) )
 */
  }

  /* "PETSc/Mat.pyx":1026
 *         if result.vec == NULL:
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 *         CHKERR( MatGetDiagonal(self.mat, result.vec) )             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetDiagonal(__pyx_v_self->mat, __pyx_v_result->vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1026, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1027
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 *         CHKERR( MatGetDiagonal(self.mat, result.vec) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def getRowSum(self, Vec result=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1021
 *         return out
 * 
 *     def getDiagonal(self, Vec result=None):             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = Vec()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getDiagonal", __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;
}

/* "PETSc/Mat.pyx":1029
 *         return result
 * 
 *     def getRowSum(self, Vec result=None):             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = Vec()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_239getRowSum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_238getRowSum[] = "Mat.getRowSum(self, Vec result=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_239getRowSum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_result = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRowSum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_result,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscVecObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getRowSum") < 0)) __PYX_ERR(33, 1029, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_result = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getRowSum", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1029, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getRowSum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "result", 0))) __PYX_ERR(33, 1029, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_238getRowSum(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_result);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_238getRowSum(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_result) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("getRowSum", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_result);

  /* "PETSc/Mat.pyx":1030
 * 
 *     def getRowSum(self, Vec result=None):
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Vec()
 *         if result.vec == NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_result) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1031
 *     def getRowSum(self, Vec result=None):
 *         if result is None:
 *             result = Vec()             # <<<<<<<<<<<<<<
 *         if result.vec == NULL:
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1031, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_result, ((struct PyPetscVecObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/Mat.pyx":1030
 * 
 *     def getRowSum(self, Vec result=None):
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Vec()
 *         if result.vec == NULL:
 */
  }

  /* "PETSc/Mat.pyx":1032
 *         if result is None:
 *             result = Vec()
 *         if result.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 *         CHKERR( MatGetRowSum(self.mat, result.vec) )
 */
  __pyx_t_2 = ((__pyx_v_result->vec == NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1033
 *             result = Vec()
 *         if result.vec == NULL:
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetRowSum(self.mat, result.vec) )
 *         return result
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCreateVecs(__pyx_v_self->mat, NULL, (&__pyx_v_result->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1033, __pyx_L1_error)

    /* "PETSc/Mat.pyx":1032
 *         if result is None:
 *             result = Vec()
 *         if result.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 *         CHKERR( MatGetRowSum(self.mat, result.vec) )
 */
  }

  /* "PETSc/Mat.pyx":1034
 *         if result.vec == NULL:
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 *         CHKERR( MatGetRowSum(self.mat, result.vec) )             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetRowSum(__pyx_v_self->mat, __pyx_v_result->vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1034, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1035
 *             CHKERR( MatCreateVecs(self.mat, NULL, &result.vec) )
 *         CHKERR( MatGetRowSum(self.mat, result.vec) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def setDiagonal(self, Vec diag not None, addv=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1029
 *         return result
 * 
 *     def getRowSum(self, Vec result=None):             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = Vec()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getRowSum", __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;
}

/* "PETSc/Mat.pyx":1037
 *         return result
 * 
 *     def setDiagonal(self, Vec diag not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( MatDiagonalSet(self.mat, diag.vec, caddv) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_241setDiagonal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_240setDiagonal[] = "Mat.setDiagonal(self, Vec diag, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_241setDiagonal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_diag = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDiagonal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_diag,&__pyx_n_s_addv,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_diag)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setDiagonal") < 0)) __PYX_ERR(33, 1037, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_diag = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_addv = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDiagonal", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1037, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setDiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_diag), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "diag", 0))) __PYX_ERR(33, 1037, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_240setDiagonal(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_diag, __pyx_v_addv);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_240setDiagonal(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_diag, PyObject *__pyx_v_addv) {
  InsertMode __pyx_v_caddv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setDiagonal", 0);

  /* "PETSc/Mat.pyx":1038
 * 
 *     def setDiagonal(self, Vec diag not None, addv=None):
 *         cdef PetscInsertMode caddv = insertmode(addv)             # <<<<<<<<<<<<<<
 *         CHKERR( MatDiagonalSet(self.mat, diag.vec, caddv) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(33, 1038, __pyx_L1_error)
  __pyx_v_caddv = __pyx_t_1;

  /* "PETSc/Mat.pyx":1039
 *     def setDiagonal(self, Vec diag not None, addv=None):
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( MatDiagonalSet(self.mat, diag.vec, caddv) )             # <<<<<<<<<<<<<<
 * 
 *     def diagonalScale(self, Vec L=None, Vec R=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDiagonalSet(__pyx_v_self->mat, __pyx_v_diag->vec, __pyx_v_caddv)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1039, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1037
 *         return result
 * 
 *     def setDiagonal(self, Vec diag not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode caddv = insertmode(addv)
 *         CHKERR( MatDiagonalSet(self.mat, diag.vec, caddv) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setDiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1041
 *         CHKERR( MatDiagonalSet(self.mat, diag.vec, caddv) )
 * 
 *     def diagonalScale(self, Vec L=None, Vec R=None):             # <<<<<<<<<<<<<<
 *         cdef PetscVec vecl=NULL, vecr=NULL
 *         if L is not None: vecl = L.vec
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_243diagonalScale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_242diagonalScale[] = "Mat.diagonalScale(self, Vec L=None, Vec R=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_243diagonalScale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_L = 0;
  struct PyPetscVecObject *__pyx_v_R = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diagonalScale (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_R,0};
    PyObject* values[2] = {0,0};
    values[0] = (PyObject *)((struct PyPetscVecObject *)Py_None);
    values[1] = (PyObject *)((struct PyPetscVecObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_L);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_R);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "diagonalScale") < 0)) __PYX_ERR(33, 1041, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_R = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("diagonalScale", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1041, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.diagonalScale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_L), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "L", 0))) __PYX_ERR(33, 1041, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_R), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "R", 0))) __PYX_ERR(33, 1041, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_242diagonalScale(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_L, __pyx_v_R);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_242diagonalScale(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_L, struct PyPetscVecObject *__pyx_v_R) {
  Vec __pyx_v_vecl;
  Vec __pyx_v_vecr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Vec __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("diagonalScale", 0);

  /* "PETSc/Mat.pyx":1042
 * 
 *     def diagonalScale(self, Vec L=None, Vec R=None):
 *         cdef PetscVec vecl=NULL, vecr=NULL             # <<<<<<<<<<<<<<
 *         if L is not None: vecl = L.vec
 *         if R is not None: vecr = R.vec
 */
  __pyx_v_vecl = NULL;
  __pyx_v_vecr = NULL;

  /* "PETSc/Mat.pyx":1043
 *     def diagonalScale(self, Vec L=None, Vec R=None):
 *         cdef PetscVec vecl=NULL, vecr=NULL
 *         if L is not None: vecl = L.vec             # <<<<<<<<<<<<<<
 *         if R is not None: vecr = R.vec
 *         CHKERR( MatDiagonalScale(self.mat, vecl, vecr) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_L) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_L->vec;
    __pyx_v_vecl = __pyx_t_3;
  }

  /* "PETSc/Mat.pyx":1044
 *         cdef PetscVec vecl=NULL, vecr=NULL
 *         if L is not None: vecl = L.vec
 *         if R is not None: vecr = R.vec             # <<<<<<<<<<<<<<
 *         CHKERR( MatDiagonalScale(self.mat, vecl, vecr) )
 * 
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_R) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_R->vec;
    __pyx_v_vecr = __pyx_t_3;
  }

  /* "PETSc/Mat.pyx":1045
 *         if L is not None: vecl = L.vec
 *         if R is not None: vecr = R.vec
 *         CHKERR( MatDiagonalScale(self.mat, vecl, vecr) )             # <<<<<<<<<<<<<<
 * 
 *     def invertBlockDiagonal(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDiagonalScale(__pyx_v_self->mat, __pyx_v_vecl, __pyx_v_vecr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1045, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1041
 *         CHKERR( MatDiagonalSet(self.mat, diag.vec, caddv) )
 * 
 *     def diagonalScale(self, Vec L=None, Vec R=None):             # <<<<<<<<<<<<<<
 *         cdef PetscVec vecl=NULL, vecr=NULL
 *         if L is not None: vecl = L.vec
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.diagonalScale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1047
 *         CHKERR( MatDiagonalScale(self.mat, vecl, vecr) )
 * 
 *     def invertBlockDiagonal(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = 0, m = 0
 *         cdef const_PetscScalar *cibdiag = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_245invertBlockDiagonal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_244invertBlockDiagonal[] = "Mat.invertBlockDiagonal(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_245invertBlockDiagonal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("invertBlockDiagonal (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("invertBlockDiagonal", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "invertBlockDiagonal", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_244invertBlockDiagonal(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_244invertBlockDiagonal(struct PyPetscMatObject *__pyx_v_self) {
  PetscInt __pyx_v_bs;
  PetscInt __pyx_v_m;
  const PetscScalar *__pyx_v_cibdiag;
  PyArrayObject *__pyx_v_ibdiag = 0;
  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;
  __Pyx_RefNannySetupContext("invertBlockDiagonal", 0);

  /* "PETSc/Mat.pyx":1048
 * 
 *     def invertBlockDiagonal(self):
 *         cdef PetscInt bs = 0, m = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscScalar *cibdiag = NULL
 *         CHKERR( MatGetBlockSize(self.mat, &bs) )
 */
  __pyx_v_bs = 0;
  __pyx_v_m = 0;

  /* "PETSc/Mat.pyx":1049
 *     def invertBlockDiagonal(self):
 *         cdef PetscInt bs = 0, m = 0
 *         cdef const_PetscScalar *cibdiag = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetBlockSize(self.mat, &bs) )
 *         CHKERR( MatGetLocalSize(self.mat, &m, NULL) )
 */
  __pyx_v_cibdiag = NULL;

  /* "PETSc/Mat.pyx":1050
 *         cdef PetscInt bs = 0, m = 0
 *         cdef const_PetscScalar *cibdiag = NULL
 *         CHKERR( MatGetBlockSize(self.mat, &bs) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetLocalSize(self.mat, &m, NULL) )
 *         CHKERR( MatInvertBlockDiagonal(self.mat, &cibdiag) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetBlockSize(__pyx_v_self->mat, (&__pyx_v_bs))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1050, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1051
 *         cdef const_PetscScalar *cibdiag = NULL
 *         CHKERR( MatGetBlockSize(self.mat, &bs) )
 *         CHKERR( MatGetLocalSize(self.mat, &m, NULL) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatInvertBlockDiagonal(self.mat, &cibdiag) )
 *         cdef ndarray ibdiag = array_s(m*bs, cibdiag)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetLocalSize(__pyx_v_self->mat, (&__pyx_v_m), NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1051, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1052
 *         CHKERR( MatGetBlockSize(self.mat, &bs) )
 *         CHKERR( MatGetLocalSize(self.mat, &m, NULL) )
 *         CHKERR( MatInvertBlockDiagonal(self.mat, &cibdiag) )             # <<<<<<<<<<<<<<
 *         cdef ndarray ibdiag = array_s(m*bs, cibdiag)
 *         ibdiag.shape = (toInt(m//bs), toInt(bs), toInt(bs))
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatInvertBlockDiagonal(__pyx_v_self->mat, (&__pyx_v_cibdiag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1052, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1053
 *         CHKERR( MatGetLocalSize(self.mat, &m, NULL) )
 *         CHKERR( MatInvertBlockDiagonal(self.mat, &cibdiag) )
 *         cdef ndarray ibdiag = array_s(m*bs, cibdiag)             # <<<<<<<<<<<<<<
 *         ibdiag.shape = (toInt(m//bs), toInt(bs), toInt(bs))
 *         return ibdiag.transpose(0, 2, 1)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_s((__pyx_v_m * __pyx_v_bs), __pyx_v_cibdiag)); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ibdiag = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Mat.pyx":1054
 *         CHKERR( MatInvertBlockDiagonal(self.mat, &cibdiag) )
 *         cdef ndarray ibdiag = array_s(m*bs, cibdiag)
 *         ibdiag.shape = (toInt(m//bs), toInt(bs), toInt(bs))             # <<<<<<<<<<<<<<
 *         return ibdiag.transpose(0, 2, 1)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_m / __pyx_v_bs)); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_bs); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_bs); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 1054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_ibdiag), __pyx_n_s_shape, __pyx_t_5) < 0) __PYX_ERR(33, 1054, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Mat.pyx":1055
 *         cdef ndarray ibdiag = array_s(m*bs, cibdiag)
 *         ibdiag.shape = (toInt(m//bs), toInt(bs), toInt(bs))
 *         return ibdiag.transpose(0, 2, 1)             # <<<<<<<<<<<<<<
 * 
 *     # null space
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ibdiag), __pyx_n_s_transpose); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1047
 *         CHKERR( MatDiagonalScale(self.mat, vecl, vecr) )
 * 
 *     def invertBlockDiagonal(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = 0, m = 0
 *         cdef const_PetscScalar *cibdiag = NULL
 */

  /* 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("petsc4py.PETSc.Mat.invertBlockDiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ibdiag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1059
 *     # null space
 * 
 *     def setNullSpace(self, NullSpace nsp not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetNullSpace(self.mat, nsp.nsp) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_247setNullSpace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_246setNullSpace[] = "Mat.setNullSpace(self, NullSpace nsp)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_247setNullSpace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscNullSpaceObject *__pyx_v_nsp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setNullSpace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nsp,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);
        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_nsp)) != 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, "setNullSpace") < 0)) __PYX_ERR(33, 1059, __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_nsp = ((struct PyPetscNullSpaceObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setNullSpace", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1059, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setNullSpace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nsp), __pyx_ptype_8petsc4py_5PETSc_NullSpace, 0, "nsp", 0))) __PYX_ERR(33, 1059, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_246setNullSpace(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_nsp);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_246setNullSpace(struct PyPetscMatObject *__pyx_v_self, struct PyPetscNullSpaceObject *__pyx_v_nsp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setNullSpace", 0);

  /* "PETSc/Mat.pyx":1060
 * 
 *     def setNullSpace(self, NullSpace nsp not None):
 *         CHKERR( MatSetNullSpace(self.mat, nsp.nsp) )             # <<<<<<<<<<<<<<
 * 
 *     def getNullSpace(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetNullSpace(__pyx_v_self->mat, __pyx_v_nsp->nsp)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1060, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1059
 *     # null space
 * 
 *     def setNullSpace(self, NullSpace nsp not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetNullSpace(self.mat, nsp.nsp) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setNullSpace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1062
 *         CHKERR( MatSetNullSpace(self.mat, nsp.nsp) )
 * 
 *     def getNullSpace(self):             # <<<<<<<<<<<<<<
 *         cdef NullSpace nsp = NullSpace()
 *         CHKERR( MatGetNullSpace(self.mat, &nsp.nsp) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_249getNullSpace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_248getNullSpace[] = "Mat.getNullSpace(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_249getNullSpace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getNullSpace (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getNullSpace", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getNullSpace", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_248getNullSpace(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_248getNullSpace(struct PyPetscMatObject *__pyx_v_self) {
  struct PyPetscNullSpaceObject *__pyx_v_nsp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getNullSpace", 0);

  /* "PETSc/Mat.pyx":1063
 * 
 *     def getNullSpace(self):
 *         cdef NullSpace nsp = NullSpace()             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetNullSpace(self.mat, &nsp.nsp) )
 *         PetscINCREF(nsp.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_NullSpace), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_nsp = ((struct PyPetscNullSpaceObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":1064
 *     def getNullSpace(self):
 *         cdef NullSpace nsp = NullSpace()
 *         CHKERR( MatGetNullSpace(self.mat, &nsp.nsp) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(nsp.obj)
 *         return nsp
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetNullSpace(__pyx_v_self->mat, (&__pyx_v_nsp->nsp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1064, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1065
 *         cdef NullSpace nsp = NullSpace()
 *         CHKERR( MatGetNullSpace(self.mat, &nsp.nsp) )
 *         PetscINCREF(nsp.obj)             # <<<<<<<<<<<<<<
 *         return nsp
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_nsp->__pyx_base.obj);

  /* "PETSc/Mat.pyx":1066
 *         CHKERR( MatGetNullSpace(self.mat, &nsp.nsp) )
 *         PetscINCREF(nsp.obj)
 *         return nsp             # <<<<<<<<<<<<<<
 * 
 *     def setNearNullSpace(self, NullSpace nsp not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_nsp));
  __pyx_r = ((PyObject *)__pyx_v_nsp);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1062
 *         CHKERR( MatSetNullSpace(self.mat, nsp.nsp) )
 * 
 *     def getNullSpace(self):             # <<<<<<<<<<<<<<
 *         cdef NullSpace nsp = NullSpace()
 *         CHKERR( MatGetNullSpace(self.mat, &nsp.nsp) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getNullSpace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_nsp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1068
 *         return nsp
 * 
 *     def setNearNullSpace(self, NullSpace nsp not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetNearNullSpace(self.mat, nsp.nsp) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_251setNearNullSpace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_250setNearNullSpace[] = "Mat.setNearNullSpace(self, NullSpace nsp)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_251setNearNullSpace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscNullSpaceObject *__pyx_v_nsp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setNearNullSpace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nsp,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);
        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_nsp)) != 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, "setNearNullSpace") < 0)) __PYX_ERR(33, 1068, __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_nsp = ((struct PyPetscNullSpaceObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setNearNullSpace", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1068, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setNearNullSpace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nsp), __pyx_ptype_8petsc4py_5PETSc_NullSpace, 0, "nsp", 0))) __PYX_ERR(33, 1068, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_250setNearNullSpace(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_nsp);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_250setNearNullSpace(struct PyPetscMatObject *__pyx_v_self, struct PyPetscNullSpaceObject *__pyx_v_nsp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setNearNullSpace", 0);

  /* "PETSc/Mat.pyx":1069
 * 
 *     def setNearNullSpace(self, NullSpace nsp not None):
 *         CHKERR( MatSetNearNullSpace(self.mat, nsp.nsp) )             # <<<<<<<<<<<<<<
 * 
 *     def getNearNullSpace(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetNearNullSpace(__pyx_v_self->mat, __pyx_v_nsp->nsp)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1069, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1068
 *         return nsp
 * 
 *     def setNearNullSpace(self, NullSpace nsp not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetNearNullSpace(self.mat, nsp.nsp) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setNearNullSpace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1071
 *         CHKERR( MatSetNearNullSpace(self.mat, nsp.nsp) )
 * 
 *     def getNearNullSpace(self):             # <<<<<<<<<<<<<<
 *         cdef NullSpace nsp = NullSpace()
 *         CHKERR( MatGetNearNullSpace(self.mat, &nsp.nsp) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_253getNearNullSpace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_252getNearNullSpace[] = "Mat.getNearNullSpace(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_253getNearNullSpace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getNearNullSpace (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getNearNullSpace", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getNearNullSpace", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_252getNearNullSpace(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_252getNearNullSpace(struct PyPetscMatObject *__pyx_v_self) {
  struct PyPetscNullSpaceObject *__pyx_v_nsp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getNearNullSpace", 0);

  /* "PETSc/Mat.pyx":1072
 * 
 *     def getNearNullSpace(self):
 *         cdef NullSpace nsp = NullSpace()             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetNearNullSpace(self.mat, &nsp.nsp) )
 *         PetscINCREF(nsp.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_NullSpace), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_nsp = ((struct PyPetscNullSpaceObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":1073
 *     def getNearNullSpace(self):
 *         cdef NullSpace nsp = NullSpace()
 *         CHKERR( MatGetNearNullSpace(self.mat, &nsp.nsp) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(nsp.obj)
 *         return nsp
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetNearNullSpace(__pyx_v_self->mat, (&__pyx_v_nsp->nsp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1073, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1074
 *         cdef NullSpace nsp = NullSpace()
 *         CHKERR( MatGetNearNullSpace(self.mat, &nsp.nsp) )
 *         PetscINCREF(nsp.obj)             # <<<<<<<<<<<<<<
 *         return nsp
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_nsp->__pyx_base.obj);

  /* "PETSc/Mat.pyx":1075
 *         CHKERR( MatGetNearNullSpace(self.mat, &nsp.nsp) )
 *         PetscINCREF(nsp.obj)
 *         return nsp             # <<<<<<<<<<<<<<
 * 
 *     # matrix-vector product
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_nsp));
  __pyx_r = ((PyObject *)__pyx_v_nsp);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1071
 *         CHKERR( MatSetNearNullSpace(self.mat, nsp.nsp) )
 * 
 *     def getNearNullSpace(self):             # <<<<<<<<<<<<<<
 *         cdef NullSpace nsp = NullSpace()
 *         CHKERR( MatGetNearNullSpace(self.mat, &nsp.nsp) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getNearNullSpace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_nsp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1079
 *     # matrix-vector product
 * 
 *     def mult(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMult(self.mat, x.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_255mult(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_254mult[] = "Mat.mult(self, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_255mult(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mult (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mult", 1, 2, 2, 1); __PYX_ERR(33, 1079, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mult") < 0)) __PYX_ERR(33, 1079, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mult", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1079, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.mult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1079, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(33, 1079, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_254mult(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_254mult(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("mult", 0);

  /* "PETSc/Mat.pyx":1080
 * 
 *     def mult(self, Vec x not None, Vec y not None):
 *         CHKERR( MatMult(self.mat, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def multAdd(self, Vec x not None, Vec v not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMult(__pyx_v_self->mat, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1080, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1079
 *     # matrix-vector product
 * 
 *     def mult(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMult(self.mat, x.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.mult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1082
 *         CHKERR( MatMult(self.mat, x.vec, y.vec) )
 * 
 *     def multAdd(self, Vec x not None, Vec v not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMultAdd(self.mat, x.vec, v.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_257multAdd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_256multAdd[] = "Mat.multAdd(self, Vec x, Vec v, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_257multAdd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_v = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("multAdd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_y,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("multAdd", 1, 3, 3, 1); __PYX_ERR(33, 1082, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("multAdd", 1, 3, 3, 2); __PYX_ERR(33, 1082, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "multAdd") < 0)) __PYX_ERR(33, 1082, __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_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_v = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("multAdd", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1082, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.multAdd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1082, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "v", 0))) __PYX_ERR(33, 1082, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(33, 1082, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_256multAdd(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_x, __pyx_v_v, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_256multAdd(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_v, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("multAdd", 0);

  /* "PETSc/Mat.pyx":1083
 * 
 *     def multAdd(self, Vec x not None, Vec v not None, Vec y not None):
 *         CHKERR( MatMultAdd(self.mat, x.vec, v.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def multTranspose(self, Vec x not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMultAdd(__pyx_v_self->mat, __pyx_v_x->vec, __pyx_v_v->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1083, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1082
 *         CHKERR( MatMult(self.mat, x.vec, y.vec) )
 * 
 *     def multAdd(self, Vec x not None, Vec v not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMultAdd(self.mat, x.vec, v.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.multAdd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1085
 *         CHKERR( MatMultAdd(self.mat, x.vec, v.vec, y.vec) )
 * 
 *     def multTranspose(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMultTranspose(self.mat, x.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_259multTranspose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_258multTranspose[] = "Mat.multTranspose(self, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_259multTranspose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("multTranspose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("multTranspose", 1, 2, 2, 1); __PYX_ERR(33, 1085, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "multTranspose") < 0)) __PYX_ERR(33, 1085, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("multTranspose", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1085, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.multTranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1085, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(33, 1085, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_258multTranspose(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_258multTranspose(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("multTranspose", 0);

  /* "PETSc/Mat.pyx":1086
 * 
 *     def multTranspose(self, Vec x not None, Vec y not None):
 *         CHKERR( MatMultTranspose(self.mat, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def multTransposeAdd(self, Vec x not None, Vec v not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMultTranspose(__pyx_v_self->mat, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1086, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1085
 *         CHKERR( MatMultAdd(self.mat, x.vec, v.vec, y.vec) )
 * 
 *     def multTranspose(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMultTranspose(self.mat, x.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.multTranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1088
 *         CHKERR( MatMultTranspose(self.mat, x.vec, y.vec) )
 * 
 *     def multTransposeAdd(self, Vec x not None, Vec v not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMultTransposeAdd(self.mat, x.vec, v.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_261multTransposeAdd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_260multTransposeAdd[] = "Mat.multTransposeAdd(self, Vec x, Vec v, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_261multTransposeAdd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_v = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("multTransposeAdd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_y,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("multTransposeAdd", 1, 3, 3, 1); __PYX_ERR(33, 1088, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("multTransposeAdd", 1, 3, 3, 2); __PYX_ERR(33, 1088, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "multTransposeAdd") < 0)) __PYX_ERR(33, 1088, __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_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_v = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("multTransposeAdd", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1088, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.multTransposeAdd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1088, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "v", 0))) __PYX_ERR(33, 1088, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(33, 1088, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_260multTransposeAdd(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_x, __pyx_v_v, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_260multTransposeAdd(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_v, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("multTransposeAdd", 0);

  /* "PETSc/Mat.pyx":1089
 * 
 *     def multTransposeAdd(self, Vec x not None, Vec v not None, Vec y not None):
 *         CHKERR( MatMultTransposeAdd(self.mat, x.vec, v.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def multHermitian(self, Vec x not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMultTransposeAdd(__pyx_v_self->mat, __pyx_v_x->vec, __pyx_v_v->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1089, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1088
 *         CHKERR( MatMultTranspose(self.mat, x.vec, y.vec) )
 * 
 *     def multTransposeAdd(self, Vec x not None, Vec v not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMultTransposeAdd(self.mat, x.vec, v.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.multTransposeAdd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1091
 *         CHKERR( MatMultTransposeAdd(self.mat, x.vec, v.vec, y.vec) )
 * 
 *     def multHermitian(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMultHermitian(self.mat, x.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_263multHermitian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_262multHermitian[] = "Mat.multHermitian(self, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_263multHermitian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("multHermitian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("multHermitian", 1, 2, 2, 1); __PYX_ERR(33, 1091, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "multHermitian") < 0)) __PYX_ERR(33, 1091, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("multHermitian", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1091, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.multHermitian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1091, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(33, 1091, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_262multHermitian(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_262multHermitian(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("multHermitian", 0);

  /* "PETSc/Mat.pyx":1092
 * 
 *     def multHermitian(self, Vec x not None, Vec y not None):
 *         CHKERR( MatMultHermitian(self.mat, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def multHermitianAdd(self, Vec x not None, Vec v not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMultHermitianTranspose(__pyx_v_self->mat, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1092, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1091
 *         CHKERR( MatMultTransposeAdd(self.mat, x.vec, v.vec, y.vec) )
 * 
 *     def multHermitian(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMultHermitian(self.mat, x.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.multHermitian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1094
 *         CHKERR( MatMultHermitian(self.mat, x.vec, y.vec) )
 * 
 *     def multHermitianAdd(self, Vec x not None, Vec v not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMultHermitianAdd(self.mat, x.vec, v.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_265multHermitianAdd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_264multHermitianAdd[] = "Mat.multHermitianAdd(self, Vec x, Vec v, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_265multHermitianAdd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_v = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("multHermitianAdd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_y,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("multHermitianAdd", 1, 3, 3, 1); __PYX_ERR(33, 1094, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("multHermitianAdd", 1, 3, 3, 2); __PYX_ERR(33, 1094, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "multHermitianAdd") < 0)) __PYX_ERR(33, 1094, __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_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_v = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("multHermitianAdd", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1094, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.multHermitianAdd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1094, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "v", 0))) __PYX_ERR(33, 1094, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(33, 1094, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_264multHermitianAdd(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_x, __pyx_v_v, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_264multHermitianAdd(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_v, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("multHermitianAdd", 0);

  /* "PETSc/Mat.pyx":1095
 * 
 *     def multHermitianAdd(self, Vec x not None, Vec v not None, Vec y not None):
 *         CHKERR( MatMultHermitianAdd(self.mat, x.vec, v.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     # SOR
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMultHermitianTransposeAdd(__pyx_v_self->mat, __pyx_v_x->vec, __pyx_v_v->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1095, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1094
 *         CHKERR( MatMultHermitian(self.mat, x.vec, y.vec) )
 * 
 *     def multHermitianAdd(self, Vec x not None, Vec v not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMultHermitianAdd(self.mat, x.vec, v.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.multHermitianAdd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1099
 *     # SOR
 * 
 *     def SOR(self, Vec b not None, Vec x not None, omega=1.0, sortype=None, shift=0.0, its=1, lits=1):             # <<<<<<<<<<<<<<
 *         cdef PetscReal comega = asReal(omega)
 *         cdef PetscMatSORType csortype = SOR_LOCAL_SYMMETRIC_SWEEP
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_267SOR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_266SOR[] = "Mat.SOR(self, Vec b, Vec x, omega=1.0, sortype=None, shift=0.0, its=1, lits=1)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_267SOR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_b = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_v_omega = 0;
  PyObject *__pyx_v_sortype = 0;
  PyObject *__pyx_v_shift = 0;
  PyObject *__pyx_v_its = 0;
  PyObject *__pyx_v_lits = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SOR (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_x,&__pyx_n_s_omega,&__pyx_n_s_sortype,&__pyx_n_s_shift,&__pyx_n_s_its,&__pyx_n_s_lits,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[2] = ((PyObject *)__pyx_float_1_0);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)__pyx_float_0_0);
    values[5] = ((PyObject *)__pyx_int_1);
    values[6] = ((PyObject *)__pyx_int_1);
    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);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("SOR", 0, 2, 7, 1); __PYX_ERR(33, 1099, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_omega);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sortype);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shift);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_its);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lits);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "SOR") < 0)) __PYX_ERR(33, 1099, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_b = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_omega = values[2];
    __pyx_v_sortype = values[3];
    __pyx_v_shift = values[4];
    __pyx_v_its = values[5];
    __pyx_v_lits = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("SOR", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1099, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.SOR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "b", 0))) __PYX_ERR(33, 1099, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1099, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_266SOR(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_b, __pyx_v_x, __pyx_v_omega, __pyx_v_sortype, __pyx_v_shift, __pyx_v_its, __pyx_v_lits);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_266SOR(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x, PyObject *__pyx_v_omega, PyObject *__pyx_v_sortype, PyObject *__pyx_v_shift, PyObject *__pyx_v_its, PyObject *__pyx_v_lits) {
  PetscReal __pyx_v_comega;
  MatSORType __pyx_v_csortype;
  PetscInt __pyx_v_cshift;
  PetscInt __pyx_v_cits;
  PetscInt __pyx_v_clits;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PetscInt __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("SOR", 0);

  /* "PETSc/Mat.pyx":1100
 * 
 *     def SOR(self, Vec b not None, Vec x not None, omega=1.0, sortype=None, shift=0.0, its=1, lits=1):
 *         cdef PetscReal comega = asReal(omega)             # <<<<<<<<<<<<<<
 *         cdef PetscMatSORType csortype = SOR_LOCAL_SYMMETRIC_SWEEP
 *         if sortype is not None:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_omega); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(33, 1100, __pyx_L1_error)
  __pyx_v_comega = __pyx_t_1;

  /* "PETSc/Mat.pyx":1101
 *     def SOR(self, Vec b not None, Vec x not None, omega=1.0, sortype=None, shift=0.0, its=1, lits=1):
 *         cdef PetscReal comega = asReal(omega)
 *         cdef PetscMatSORType csortype = SOR_LOCAL_SYMMETRIC_SWEEP             # <<<<<<<<<<<<<<
 *         if sortype is not None:
 *             csortype = <PetscMatSORType> asInt(sortype)
 */
  __pyx_v_csortype = SOR_LOCAL_SYMMETRIC_SWEEP;

  /* "PETSc/Mat.pyx":1102
 *         cdef PetscReal comega = asReal(omega)
 *         cdef PetscMatSORType csortype = SOR_LOCAL_SYMMETRIC_SWEEP
 *         if sortype is not None:             # <<<<<<<<<<<<<<
 *             csortype = <PetscMatSORType> asInt(sortype)
 *         cdef PetscInt cshift = asInt(shift)
 */
  __pyx_t_2 = (__pyx_v_sortype != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Mat.pyx":1103
 *         cdef PetscMatSORType csortype = SOR_LOCAL_SYMMETRIC_SWEEP
 *         if sortype is not None:
 *             csortype = <PetscMatSORType> asInt(sortype)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cshift = asInt(shift)
 *         cdef PetscInt cits = asInt(its)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_sortype); if (unlikely(__pyx_t_4 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1103, __pyx_L1_error)
    __pyx_v_csortype = ((MatSORType)__pyx_t_4);

    /* "PETSc/Mat.pyx":1102
 *         cdef PetscReal comega = asReal(omega)
 *         cdef PetscMatSORType csortype = SOR_LOCAL_SYMMETRIC_SWEEP
 *         if sortype is not None:             # <<<<<<<<<<<<<<
 *             csortype = <PetscMatSORType> asInt(sortype)
 *         cdef PetscInt cshift = asInt(shift)
 */
  }

  /* "PETSc/Mat.pyx":1104
 *         if sortype is not None:
 *             csortype = <PetscMatSORType> asInt(sortype)
 *         cdef PetscInt cshift = asInt(shift)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cits = asInt(its)
 *         cdef PetscInt clits = asInt(lits)
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_shift); if (unlikely(__pyx_t_4 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1104, __pyx_L1_error)
  __pyx_v_cshift = __pyx_t_4;

  /* "PETSc/Mat.pyx":1105
 *             csortype = <PetscMatSORType> asInt(sortype)
 *         cdef PetscInt cshift = asInt(shift)
 *         cdef PetscInt cits = asInt(its)             # <<<<<<<<<<<<<<
 *         cdef PetscInt clits = asInt(lits)
 *         CHKERR( MatSOR(self.mat, b.vec, comega, csortype, cshift, cits, clits, x.vec) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_its); if (unlikely(__pyx_t_4 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1105, __pyx_L1_error)
  __pyx_v_cits = __pyx_t_4;

  /* "PETSc/Mat.pyx":1106
 *         cdef PetscInt cshift = asInt(shift)
 *         cdef PetscInt cits = asInt(its)
 *         cdef PetscInt clits = asInt(lits)             # <<<<<<<<<<<<<<
 *         CHKERR( MatSOR(self.mat, b.vec, comega, csortype, cshift, cits, clits, x.vec) )
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_lits); if (unlikely(__pyx_t_4 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1106, __pyx_L1_error)
  __pyx_v_clits = __pyx_t_4;

  /* "PETSc/Mat.pyx":1107
 *         cdef PetscInt cits = asInt(its)
 *         cdef PetscInt clits = asInt(lits)
 *         CHKERR( MatSOR(self.mat, b.vec, comega, csortype, cshift, cits, clits, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSOR(__pyx_v_self->mat, __pyx_v_b->vec, __pyx_v_comega, __pyx_v_csortype, __pyx_v_cshift, __pyx_v_cits, __pyx_v_clits, __pyx_v_x->vec)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 1107, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1099
 *     # SOR
 * 
 *     def SOR(self, Vec b not None, Vec x not None, omega=1.0, sortype=None, shift=0.0, its=1, lits=1):             # <<<<<<<<<<<<<<
 *         cdef PetscReal comega = asReal(omega)
 *         cdef PetscMatSORType csortype = SOR_LOCAL_SYMMETRIC_SWEEP
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.SOR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1111
 *     #
 * 
 *     def getDiagonalBlock(self):             # <<<<<<<<<<<<<<
 *         cdef Mat submat = Mat()
 *         CHKERR( MatGetDiagonalBlock(self.mat, &submat.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_269getDiagonalBlock(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_268getDiagonalBlock[] = "Mat.getDiagonalBlock(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_269getDiagonalBlock(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDiagonalBlock (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDiagonalBlock", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDiagonalBlock", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_268getDiagonalBlock(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_268getDiagonalBlock(struct PyPetscMatObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_submat = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getDiagonalBlock", 0);

  /* "PETSc/Mat.pyx":1112
 * 
 *     def getDiagonalBlock(self):
 *         cdef Mat submat = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetDiagonalBlock(self.mat, &submat.mat) )
 *         PetscINCREF(submat.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_submat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":1113
 *     def getDiagonalBlock(self):
 *         cdef Mat submat = Mat()
 *         CHKERR( MatGetDiagonalBlock(self.mat, &submat.mat) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(submat.obj)
 *         return submat
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetDiagonalBlock(__pyx_v_self->mat, (&__pyx_v_submat->mat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1113, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1114
 *         cdef Mat submat = Mat()
 *         CHKERR( MatGetDiagonalBlock(self.mat, &submat.mat) )
 *         PetscINCREF(submat.obj)             # <<<<<<<<<<<<<<
 *         return submat
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_submat->__pyx_base.obj);

  /* "PETSc/Mat.pyx":1115
 *         CHKERR( MatGetDiagonalBlock(self.mat, &submat.mat) )
 *         PetscINCREF(submat.obj)
 *         return submat             # <<<<<<<<<<<<<<
 * 
 *     def increaseOverlap(self, IS iset not None, overlap=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_submat));
  __pyx_r = ((PyObject *)__pyx_v_submat);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1111
 *     #
 * 
 *     def getDiagonalBlock(self):             # <<<<<<<<<<<<<<
 *         cdef Mat submat = Mat()
 *         CHKERR( MatGetDiagonalBlock(self.mat, &submat.mat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getDiagonalBlock", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_submat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1117
 *         return submat
 * 
 *     def increaseOverlap(self, IS iset not None, overlap=1):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(overlap)
 *         CHKERR( MatIncreaseOverlap(self.mat, 1, &iset.iset, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_271increaseOverlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_270increaseOverlap[] = "Mat.increaseOverlap(self, IS iset, overlap=1)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_271increaseOverlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_v_overlap = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("increaseOverlap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iset,&__pyx_n_s_overlap,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_int_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_iset)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_overlap);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "increaseOverlap") < 0)) __PYX_ERR(33, 1117, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_iset = ((struct PyPetscISObject *)values[0]);
    __pyx_v_overlap = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("increaseOverlap", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1117, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.increaseOverlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iset), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iset", 0))) __PYX_ERR(33, 1117, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_270increaseOverlap(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_iset, __pyx_v_overlap);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_270increaseOverlap(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_iset, PyObject *__pyx_v_overlap) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("increaseOverlap", 0);

  /* "PETSc/Mat.pyx":1118
 * 
 *     def increaseOverlap(self, IS iset not None, overlap=1):
 *         cdef PetscInt ival = asInt(overlap)             # <<<<<<<<<<<<<<
 *         CHKERR( MatIncreaseOverlap(self.mat, 1, &iset.iset, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_overlap); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1118, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/Mat.pyx":1119
 *     def increaseOverlap(self, IS iset not None, overlap=1):
 *         cdef PetscInt ival = asInt(overlap)
 *         CHKERR( MatIncreaseOverlap(self.mat, 1, &iset.iset, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def getSubMatrix(self, IS isrow not None, IS iscol=None, Mat submat=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatIncreaseOverlap(__pyx_v_self->mat, 1, (&__pyx_v_iset->iset), __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1119, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1117
 *         return submat
 * 
 *     def increaseOverlap(self, IS iset not None, overlap=1):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(overlap)
 *         CHKERR( MatIncreaseOverlap(self.mat, 1, &iset.iset, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.increaseOverlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1121
 *         CHKERR( MatIncreaseOverlap(self.mat, 1, &iset.iset, ival) )
 * 
 *     def getSubMatrix(self, IS isrow not None, IS iscol=None, Mat submat=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscIS ciscol = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_273getSubMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_272getSubMatrix[] = "Mat.getSubMatrix(self, IS isrow, IS iscol=None, Mat submat=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_273getSubMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_isrow = 0;
  struct PyPetscISObject *__pyx_v_iscol = 0;
  struct PyPetscMatObject *__pyx_v_submat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSubMatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isrow,&__pyx_n_s_iscol,&__pyx_n_s_submat,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct PyPetscISObject *)Py_None);
    values[2] = (PyObject *)((struct PyPetscMatObject *)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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_isrow)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscol);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_submat);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getSubMatrix") < 0)) __PYX_ERR(33, 1121, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_isrow = ((struct PyPetscISObject *)values[0]);
    __pyx_v_iscol = ((struct PyPetscISObject *)values[1]);
    __pyx_v_submat = ((struct PyPetscMatObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getSubMatrix", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1121, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getSubMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isrow), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isrow", 0))) __PYX_ERR(33, 1121, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iscol), __pyx_ptype_8petsc4py_5PETSc_IS, 1, "iscol", 0))) __PYX_ERR(33, 1121, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_submat), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "submat", 0))) __PYX_ERR(33, 1121, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_272getSubMatrix(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_isrow, __pyx_v_iscol, __pyx_v_submat);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_272getSubMatrix(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, struct PyPetscMatObject *__pyx_v_submat) {
  MatReuse __pyx_v_reuse;
  IS __pyx_v_ciscol;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  IS __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("getSubMatrix", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_submat);

  /* "PETSc/Mat.pyx":1122
 * 
 *     def getSubMatrix(self, IS isrow not None, IS iscol=None, Mat submat=None):
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX             # <<<<<<<<<<<<<<
 *         cdef PetscIS ciscol = NULL
 *         if iscol is not None: ciscol = iscol.iset
 */
  __pyx_v_reuse = MAT_INITIAL_MATRIX;

  /* "PETSc/Mat.pyx":1123
 *     def getSubMatrix(self, IS isrow not None, IS iscol=None, Mat submat=None):
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscIS ciscol = NULL             # <<<<<<<<<<<<<<
 *         if iscol is not None: ciscol = iscol.iset
 *         if submat is None: submat = Mat()
 */
  __pyx_v_ciscol = NULL;

  /* "PETSc/Mat.pyx":1124
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscIS ciscol = NULL
 *         if iscol is not None: ciscol = iscol.iset             # <<<<<<<<<<<<<<
 *         if submat is None: submat = Mat()
 *         if submat.mat != NULL: reuse = MAT_REUSE_MATRIX
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_iscol) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_iscol->iset;
    __pyx_v_ciscol = __pyx_t_3;
  }

  /* "PETSc/Mat.pyx":1125
 *         cdef PetscIS ciscol = NULL
 *         if iscol is not None: ciscol = iscol.iset
 *         if submat is None: submat = Mat()             # <<<<<<<<<<<<<<
 *         if submat.mat != NULL: reuse = MAT_REUSE_MATRIX
 *         CHKERR( MatGetSubMatrix(self.mat, isrow.iset, ciscol,
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_submat) == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_submat, ((struct PyPetscMatObject *)__pyx_t_4));
    __pyx_t_4 = 0;
  }

  /* "PETSc/Mat.pyx":1126
 *         if iscol is not None: ciscol = iscol.iset
 *         if submat is None: submat = Mat()
 *         if submat.mat != NULL: reuse = MAT_REUSE_MATRIX             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSubMatrix(self.mat, isrow.iset, ciscol,
 *                                 reuse, &submat.mat) )
 */
  __pyx_t_1 = ((__pyx_v_submat->mat != NULL) != 0);
  if (__pyx_t_1) {
    __pyx_v_reuse = MAT_REUSE_MATRIX;
  }

  /* "PETSc/Mat.pyx":1127
 *         if submat is None: submat = Mat()
 *         if submat.mat != NULL: reuse = MAT_REUSE_MATRIX
 *         CHKERR( MatGetSubMatrix(self.mat, isrow.iset, ciscol,             # <<<<<<<<<<<<<<
 *                                 reuse, &submat.mat) )
 *         return submat
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetSubMatrix(__pyx_v_self->mat, __pyx_v_isrow->iset, __pyx_v_ciscol, __pyx_v_reuse, (&__pyx_v_submat->mat))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 1127, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1129
 *         CHKERR( MatGetSubMatrix(self.mat, isrow.iset, ciscol,
 *                                 reuse, &submat.mat) )
 *         return submat             # <<<<<<<<<<<<<<
 * 
 *     def getSubMatrices(self, isrows not None, iscols=None, submats=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_submat));
  __pyx_r = ((PyObject *)__pyx_v_submat);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1121
 *         CHKERR( MatIncreaseOverlap(self.mat, 1, &iset.iset, ival) )
 * 
 *     def getSubMatrix(self, IS isrow not None, IS iscol=None, Mat submat=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscIS ciscol = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getSubMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_submat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1131
 *         return submat
 * 
 *     def getSubMatrices(self, isrows not None, iscols=None, submats=None):             # <<<<<<<<<<<<<<
 *         if iscols is None: iscols = isrows
 *         isrows = [isrows] if isinstance(isrows, IS) else list(isrows)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_275getSubMatrices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_274getSubMatrices[] = "Mat.getSubMatrices(self, isrows, iscols=None, submats=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_275getSubMatrices(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_isrows = 0;
  PyObject *__pyx_v_iscols = 0;
  PyObject *__pyx_v_submats = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSubMatrices (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isrows,&__pyx_n_s_iscols,&__pyx_n_s_submats,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_isrows)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscols);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_submats);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getSubMatrices") < 0)) __PYX_ERR(33, 1131, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_isrows = values[0];
    __pyx_v_iscols = values[1];
    __pyx_v_submats = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getSubMatrices", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1131, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getSubMatrices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(((PyObject *)__pyx_v_isrows) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "isrows"); __PYX_ERR(33, 1131, __pyx_L1_error)
  }
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_274getSubMatrices(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_isrows, __pyx_v_iscols, __pyx_v_submats);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_274getSubMatrices(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_isrows, PyObject *__pyx_v_iscols, PyObject *__pyx_v_submats) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  MatReuse __pyx_v_reuse;
  IS *__pyx_v_cisrows;
  IS *__pyx_v_ciscols;
  Mat *__pyx_v_cmats;
  CYTHON_UNUSED PyObject *__pyx_v_tmp1 = 0;
  CYTHON_UNUSED PyObject *__pyx_v_tmp2 = 0;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  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;
  Py_ssize_t __pyx_t_6;
  IS __pyx_t_7;
  int __pyx_t_8;
  Mat __pyx_t_9;
  __Pyx_RefNannySetupContext("getSubMatrices", 0);
  __Pyx_INCREF(__pyx_v_isrows);
  __Pyx_INCREF(__pyx_v_iscols);
  __Pyx_INCREF(__pyx_v_submats);

  /* "PETSc/Mat.pyx":1132
 * 
 *     def getSubMatrices(self, isrows not None, iscols=None, submats=None):
 *         if iscols is None: iscols = isrows             # <<<<<<<<<<<<<<
 *         isrows = [isrows] if isinstance(isrows, IS) else list(isrows)
 *         iscols = [iscols] if isinstance(iscols, IS) else list(iscols)
 */
  __pyx_t_1 = (__pyx_v_iscols == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_v_isrows);
    __Pyx_DECREF_SET(__pyx_v_iscols, __pyx_v_isrows);
  }

  /* "PETSc/Mat.pyx":1133
 *     def getSubMatrices(self, isrows not None, iscols=None, submats=None):
 *         if iscols is None: iscols = isrows
 *         isrows = [isrows] if isinstance(isrows, IS) else list(isrows)             # <<<<<<<<<<<<<<
 *         iscols = [iscols] if isinstance(iscols, IS) else list(iscols)
 *         assert len(isrows) == len(iscols)
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_isrows, __pyx_ptype_8petsc4py_5PETSc_IS); 
  if ((__pyx_t_2 != 0)) {
    __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_isrows);
    __Pyx_GIVEREF(__pyx_v_isrows);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_isrows);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __pyx_t_4 = PySequence_List(__pyx_v_isrows); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __Pyx_DECREF_SET(__pyx_v_isrows, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Mat.pyx":1134
 *         if iscols is None: iscols = isrows
 *         isrows = [isrows] if isinstance(isrows, IS) else list(isrows)
 *         iscols = [iscols] if isinstance(iscols, IS) else list(iscols)             # <<<<<<<<<<<<<<
 *         assert len(isrows) == len(iscols)
 *         cdef Py_ssize_t i, n = len(isrows)
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_iscols, __pyx_ptype_8petsc4py_5PETSc_IS); 
  if ((__pyx_t_2 != 0)) {
    __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_iscols);
    __Pyx_GIVEREF(__pyx_v_iscols);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_iscols);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __pyx_t_4 = PySequence_List(__pyx_v_iscols); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __Pyx_DECREF_SET(__pyx_v_iscols, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Mat.pyx":1135
 *         isrows = [isrows] if isinstance(isrows, IS) else list(isrows)
 *         iscols = [iscols] if isinstance(iscols, IS) else list(iscols)
 *         assert len(isrows) == len(iscols)             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i, n = len(isrows)
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_5 = PyObject_Length(__pyx_v_isrows); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 1135, __pyx_L1_error)
    __pyx_t_6 = PyObject_Length(__pyx_v_iscols); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(33, 1135, __pyx_L1_error)
    if (unlikely(!((__pyx_t_5 == __pyx_t_6) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(33, 1135, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/Mat.pyx":1136
 *         iscols = [iscols] if isinstance(iscols, IS) else list(iscols)
 *         assert len(isrows) == len(iscols)
 *         cdef Py_ssize_t i, n = len(isrows)             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscIS  *cisrows = NULL
 */
  __pyx_t_6 = PyObject_Length(__pyx_v_isrows); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(33, 1136, __pyx_L1_error)
  __pyx_v_n = __pyx_t_6;

  /* "PETSc/Mat.pyx":1137
 *         assert len(isrows) == len(iscols)
 *         cdef Py_ssize_t i, n = len(isrows)
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX             # <<<<<<<<<<<<<<
 *         cdef PetscIS  *cisrows = NULL
 *         cdef PetscIS  *ciscols = NULL
 */
  __pyx_v_reuse = MAT_INITIAL_MATRIX;

  /* "PETSc/Mat.pyx":1138
 *         cdef Py_ssize_t i, n = len(isrows)
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscIS  *cisrows = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscIS  *ciscols = NULL
 *         cdef PetscMat *cmats   = NULL
 */
  __pyx_v_cisrows = NULL;

  /* "PETSc/Mat.pyx":1139
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscIS  *cisrows = NULL
 *         cdef PetscIS  *ciscols = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscMat *cmats   = NULL
 *         cdef object tmp1, tmp2
 */
  __pyx_v_ciscols = NULL;

  /* "PETSc/Mat.pyx":1140
 *         cdef PetscIS  *cisrows = NULL
 *         cdef PetscIS  *ciscols = NULL
 *         cdef PetscMat *cmats   = NULL             # <<<<<<<<<<<<<<
 *         cdef object tmp1, tmp2
 *         cdef Mat mat
 */
  __pyx_v_cmats = NULL;

  /* "PETSc/Mat.pyx":1143
 *         cdef object tmp1, tmp2
 *         cdef Mat mat
 *         tmp1 = oarray_p(empty_p(n), NULL, <void**>&cisrows)             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n: cisrows[i] = (<IS?>isrows[i]).iset
 *         tmp2 = oarray_p(empty_p(n), NULL, <void**>&ciscols)
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_n)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_3, NULL, ((void **)(&__pyx_v_cisrows)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_tmp1 = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/Mat.pyx":1144
 *         cdef Mat mat
 *         tmp1 = oarray_p(empty_p(n), NULL, <void**>&cisrows)
 *         for i from 0 <= i < n: cisrows[i] = (<IS?>isrows[i]).iset             # <<<<<<<<<<<<<<
 *         tmp2 = oarray_p(empty_p(n), NULL, <void**>&ciscols)
 *         for i from 0 <= i < n: ciscols[i] = (<IS?>iscols[i]).iset
 */
  __pyx_t_6 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_isrows, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(33, 1144, __pyx_L1_error)
    __pyx_t_7 = ((struct PyPetscISObject *)__pyx_t_4)->iset;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    (__pyx_v_cisrows[__pyx_v_i]) = __pyx_t_7;
  }

  /* "PETSc/Mat.pyx":1145
 *         tmp1 = oarray_p(empty_p(n), NULL, <void**>&cisrows)
 *         for i from 0 <= i < n: cisrows[i] = (<IS?>isrows[i]).iset
 *         tmp2 = oarray_p(empty_p(n), NULL, <void**>&ciscols)             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n: ciscols[i] = (<IS?>iscols[i]).iset
 *         if submats is not None:
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_n)); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_4, NULL, ((void **)(&__pyx_v_ciscols)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_tmp2 = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/Mat.pyx":1146
 *         for i from 0 <= i < n: cisrows[i] = (<IS?>isrows[i]).iset
 *         tmp2 = oarray_p(empty_p(n), NULL, <void**>&ciscols)
 *         for i from 0 <= i < n: ciscols[i] = (<IS?>iscols[i]).iset             # <<<<<<<<<<<<<<
 *         if submats is not None:
 *             reuse = MAT_REUSE_MATRIX
 */
  __pyx_t_6 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_iscols, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(33, 1146, __pyx_L1_error)
    __pyx_t_7 = ((struct PyPetscISObject *)__pyx_t_3)->iset;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    (__pyx_v_ciscols[__pyx_v_i]) = __pyx_t_7;
  }

  /* "PETSc/Mat.pyx":1147
 *         tmp2 = oarray_p(empty_p(n), NULL, <void**>&ciscols)
 *         for i from 0 <= i < n: ciscols[i] = (<IS?>iscols[i]).iset
 *         if submats is not None:             # <<<<<<<<<<<<<<
 *             reuse = MAT_REUSE_MATRIX
 *             submats = list(submats)
 */
  __pyx_t_2 = (__pyx_v_submats != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/Mat.pyx":1148
 *         for i from 0 <= i < n: ciscols[i] = (<IS?>iscols[i]).iset
 *         if submats is not None:
 *             reuse = MAT_REUSE_MATRIX             # <<<<<<<<<<<<<<
 *             submats = list(submats)
 *             assert len(submats) == len(isrows)
 */
    __pyx_v_reuse = MAT_REUSE_MATRIX;

    /* "PETSc/Mat.pyx":1149
 *         if submats is not None:
 *             reuse = MAT_REUSE_MATRIX
 *             submats = list(submats)             # <<<<<<<<<<<<<<
 *             assert len(submats) == len(isrows)
 *             CHKERR( PetscMalloc(<size_t>(n+1)*sizeof(PetscMat), &cmats) )
 */
    __pyx_t_3 = PySequence_List(__pyx_v_submats); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_submats, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/Mat.pyx":1150
 *             reuse = MAT_REUSE_MATRIX
 *             submats = list(submats)
 *             assert len(submats) == len(isrows)             # <<<<<<<<<<<<<<
 *             CHKERR( PetscMalloc(<size_t>(n+1)*sizeof(PetscMat), &cmats) )
 *             for i from 0 <= i < n: cmats[i] = (<Mat?>submats[i]).mat
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_6 = PyObject_Length(__pyx_v_submats); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(33, 1150, __pyx_L1_error)
      __pyx_t_5 = PyObject_Length(__pyx_v_isrows); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 1150, __pyx_L1_error)
      if (unlikely(!((__pyx_t_6 == __pyx_t_5) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(33, 1150, __pyx_L1_error)
      }
    }
    #endif

    /* "PETSc/Mat.pyx":1151
 *             submats = list(submats)
 *             assert len(submats) == len(isrows)
 *             CHKERR( PetscMalloc(<size_t>(n+1)*sizeof(PetscMat), &cmats) )             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < n: cmats[i] = (<Mat?>submats[i]).mat
 *         CHKERR( MatGetSubMatrices(self.mat, <PetscInt>n, cisrows, ciscols, reuse, &cmats) )
 */
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscMalloc((((size_t)(__pyx_v_n + 1)) * (sizeof(Mat))), (&__pyx_v_cmats))); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(33, 1151, __pyx_L1_error)

    /* "PETSc/Mat.pyx":1152
 *             assert len(submats) == len(isrows)
 *             CHKERR( PetscMalloc(<size_t>(n+1)*sizeof(PetscMat), &cmats) )
 *             for i from 0 <= i < n: cmats[i] = (<Mat?>submats[i]).mat             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSubMatrices(self.mat, <PetscInt>n, cisrows, ciscols, reuse, &cmats) )
 *         for i from 0 <= i < n: PetscINCREF(<PetscObject*>&cmats[i])
 */
    __pyx_t_5 = __pyx_v_n;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_submats, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1152, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8petsc4py_5PETSc_Mat)))) __PYX_ERR(33, 1152, __pyx_L1_error)
      __pyx_t_9 = ((struct PyPetscMatObject *)__pyx_t_3)->mat;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      (__pyx_v_cmats[__pyx_v_i]) = __pyx_t_9;
    }

    /* "PETSc/Mat.pyx":1147
 *         tmp2 = oarray_p(empty_p(n), NULL, <void**>&ciscols)
 *         for i from 0 <= i < n: ciscols[i] = (<IS?>iscols[i]).iset
 *         if submats is not None:             # <<<<<<<<<<<<<<
 *             reuse = MAT_REUSE_MATRIX
 *             submats = list(submats)
 */
  }

  /* "PETSc/Mat.pyx":1153
 *             CHKERR( PetscMalloc(<size_t>(n+1)*sizeof(PetscMat), &cmats) )
 *             for i from 0 <= i < n: cmats[i] = (<Mat?>submats[i]).mat
 *         CHKERR( MatGetSubMatrices(self.mat, <PetscInt>n, cisrows, ciscols, reuse, &cmats) )             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n: PetscINCREF(<PetscObject*>&cmats[i])
 *         if reuse == MAT_INITIAL_MATRIX:
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetSubMatrices(__pyx_v_self->mat, ((PetscInt)__pyx_v_n), __pyx_v_cisrows, __pyx_v_ciscols, __pyx_v_reuse, (&__pyx_v_cmats))); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(33, 1153, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1154
 *             for i from 0 <= i < n: cmats[i] = (<Mat?>submats[i]).mat
 *         CHKERR( MatGetSubMatrices(self.mat, <PetscInt>n, cisrows, ciscols, reuse, &cmats) )
 *         for i from 0 <= i < n: PetscINCREF(<PetscObject*>&cmats[i])             # <<<<<<<<<<<<<<
 *         if reuse == MAT_INITIAL_MATRIX:
 *             submats = [None] * n
 */
  __pyx_t_5 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
    __pyx_f_8petsc4py_5PETSc_PetscINCREF(((PetscObject *)(&(__pyx_v_cmats[__pyx_v_i]))));
  }

  /* "PETSc/Mat.pyx":1155
 *         CHKERR( MatGetSubMatrices(self.mat, <PetscInt>n, cisrows, ciscols, reuse, &cmats) )
 *         for i from 0 <= i < n: PetscINCREF(<PetscObject*>&cmats[i])
 *         if reuse == MAT_INITIAL_MATRIX:             # <<<<<<<<<<<<<<
 *             submats = [None] * n
 *             for i from 0 <= i < n:
 */
  __pyx_t_1 = ((__pyx_v_reuse == MAT_INITIAL_MATRIX) != 0);
  if (__pyx_t_1) {

    /* "PETSc/Mat.pyx":1156
 *         for i from 0 <= i < n: PetscINCREF(<PetscObject*>&cmats[i])
 *         if reuse == MAT_INITIAL_MATRIX:
 *             submats = [None] * n             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < n:
 *                 submats[i] = mat = Mat()
 */
    __pyx_t_3 = PyList_New(1 * ((__pyx_v_n<0) ? 0:__pyx_v_n)); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    { Py_ssize_t __pyx_temp;
      for (__pyx_temp=0; __pyx_temp < __pyx_v_n; __pyx_temp++) {
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        PyList_SET_ITEM(__pyx_t_3, __pyx_temp, Py_None);
      }
    }
    __Pyx_DECREF_SET(__pyx_v_submats, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/Mat.pyx":1157
 *         if reuse == MAT_INITIAL_MATRIX:
 *             submats = [None] * n
 *             for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *                 submats[i] = mat = Mat()
 *                 mat.mat = cmats[i]
 */
    __pyx_t_5 = __pyx_v_n;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {

      /* "PETSc/Mat.pyx":1158
 *             submats = [None] * n
 *             for i from 0 <= i < n:
 *                 submats[i] = mat = Mat()             # <<<<<<<<<<<<<<
 *                 mat.mat = cmats[i]
 *         CHKERR( MatDestroyMatrices(<PetscInt>n, &cmats) )
 */
      __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1158, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_SetItemInt(__pyx_v_submats, __pyx_v_i, __pyx_t_3, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) __PYX_ERR(33, 1158, __pyx_L1_error)
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_mat, ((struct PyPetscMatObject *)__pyx_t_3));
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "PETSc/Mat.pyx":1159
 *             for i from 0 <= i < n:
 *                 submats[i] = mat = Mat()
 *                 mat.mat = cmats[i]             # <<<<<<<<<<<<<<
 *         CHKERR( MatDestroyMatrices(<PetscInt>n, &cmats) )
 *         return submats
 */
      __pyx_v_mat->mat = (__pyx_v_cmats[__pyx_v_i]);
    }

    /* "PETSc/Mat.pyx":1155
 *         CHKERR( MatGetSubMatrices(self.mat, <PetscInt>n, cisrows, ciscols, reuse, &cmats) )
 *         for i from 0 <= i < n: PetscINCREF(<PetscObject*>&cmats[i])
 *         if reuse == MAT_INITIAL_MATRIX:             # <<<<<<<<<<<<<<
 *             submats = [None] * n
 *             for i from 0 <= i < n:
 */
  }

  /* "PETSc/Mat.pyx":1160
 *                 submats[i] = mat = Mat()
 *                 mat.mat = cmats[i]
 *         CHKERR( MatDestroyMatrices(<PetscInt>n, &cmats) )             # <<<<<<<<<<<<<<
 *         return submats
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDestroyMatrices(((PetscInt)__pyx_v_n), (&__pyx_v_cmats))); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(33, 1160, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1161
 *                 mat.mat = cmats[i]
 *         CHKERR( MatDestroyMatrices(<PetscInt>n, &cmats) )
 *         return submats             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_submats);
  __pyx_r = __pyx_v_submats;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1131
 *         return submat
 * 
 *     def getSubMatrices(self, isrows not None, iscols=None, submats=None):             # <<<<<<<<<<<<<<
 *         if iscols is None: iscols = isrows
 *         isrows = [isrows] if isinstance(isrows, IS) else list(isrows)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getSubMatrices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp1);
  __Pyx_XDECREF(__pyx_v_tmp2);
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XDECREF(__pyx_v_isrows);
  __Pyx_XDECREF(__pyx_v_iscols);
  __Pyx_XDECREF(__pyx_v_submats);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1165
 *     #
 * 
 *     def getLocalSubMatrix(self, IS isrow not None, IS iscol not None, Mat submat=None):             # <<<<<<<<<<<<<<
 *         if submat is None: submat = Mat()
 *         else: CHKERR( MatDestroy(&submat.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_277getLocalSubMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_276getLocalSubMatrix[] = "Mat.getLocalSubMatrix(self, IS isrow, IS iscol, Mat submat=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_277getLocalSubMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_isrow = 0;
  struct PyPetscISObject *__pyx_v_iscol = 0;
  struct PyPetscMatObject *__pyx_v_submat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLocalSubMatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isrow,&__pyx_n_s_iscol,&__pyx_n_s_submat,0};
    PyObject* values[3] = {0,0,0};
    values[2] = (PyObject *)((struct PyPetscMatObject *)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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_isrow)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getLocalSubMatrix", 0, 2, 3, 1); __PYX_ERR(33, 1165, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_submat);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getLocalSubMatrix") < 0)) __PYX_ERR(33, 1165, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_isrow = ((struct PyPetscISObject *)values[0]);
    __pyx_v_iscol = ((struct PyPetscISObject *)values[1]);
    __pyx_v_submat = ((struct PyPetscMatObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getLocalSubMatrix", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1165, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getLocalSubMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isrow), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isrow", 0))) __PYX_ERR(33, 1165, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iscol), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iscol", 0))) __PYX_ERR(33, 1165, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_submat), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "submat", 0))) __PYX_ERR(33, 1165, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_276getLocalSubMatrix(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_isrow, __pyx_v_iscol, __pyx_v_submat);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_276getLocalSubMatrix(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, struct PyPetscMatObject *__pyx_v_submat) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("getLocalSubMatrix", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_submat);

  /* "PETSc/Mat.pyx":1166
 * 
 *     def getLocalSubMatrix(self, IS isrow not None, IS iscol not None, Mat submat=None):
 *         if submat is None: submat = Mat()             # <<<<<<<<<<<<<<
 *         else: CHKERR( MatDestroy(&submat.mat) )
 *         CHKERR( MatGetLocalSubMatrix(self.mat, isrow.iset, iscol.iset, &submat.mat) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_submat) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_submat, ((struct PyPetscMatObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "PETSc/Mat.pyx":1167
 *     def getLocalSubMatrix(self, IS isrow not None, IS iscol not None, Mat submat=None):
 *         if submat is None: submat = Mat()
 *         else: CHKERR( MatDestroy(&submat.mat) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetLocalSubMatrix(self.mat, isrow.iset, iscol.iset, &submat.mat) )
 *         return submat
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDestroy((&__pyx_v_submat->mat))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1167, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/Mat.pyx":1168
 *         if submat is None: submat = Mat()
 *         else: CHKERR( MatDestroy(&submat.mat) )
 *         CHKERR( MatGetLocalSubMatrix(self.mat, isrow.iset, iscol.iset, &submat.mat) )             # <<<<<<<<<<<<<<
 *         return submat
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetLocalSubMatrix(__pyx_v_self->mat, __pyx_v_isrow->iset, __pyx_v_iscol->iset, (&__pyx_v_submat->mat))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1168, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1169
 *         else: CHKERR( MatDestroy(&submat.mat) )
 *         CHKERR( MatGetLocalSubMatrix(self.mat, isrow.iset, iscol.iset, &submat.mat) )
 *         return submat             # <<<<<<<<<<<<<<
 * 
 *     def restoreLocalSubMatrix(self, IS isrow not None, IS iscol not None, Mat submat not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_submat));
  __pyx_r = ((PyObject *)__pyx_v_submat);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1165
 *     #
 * 
 *     def getLocalSubMatrix(self, IS isrow not None, IS iscol not None, Mat submat=None):             # <<<<<<<<<<<<<<
 *         if submat is None: submat = Mat()
 *         else: CHKERR( MatDestroy(&submat.mat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getLocalSubMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_submat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1171
 *         return submat
 * 
 *     def restoreLocalSubMatrix(self, IS isrow not None, IS iscol not None, Mat submat not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatRestoreLocalSubMatrix(self.mat, isrow.iset, iscol.iset, &submat.mat) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_279restoreLocalSubMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_278restoreLocalSubMatrix[] = "Mat.restoreLocalSubMatrix(self, IS isrow, IS iscol, Mat submat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_279restoreLocalSubMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_isrow = 0;
  struct PyPetscISObject *__pyx_v_iscol = 0;
  struct PyPetscMatObject *__pyx_v_submat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("restoreLocalSubMatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isrow,&__pyx_n_s_iscol,&__pyx_n_s_submat,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_isrow)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("restoreLocalSubMatrix", 1, 3, 3, 1); __PYX_ERR(33, 1171, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_submat)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("restoreLocalSubMatrix", 1, 3, 3, 2); __PYX_ERR(33, 1171, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "restoreLocalSubMatrix") < 0)) __PYX_ERR(33, 1171, __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_isrow = ((struct PyPetscISObject *)values[0]);
    __pyx_v_iscol = ((struct PyPetscISObject *)values[1]);
    __pyx_v_submat = ((struct PyPetscMatObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("restoreLocalSubMatrix", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1171, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.restoreLocalSubMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isrow), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isrow", 0))) __PYX_ERR(33, 1171, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iscol), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iscol", 0))) __PYX_ERR(33, 1171, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_submat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "submat", 0))) __PYX_ERR(33, 1171, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_278restoreLocalSubMatrix(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_isrow, __pyx_v_iscol, __pyx_v_submat);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_278restoreLocalSubMatrix(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, struct PyPetscMatObject *__pyx_v_submat) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("restoreLocalSubMatrix", 0);

  /* "PETSc/Mat.pyx":1172
 * 
 *     def restoreLocalSubMatrix(self, IS isrow not None, IS iscol not None, Mat submat not None):
 *         CHKERR( MatRestoreLocalSubMatrix(self.mat, isrow.iset, iscol.iset, &submat.mat) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatRestoreLocalSubMatrix(__pyx_v_self->mat, __pyx_v_isrow->iset, __pyx_v_iscol->iset, (&__pyx_v_submat->mat))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1172, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1171
 *         return submat
 * 
 *     def restoreLocalSubMatrix(self, IS isrow not None, IS iscol not None, Mat submat not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatRestoreLocalSubMatrix(self.mat, isrow.iset, iscol.iset, &submat.mat) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.restoreLocalSubMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1176
 *     #
 * 
 *     def norm(self, norm_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_FROBENIUS
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_281norm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_280norm[] = "Mat.norm(self, norm_type=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_281norm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_norm_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("norm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_norm_type,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_norm_type);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "norm") < 0)) __PYX_ERR(33, 1176, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_norm_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("norm", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1176, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_280norm(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_norm_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_280norm(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_norm_type) {
  NormType __pyx_v_norm_1_2;
  NormType __pyx_v_ntype;
  PetscReal __pyx_v_rval[2];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  NormType __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("norm", 0);

  /* "PETSc/Mat.pyx":1177
 * 
 *     def norm(self, norm_type=None):
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2             # <<<<<<<<<<<<<<
 *         cdef PetscNormType ntype = PETSC_NORM_FROBENIUS
 *         if norm_type is not None: ntype = norm_type
 */
  __pyx_v_norm_1_2 = NORM_1_AND_2;

  /* "PETSc/Mat.pyx":1178
 *     def norm(self, norm_type=None):
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_FROBENIUS             # <<<<<<<<<<<<<<
 *         if norm_type is not None: ntype = norm_type
 *         cdef PetscReal rval[2]
 */
  __pyx_v_ntype = NORM_FROBENIUS;

  /* "PETSc/Mat.pyx":1179
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_FROBENIUS
 *         if norm_type is not None: ntype = norm_type             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval[2]
 *         CHKERR( MatNorm(self.mat, ntype, rval) )
 */
  __pyx_t_1 = (__pyx_v_norm_type != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = ((NormType)__Pyx_PyInt_As_NormType(__pyx_v_norm_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 1179, __pyx_L1_error)
    __pyx_v_ntype = __pyx_t_3;
  }

  /* "PETSc/Mat.pyx":1181
 *         if norm_type is not None: ntype = norm_type
 *         cdef PetscReal rval[2]
 *         CHKERR( MatNorm(self.mat, ntype, rval) )             # <<<<<<<<<<<<<<
 *         if ntype != norm_1_2: return toReal(rval[0])
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatNorm(__pyx_v_self->mat, __pyx_v_ntype, __pyx_v_rval)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1181, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1182
 *         cdef PetscReal rval[2]
 *         CHKERR( MatNorm(self.mat, ntype, rval) )
 *         if ntype != norm_1_2: return toReal(rval[0])             # <<<<<<<<<<<<<<
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 * 
 */
  __pyx_t_2 = ((__pyx_v_ntype != __pyx_v_norm_1_2) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_rval[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 1182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Mat.pyx":1183
 *         CHKERR( MatNorm(self.mat, ntype, rval) )
 *         if ntype != norm_1_2: return toReal(rval[0])
 *         else: return (toReal(rval[0]), toReal(rval[1]))             # <<<<<<<<<<<<<<
 * 
 *     def scale(self, alpha):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_rval[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 1183, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_rval[1])); if (unlikely(!__pyx_t_6)) __PYX_ERR(33, 1183, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(33, 1183, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/Mat.pyx":1176
 *     #
 * 
 *     def norm(self, norm_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscNormType norm_1_2 = PETSC_NORM_1_AND_2
 *         cdef PetscNormType ntype = PETSC_NORM_FROBENIUS
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1185
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 * 
 *     def scale(self, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( MatScale(self.mat, sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_283scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_282scale[] = "Mat.scale(self, alpha)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_283scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scale (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alpha,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);
        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_alpha)) != 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, "scale") < 0)) __PYX_ERR(33, 1185, __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_alpha = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scale", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1185, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_282scale(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_alpha);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_282scale(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_alpha) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("scale", 0);

  /* "PETSc/Mat.pyx":1186
 * 
 *     def scale(self, alpha):
 *         cdef PetscScalar sval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         CHKERR( MatScale(self.mat, sval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 1186, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Mat.pyx":1187
 *     def scale(self, alpha):
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( MatScale(self.mat, sval) )             # <<<<<<<<<<<<<<
 * 
 *     def shift(self, alpha):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatScale(__pyx_v_self->mat, __pyx_v_sval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1187, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1185
 *         else: return (toReal(rval[0]), toReal(rval[1]))
 * 
 *     def scale(self, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( MatScale(self.mat, sval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1189
 *         CHKERR( MatScale(self.mat, sval) )
 * 
 *     def shift(self, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( MatShift(self.mat, sval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_285shift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_284shift[] = "Mat.shift(self, alpha)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_285shift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alpha,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);
        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_alpha)) != 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, "shift") < 0)) __PYX_ERR(33, 1189, __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_alpha = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("shift", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1189, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.shift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_284shift(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_alpha);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_284shift(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_alpha) {
  PetscScalar __pyx_v_sval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("shift", 0);

  /* "PETSc/Mat.pyx":1190
 * 
 *     def shift(self, alpha):
 *         cdef PetscScalar sval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         CHKERR( MatShift(self.mat, sval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 1190, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Mat.pyx":1191
 *     def shift(self, alpha):
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( MatShift(self.mat, sval) )             # <<<<<<<<<<<<<<
 * 
 *     def chop(self, tol):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatShift(__pyx_v_self->mat, __pyx_v_sval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1191, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1189
 *         CHKERR( MatScale(self.mat, sval) )
 * 
 *     def shift(self, alpha):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         CHKERR( MatShift(self.mat, sval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.shift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1193
 *         CHKERR( MatShift(self.mat, sval) )
 * 
 *     def chop(self, tol):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(tol)
 *         CHKERR( MatChop(self.mat, rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_287chop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_286chop[] = "Mat.chop(self, tol)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_287chop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tol,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);
        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_tol)) != 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, "chop") < 0)) __PYX_ERR(33, 1193, __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_tol = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chop", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1193, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.chop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_286chop(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_tol);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_286chop(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_tol) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("chop", 0);

  /* "PETSc/Mat.pyx":1194
 * 
 *     def chop(self, tol):
 *         cdef PetscReal rval = asReal(tol)             # <<<<<<<<<<<<<<
 *         CHKERR( MatChop(self.mat, rval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_tol); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(33, 1194, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/Mat.pyx":1195
 *     def chop(self, tol):
 *         cdef PetscReal rval = asReal(tol)
 *         CHKERR( MatChop(self.mat, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def axpy(self, alpha, Mat X not None, structure=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatChop(__pyx_v_self->mat, __pyx_v_rval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1195, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1193
 *         CHKERR( MatShift(self.mat, sval) )
 * 
 *     def chop(self, tol):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(tol)
 *         CHKERR( MatChop(self.mat, rval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.chop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1197
 *         CHKERR( MatChop(self.mat, rval) )
 * 
 *     def axpy(self, alpha, Mat X not None, structure=None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         cdef PetscMatStructure flag = matstructure(structure)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_289axpy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_288axpy[] = "Mat.axpy(self, alpha, Mat X, structure=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_289axpy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha = 0;
  struct PyPetscMatObject *__pyx_v_X = 0;
  PyObject *__pyx_v_structure = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("axpy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alpha,&__pyx_n_s_X,&__pyx_n_s_structure,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_alpha)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("axpy", 0, 2, 3, 1); __PYX_ERR(33, 1197, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_structure);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "axpy") < 0)) __PYX_ERR(33, 1197, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_alpha = values[0];
    __pyx_v_X = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_structure = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("axpy", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1197, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.axpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "X", 0))) __PYX_ERR(33, 1197, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_288axpy(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_alpha, __pyx_v_X, __pyx_v_structure);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_288axpy(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_alpha, struct PyPetscMatObject *__pyx_v_X, PyObject *__pyx_v_structure) {
  PetscScalar __pyx_v_sval;
  MatStructure __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  MatStructure __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("axpy", 0);

  /* "PETSc/Mat.pyx":1198
 * 
 *     def axpy(self, alpha, Mat X not None, structure=None):
 *         cdef PetscScalar sval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         cdef PetscMatStructure flag = matstructure(structure)
 *         CHKERR( MatAXPY(self.mat, sval, X.mat, flag) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 1198, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Mat.pyx":1199
 *     def axpy(self, alpha, Mat X not None, structure=None):
 *         cdef PetscScalar sval = asScalar(alpha)
 *         cdef PetscMatStructure flag = matstructure(structure)             # <<<<<<<<<<<<<<
 *         CHKERR( MatAXPY(self.mat, sval, X.mat, flag) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_matstructure(__pyx_v_structure); if (unlikely(__pyx_t_2 == ((MatStructure)-1L))) __PYX_ERR(33, 1199, __pyx_L1_error)
  __pyx_v_flag = __pyx_t_2;

  /* "PETSc/Mat.pyx":1200
 *         cdef PetscScalar sval = asScalar(alpha)
 *         cdef PetscMatStructure flag = matstructure(structure)
 *         CHKERR( MatAXPY(self.mat, sval, X.mat, flag) )             # <<<<<<<<<<<<<<
 * 
 *     def aypx(self, alpha, Mat X not None, structure=None):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatAXPY(__pyx_v_self->mat, __pyx_v_sval, __pyx_v_X->mat, __pyx_v_flag)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 1200, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1197
 *         CHKERR( MatChop(self.mat, rval) )
 * 
 *     def axpy(self, alpha, Mat X not None, structure=None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         cdef PetscMatStructure flag = matstructure(structure)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.axpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1202
 *         CHKERR( MatAXPY(self.mat, sval, X.mat, flag) )
 * 
 *     def aypx(self, alpha, Mat X not None, structure=None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         cdef PetscMatStructure flag = matstructure(structure)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_291aypx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_290aypx[] = "Mat.aypx(self, alpha, Mat X, structure=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_291aypx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha = 0;
  struct PyPetscMatObject *__pyx_v_X = 0;
  PyObject *__pyx_v_structure = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("aypx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alpha,&__pyx_n_s_X,&__pyx_n_s_structure,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_alpha)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aypx", 0, 2, 3, 1); __PYX_ERR(33, 1202, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_structure);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "aypx") < 0)) __PYX_ERR(33, 1202, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_alpha = values[0];
    __pyx_v_X = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_structure = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("aypx", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1202, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.aypx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "X", 0))) __PYX_ERR(33, 1202, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_290aypx(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_alpha, __pyx_v_X, __pyx_v_structure);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_290aypx(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_alpha, struct PyPetscMatObject *__pyx_v_X, PyObject *__pyx_v_structure) {
  PetscScalar __pyx_v_sval;
  MatStructure __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscScalar __pyx_t_1;
  MatStructure __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("aypx", 0);

  /* "PETSc/Mat.pyx":1203
 * 
 *     def aypx(self, alpha, Mat X not None, structure=None):
 *         cdef PetscScalar sval = asScalar(alpha)             # <<<<<<<<<<<<<<
 *         cdef PetscMatStructure flag = matstructure(structure)
 *         CHKERR( MatAYPX(self.mat, sval, X.mat, flag) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asScalar(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 1203, __pyx_L1_error)
  __pyx_v_sval = __pyx_t_1;

  /* "PETSc/Mat.pyx":1204
 *     def aypx(self, alpha, Mat X not None, structure=None):
 *         cdef PetscScalar sval = asScalar(alpha)
 *         cdef PetscMatStructure flag = matstructure(structure)             # <<<<<<<<<<<<<<
 *         CHKERR( MatAYPX(self.mat, sval, X.mat, flag) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_matstructure(__pyx_v_structure); if (unlikely(__pyx_t_2 == ((MatStructure)-1L))) __PYX_ERR(33, 1204, __pyx_L1_error)
  __pyx_v_flag = __pyx_t_2;

  /* "PETSc/Mat.pyx":1205
 *         cdef PetscScalar sval = asScalar(alpha)
 *         cdef PetscMatStructure flag = matstructure(structure)
 *         CHKERR( MatAYPX(self.mat, sval, X.mat, flag) )             # <<<<<<<<<<<<<<
 * 
 *     # matrix-matrix product
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatAYPX(__pyx_v_self->mat, __pyx_v_sval, __pyx_v_X->mat, __pyx_v_flag)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 1205, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1202
 *         CHKERR( MatAXPY(self.mat, sval, X.mat, flag) )
 * 
 *     def aypx(self, alpha, Mat X not None, structure=None):             # <<<<<<<<<<<<<<
 *         cdef PetscScalar sval = asScalar(alpha)
 *         cdef PetscMatStructure flag = matstructure(structure)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.aypx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1209
 *     # matrix-matrix product
 * 
 *     def matMultSymbolic(self, Mat mat not None, fill=None):             # <<<<<<<<<<<<<<
 *         cdef Mat result = Mat()
 *         cdef PetscReal rval = 2
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_293matMultSymbolic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_292matMultSymbolic[] = "Mat.matMultSymbolic(self, Mat mat, fill=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_293matMultSymbolic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_v_fill = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matMultSymbolic (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,&__pyx_n_s_fill,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_mat)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fill);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matMultSymbolic") < 0)) __PYX_ERR(33, 1209, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mat = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_fill = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matMultSymbolic", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1209, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.matMultSymbolic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(33, 1209, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_292matMultSymbolic(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat, __pyx_v_fill);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_292matMultSymbolic(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, PyObject *__pyx_v_fill) {
  struct PyPetscMatObject *__pyx_v_result = 0;
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PetscReal __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("matMultSymbolic", 0);

  /* "PETSc/Mat.pyx":1210
 * 
 *     def matMultSymbolic(self, Mat mat not None, fill=None):
 *         cdef Mat result = Mat()             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 2
 *         if fill is not None: rval = asReal(fill)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":1211
 *     def matMultSymbolic(self, Mat mat not None, fill=None):
 *         cdef Mat result = Mat()
 *         cdef PetscReal rval = 2             # <<<<<<<<<<<<<<
 *         if fill is not None: rval = asReal(fill)
 *         CHKERR( MatMatMultSymbolic(self.mat, mat.mat, rval, &result.mat) )
 */
  __pyx_v_rval = 2.0;

  /* "PETSc/Mat.pyx":1212
 *         cdef Mat result = Mat()
 *         cdef PetscReal rval = 2
 *         if fill is not None: rval = asReal(fill)             # <<<<<<<<<<<<<<
 *         CHKERR( MatMatMultSymbolic(self.mat, mat.mat, rval, &result.mat) )
 *         return result
 */
  __pyx_t_2 = (__pyx_v_fill != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_fill); if (unlikely(__pyx_t_4 == -1.0 && PyErr_Occurred())) __PYX_ERR(33, 1212, __pyx_L1_error)
    __pyx_v_rval = __pyx_t_4;
  }

  /* "PETSc/Mat.pyx":1213
 *         cdef PetscReal rval = 2
 *         if fill is not None: rval = asReal(fill)
 *         CHKERR( MatMatMultSymbolic(self.mat, mat.mat, rval, &result.mat) )             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatMultSymbolic(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_rval, (&__pyx_v_result->mat))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 1213, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1214
 *         if fill is not None: rval = asReal(fill)
 *         CHKERR( MatMatMultSymbolic(self.mat, mat.mat, rval, &result.mat) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def matMultNumeric(self, Mat mat not None, Mat result=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1209
 *     # matrix-matrix product
 * 
 *     def matMultSymbolic(self, Mat mat not None, fill=None):             # <<<<<<<<<<<<<<
 *         cdef Mat result = Mat()
 *         cdef PetscReal rval = 2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.matMultSymbolic", __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;
}

/* "PETSc/Mat.pyx":1216
 *         return result
 * 
 *     def matMultNumeric(self, Mat mat not None, Mat result=None):             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = Mat()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_295matMultNumeric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_294matMultNumeric[] = "Mat.matMultNumeric(self, Mat mat, Mat result=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_295matMultNumeric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  struct PyPetscMatObject *__pyx_v_result = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matMultNumeric (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,&__pyx_n_s_result,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct PyPetscMatObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_mat)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matMultNumeric") < 0)) __PYX_ERR(33, 1216, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mat = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_result = ((struct PyPetscMatObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matMultNumeric", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1216, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.matMultNumeric", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(33, 1216, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "result", 0))) __PYX_ERR(33, 1216, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_294matMultNumeric(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat, __pyx_v_result);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_294matMultNumeric(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, struct PyPetscMatObject *__pyx_v_result) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("matMultNumeric", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_result);

  /* "PETSc/Mat.pyx":1217
 * 
 *     def matMultNumeric(self, Mat mat not None, Mat result=None):
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Mat()
 *         if result.mat == NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_result) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1218
 *     def matMultNumeric(self, Mat mat not None, Mat result=None):
 *         if result is None:
 *             result = Mat()             # <<<<<<<<<<<<<<
 *         if result.mat == NULL:
 *             CHKERR( MatMatMultSymbolic(self.mat, mat.mat, 2.0, &result.mat) )
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_result, ((struct PyPetscMatObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/Mat.pyx":1217
 * 
 *     def matMultNumeric(self, Mat mat not None, Mat result=None):
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Mat()
 *         if result.mat == NULL:
 */
  }

  /* "PETSc/Mat.pyx":1219
 *         if result is None:
 *             result = Mat()
 *         if result.mat == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatMatMultSymbolic(self.mat, mat.mat, 2.0, &result.mat) )
 *         CHKERR( MatMatMultNumeric(self.mat, mat.mat, result.mat) )
 */
  __pyx_t_2 = ((__pyx_v_result->mat == NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1220
 *             result = Mat()
 *         if result.mat == NULL:
 *             CHKERR( MatMatMultSymbolic(self.mat, mat.mat, 2.0, &result.mat) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatMatMultNumeric(self.mat, mat.mat, result.mat) )
 *         return result
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatMultSymbolic(__pyx_v_self->mat, __pyx_v_mat->mat, 2.0, (&__pyx_v_result->mat))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1220, __pyx_L1_error)

    /* "PETSc/Mat.pyx":1219
 *         if result is None:
 *             result = Mat()
 *         if result.mat == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( MatMatMultSymbolic(self.mat, mat.mat, 2.0, &result.mat) )
 *         CHKERR( MatMatMultNumeric(self.mat, mat.mat, result.mat) )
 */
  }

  /* "PETSc/Mat.pyx":1221
 *         if result.mat == NULL:
 *             CHKERR( MatMatMultSymbolic(self.mat, mat.mat, 2.0, &result.mat) )
 *         CHKERR( MatMatMultNumeric(self.mat, mat.mat, result.mat) )             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatMultNumeric(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_result->mat)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1221, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1222
 *             CHKERR( MatMatMultSymbolic(self.mat, mat.mat, 2.0, &result.mat) )
 *         CHKERR( MatMatMultNumeric(self.mat, mat.mat, result.mat) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def matMult(self, Mat mat not None, Mat result=None, fill=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1216
 *         return result
 * 
 *     def matMultNumeric(self, Mat mat not None, Mat result=None):             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = Mat()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.matMultNumeric", __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;
}

/* "PETSc/Mat.pyx":1224
 *         return result
 * 
 *     def matMult(self, Mat mat not None, Mat result=None, fill=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_297matMult(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_296matMult[] = "Mat.matMult(self, Mat mat, Mat result=None, fill=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_297matMult(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  struct PyPetscMatObject *__pyx_v_result = 0;
  PyObject *__pyx_v_fill = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matMult (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,&__pyx_n_s_result,&__pyx_n_s_fill,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_mat)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fill);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matMult") < 0)) __PYX_ERR(33, 1224, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mat = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_result = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_fill = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matMult", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1224, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.matMult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(33, 1224, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "result", 0))) __PYX_ERR(33, 1224, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_296matMult(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat, __pyx_v_result, __pyx_v_fill);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_296matMult(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, struct PyPetscMatObject *__pyx_v_result, PyObject *__pyx_v_fill) {
  MatReuse __pyx_v_reuse;
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PetscReal __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("matMult", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_result);

  /* "PETSc/Mat.pyx":1225
 * 
 *     def matMult(self, Mat mat not None, Mat result=None, fill=None):
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 2
 *         if result is None:
 */
  __pyx_v_reuse = MAT_INITIAL_MATRIX;

  /* "PETSc/Mat.pyx":1226
 *     def matMult(self, Mat mat not None, Mat result=None, fill=None):
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = Mat()
 */
  __pyx_v_rval = 2.0;

  /* "PETSc/Mat.pyx":1227
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Mat()
 *         elif result.mat != NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_result) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1228
 *         cdef PetscReal rval = 2
 *         if result is None:
 *             result = Mat()             # <<<<<<<<<<<<<<
 *         elif result.mat != NULL:
 *             reuse = MAT_REUSE_MATRIX
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_result, ((struct PyPetscMatObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/Mat.pyx":1227
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Mat()
 *         elif result.mat != NULL:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Mat.pyx":1229
 *         if result is None:
 *             result = Mat()
 *         elif result.mat != NULL:             # <<<<<<<<<<<<<<
 *             reuse = MAT_REUSE_MATRIX
 *         if fill is not None: rval = asReal(fill)
 */
  __pyx_t_2 = ((__pyx_v_result->mat != NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1230
 *             result = Mat()
 *         elif result.mat != NULL:
 *             reuse = MAT_REUSE_MATRIX             # <<<<<<<<<<<<<<
 *         if fill is not None: rval = asReal(fill)
 *         CHKERR( MatMatMult(self.mat, mat.mat, reuse, rval, &result.mat) )
 */
    __pyx_v_reuse = MAT_REUSE_MATRIX;

    /* "PETSc/Mat.pyx":1229
 *         if result is None:
 *             result = Mat()
 *         elif result.mat != NULL:             # <<<<<<<<<<<<<<
 *             reuse = MAT_REUSE_MATRIX
 *         if fill is not None: rval = asReal(fill)
 */
  }
  __pyx_L3:;

  /* "PETSc/Mat.pyx":1231
 *         elif result.mat != NULL:
 *             reuse = MAT_REUSE_MATRIX
 *         if fill is not None: rval = asReal(fill)             # <<<<<<<<<<<<<<
 *         CHKERR( MatMatMult(self.mat, mat.mat, reuse, rval, &result.mat) )
 *         return result
 */
  __pyx_t_2 = (__pyx_v_fill != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_fill); if (unlikely(__pyx_t_4 == -1.0 && PyErr_Occurred())) __PYX_ERR(33, 1231, __pyx_L1_error)
    __pyx_v_rval = __pyx_t_4;
  }

  /* "PETSc/Mat.pyx":1232
 *             reuse = MAT_REUSE_MATRIX
 *         if fill is not None: rval = asReal(fill)
 *         CHKERR( MatMatMult(self.mat, mat.mat, reuse, rval, &result.mat) )             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatMult(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_reuse, __pyx_v_rval, (&__pyx_v_result->mat))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 1232, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1233
 *         if fill is not None: rval = asReal(fill)
 *         CHKERR( MatMatMult(self.mat, mat.mat, reuse, rval, &result.mat) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def matTransposeMult(self, Mat mat not None, Mat result=None, fill=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1224
 *         return result
 * 
 *     def matMult(self, Mat mat not None, Mat result=None, fill=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.matMult", __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;
}

/* "PETSc/Mat.pyx":1235
 *         return result
 * 
 *     def matTransposeMult(self, Mat mat not None, Mat result=None, fill=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_299matTransposeMult(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_298matTransposeMult[] = "Mat.matTransposeMult(self, Mat mat, Mat result=None, fill=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_299matTransposeMult(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  struct PyPetscMatObject *__pyx_v_result = 0;
  PyObject *__pyx_v_fill = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matTransposeMult (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,&__pyx_n_s_result,&__pyx_n_s_fill,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_mat)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fill);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matTransposeMult") < 0)) __PYX_ERR(33, 1235, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mat = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_result = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_fill = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matTransposeMult", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1235, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.matTransposeMult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(33, 1235, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "result", 0))) __PYX_ERR(33, 1235, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_298matTransposeMult(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat, __pyx_v_result, __pyx_v_fill);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_298matTransposeMult(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, struct PyPetscMatObject *__pyx_v_result, PyObject *__pyx_v_fill) {
  MatReuse __pyx_v_reuse;
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PetscReal __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("matTransposeMult", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_result);

  /* "PETSc/Mat.pyx":1236
 * 
 *     def matTransposeMult(self, Mat mat not None, Mat result=None, fill=None):
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 2
 *         if result is None:
 */
  __pyx_v_reuse = MAT_INITIAL_MATRIX;

  /* "PETSc/Mat.pyx":1237
 *     def matTransposeMult(self, Mat mat not None, Mat result=None, fill=None):
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = Mat()
 */
  __pyx_v_rval = 2.0;

  /* "PETSc/Mat.pyx":1238
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Mat()
 *         elif result.mat != NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_result) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1239
 *         cdef PetscReal rval = 2
 *         if result is None:
 *             result = Mat()             # <<<<<<<<<<<<<<
 *         elif result.mat != NULL:
 *             reuse = MAT_REUSE_MATRIX
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_result, ((struct PyPetscMatObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/Mat.pyx":1238
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Mat()
 *         elif result.mat != NULL:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Mat.pyx":1240
 *         if result is None:
 *             result = Mat()
 *         elif result.mat != NULL:             # <<<<<<<<<<<<<<
 *             reuse = MAT_REUSE_MATRIX
 *         if fill is not None: rval = asReal(fill)
 */
  __pyx_t_2 = ((__pyx_v_result->mat != NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1241
 *             result = Mat()
 *         elif result.mat != NULL:
 *             reuse = MAT_REUSE_MATRIX             # <<<<<<<<<<<<<<
 *         if fill is not None: rval = asReal(fill)
 *         CHKERR( MatMatTransposeMult(self.mat, mat.mat, reuse, rval, &result.mat) )
 */
    __pyx_v_reuse = MAT_REUSE_MATRIX;

    /* "PETSc/Mat.pyx":1240
 *         if result is None:
 *             result = Mat()
 *         elif result.mat != NULL:             # <<<<<<<<<<<<<<
 *             reuse = MAT_REUSE_MATRIX
 *         if fill is not None: rval = asReal(fill)
 */
  }
  __pyx_L3:;

  /* "PETSc/Mat.pyx":1242
 *         elif result.mat != NULL:
 *             reuse = MAT_REUSE_MATRIX
 *         if fill is not None: rval = asReal(fill)             # <<<<<<<<<<<<<<
 *         CHKERR( MatMatTransposeMult(self.mat, mat.mat, reuse, rval, &result.mat) )
 *         return result
 */
  __pyx_t_2 = (__pyx_v_fill != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_fill); if (unlikely(__pyx_t_4 == -1.0 && PyErr_Occurred())) __PYX_ERR(33, 1242, __pyx_L1_error)
    __pyx_v_rval = __pyx_t_4;
  }

  /* "PETSc/Mat.pyx":1243
 *             reuse = MAT_REUSE_MATRIX
 *         if fill is not None: rval = asReal(fill)
 *         CHKERR( MatMatTransposeMult(self.mat, mat.mat, reuse, rval, &result.mat) )             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatTransposeMult(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_reuse, __pyx_v_rval, (&__pyx_v_result->mat))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 1243, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1244
 *         if fill is not None: rval = asReal(fill)
 *         CHKERR( MatMatTransposeMult(self.mat, mat.mat, reuse, rval, &result.mat) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def transposeMatMult(self, Mat mat not None, Mat result=None, fill=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1235
 *         return result
 * 
 *     def matTransposeMult(self, Mat mat not None, Mat result=None, fill=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.matTransposeMult", __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;
}

/* "PETSc/Mat.pyx":1246
 *         return result
 * 
 *     def transposeMatMult(self, Mat mat not None, Mat result=None, fill=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_301transposeMatMult(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_300transposeMatMult[] = "Mat.transposeMatMult(self, Mat mat, Mat result=None, fill=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_301transposeMatMult(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  struct PyPetscMatObject *__pyx_v_result = 0;
  PyObject *__pyx_v_fill = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transposeMatMult (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,&__pyx_n_s_result,&__pyx_n_s_fill,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_mat)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fill);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "transposeMatMult") < 0)) __PYX_ERR(33, 1246, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mat = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_result = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_fill = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("transposeMatMult", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1246, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.transposeMatMult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(33, 1246, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "result", 0))) __PYX_ERR(33, 1246, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_300transposeMatMult(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat, __pyx_v_result, __pyx_v_fill);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_300transposeMatMult(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, struct PyPetscMatObject *__pyx_v_result, PyObject *__pyx_v_fill) {
  MatReuse __pyx_v_reuse;
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PetscReal __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("transposeMatMult", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_result);

  /* "PETSc/Mat.pyx":1247
 * 
 *     def transposeMatMult(self, Mat mat not None, Mat result=None, fill=None):
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 2
 *         if result is None:
 */
  __pyx_v_reuse = MAT_INITIAL_MATRIX;

  /* "PETSc/Mat.pyx":1248
 *     def transposeMatMult(self, Mat mat not None, Mat result=None, fill=None):
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2             # <<<<<<<<<<<<<<
 *         if result is None:
 *             result = Mat()
 */
  __pyx_v_rval = 2.0;

  /* "PETSc/Mat.pyx":1249
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Mat()
 *         elif result.mat != NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_result) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1250
 *         cdef PetscReal rval = 2
 *         if result is None:
 *             result = Mat()             # <<<<<<<<<<<<<<
 *         elif result.mat != NULL:
 *             reuse = MAT_REUSE_MATRIX
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_result, ((struct PyPetscMatObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/Mat.pyx":1249
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2
 *         if result is None:             # <<<<<<<<<<<<<<
 *             result = Mat()
 *         elif result.mat != NULL:
 */
    goto __pyx_L3;
  }

  /* "PETSc/Mat.pyx":1251
 *         if result is None:
 *             result = Mat()
 *         elif result.mat != NULL:             # <<<<<<<<<<<<<<
 *             reuse = MAT_REUSE_MATRIX
 *         if fill is not None: rval = asReal(fill)
 */
  __pyx_t_2 = ((__pyx_v_result->mat != NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1252
 *             result = Mat()
 *         elif result.mat != NULL:
 *             reuse = MAT_REUSE_MATRIX             # <<<<<<<<<<<<<<
 *         if fill is not None: rval = asReal(fill)
 *         CHKERR( MatTransposeMatMult(self.mat, mat.mat, reuse, rval, &result.mat) )
 */
    __pyx_v_reuse = MAT_REUSE_MATRIX;

    /* "PETSc/Mat.pyx":1251
 *         if result is None:
 *             result = Mat()
 *         elif result.mat != NULL:             # <<<<<<<<<<<<<<
 *             reuse = MAT_REUSE_MATRIX
 *         if fill is not None: rval = asReal(fill)
 */
  }
  __pyx_L3:;

  /* "PETSc/Mat.pyx":1253
 *         elif result.mat != NULL:
 *             reuse = MAT_REUSE_MATRIX
 *         if fill is not None: rval = asReal(fill)             # <<<<<<<<<<<<<<
 *         CHKERR( MatTransposeMatMult(self.mat, mat.mat, reuse, rval, &result.mat) )
 *         return result
 */
  __pyx_t_2 = (__pyx_v_fill != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_fill); if (unlikely(__pyx_t_4 == -1.0 && PyErr_Occurred())) __PYX_ERR(33, 1253, __pyx_L1_error)
    __pyx_v_rval = __pyx_t_4;
  }

  /* "PETSc/Mat.pyx":1254
 *             reuse = MAT_REUSE_MATRIX
 *         if fill is not None: rval = asReal(fill)
 *         CHKERR( MatTransposeMatMult(self.mat, mat.mat, reuse, rval, &result.mat) )             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatTransposeMatMult(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_reuse, __pyx_v_rval, (&__pyx_v_result->mat))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(33, 1254, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1255
 *         if fill is not None: rval = asReal(fill)
 *         CHKERR( MatTransposeMatMult(self.mat, mat.mat, reuse, rval, &result.mat) )
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     # XXX factorization
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1246
 *         return result
 * 
 *     def transposeMatMult(self, Mat mat not None, Mat result=None, fill=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatReuse reuse = MAT_INITIAL_MATRIX
 *         cdef PetscReal rval = 2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.transposeMatMult", __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;
}

/* "PETSc/Mat.pyx":1259
 *     # XXX factorization
 * 
 *     def getOrdering(self, ord_type):             # <<<<<<<<<<<<<<
 *         cdef PetscMatOrderingType cval = NULL
 *         ord_type = str2bytes(ord_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_303getOrdering(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_302getOrdering[] = "Mat.getOrdering(self, ord_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_303getOrdering(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ord_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOrdering (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ord_type,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);
        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_ord_type)) != 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, "getOrdering") < 0)) __PYX_ERR(33, 1259, __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_ord_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getOrdering", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1259, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getOrdering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_302getOrdering(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_ord_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_302getOrdering(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_ord_type) {
  const char* __pyx_v_cval;
  struct PyPetscISObject *__pyx_v_rp = 0;
  struct PyPetscISObject *__pyx_v_cp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getOrdering", 0);
  __Pyx_INCREF(__pyx_v_ord_type);

  /* "PETSc/Mat.pyx":1260
 * 
 *     def getOrdering(self, ord_type):
 *         cdef PetscMatOrderingType cval = NULL             # <<<<<<<<<<<<<<
 *         ord_type = str2bytes(ord_type, &cval)
 *         cdef IS rp = IS(), cp = IS()
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Mat.pyx":1261
 *     def getOrdering(self, ord_type):
 *         cdef PetscMatOrderingType cval = NULL
 *         ord_type = str2bytes(ord_type, &cval)             # <<<<<<<<<<<<<<
 *         cdef IS rp = IS(), cp = IS()
 *         CHKERR( MatGetOrdering(self.mat, cval, &rp.iset, &cp.iset) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_ord_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_ord_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":1262
 *         cdef PetscMatOrderingType cval = NULL
 *         ord_type = str2bytes(ord_type, &cval)
 *         cdef IS rp = IS(), cp = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetOrdering(self.mat, cval, &rp.iset, &cp.iset) )
 *         return (rp, cp)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rp = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cp = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":1263
 *         ord_type = str2bytes(ord_type, &cval)
 *         cdef IS rp = IS(), cp = IS()
 *         CHKERR( MatGetOrdering(self.mat, cval, &rp.iset, &cp.iset) )             # <<<<<<<<<<<<<<
 *         return (rp, cp)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetOrdering(__pyx_v_self->mat, __pyx_v_cval, (&__pyx_v_rp->iset), (&__pyx_v_cp->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1263, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1264
 *         cdef IS rp = IS(), cp = IS()
 *         CHKERR( MatGetOrdering(self.mat, cval, &rp.iset, &cp.iset) )
 *         return (rp, cp)             # <<<<<<<<<<<<<<
 * 
 *     def reorderForNonzeroDiagonal(self, IS isrow not None, IS iscol not None, atol=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_rp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rp));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_rp));
  __Pyx_INCREF(((PyObject *)__pyx_v_cp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_cp));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_cp));
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1259
 *     # XXX factorization
 * 
 *     def getOrdering(self, ord_type):             # <<<<<<<<<<<<<<
 *         cdef PetscMatOrderingType cval = NULL
 *         ord_type = str2bytes(ord_type, &cval)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getOrdering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rp);
  __Pyx_XDECREF((PyObject *)__pyx_v_cp);
  __Pyx_XDECREF(__pyx_v_ord_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1266
 *         return (rp, cp)
 * 
 *     def reorderForNonzeroDiagonal(self, IS isrow not None, IS iscol not None, atol=0):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(atol)
 *         cdef PetscIS rp = isrow.iset, cp = iscol.iset
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_305reorderForNonzeroDiagonal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_304reorderForNonzeroDiagonal[] = "Mat.reorderForNonzeroDiagonal(self, IS isrow, IS iscol, atol=0)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_305reorderForNonzeroDiagonal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_isrow = 0;
  struct PyPetscISObject *__pyx_v_iscol = 0;
  PyObject *__pyx_v_atol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reorderForNonzeroDiagonal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isrow,&__pyx_n_s_iscol,&__pyx_n_s_atol,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)__pyx_int_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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_isrow)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reorderForNonzeroDiagonal", 0, 2, 3, 1); __PYX_ERR(33, 1266, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_atol);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reorderForNonzeroDiagonal") < 0)) __PYX_ERR(33, 1266, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_isrow = ((struct PyPetscISObject *)values[0]);
    __pyx_v_iscol = ((struct PyPetscISObject *)values[1]);
    __pyx_v_atol = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("reorderForNonzeroDiagonal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1266, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.reorderForNonzeroDiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isrow), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isrow", 0))) __PYX_ERR(33, 1266, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iscol), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iscol", 0))) __PYX_ERR(33, 1266, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_304reorderForNonzeroDiagonal(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_isrow, __pyx_v_iscol, __pyx_v_atol);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_304reorderForNonzeroDiagonal(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, PyObject *__pyx_v_atol) {
  PetscReal __pyx_v_rval;
  IS __pyx_v_rp;
  IS __pyx_v_cp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  IS __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("reorderForNonzeroDiagonal", 0);

  /* "PETSc/Mat.pyx":1267
 * 
 *     def reorderForNonzeroDiagonal(self, IS isrow not None, IS iscol not None, atol=0):
 *         cdef PetscReal rval = asReal(atol)             # <<<<<<<<<<<<<<
 *         cdef PetscIS rp = isrow.iset, cp = iscol.iset
 *         CHKERR( MatReorderForNonzeroDiagonal(self.mat, rval, rp, cp) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_atol); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(33, 1267, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/Mat.pyx":1268
 *     def reorderForNonzeroDiagonal(self, IS isrow not None, IS iscol not None, atol=0):
 *         cdef PetscReal rval = asReal(atol)
 *         cdef PetscIS rp = isrow.iset, cp = iscol.iset             # <<<<<<<<<<<<<<
 *         CHKERR( MatReorderForNonzeroDiagonal(self.mat, rval, rp, cp) )
 * 
 */
  __pyx_t_2 = __pyx_v_isrow->iset;
  __pyx_v_rp = __pyx_t_2;
  __pyx_t_2 = __pyx_v_iscol->iset;
  __pyx_v_cp = __pyx_t_2;

  /* "PETSc/Mat.pyx":1269
 *         cdef PetscReal rval = asReal(atol)
 *         cdef PetscIS rp = isrow.iset, cp = iscol.iset
 *         CHKERR( MatReorderForNonzeroDiagonal(self.mat, rval, rp, cp) )             # <<<<<<<<<<<<<<
 * 
 *     def factorLU(self, IS isrow not None, IS iscol not None, options=None):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatReorderForNonzeroDiagonal(__pyx_v_self->mat, __pyx_v_rval, __pyx_v_rp, __pyx_v_cp)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 1269, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1266
 *         return (rp, cp)
 * 
 *     def reorderForNonzeroDiagonal(self, IS isrow not None, IS iscol not None, atol=0):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(atol)
 *         cdef PetscIS rp = isrow.iset, cp = iscol.iset
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.reorderForNonzeroDiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1271
 *         CHKERR( MatReorderForNonzeroDiagonal(self.mat, rval, rp, cp) )
 * 
 *     def factorLU(self, IS isrow not None, IS iscol not None, options=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_FALSE, PETSC_FALSE, options, &info)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_307factorLU(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_306factorLU[] = "Mat.factorLU(self, IS isrow, IS iscol, options=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_307factorLU(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_isrow = 0;
  struct PyPetscISObject *__pyx_v_iscol = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorLU (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isrow,&__pyx_n_s_iscol,&__pyx_n_s_options,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_isrow)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("factorLU", 0, 2, 3, 1); __PYX_ERR(33, 1271, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorLU") < 0)) __PYX_ERR(33, 1271, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_isrow = ((struct PyPetscISObject *)values[0]);
    __pyx_v_iscol = ((struct PyPetscISObject *)values[1]);
    __pyx_v_options = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorLU", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1271, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorLU", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isrow), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isrow", 0))) __PYX_ERR(33, 1271, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iscol), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iscol", 0))) __PYX_ERR(33, 1271, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_306factorLU(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_isrow, __pyx_v_iscol, __pyx_v_options);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_306factorLU(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, PyObject *__pyx_v_options) {
  MatFactorInfo __pyx_v_info;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("factorLU", 0);

  /* "PETSc/Mat.pyx":1273
 *     def factorLU(self, IS isrow not None, IS iscol not None, options=None):
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_FALSE, PETSC_FALSE, options, &info)             # <<<<<<<<<<<<<<
 *         CHKERR( MatLUFactor(self.mat, isrow.iset, iscol.iset, &info) )
 *     def factorSymbolicLU(self, Mat mat not None, IS isrow not None, IS iscol not None, options=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matfactorinfo(PETSC_FALSE, PETSC_FALSE, __pyx_v_options, (&__pyx_v_info)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1273, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1274
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_FALSE, PETSC_FALSE, options, &info)
 *         CHKERR( MatLUFactor(self.mat, isrow.iset, iscol.iset, &info) )             # <<<<<<<<<<<<<<
 *     def factorSymbolicLU(self, Mat mat not None, IS isrow not None, IS iscol not None, options=None):
 *         <void>self; <void>mat; <void>isrow; <void>iscol; <void>options; # unused
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatLUFactor(__pyx_v_self->mat, __pyx_v_isrow->iset, __pyx_v_iscol->iset, (&__pyx_v_info))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1274, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1271
 *         CHKERR( MatReorderForNonzeroDiagonal(self.mat, rval, rp, cp) )
 * 
 *     def factorLU(self, IS isrow not None, IS iscol not None, options=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_FALSE, PETSC_FALSE, options, &info)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorLU", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1275
 *         matfactorinfo(PETSC_FALSE, PETSC_FALSE, options, &info)
 *         CHKERR( MatLUFactor(self.mat, isrow.iset, iscol.iset, &info) )
 *     def factorSymbolicLU(self, Mat mat not None, IS isrow not None, IS iscol not None, options=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>mat; <void>isrow; <void>iscol; <void>options; # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_309factorSymbolicLU(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_308factorSymbolicLU[] = "Mat.factorSymbolicLU(self, Mat mat, IS isrow, IS iscol, options=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_309factorSymbolicLU(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  struct PyPetscISObject *__pyx_v_isrow = 0;
  struct PyPetscISObject *__pyx_v_iscol = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorSymbolicLU (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,&__pyx_n_s_isrow,&__pyx_n_s_iscol,&__pyx_n_s_options,0};
    PyObject* values[4] = {0,0,0,0};
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_mat)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_isrow)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("factorSymbolicLU", 0, 3, 4, 1); __PYX_ERR(33, 1275, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("factorSymbolicLU", 0, 3, 4, 2); __PYX_ERR(33, 1275, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorSymbolicLU") < 0)) __PYX_ERR(33, 1275, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_mat = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_isrow = ((struct PyPetscISObject *)values[1]);
    __pyx_v_iscol = ((struct PyPetscISObject *)values[2]);
    __pyx_v_options = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorSymbolicLU", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1275, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorSymbolicLU", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(33, 1275, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isrow), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isrow", 0))) __PYX_ERR(33, 1275, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iscol), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iscol", 0))) __PYX_ERR(33, 1275, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_308factorSymbolicLU(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat, __pyx_v_isrow, __pyx_v_iscol, __pyx_v_options);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_308factorSymbolicLU(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, PyObject *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorSymbolicLU", 0);

  /* "PETSc/Mat.pyx":1276
 *         CHKERR( MatLUFactor(self.mat, isrow.iset, iscol.iset, &info) )
 *     def factorSymbolicLU(self, Mat mat not None, IS isrow not None, IS iscol not None, options=None):
 *         <void>self; <void>mat; <void>isrow; <void>iscol; <void>options; # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 *     def factorNumericLU(self, Mat mat not None, options=None):
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_mat);
  ((void)__pyx_v_isrow);
  ((void)__pyx_v_iscol);
  ((void)__pyx_v_options);

  /* "PETSc/Mat.pyx":1277
 *     def factorSymbolicLU(self, Mat mat not None, IS isrow not None, IS iscol not None, options=None):
 *         <void>self; <void>mat; <void>isrow; <void>iscol; <void>options; # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 *     def factorNumericLU(self, Mat mat not None, options=None):
 *         <void>self; <void>mat; <void>options; # unused
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(33, 1277, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1275
 *         matfactorinfo(PETSC_FALSE, PETSC_FALSE, options, &info)
 *         CHKERR( MatLUFactor(self.mat, isrow.iset, iscol.iset, &info) )
 *     def factorSymbolicLU(self, Mat mat not None, IS isrow not None, IS iscol not None, options=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>mat; <void>isrow; <void>iscol; <void>options; # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorSymbolicLU", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1278
 *         <void>self; <void>mat; <void>isrow; <void>iscol; <void>options; # unused
 *         raise NotImplementedError
 *     def factorNumericLU(self, Mat mat not None, options=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>mat; <void>options; # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_311factorNumericLU(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_310factorNumericLU[] = "Mat.factorNumericLU(self, Mat mat, options=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_311factorNumericLU(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorNumericLU (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_mat)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorNumericLU") < 0)) __PYX_ERR(33, 1278, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mat = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_options = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorNumericLU", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1278, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorNumericLU", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(33, 1278, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_310factorNumericLU(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat, __pyx_v_options);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_310factorNumericLU(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, PyObject *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorNumericLU", 0);

  /* "PETSc/Mat.pyx":1279
 *         raise NotImplementedError
 *     def factorNumericLU(self, Mat mat not None, options=None):
 *         <void>self; <void>mat; <void>options; # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 *     def factorILU(self, IS isrow not None, IS iscol not None, options=None):
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_mat);
  ((void)__pyx_v_options);

  /* "PETSc/Mat.pyx":1280
 *     def factorNumericLU(self, Mat mat not None, options=None):
 *         <void>self; <void>mat; <void>options; # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 *     def factorILU(self, IS isrow not None, IS iscol not None, options=None):
 *         cdef PetscMatFactorInfo info
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(33, 1280, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1278
 *         <void>self; <void>mat; <void>isrow; <void>iscol; <void>options; # unused
 *         raise NotImplementedError
 *     def factorNumericLU(self, Mat mat not None, options=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>mat; <void>options; # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorNumericLU", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1281
 *         <void>self; <void>mat; <void>options; # unused
 *         raise NotImplementedError
 *     def factorILU(self, IS isrow not None, IS iscol not None, options=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_TRUE, PETSC_FALSE, options, &info)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_313factorILU(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_312factorILU[] = "Mat.factorILU(self, IS isrow, IS iscol, options=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_313factorILU(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_isrow = 0;
  struct PyPetscISObject *__pyx_v_iscol = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorILU (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isrow,&__pyx_n_s_iscol,&__pyx_n_s_options,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_isrow)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("factorILU", 0, 2, 3, 1); __PYX_ERR(33, 1281, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorILU") < 0)) __PYX_ERR(33, 1281, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_isrow = ((struct PyPetscISObject *)values[0]);
    __pyx_v_iscol = ((struct PyPetscISObject *)values[1]);
    __pyx_v_options = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorILU", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1281, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorILU", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isrow), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isrow", 0))) __PYX_ERR(33, 1281, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iscol), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iscol", 0))) __PYX_ERR(33, 1281, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_312factorILU(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_isrow, __pyx_v_iscol, __pyx_v_options);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_312factorILU(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, PyObject *__pyx_v_options) {
  MatFactorInfo __pyx_v_info;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("factorILU", 0);

  /* "PETSc/Mat.pyx":1283
 *     def factorILU(self, IS isrow not None, IS iscol not None, options=None):
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_TRUE, PETSC_FALSE, options, &info)             # <<<<<<<<<<<<<<
 *         CHKERR( MatILUFactor(self.mat, isrow.iset, iscol.iset, &info) )
 *     def factorSymbolicILU(self, IS isrow not None, IS iscol not None, options=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matfactorinfo(PETSC_TRUE, PETSC_FALSE, __pyx_v_options, (&__pyx_v_info)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1283, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1284
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_TRUE, PETSC_FALSE, options, &info)
 *         CHKERR( MatILUFactor(self.mat, isrow.iset, iscol.iset, &info) )             # <<<<<<<<<<<<<<
 *     def factorSymbolicILU(self, IS isrow not None, IS iscol not None, options=None):
 *         <void>self; <void>isrow; <void>iscol; <void>options; # unused
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatILUFactor(__pyx_v_self->mat, __pyx_v_isrow->iset, __pyx_v_iscol->iset, (&__pyx_v_info))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1284, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1281
 *         <void>self; <void>mat; <void>options; # unused
 *         raise NotImplementedError
 *     def factorILU(self, IS isrow not None, IS iscol not None, options=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_TRUE, PETSC_FALSE, options, &info)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorILU", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1285
 *         matfactorinfo(PETSC_TRUE, PETSC_FALSE, options, &info)
 *         CHKERR( MatILUFactor(self.mat, isrow.iset, iscol.iset, &info) )
 *     def factorSymbolicILU(self, IS isrow not None, IS iscol not None, options=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>isrow; <void>iscol; <void>options; # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_315factorSymbolicILU(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_314factorSymbolicILU[] = "Mat.factorSymbolicILU(self, IS isrow, IS iscol, options=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_315factorSymbolicILU(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_isrow = 0;
  struct PyPetscISObject *__pyx_v_iscol = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorSymbolicILU (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isrow,&__pyx_n_s_iscol,&__pyx_n_s_options,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_isrow)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("factorSymbolicILU", 0, 2, 3, 1); __PYX_ERR(33, 1285, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorSymbolicILU") < 0)) __PYX_ERR(33, 1285, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_isrow = ((struct PyPetscISObject *)values[0]);
    __pyx_v_iscol = ((struct PyPetscISObject *)values[1]);
    __pyx_v_options = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorSymbolicILU", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1285, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorSymbolicILU", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isrow), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isrow", 0))) __PYX_ERR(33, 1285, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iscol), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "iscol", 0))) __PYX_ERR(33, 1285, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_314factorSymbolicILU(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_isrow, __pyx_v_iscol, __pyx_v_options);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_314factorSymbolicILU(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isrow, struct PyPetscISObject *__pyx_v_iscol, PyObject *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorSymbolicILU", 0);

  /* "PETSc/Mat.pyx":1286
 *         CHKERR( MatILUFactor(self.mat, isrow.iset, iscol.iset, &info) )
 *     def factorSymbolicILU(self, IS isrow not None, IS iscol not None, options=None):
 *         <void>self; <void>isrow; <void>iscol; <void>options; # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_isrow);
  ((void)__pyx_v_iscol);
  ((void)__pyx_v_options);

  /* "PETSc/Mat.pyx":1287
 *     def factorSymbolicILU(self, IS isrow not None, IS iscol not None, options=None):
 *         <void>self; <void>isrow; <void>iscol; <void>options; # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def factorCholesky(self, IS isperm not None, options=None):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(33, 1287, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1285
 *         matfactorinfo(PETSC_TRUE, PETSC_FALSE, options, &info)
 *         CHKERR( MatILUFactor(self.mat, isrow.iset, iscol.iset, &info) )
 *     def factorSymbolicILU(self, IS isrow not None, IS iscol not None, options=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>isrow; <void>iscol; <void>options; # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorSymbolicILU", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1289
 *         raise NotImplementedError
 * 
 *     def factorCholesky(self, IS isperm not None, options=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_FALSE, PETSC_TRUE, options, &info)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_317factorCholesky(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_316factorCholesky[] = "Mat.factorCholesky(self, IS isperm, options=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_317factorCholesky(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_isperm = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorCholesky (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isperm,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_isperm)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorCholesky") < 0)) __PYX_ERR(33, 1289, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_isperm = ((struct PyPetscISObject *)values[0]);
    __pyx_v_options = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorCholesky", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1289, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorCholesky", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isperm), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isperm", 0))) __PYX_ERR(33, 1289, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_316factorCholesky(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_isperm, __pyx_v_options);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_316factorCholesky(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isperm, PyObject *__pyx_v_options) {
  MatFactorInfo __pyx_v_info;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("factorCholesky", 0);

  /* "PETSc/Mat.pyx":1291
 *     def factorCholesky(self, IS isperm not None, options=None):
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_FALSE, PETSC_TRUE, options, &info)             # <<<<<<<<<<<<<<
 *         CHKERR( MatCholeskyFactor(self.mat, isperm.iset, &info) )
 *     def factorSymbolicCholesky(self, IS isperm not None, options=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matfactorinfo(PETSC_FALSE, PETSC_TRUE, __pyx_v_options, (&__pyx_v_info)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1291, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1292
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_FALSE, PETSC_TRUE, options, &info)
 *         CHKERR( MatCholeskyFactor(self.mat, isperm.iset, &info) )             # <<<<<<<<<<<<<<
 *     def factorSymbolicCholesky(self, IS isperm not None, options=None):
 *         <void>self; <void>isperm; <void>options; # unused
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatCholeskyFactor(__pyx_v_self->mat, __pyx_v_isperm->iset, (&__pyx_v_info))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1292, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1289
 *         raise NotImplementedError
 * 
 *     def factorCholesky(self, IS isperm not None, options=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_FALSE, PETSC_TRUE, options, &info)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorCholesky", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1293
 *         matfactorinfo(PETSC_FALSE, PETSC_TRUE, options, &info)
 *         CHKERR( MatCholeskyFactor(self.mat, isperm.iset, &info) )
 *     def factorSymbolicCholesky(self, IS isperm not None, options=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>isperm; <void>options; # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_319factorSymbolicCholesky(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_318factorSymbolicCholesky[] = "Mat.factorSymbolicCholesky(self, IS isperm, options=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_319factorSymbolicCholesky(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_isperm = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorSymbolicCholesky (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isperm,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_isperm)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorSymbolicCholesky") < 0)) __PYX_ERR(33, 1293, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_isperm = ((struct PyPetscISObject *)values[0]);
    __pyx_v_options = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorSymbolicCholesky", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1293, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorSymbolicCholesky", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isperm), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isperm", 0))) __PYX_ERR(33, 1293, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_318factorSymbolicCholesky(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_isperm, __pyx_v_options);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_318factorSymbolicCholesky(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isperm, PyObject *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorSymbolicCholesky", 0);

  /* "PETSc/Mat.pyx":1294
 *         CHKERR( MatCholeskyFactor(self.mat, isperm.iset, &info) )
 *     def factorSymbolicCholesky(self, IS isperm not None, options=None):
 *         <void>self; <void>isperm; <void>options; # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 *     def factorNumericCholesky(self, Mat mat not None, options=None):
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_isperm);
  ((void)__pyx_v_options);

  /* "PETSc/Mat.pyx":1295
 *     def factorSymbolicCholesky(self, IS isperm not None, options=None):
 *         <void>self; <void>isperm; <void>options; # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 *     def factorNumericCholesky(self, Mat mat not None, options=None):
 *         <void>self; <void>mat; <void>options; # unused
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(33, 1295, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1293
 *         matfactorinfo(PETSC_FALSE, PETSC_TRUE, options, &info)
 *         CHKERR( MatCholeskyFactor(self.mat, isperm.iset, &info) )
 *     def factorSymbolicCholesky(self, IS isperm not None, options=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>isperm; <void>options; # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorSymbolicCholesky", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1296
 *         <void>self; <void>isperm; <void>options; # unused
 *         raise NotImplementedError
 *     def factorNumericCholesky(self, Mat mat not None, options=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>mat; <void>options; # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_321factorNumericCholesky(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_320factorNumericCholesky[] = "Mat.factorNumericCholesky(self, Mat mat, options=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_321factorNumericCholesky(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorNumericCholesky (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_mat)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorNumericCholesky") < 0)) __PYX_ERR(33, 1296, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mat = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_options = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorNumericCholesky", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1296, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorNumericCholesky", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(33, 1296, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_320factorNumericCholesky(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_mat, __pyx_v_options);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_320factorNumericCholesky(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat, PyObject *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorNumericCholesky", 0);

  /* "PETSc/Mat.pyx":1297
 *         raise NotImplementedError
 *     def factorNumericCholesky(self, Mat mat not None, options=None):
 *         <void>self; <void>mat; <void>options; # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 *     def factorICC(self, IS isperm not None, options=None):
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_mat);
  ((void)__pyx_v_options);

  /* "PETSc/Mat.pyx":1298
 *     def factorNumericCholesky(self, Mat mat not None, options=None):
 *         <void>self; <void>mat; <void>options; # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 *     def factorICC(self, IS isperm not None, options=None):
 *         cdef PetscMatFactorInfo info
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(33, 1298, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1296
 *         <void>self; <void>isperm; <void>options; # unused
 *         raise NotImplementedError
 *     def factorNumericCholesky(self, Mat mat not None, options=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>mat; <void>options; # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorNumericCholesky", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1299
 *         <void>self; <void>mat; <void>options; # unused
 *         raise NotImplementedError
 *     def factorICC(self, IS isperm not None, options=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_TRUE, PETSC_TRUE, options, &info)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_323factorICC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_322factorICC[] = "Mat.factorICC(self, IS isperm, options=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_323factorICC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_isperm = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorICC (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isperm,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_isperm)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorICC") < 0)) __PYX_ERR(33, 1299, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_isperm = ((struct PyPetscISObject *)values[0]);
    __pyx_v_options = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorICC", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1299, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorICC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isperm), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isperm", 0))) __PYX_ERR(33, 1299, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_322factorICC(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_isperm, __pyx_v_options);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_322factorICC(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isperm, PyObject *__pyx_v_options) {
  MatFactorInfo __pyx_v_info;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("factorICC", 0);

  /* "PETSc/Mat.pyx":1301
 *     def factorICC(self, IS isperm not None, options=None):
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_TRUE, PETSC_TRUE, options, &info)             # <<<<<<<<<<<<<<
 *         CHKERR( MatICCFactor(self.mat, isperm.iset, &info) )
 *     def factorSymbolicICC(self, IS isperm not None, options=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_matfactorinfo(PETSC_TRUE, PETSC_TRUE, __pyx_v_options, (&__pyx_v_info)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1301, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1302
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_TRUE, PETSC_TRUE, options, &info)
 *         CHKERR( MatICCFactor(self.mat, isperm.iset, &info) )             # <<<<<<<<<<<<<<
 *     def factorSymbolicICC(self, IS isperm not None, options=None):
 *         <void>self; <void>isperm; <void>options; # unused
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatICCFactor(__pyx_v_self->mat, __pyx_v_isperm->iset, (&__pyx_v_info))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1302, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1299
 *         <void>self; <void>mat; <void>options; # unused
 *         raise NotImplementedError
 *     def factorICC(self, IS isperm not None, options=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatFactorInfo info
 *         matfactorinfo(PETSC_TRUE, PETSC_TRUE, options, &info)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorICC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1303
 *         matfactorinfo(PETSC_TRUE, PETSC_TRUE, options, &info)
 *         CHKERR( MatICCFactor(self.mat, isperm.iset, &info) )
 *     def factorSymbolicICC(self, IS isperm not None, options=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>isperm; <void>options; # unused
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_325factorSymbolicICC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_324factorSymbolicICC[] = "Mat.factorSymbolicICC(self, IS isperm, options=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_325factorSymbolicICC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_isperm = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorSymbolicICC (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_isperm,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_isperm)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorSymbolicICC") < 0)) __PYX_ERR(33, 1303, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_isperm = ((struct PyPetscISObject *)values[0]);
    __pyx_v_options = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorSymbolicICC", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1303, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorSymbolicICC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isperm), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "isperm", 0))) __PYX_ERR(33, 1303, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_324factorSymbolicICC(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_isperm, __pyx_v_options);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_324factorSymbolicICC(struct PyPetscMatObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_isperm, PyObject *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorSymbolicICC", 0);

  /* "PETSc/Mat.pyx":1304
 *         CHKERR( MatICCFactor(self.mat, isperm.iset, &info) )
 *     def factorSymbolicICC(self, IS isperm not None, options=None):
 *         <void>self; <void>isperm; <void>options; # unused             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  ((void)__pyx_v_self);
  ((void)__pyx_v_isperm);
  ((void)__pyx_v_options);

  /* "PETSc/Mat.pyx":1305
 *     def factorSymbolicICC(self, IS isperm not None, options=None):
 *         <void>self; <void>isperm; <void>options; # unused
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def getInertia(self):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(33, 1305, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1303
 *         matfactorinfo(PETSC_TRUE, PETSC_TRUE, options, &info)
 *         CHKERR( MatICCFactor(self.mat, isperm.iset, &info) )
 *     def factorSymbolicICC(self, IS isperm not None, options=None):             # <<<<<<<<<<<<<<
 *         <void>self; <void>isperm; <void>options; # unused
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.factorSymbolicICC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1307
 *         raise NotImplementedError
 * 
 *     def getInertia(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival1 = 0, ival2 = 0, ival3 = 0
 *         CHKERR( MatGetInertia(self.mat, &ival1, &ival2, &ival3) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_327getInertia(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_326getInertia[] = "Mat.getInertia(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_327getInertia(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getInertia (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getInertia", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getInertia", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_326getInertia(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_326getInertia(struct PyPetscMatObject *__pyx_v_self) {
  PetscInt __pyx_v_ival1;
  PetscInt __pyx_v_ival2;
  PetscInt __pyx_v_ival3;
  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;
  __Pyx_RefNannySetupContext("getInertia", 0);

  /* "PETSc/Mat.pyx":1308
 * 
 *     def getInertia(self):
 *         cdef PetscInt ival1 = 0, ival2 = 0, ival3 = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetInertia(self.mat, &ival1, &ival2, &ival3) )
 *         return (toInt(ival1), toInt(ival2), toInt(ival3))
 */
  __pyx_v_ival1 = 0;
  __pyx_v_ival2 = 0;
  __pyx_v_ival3 = 0;

  /* "PETSc/Mat.pyx":1309
 *     def getInertia(self):
 *         cdef PetscInt ival1 = 0, ival2 = 0, ival3 = 0
 *         CHKERR( MatGetInertia(self.mat, &ival1, &ival2, &ival3) )             # <<<<<<<<<<<<<<
 *         return (toInt(ival1), toInt(ival2), toInt(ival3))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetInertia(__pyx_v_self->mat, (&__pyx_v_ival1), (&__pyx_v_ival2), (&__pyx_v_ival3))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1309, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1310
 *         cdef PetscInt ival1 = 0, ival2 = 0, ival3 = 0
 *         CHKERR( MatGetInertia(self.mat, &ival1, &ival2, &ival3) )
 *         return (toInt(ival1), toInt(ival2), toInt(ival3))             # <<<<<<<<<<<<<<
 * 
 *     def setUnfactored(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival1); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival2); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival3); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1307
 *         raise NotImplementedError
 * 
 *     def getInertia(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival1 = 0, ival2 = 0, ival3 = 0
 *         CHKERR( MatGetInertia(self.mat, &ival1, &ival2, &ival3) )
 */

  /* 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("petsc4py.PETSc.Mat.getInertia", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1312
 *         return (toInt(ival1), toInt(ival2), toInt(ival3))
 * 
 *     def setUnfactored(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetUnfactored(self.mat) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_329setUnfactored(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_328setUnfactored[] = "Mat.setUnfactored(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_329setUnfactored(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUnfactored (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUnfactored", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUnfactored", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_328setUnfactored(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_328setUnfactored(struct PyPetscMatObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUnfactored", 0);

  /* "PETSc/Mat.pyx":1313
 * 
 *     def setUnfactored(self):
 *         CHKERR( MatSetUnfactored(self.mat) )             # <<<<<<<<<<<<<<
 * 
 *     # MUMPS
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSetUnfactored(__pyx_v_self->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1313, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1312
 *         return (toInt(ival1), toInt(ival2), toInt(ival3))
 * 
 *     def setUnfactored(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSetUnfactored(self.mat) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setUnfactored", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1317
 *     # MUMPS
 * 
 *     def setMumpsIcntl(self, icntl, ival):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt _ival = asInt(ival)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_331setMumpsIcntl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_330setMumpsIcntl[] = "Mat.setMumpsIcntl(self, icntl, ival)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_331setMumpsIcntl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_icntl = 0;
  PyObject *__pyx_v_ival = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMumpsIcntl (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_icntl,&__pyx_n_s_ival,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_icntl)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ival)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setMumpsIcntl", 1, 2, 2, 1); __PYX_ERR(33, 1317, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMumpsIcntl") < 0)) __PYX_ERR(33, 1317, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_icntl = values[0];
    __pyx_v_ival = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMumpsIcntl", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1317, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setMumpsIcntl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_330setMumpsIcntl(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_icntl, __pyx_v_ival);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_330setMumpsIcntl(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl, PyObject *__pyx_v_ival) {
  PetscInt __pyx_v__icntl;
  PetscInt __pyx_v__ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMumpsIcntl", 0);

  /* "PETSc/Mat.pyx":1318
 * 
 *     def setMumpsIcntl(self, icntl, ival):
 *         cdef PetscInt _icntl = asInt(icntl)             # <<<<<<<<<<<<<<
 *         cdef PetscInt _ival = asInt(ival)
 *         CHKERR( MatMumpsSetIcntl(self.mat, _icntl, _ival) );
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_icntl); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1318, __pyx_L1_error)
  __pyx_v__icntl = __pyx_t_1;

  /* "PETSc/Mat.pyx":1319
 *     def setMumpsIcntl(self, icntl, ival):
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt _ival = asInt(ival)             # <<<<<<<<<<<<<<
 *         CHKERR( MatMumpsSetIcntl(self.mat, _icntl, _ival) );
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_ival); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1319, __pyx_L1_error)
  __pyx_v__ival = __pyx_t_1;

  /* "PETSc/Mat.pyx":1320
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt _ival = asInt(ival)
 *         CHKERR( MatMumpsSetIcntl(self.mat, _icntl, _ival) );             # <<<<<<<<<<<<<<
 * 
 *     def getMumpsIcntl(self, icntl):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMumpsSetIcntl(__pyx_v_self->mat, __pyx_v__icntl, __pyx_v__ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1320, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1317
 *     # MUMPS
 * 
 *     def setMumpsIcntl(self, icntl, ival):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt _ival = asInt(ival)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setMumpsIcntl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1322
 *         CHKERR( MatMumpsSetIcntl(self.mat, _icntl, _ival) );
 * 
 *     def getMumpsIcntl(self, icntl):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt ival = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_333getMumpsIcntl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_332getMumpsIcntl[] = "Mat.getMumpsIcntl(self, icntl)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_333getMumpsIcntl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_icntl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMumpsIcntl (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_icntl,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);
        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_icntl)) != 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, "getMumpsIcntl") < 0)) __PYX_ERR(33, 1322, __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_icntl = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMumpsIcntl", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1322, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getMumpsIcntl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_332getMumpsIcntl(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_icntl);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_332getMumpsIcntl(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl) {
  PetscInt __pyx_v__icntl;
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getMumpsIcntl", 0);

  /* "PETSc/Mat.pyx":1323
 * 
 *     def getMumpsIcntl(self, icntl):
 *         cdef PetscInt _icntl = asInt(icntl)             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( MatMumpsGetIcntl(self.mat, _icntl, &ival) );
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_icntl); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1323, __pyx_L1_error)
  __pyx_v__icntl = __pyx_t_1;

  /* "PETSc/Mat.pyx":1324
 *     def getMumpsIcntl(self, icntl):
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatMumpsGetIcntl(self.mat, _icntl, &ival) );
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/Mat.pyx":1325
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt ival = 0
 *         CHKERR( MatMumpsGetIcntl(self.mat, _icntl, &ival) );             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMumpsGetIcntl(__pyx_v_self->mat, __pyx_v__icntl, (&__pyx_v_ival))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1325, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1326
 *         cdef PetscInt ival = 0
 *         CHKERR( MatMumpsGetIcntl(self.mat, _icntl, &ival) );
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def setMumpsCntl(self, icntl, val):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1322
 *         CHKERR( MatMumpsSetIcntl(self.mat, _icntl, _ival) );
 * 
 *     def getMumpsIcntl(self, icntl):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt ival = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getMumpsIcntl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1328
 *         return toInt(ival)
 * 
 *     def setMumpsCntl(self, icntl, val):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal _val = asReal(val)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_335setMumpsCntl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_334setMumpsCntl[] = "Mat.setMumpsCntl(self, icntl, val)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_335setMumpsCntl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_icntl = 0;
  PyObject *__pyx_v_val = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMumpsCntl (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_icntl,&__pyx_n_s_val,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_icntl)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setMumpsCntl", 1, 2, 2, 1); __PYX_ERR(33, 1328, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMumpsCntl") < 0)) __PYX_ERR(33, 1328, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_icntl = values[0];
    __pyx_v_val = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMumpsCntl", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1328, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setMumpsCntl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_334setMumpsCntl(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_icntl, __pyx_v_val);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_334setMumpsCntl(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl, PyObject *__pyx_v_val) {
  PetscInt __pyx_v__icntl;
  PetscReal __pyx_v__val;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscReal __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setMumpsCntl", 0);

  /* "PETSc/Mat.pyx":1329
 * 
 *     def setMumpsCntl(self, icntl, val):
 *         cdef PetscInt _icntl = asInt(icntl)             # <<<<<<<<<<<<<<
 *         cdef PetscReal _val = asReal(val)
 *         CHKERR( MatMumpsSetCntl(self.mat, _icntl, _val) );
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_icntl); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1329, __pyx_L1_error)
  __pyx_v__icntl = __pyx_t_1;

  /* "PETSc/Mat.pyx":1330
 *     def setMumpsCntl(self, icntl, val):
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal _val = asReal(val)             # <<<<<<<<<<<<<<
 *         CHKERR( MatMumpsSetCntl(self.mat, _icntl, _val) );
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_val); if (unlikely(__pyx_t_2 == -1.0 && PyErr_Occurred())) __PYX_ERR(33, 1330, __pyx_L1_error)
  __pyx_v__val = __pyx_t_2;

  /* "PETSc/Mat.pyx":1331
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal _val = asReal(val)
 *         CHKERR( MatMumpsSetCntl(self.mat, _icntl, _val) );             # <<<<<<<<<<<<<<
 * 
 *     def getMumpsCntl(self, icntl):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMumpsSetCntl(__pyx_v_self->mat, __pyx_v__icntl, __pyx_v__val)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 1331, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1328
 *         return toInt(ival)
 * 
 *     def setMumpsCntl(self, icntl, val):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal _val = asReal(val)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.setMumpsCntl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1333
 *         CHKERR( MatMumpsSetCntl(self.mat, _icntl, _val) );
 * 
 *     def getMumpsCntl(self, icntl):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal val = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_337getMumpsCntl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_336getMumpsCntl[] = "Mat.getMumpsCntl(self, icntl)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_337getMumpsCntl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_icntl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMumpsCntl (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_icntl,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);
        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_icntl)) != 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, "getMumpsCntl") < 0)) __PYX_ERR(33, 1333, __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_icntl = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMumpsCntl", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1333, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getMumpsCntl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_336getMumpsCntl(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_icntl);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_336getMumpsCntl(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl) {
  PetscInt __pyx_v__icntl;
  PetscReal __pyx_v_val;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getMumpsCntl", 0);

  /* "PETSc/Mat.pyx":1334
 * 
 *     def getMumpsCntl(self, icntl):
 *         cdef PetscInt _icntl = asInt(icntl)             # <<<<<<<<<<<<<<
 *         cdef PetscReal val = 0
 *         CHKERR( MatMumpsGetCntl(self.mat, _icntl, &val) );
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_icntl); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1334, __pyx_L1_error)
  __pyx_v__icntl = __pyx_t_1;

  /* "PETSc/Mat.pyx":1335
 *     def getMumpsCntl(self, icntl):
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal val = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatMumpsGetCntl(self.mat, _icntl, &val) );
 *         return toReal(val)
 */
  __pyx_v_val = 0.0;

  /* "PETSc/Mat.pyx":1336
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal val = 0
 *         CHKERR( MatMumpsGetCntl(self.mat, _icntl, &val) );             # <<<<<<<<<<<<<<
 *         return toReal(val)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMumpsGetCntl(__pyx_v_self->mat, __pyx_v__icntl, (&__pyx_v_val))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1336, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1337
 *         cdef PetscReal val = 0
 *         CHKERR( MatMumpsGetCntl(self.mat, _icntl, &val) );
 *         return toReal(val)             # <<<<<<<<<<<<<<
 * 
 *     def getMumpsInfo(self, icntl):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_val); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1333
 *         CHKERR( MatMumpsSetCntl(self.mat, _icntl, _val) );
 * 
 *     def getMumpsCntl(self, icntl):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal val = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getMumpsCntl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1339
 *         return toReal(val)
 * 
 *     def getMumpsInfo(self, icntl):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt ival = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_339getMumpsInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_338getMumpsInfo[] = "Mat.getMumpsInfo(self, icntl)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_339getMumpsInfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_icntl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMumpsInfo (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_icntl,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);
        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_icntl)) != 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, "getMumpsInfo") < 0)) __PYX_ERR(33, 1339, __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_icntl = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMumpsInfo", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1339, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getMumpsInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_338getMumpsInfo(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_icntl);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_338getMumpsInfo(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl) {
  PetscInt __pyx_v__icntl;
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getMumpsInfo", 0);

  /* "PETSc/Mat.pyx":1340
 * 
 *     def getMumpsInfo(self, icntl):
 *         cdef PetscInt _icntl = asInt(icntl)             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( MatMumpsGetInfo(self.mat, _icntl, &ival) );
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_icntl); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1340, __pyx_L1_error)
  __pyx_v__icntl = __pyx_t_1;

  /* "PETSc/Mat.pyx":1341
 *     def getMumpsInfo(self, icntl):
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatMumpsGetInfo(self.mat, _icntl, &ival) );
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/Mat.pyx":1342
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt ival = 0
 *         CHKERR( MatMumpsGetInfo(self.mat, _icntl, &ival) );             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMumpsGetInfo(__pyx_v_self->mat, __pyx_v__icntl, (&__pyx_v_ival))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1342, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1343
 *         cdef PetscInt ival = 0
 *         CHKERR( MatMumpsGetInfo(self.mat, _icntl, &ival) );
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def getMumpsInfog(self, icntl):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1339
 *         return toReal(val)
 * 
 *     def getMumpsInfo(self, icntl):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt ival = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getMumpsInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1345
 *         return toInt(ival)
 * 
 *     def getMumpsInfog(self, icntl):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt ival = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_341getMumpsInfog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_340getMumpsInfog[] = "Mat.getMumpsInfog(self, icntl)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_341getMumpsInfog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_icntl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMumpsInfog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_icntl,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);
        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_icntl)) != 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, "getMumpsInfog") < 0)) __PYX_ERR(33, 1345, __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_icntl = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMumpsInfog", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1345, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getMumpsInfog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_340getMumpsInfog(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_icntl);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_340getMumpsInfog(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl) {
  PetscInt __pyx_v__icntl;
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getMumpsInfog", 0);

  /* "PETSc/Mat.pyx":1346
 * 
 *     def getMumpsInfog(self, icntl):
 *         cdef PetscInt _icntl = asInt(icntl)             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( MatMumpsGetInfog(self.mat, _icntl, &ival) );
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_icntl); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1346, __pyx_L1_error)
  __pyx_v__icntl = __pyx_t_1;

  /* "PETSc/Mat.pyx":1347
 *     def getMumpsInfog(self, icntl):
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatMumpsGetInfog(self.mat, _icntl, &ival) );
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/Mat.pyx":1348
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt ival = 0
 *         CHKERR( MatMumpsGetInfog(self.mat, _icntl, &ival) );             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMumpsGetInfog(__pyx_v_self->mat, __pyx_v__icntl, (&__pyx_v_ival))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1348, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1349
 *         cdef PetscInt ival = 0
 *         CHKERR( MatMumpsGetInfog(self.mat, _icntl, &ival) );
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def getMumpsRinfo(self, icntl):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1345
 *         return toInt(ival)
 * 
 *     def getMumpsInfog(self, icntl):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscInt ival = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getMumpsInfog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1351
 *         return toInt(ival)
 * 
 *     def getMumpsRinfo(self, icntl):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal val = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_343getMumpsRinfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_342getMumpsRinfo[] = "Mat.getMumpsRinfo(self, icntl)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_343getMumpsRinfo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_icntl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMumpsRinfo (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_icntl,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);
        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_icntl)) != 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, "getMumpsRinfo") < 0)) __PYX_ERR(33, 1351, __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_icntl = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMumpsRinfo", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1351, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getMumpsRinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_342getMumpsRinfo(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_icntl);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_342getMumpsRinfo(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl) {
  PetscInt __pyx_v__icntl;
  PetscReal __pyx_v_val;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getMumpsRinfo", 0);

  /* "PETSc/Mat.pyx":1352
 * 
 *     def getMumpsRinfo(self, icntl):
 *         cdef PetscInt _icntl = asInt(icntl)             # <<<<<<<<<<<<<<
 *         cdef PetscReal val = 0
 *         CHKERR( MatMumpsGetRinfo(self.mat, _icntl, &val) );
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_icntl); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1352, __pyx_L1_error)
  __pyx_v__icntl = __pyx_t_1;

  /* "PETSc/Mat.pyx":1353
 *     def getMumpsRinfo(self, icntl):
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal val = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatMumpsGetRinfo(self.mat, _icntl, &val) );
 *         return toReal(val)
 */
  __pyx_v_val = 0.0;

  /* "PETSc/Mat.pyx":1354
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal val = 0
 *         CHKERR( MatMumpsGetRinfo(self.mat, _icntl, &val) );             # <<<<<<<<<<<<<<
 *         return toReal(val)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMumpsGetRinfo(__pyx_v_self->mat, __pyx_v__icntl, (&__pyx_v_val))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1354, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1355
 *         cdef PetscReal val = 0
 *         CHKERR( MatMumpsGetRinfo(self.mat, _icntl, &val) );
 *         return toReal(val)             # <<<<<<<<<<<<<<
 * 
 *     def getMumpsRinfog(self, icntl):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_val); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1351
 *         return toInt(ival)
 * 
 *     def getMumpsRinfo(self, icntl):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal val = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getMumpsRinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1357
 *         return toReal(val)
 * 
 *     def getMumpsRinfog(self, icntl):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal val = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_345getMumpsRinfog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_344getMumpsRinfog[] = "Mat.getMumpsRinfog(self, icntl)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_345getMumpsRinfog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_icntl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMumpsRinfog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_icntl,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);
        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_icntl)) != 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, "getMumpsRinfog") < 0)) __PYX_ERR(33, 1357, __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_icntl = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMumpsRinfog", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1357, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getMumpsRinfog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_344getMumpsRinfog(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_icntl);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_344getMumpsRinfog(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_icntl) {
  PetscInt __pyx_v__icntl;
  PetscReal __pyx_v_val;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getMumpsRinfog", 0);

  /* "PETSc/Mat.pyx":1358
 * 
 *     def getMumpsRinfog(self, icntl):
 *         cdef PetscInt _icntl = asInt(icntl)             # <<<<<<<<<<<<<<
 *         cdef PetscReal val = 0
 *         CHKERR( MatMumpsGetRinfog(self.mat, _icntl, &val) );
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_icntl); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(33, 1358, __pyx_L1_error)
  __pyx_v__icntl = __pyx_t_1;

  /* "PETSc/Mat.pyx":1359
 *     def getMumpsRinfog(self, icntl):
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal val = 0             # <<<<<<<<<<<<<<
 *         CHKERR( MatMumpsGetRinfog(self.mat, _icntl, &val) );
 *         return toReal(val)
 */
  __pyx_v_val = 0.0;

  /* "PETSc/Mat.pyx":1360
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal val = 0
 *         CHKERR( MatMumpsGetRinfog(self.mat, _icntl, &val) );             # <<<<<<<<<<<<<<
 *         return toReal(val)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMumpsGetRinfog(__pyx_v_self->mat, __pyx_v__icntl, (&__pyx_v_val))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(33, 1360, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1361
 *         cdef PetscReal val = 0
 *         CHKERR( MatMumpsGetRinfog(self.mat, _icntl, &val) );
 *         return toReal(val)             # <<<<<<<<<<<<<<
 * 
 *     # solve
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_val); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 1361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1357
 *         return toReal(val)
 * 
 *     def getMumpsRinfog(self, icntl):             # <<<<<<<<<<<<<<
 *         cdef PetscInt _icntl = asInt(icntl)
 *         cdef PetscReal val = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getMumpsRinfog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1365
 *     # solve
 * 
 *     def solveForward(self, Vec b not None, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatForwardSolve(self.mat, b.vec, x.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_347solveForward(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_346solveForward[] = "Mat.solveForward(self, Vec b, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_347solveForward(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_b = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solveForward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_x,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solveForward", 1, 2, 2, 1); __PYX_ERR(33, 1365, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solveForward") < 0)) __PYX_ERR(33, 1365, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_b = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solveForward", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1365, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.solveForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "b", 0))) __PYX_ERR(33, 1365, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1365, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_346solveForward(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_b, __pyx_v_x);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_346solveForward(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("solveForward", 0);

  /* "PETSc/Mat.pyx":1366
 * 
 *     def solveForward(self, Vec b not None, Vec x not None):
 *         CHKERR( MatForwardSolve(self.mat, b.vec, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def solveBackward(self, Vec b not None, Vec x not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatForwardSolve(__pyx_v_self->mat, __pyx_v_b->vec, __pyx_v_x->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1366, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1365
 *     # solve
 * 
 *     def solveForward(self, Vec b not None, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatForwardSolve(self.mat, b.vec, x.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.solveForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1368
 *         CHKERR( MatForwardSolve(self.mat, b.vec, x.vec) )
 * 
 *     def solveBackward(self, Vec b not None, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatBackwardSolve(self.mat, b.vec, x.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_349solveBackward(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_348solveBackward[] = "Mat.solveBackward(self, Vec b, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_349solveBackward(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_b = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solveBackward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_x,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solveBackward", 1, 2, 2, 1); __PYX_ERR(33, 1368, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solveBackward") < 0)) __PYX_ERR(33, 1368, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_b = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solveBackward", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1368, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.solveBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "b", 0))) __PYX_ERR(33, 1368, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1368, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_348solveBackward(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_b, __pyx_v_x);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_348solveBackward(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("solveBackward", 0);

  /* "PETSc/Mat.pyx":1369
 * 
 *     def solveBackward(self, Vec b not None, Vec x not None):
 *         CHKERR( MatBackwardSolve(self.mat, b.vec, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def solve(self, Vec b not None, Vec x not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatBackwardSolve(__pyx_v_self->mat, __pyx_v_b->vec, __pyx_v_x->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1369, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1368
 *         CHKERR( MatForwardSolve(self.mat, b.vec, x.vec) )
 * 
 *     def solveBackward(self, Vec b not None, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatBackwardSolve(self.mat, b.vec, x.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.solveBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1371
 *         CHKERR( MatBackwardSolve(self.mat, b.vec, x.vec) )
 * 
 *     def solve(self, Vec b not None, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSolve(self.mat, b.vec, x.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_351solve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_350solve[] = "Mat.solve(self, Vec b, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_351solve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_b = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_x,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solve", 1, 2, 2, 1); __PYX_ERR(33, 1371, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solve") < 0)) __PYX_ERR(33, 1371, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_b = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1371, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "b", 0))) __PYX_ERR(33, 1371, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1371, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_350solve(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_b, __pyx_v_x);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_350solve(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("solve", 0);

  /* "PETSc/Mat.pyx":1372
 * 
 *     def solve(self, Vec b not None, Vec x not None):
 *         CHKERR( MatSolve(self.mat, b.vec, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def solveTranspose(self, Vec b not None, Vec x not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSolve(__pyx_v_self->mat, __pyx_v_b->vec, __pyx_v_x->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1372, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1371
 *         CHKERR( MatBackwardSolve(self.mat, b.vec, x.vec) )
 * 
 *     def solve(self, Vec b not None, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSolve(self.mat, b.vec, x.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1374
 *         CHKERR( MatSolve(self.mat, b.vec, x.vec) )
 * 
 *     def solveTranspose(self, Vec b not None, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSolveTranspose(self.mat, b.vec, x.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_353solveTranspose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_352solveTranspose[] = "Mat.solveTranspose(self, Vec b, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_353solveTranspose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_b = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solveTranspose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_x,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solveTranspose", 1, 2, 2, 1); __PYX_ERR(33, 1374, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solveTranspose") < 0)) __PYX_ERR(33, 1374, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_b = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solveTranspose", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1374, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.solveTranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "b", 0))) __PYX_ERR(33, 1374, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1374, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_352solveTranspose(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_b, __pyx_v_x);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_352solveTranspose(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("solveTranspose", 0);

  /* "PETSc/Mat.pyx":1375
 * 
 *     def solveTranspose(self, Vec b not None, Vec x not None):
 *         CHKERR( MatSolveTranspose(self.mat, b.vec, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def solveAdd(self, Vec b not None, Vec y, Vec x not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSolveTranspose(__pyx_v_self->mat, __pyx_v_b->vec, __pyx_v_x->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1375, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1374
 *         CHKERR( MatSolve(self.mat, b.vec, x.vec) )
 * 
 *     def solveTranspose(self, Vec b not None, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSolveTranspose(self.mat, b.vec, x.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.solveTranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1377
 *         CHKERR( MatSolveTranspose(self.mat, b.vec, x.vec) )
 * 
 *     def solveAdd(self, Vec b not None, Vec y, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSolveAdd(self.mat, b.vec, y.vec, x.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_355solveAdd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_354solveAdd[] = "Mat.solveAdd(self, Vec b, Vec y, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_355solveAdd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_b = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solveAdd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_y,&__pyx_n_s_x,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solveAdd", 1, 3, 3, 1); __PYX_ERR(33, 1377, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solveAdd", 1, 3, 3, 2); __PYX_ERR(33, 1377, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solveAdd") < 0)) __PYX_ERR(33, 1377, __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_b = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_x = ((struct PyPetscVecObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solveAdd", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1377, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.solveAdd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "b", 0))) __PYX_ERR(33, 1377, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "y", 0))) __PYX_ERR(33, 1377, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1377, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_354solveAdd(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_b, __pyx_v_y, __pyx_v_x);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_354solveAdd(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_y, struct PyPetscVecObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("solveAdd", 0);

  /* "PETSc/Mat.pyx":1378
 * 
 *     def solveAdd(self, Vec b not None, Vec y, Vec x not None):
 *         CHKERR( MatSolveAdd(self.mat, b.vec, y.vec, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def solveTransposeAdd(self, Vec b not None, Vec y, Vec x not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSolveAdd(__pyx_v_self->mat, __pyx_v_b->vec, __pyx_v_y->vec, __pyx_v_x->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1378, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1377
 *         CHKERR( MatSolveTranspose(self.mat, b.vec, x.vec) )
 * 
 *     def solveAdd(self, Vec b not None, Vec y, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSolveAdd(self.mat, b.vec, y.vec, x.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.solveAdd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1380
 *         CHKERR( MatSolveAdd(self.mat, b.vec, y.vec, x.vec) )
 * 
 *     def solveTransposeAdd(self, Vec b not None, Vec y, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSolveTransposeAdd(self.mat, b.vec, y.vec, x.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_357solveTransposeAdd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_356solveTransposeAdd[] = "Mat.solveTransposeAdd(self, Vec b, Vec y, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_357solveTransposeAdd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_b = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solveTransposeAdd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_y,&__pyx_n_s_x,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solveTransposeAdd", 1, 3, 3, 1); __PYX_ERR(33, 1380, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solveTransposeAdd", 1, 3, 3, 2); __PYX_ERR(33, 1380, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solveTransposeAdd") < 0)) __PYX_ERR(33, 1380, __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_b = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_x = ((struct PyPetscVecObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solveTransposeAdd", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1380, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.solveTransposeAdd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "b", 0))) __PYX_ERR(33, 1380, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "y", 0))) __PYX_ERR(33, 1380, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(33, 1380, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_356solveTransposeAdd(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_b, __pyx_v_y, __pyx_v_x);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_356solveTransposeAdd(struct PyPetscMatObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_y, struct PyPetscVecObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("solveTransposeAdd", 0);

  /* "PETSc/Mat.pyx":1381
 * 
 *     def solveTransposeAdd(self, Vec b not None, Vec y, Vec x not None):
 *         CHKERR( MatSolveTransposeAdd(self.mat, b.vec, y.vec, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def matSolve(self, Mat B not None, Mat X not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatSolveTransposeAdd(__pyx_v_self->mat, __pyx_v_b->vec, __pyx_v_y->vec, __pyx_v_x->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1381, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1380
 *         CHKERR( MatSolveAdd(self.mat, b.vec, y.vec, x.vec) )
 * 
 *     def solveTransposeAdd(self, Vec b not None, Vec y, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatSolveTransposeAdd(self.mat, b.vec, y.vec, x.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.solveTransposeAdd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1383
 *         CHKERR( MatSolveTransposeAdd(self.mat, b.vec, y.vec, x.vec) )
 * 
 *     def matSolve(self, Mat B not None, Mat X not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMatSolve(self.mat, B.mat, X.mat) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_359matSolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_358matSolve[] = "Mat.matSolve(self, Mat B, Mat X)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_359matSolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_B = 0;
  struct PyPetscMatObject *__pyx_v_X = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matSolve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,&__pyx_n_s_X,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_B)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matSolve", 1, 2, 2, 1); __PYX_ERR(33, 1383, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matSolve") < 0)) __PYX_ERR(33, 1383, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_B = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_X = ((struct PyPetscMatObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matSolve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1383, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.matSolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "B", 0))) __PYX_ERR(33, 1383, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "X", 0))) __PYX_ERR(33, 1383, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_358matSolve(((struct PyPetscMatObject *)__pyx_v_self), __pyx_v_B, __pyx_v_X);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_358matSolve(struct PyPetscMatObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_B, struct PyPetscMatObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("matSolve", 0);

  /* "PETSc/Mat.pyx":1384
 * 
 *     def matSolve(self, Mat B not None, Mat X not None):
 *         CHKERR( MatMatSolve(self.mat, B.mat, X.mat) )             # <<<<<<<<<<<<<<
 * 
 *     # dense matrices
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatSolve(__pyx_v_self->mat, __pyx_v_B->mat, __pyx_v_X->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1384, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1383
 *         CHKERR( MatSolveTransposeAdd(self.mat, b.vec, y.vec, x.vec) )
 * 
 *     def matSolve(self, Mat B not None, Mat X not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatMatSolve(self.mat, B.mat, X.mat) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.matSolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1388
 *     # dense matrices
 * 
 *     def getDenseArray(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt m=0, N=0, lda=0
 *         cdef PetscScalar *data = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_361getDenseArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_360getDenseArray[] = "Mat.getDenseArray(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_361getDenseArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDenseArray (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDenseArray", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDenseArray", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_360getDenseArray(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_360getDenseArray(struct PyPetscMatObject *__pyx_v_self) {
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_N;
  PetscInt __pyx_v_lda;
  PetscScalar *__pyx_v_data;
  int __pyx_v_typenum;
  int __pyx_v_itemsize;
  int __pyx_v_flags;
  npy_intp __pyx_v_dims[2];
  npy_intp __pyx_v_strides[2];
  PyObject *__pyx_v_array = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getDenseArray", 0);

  /* "PETSc/Mat.pyx":1389
 * 
 *     def getDenseArray(self):
 *         cdef PetscInt m=0, N=0, lda=0             # <<<<<<<<<<<<<<
 *         cdef PetscScalar *data = NULL
 *         CHKERR( MatGetLocalSize(self.mat, &m, NULL) )
 */
  __pyx_v_m = 0;
  __pyx_v_N = 0;
  __pyx_v_lda = 0;

  /* "PETSc/Mat.pyx":1390
 *     def getDenseArray(self):
 *         cdef PetscInt m=0, N=0, lda=0
 *         cdef PetscScalar *data = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetLocalSize(self.mat, &m, NULL) )
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 */
  __pyx_v_data = NULL;

  /* "PETSc/Mat.pyx":1391
 *         cdef PetscInt m=0, N=0, lda=0
 *         cdef PetscScalar *data = NULL
 *         CHKERR( MatGetLocalSize(self.mat, &m, NULL) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 *         lda = m # CHKERR( MatDenseGetLDA(self.mat, &ld) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetLocalSize(__pyx_v_self->mat, (&__pyx_v_m), NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1391, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1392
 *         cdef PetscScalar *data = NULL
 *         CHKERR( MatGetLocalSize(self.mat, &m, NULL) )
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )             # <<<<<<<<<<<<<<
 *         lda = m # CHKERR( MatDenseGetLDA(self.mat, &ld) )
 *         CHKERR( MatDenseGetArray(self.mat, &data) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatGetSize(__pyx_v_self->mat, NULL, (&__pyx_v_N))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1392, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1393
 *         CHKERR( MatGetLocalSize(self.mat, &m, NULL) )
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 *         lda = m # CHKERR( MatDenseGetLDA(self.mat, &ld) )             # <<<<<<<<<<<<<<
 *         CHKERR( MatDenseGetArray(self.mat, &data) )
 *         cdef int typenum = NPY_PETSC_SCALAR
 */
  __pyx_v_lda = __pyx_v_m;

  /* "PETSc/Mat.pyx":1394
 *         CHKERR( MatGetSize(self.mat, NULL, &N) )
 *         lda = m # CHKERR( MatDenseGetLDA(self.mat, &ld) )
 *         CHKERR( MatDenseGetArray(self.mat, &data) )             # <<<<<<<<<<<<<<
 *         cdef int typenum = NPY_PETSC_SCALAR
 *         cdef int itemsize = <int>sizeof(PetscScalar)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDenseGetArray(__pyx_v_self->mat, (&__pyx_v_data))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1394, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1395
 *         lda = m # CHKERR( MatDenseGetLDA(self.mat, &ld) )
 *         CHKERR( MatDenseGetArray(self.mat, &data) )
 *         cdef int typenum = NPY_PETSC_SCALAR             # <<<<<<<<<<<<<<
 *         cdef int itemsize = <int>sizeof(PetscScalar)
 *         cdef int flags = NPY_ARRAY_FARRAY
 */
  __pyx_v_typenum = NPY_PETSC_SCALAR;

  /* "PETSc/Mat.pyx":1396
 *         CHKERR( MatDenseGetArray(self.mat, &data) )
 *         cdef int typenum = NPY_PETSC_SCALAR
 *         cdef int itemsize = <int>sizeof(PetscScalar)             # <<<<<<<<<<<<<<
 *         cdef int flags = NPY_ARRAY_FARRAY
 *         cdef npy_intp dims[2], strides[2]
 */
  __pyx_v_itemsize = ((int)(sizeof(PetscScalar)));

  /* "PETSc/Mat.pyx":1397
 *         cdef int typenum = NPY_PETSC_SCALAR
 *         cdef int itemsize = <int>sizeof(PetscScalar)
 *         cdef int flags = NPY_ARRAY_FARRAY             # <<<<<<<<<<<<<<
 *         cdef npy_intp dims[2], strides[2]
 *         dims[0] = <npy_intp>m; strides[0] = <npy_intp>sizeof(PetscScalar);
 */
  __pyx_v_flags = NPY_ARRAY_FARRAY;

  /* "PETSc/Mat.pyx":1399
 *         cdef int flags = NPY_ARRAY_FARRAY
 *         cdef npy_intp dims[2], strides[2]
 *         dims[0] = <npy_intp>m; strides[0] = <npy_intp>sizeof(PetscScalar);             # <<<<<<<<<<<<<<
 *         dims[1] = <npy_intp>N; strides[1] = <npy_intp>(lda*sizeof(PetscScalar));
 *         array = <object>PyArray_New(<PyTypeObject*>ndarray, 2, dims, typenum,
 */
  (__pyx_v_dims[0]) = ((npy_intp)__pyx_v_m);
  (__pyx_v_strides[0]) = ((npy_intp)(sizeof(PetscScalar)));

  /* "PETSc/Mat.pyx":1400
 *         cdef npy_intp dims[2], strides[2]
 *         dims[0] = <npy_intp>m; strides[0] = <npy_intp>sizeof(PetscScalar);
 *         dims[1] = <npy_intp>N; strides[1] = <npy_intp>(lda*sizeof(PetscScalar));             # <<<<<<<<<<<<<<
 *         array = <object>PyArray_New(<PyTypeObject*>ndarray, 2, dims, typenum,
 *                                     strides, data, itemsize, flags, NULL)
 */
  (__pyx_v_dims[1]) = ((npy_intp)__pyx_v_N);
  (__pyx_v_strides[1]) = ((npy_intp)(__pyx_v_lda * (sizeof(PetscScalar))));

  /* "PETSc/Mat.pyx":1401
 *         dims[0] = <npy_intp>m; strides[0] = <npy_intp>sizeof(PetscScalar);
 *         dims[1] = <npy_intp>N; strides[1] = <npy_intp>(lda*sizeof(PetscScalar));
 *         array = <object>PyArray_New(<PyTypeObject*>ndarray, 2, dims, typenum,             # <<<<<<<<<<<<<<
 *                                     strides, data, itemsize, flags, NULL)
 *         CHKERR( MatDenseRestoreArray(self.mat, &data) )
 */
  __pyx_t_2 = PyArray_New(((PyTypeObject *)__pyx_ptype_8petsc4py_5PETSc_ndarray), 2, __pyx_v_dims, __pyx_v_typenum, __pyx_v_strides, __pyx_v_data, __pyx_v_itemsize, __pyx_v_flags, NULL);
  __pyx_t_3 = ((PyObject *)__pyx_t_2);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_array = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/Mat.pyx":1403
 *         array = <object>PyArray_New(<PyTypeObject*>ndarray, 2, dims, typenum,
 *                                     strides, data, itemsize, flags, NULL)
 *         CHKERR( MatDenseRestoreArray(self.mat, &data) )             # <<<<<<<<<<<<<<
 *         return array
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDenseRestoreArray(__pyx_v_self->mat, (&__pyx_v_data))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1403, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1404
 *                                     strides, data, itemsize, flags, NULL)
 *         CHKERR( MatDenseRestoreArray(self.mat, &data) )
 *         return array             # <<<<<<<<<<<<<<
 * 
 *     def getDenseLocalMatrix(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_array);
  __pyx_r = __pyx_v_array;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1388
 *     # dense matrices
 * 
 *     def getDenseArray(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt m=0, N=0, lda=0
 *         cdef PetscScalar *data = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getDenseArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1406
 *         return array
 * 
 *     def getDenseLocalMatrix(self):             # <<<<<<<<<<<<<<
 *         cdef Mat mat = type(self)()
 *         CHKERR( MatDenseGetLocalMatrix(self.mat, &mat.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_363getDenseLocalMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3Mat_362getDenseLocalMatrix[] = "Mat.getDenseLocalMatrix(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_363getDenseLocalMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDenseLocalMatrix (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDenseLocalMatrix", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDenseLocalMatrix", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_362getDenseLocalMatrix(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_362getDenseLocalMatrix(struct PyPetscMatObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_mat = 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;
  __Pyx_RefNannySetupContext("getDenseLocalMatrix", 0);

  /* "PETSc/Mat.pyx":1407
 * 
 *     def getDenseLocalMatrix(self):
 *         cdef Mat mat = type(self)()             # <<<<<<<<<<<<<<
 *         CHKERR( MatDenseGetLocalMatrix(self.mat, &mat.mat) )
 *         PetscINCREF(mat.obj)
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __pyx_t_2 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1407, __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(33, 1407, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_Mat))))) __PYX_ERR(33, 1407, __pyx_L1_error)
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":1408
 *     def getDenseLocalMatrix(self):
 *         cdef Mat mat = type(self)()
 *         CHKERR( MatDenseGetLocalMatrix(self.mat, &mat.mat) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(mat.obj)
 *         return mat
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatDenseGetLocalMatrix(__pyx_v_self->mat, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1408, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1409
 *         cdef Mat mat = type(self)()
 *         CHKERR( MatDenseGetLocalMatrix(self.mat, &mat.mat) )
 *         PetscINCREF(mat.obj)             # <<<<<<<<<<<<<<
 *         return mat
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_mat->__pyx_base.obj);

  /* "PETSc/Mat.pyx":1410
 *         CHKERR( MatDenseGetLocalMatrix(self.mat, &mat.mat) )
 *         PetscINCREF(mat.obj)
 *         return mat             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = ((PyObject *)__pyx_v_mat);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1406
 *         return array
 * 
 *     def getDenseLocalMatrix(self):             # <<<<<<<<<<<<<<
 *         cdef Mat mat = type(self)()
 *         CHKERR( MatDenseGetLocalMatrix(self.mat, &mat.mat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.getDenseLocalMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1415
 * 
 *     property sizes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSizes()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_5sizes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_5sizes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_5sizes___get__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_5sizes___get__(struct PyPetscMatObject *__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);

  /* "PETSc/Mat.pyx":1416
 *     property sizes:
 *         def __get__(self):
 *             return self.getSizes()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setSizes(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSizes); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(33, 1416, __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(33, 1416, __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;

  /* "PETSc/Mat.pyx":1415
 * 
 *     property sizes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSizes()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.sizes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1417
 *         def __get__(self):
 *             return self.getSizes()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setSizes(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3Mat_5sizes_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3Mat_5sizes_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_5sizes_2__set__(((struct PyPetscMatObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8petsc4py_5PETSc_3Mat_5sizes_2__set__(struct PyPetscMatObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/Mat.pyx":1418
 *             return self.getSizes()
 *         def __set__(self, value):
 *             self.setSizes(value)             # <<<<<<<<<<<<<<
 * 
 *     property size:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setSizes); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1418, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1418, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":1417
 *         def __get__(self):
 *             return self.getSizes()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setSizes(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.sizes.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1421
 * 
 *     property size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSize()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_4size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_4size___get__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_4size___get__(struct PyPetscMatObject *__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);

  /* "PETSc/Mat.pyx":1422
 *     property size:
 *         def __get__(self):
 *             return self.getSize()             # <<<<<<<<<<<<<<
 * 
 *     property local_size:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(33, 1422, __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(33, 1422, __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;

  /* "PETSc/Mat.pyx":1421
 * 
 *     property size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSize()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1425
 * 
 *     property local_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getLocalSize()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_10local_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_10local_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_10local_size___get__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_10local_size___get__(struct PyPetscMatObject *__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);

  /* "PETSc/Mat.pyx":1426
 *     property local_size:
 *         def __get__(self):
 *             return self.getLocalSize()             # <<<<<<<<<<<<<<
 * 
 *     property block_size:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getLocalSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(33, 1426, __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(33, 1426, __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;

  /* "PETSc/Mat.pyx":1425
 * 
 *     property local_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getLocalSize()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.local_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1429
 * 
 *     property block_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockSize()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_10block_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_10block_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_10block_size___get__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_10block_size___get__(struct PyPetscMatObject *__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);

  /* "PETSc/Mat.pyx":1430
 *     property block_size:
 *         def __get__(self):
 *             return self.getBlockSize()             # <<<<<<<<<<<<<<
 * 
 *     property block_sizes:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getBlockSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(33, 1430, __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(33, 1430, __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;

  /* "PETSc/Mat.pyx":1429
 * 
 *     property block_size:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockSize()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.block_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1433
 * 
 *     property block_sizes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockSizes()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_11block_sizes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_11block_sizes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_11block_sizes___get__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_11block_sizes___get__(struct PyPetscMatObject *__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);

  /* "PETSc/Mat.pyx":1434
 *     property block_sizes:
 *         def __get__(self):
 *             return self.getBlockSizes()             # <<<<<<<<<<<<<<
 * 
 *     property owner_range:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getBlockSizes); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(33, 1434, __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(33, 1434, __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;

  /* "PETSc/Mat.pyx":1433
 * 
 *     property block_sizes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBlockSizes()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.block_sizes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1437
 * 
 *     property owner_range:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOwnershipRange()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_11owner_range_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_11owner_range_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_11owner_range___get__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_11owner_range___get__(struct PyPetscMatObject *__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);

  /* "PETSc/Mat.pyx":1438
 *     property owner_range:
 *         def __get__(self):
 *             return self.getOwnershipRange()             # <<<<<<<<<<<<<<
 * 
 *     property owner_ranges:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getOwnershipRange); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(33, 1438, __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(33, 1438, __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;

  /* "PETSc/Mat.pyx":1437
 * 
 *     property owner_range:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOwnershipRange()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.owner_range.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1441
 * 
 *     property owner_ranges:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOwnershipRanges()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_12owner_ranges_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_12owner_ranges_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_12owner_ranges___get__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_12owner_ranges___get__(struct PyPetscMatObject *__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);

  /* "PETSc/Mat.pyx":1442
 *     property owner_ranges:
 *         def __get__(self):
 *             return self.getOwnershipRanges()             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getOwnershipRanges); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(33, 1442, __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(33, 1442, __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;

  /* "PETSc/Mat.pyx":1441
 * 
 *     property owner_ranges:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOwnershipRanges()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.owner_ranges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1447
 * 
 *     property assembled:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isAssembled()
 *     property symmetric:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_9assembled_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_9assembled_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_9assembled___get__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_9assembled___get__(struct PyPetscMatObject *__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);

  /* "PETSc/Mat.pyx":1448
 *     property assembled:
 *         def __get__(self):
 *             return self.isAssembled()             # <<<<<<<<<<<<<<
 *     property symmetric:
 *         def __get__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_isAssembled); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(33, 1448, __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(33, 1448, __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;

  /* "PETSc/Mat.pyx":1447
 * 
 *     property assembled:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isAssembled()
 *     property symmetric:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.assembled.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1450
 *             return self.isAssembled()
 *     property symmetric:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isSymmetric()
 *     property hermitian:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_9symmetric_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_9symmetric_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_9symmetric___get__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_9symmetric___get__(struct PyPetscMatObject *__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);

  /* "PETSc/Mat.pyx":1451
 *     property symmetric:
 *         def __get__(self):
 *             return self.isSymmetric()             # <<<<<<<<<<<<<<
 *     property hermitian:
 *         def __get__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_isSymmetric); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(33, 1451, __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(33, 1451, __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;

  /* "PETSc/Mat.pyx":1450
 *             return self.isAssembled()
 *     property symmetric:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isSymmetric()
 *     property hermitian:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.symmetric.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1453
 *             return self.isSymmetric()
 *     property hermitian:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isHermitian()
 *     property structsymm:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_9hermitian_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_9hermitian_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_9hermitian___get__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_9hermitian___get__(struct PyPetscMatObject *__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);

  /* "PETSc/Mat.pyx":1454
 *     property hermitian:
 *         def __get__(self):
 *             return self.isHermitian()             # <<<<<<<<<<<<<<
 *     property structsymm:
 *         def __get__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_isHermitian); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(33, 1454, __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(33, 1454, __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;

  /* "PETSc/Mat.pyx":1453
 *             return self.isSymmetric()
 *     property hermitian:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isHermitian()
 *     property structsymm:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.hermitian.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1456
 *             return self.isHermitian()
 *     property structsymm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isStructurallySymmetric()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_10structsymm_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3Mat_10structsymm_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3Mat_10structsymm___get__(((struct PyPetscMatObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_3Mat_10structsymm___get__(struct PyPetscMatObject *__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);

  /* "PETSc/Mat.pyx":1457
 *     property structsymm:
 *         def __get__(self):
 *             return self.isStructurallySymmetric()             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_isStructurallySymmetric); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(33, 1457, __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(33, 1457, __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;

  /* "PETSc/Mat.pyx":1456
 *             return self.isHermitian()
 *     property structsymm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.isStructurallySymmetric()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.Mat.structsymm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1465
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj  = <PetscObject*> &self.nsp
 *         self.nsp = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_9NullSpace_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_9NullSpace_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_9NullSpace___cinit__(((struct PyPetscNullSpaceObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_9NullSpace___cinit__(struct PyPetscNullSpaceObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Mat.pyx":1466
 * 
 *     def __cinit__(self):
 *         self.obj  = <PetscObject*> &self.nsp             # <<<<<<<<<<<<<<
 *         self.nsp = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->nsp));

  /* "PETSc/Mat.pyx":1467
 *     def __cinit__(self):
 *         self.obj  = <PetscObject*> &self.nsp
 *         self.nsp = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, vec):
 */
  __pyx_v_self->nsp = NULL;

  /* "PETSc/Mat.pyx":1465
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj  = <PetscObject*> &self.nsp
 *         self.nsp = NULL
 */

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

/* "PETSc/Mat.pyx":1469
 *         self.nsp = NULL
 * 
 *     def __call__(self, vec):             # <<<<<<<<<<<<<<
 *         self.remove(vec)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "__call__") < 0)) __PYX_ERR(33, 1469, __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_vec = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1469, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_9NullSpace_2__call__(((struct PyPetscNullSpaceObject *)__pyx_v_self), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_2__call__(struct PyPetscNullSpaceObject *__pyx_v_self, PyObject *__pyx_v_vec) {
  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_RefNannySetupContext("__call__", 0);

  /* "PETSc/Mat.pyx":1470
 * 
 *     def __call__(self, vec):
 *         self.remove(vec)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_vec); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1470, __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_vec);
    __Pyx_GIVEREF(__pyx_v_vec);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_vec);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1470, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Mat.pyx":1469
 *         self.nsp = NULL
 * 
 *     def __call__(self, vec):             # <<<<<<<<<<<<<<
 *         self.remove(vec)
 * 
 */

  /* 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1474
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_9NullSpace_4view[] = "NullSpace.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(33, 1474, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1474, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(33, 1474, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_9NullSpace_4view(((struct PyPetscNullSpaceObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_4view(struct PyPetscNullSpaceObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/Mat.pyx":1475
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( MatNullSpaceView(self.nsp, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/Mat.pyx":1476
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( MatNullSpaceView(self.nsp, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/Mat.pyx":1477
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( MatNullSpaceView(self.nsp, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatNullSpaceView(__pyx_v_self->nsp, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1477, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1474
 *     #
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1479
 *         CHKERR( MatNullSpaceView(self.nsp, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatNullSpaceDestroy(&self.nsp) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_9NullSpace_6destroy[] = "NullSpace.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_9NullSpace_6destroy(((struct PyPetscNullSpaceObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_6destroy(struct PyPetscNullSpaceObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/Mat.pyx":1480
 * 
 *     def destroy(self):
 *         CHKERR( MatNullSpaceDestroy(&self.nsp) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatNullSpaceDestroy((&__pyx_v_self->nsp))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1480, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1481
 *     def destroy(self):
 *         CHKERR( MatNullSpaceDestroy(&self.nsp) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, constant=False, vectors=(),  comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1479
 *         CHKERR( MatNullSpaceView(self.nsp, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( MatNullSpaceDestroy(&self.nsp) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1483
 *         return self
 * 
 *     def create(self, constant=False, vectors=(),  comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool has_const = PETSC_FALSE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_9NullSpace_8create[] = "NullSpace.create(self, constant=False, vectors=(), comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_constant = 0;
  PyObject *__pyx_v_vectors = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_constant,&__pyx_n_s_vectors,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_False);
    values[1] = ((PyObject *)__pyx_empty_tuple);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_constant);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vectors);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(33, 1483, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_constant = values[0];
    __pyx_v_vectors = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1483, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_9NullSpace_8create(((struct PyPetscNullSpaceObject *)__pyx_v_self), __pyx_v_constant, __pyx_v_vectors, __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_8create(struct PyPetscNullSpaceObject *__pyx_v_self, PyObject *__pyx_v_constant, PyObject *__pyx_v_vectors, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscBool __pyx_v_has_const;
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_nv;
  Vec *__pyx_v_v;
  CYTHON_UNUSED PyObject *__pyx_v_tmp2 = 0;
  MatNullSpace __pyx_v_newnsp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PetscInt __pyx_t_6;
  Vec __pyx_t_7;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/Mat.pyx":1484
 * 
 *     def create(self, constant=False, vectors=(),  comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscBool has_const = PETSC_FALSE
 *         if constant: has_const = PETSC_TRUE
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(33, 1484, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Mat.pyx":1485
 *     def create(self, constant=False, vectors=(),  comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool has_const = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if constant: has_const = PETSC_TRUE
 *         cdef PetscInt i = 0, nv = <PetscInt>len(vectors)
 */
  __pyx_v_has_const = PETSC_FALSE;

  /* "PETSc/Mat.pyx":1486
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool has_const = PETSC_FALSE
 *         if constant: has_const = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         cdef PetscInt i = 0, nv = <PetscInt>len(vectors)
 *         cdef PetscVec *v = NULL
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_constant); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(33, 1486, __pyx_L1_error)
  if (__pyx_t_2) {
    __pyx_v_has_const = PETSC_TRUE;
  }

  /* "PETSc/Mat.pyx":1487
 *         cdef PetscBool has_const = PETSC_FALSE
 *         if constant: has_const = PETSC_TRUE
 *         cdef PetscInt i = 0, nv = <PetscInt>len(vectors)             # <<<<<<<<<<<<<<
 *         cdef PetscVec *v = NULL
 *         cdef object tmp2 = oarray_p(empty_p(nv), NULL, <void**>&v)
 */
  __pyx_v_i = 0;
  __pyx_t_3 = PyObject_Length(__pyx_v_vectors); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 1487, __pyx_L1_error)
  __pyx_v_nv = ((PetscInt)__pyx_t_3);

  /* "PETSc/Mat.pyx":1488
 *         if constant: has_const = PETSC_TRUE
 *         cdef PetscInt i = 0, nv = <PetscInt>len(vectors)
 *         cdef PetscVec *v = NULL             # <<<<<<<<<<<<<<
 *         cdef object tmp2 = oarray_p(empty_p(nv), NULL, <void**>&v)
 *         for i from 0 <= i < nv:
 */
  __pyx_v_v = NULL;

  /* "PETSc/Mat.pyx":1489
 *         cdef PetscInt i = 0, nv = <PetscInt>len(vectors)
 *         cdef PetscVec *v = NULL
 *         cdef object tmp2 = oarray_p(empty_p(nv), NULL, <void**>&v)             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < nv:
 *             v[i] = (<Vec?>(vectors[<Py_ssize_t>i])).vec
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_nv)); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_4, NULL, ((void **)(&__pyx_v_v)))); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 1489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_tmp2 = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "PETSc/Mat.pyx":1490
 *         cdef PetscVec *v = NULL
 *         cdef object tmp2 = oarray_p(empty_p(nv), NULL, <void**>&v)
 *         for i from 0 <= i < nv:             # <<<<<<<<<<<<<<
 *             v[i] = (<Vec?>(vectors[<Py_ssize_t>i])).vec
 *         cdef PetscNullSpace newnsp = NULL
 */
  __pyx_t_6 = __pyx_v_nv;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {

    /* "PETSc/Mat.pyx":1491
 *         cdef object tmp2 = oarray_p(empty_p(nv), NULL, <void**>&v)
 *         for i from 0 <= i < nv:
 *             v[i] = (<Vec?>(vectors[<Py_ssize_t>i])).vec             # <<<<<<<<<<<<<<
 *         cdef PetscNullSpace newnsp = NULL
 *         CHKERR( MatNullSpaceCreate(ccomm, has_const, nv, v, &newnsp) )
 */
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_vectors, ((Py_ssize_t)__pyx_v_i), Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 1491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_8petsc4py_5PETSc_Vec)))) __PYX_ERR(33, 1491, __pyx_L1_error)
    __pyx_t_7 = ((struct PyPetscVecObject *)__pyx_t_5)->vec;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    (__pyx_v_v[__pyx_v_i]) = __pyx_t_7;
  }

  /* "PETSc/Mat.pyx":1492
 *         for i from 0 <= i < nv:
 *             v[i] = (<Vec?>(vectors[<Py_ssize_t>i])).vec
 *         cdef PetscNullSpace newnsp = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatNullSpaceCreate(ccomm, has_const, nv, v, &newnsp) )
 *         PetscCLEAR(self.obj); self.nsp = newnsp
 */
  __pyx_v_newnsp = NULL;

  /* "PETSc/Mat.pyx":1493
 *             v[i] = (<Vec?>(vectors[<Py_ssize_t>i])).vec
 *         cdef PetscNullSpace newnsp = NULL
 *         CHKERR( MatNullSpaceCreate(ccomm, has_const, nv, v, &newnsp) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.nsp = newnsp
 *         return self
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatNullSpaceCreate(__pyx_v_ccomm, __pyx_v_has_const, __pyx_v_nv, __pyx_v_v, (&__pyx_v_newnsp))); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(33, 1493, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1494
 *         cdef PetscNullSpace newnsp = NULL
 *         CHKERR( MatNullSpaceCreate(ccomm, has_const, nv, v, &newnsp) )
 *         PetscCLEAR(self.obj); self.nsp = newnsp             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->nsp = __pyx_v_newnsp;

  /* "PETSc/Mat.pyx":1495
 *         CHKERR( MatNullSpaceCreate(ccomm, has_const, nv, v, &newnsp) )
 *         PetscCLEAR(self.obj); self.nsp = newnsp
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createRigidBody(self, Vec coords not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1483
 *         return self
 * 
 *     def create(self, constant=False, vectors=(),  comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool has_const = PETSC_FALSE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1497
 *         return self
 * 
 *     def createRigidBody(self, Vec coords not None):             # <<<<<<<<<<<<<<
 *         cdef PetscNullSpace newnsp = NULL
 *         CHKERR( MatNullSpaceCreateRigidBody(coords.vec, &newnsp) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_11createRigidBody(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_9NullSpace_10createRigidBody[] = "NullSpace.createRigidBody(self, Vec coords)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_11createRigidBody(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_coords = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createRigidBody (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coords,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);
        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_coords)) != 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, "createRigidBody") < 0)) __PYX_ERR(33, 1497, __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_coords = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createRigidBody", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1497, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.createRigidBody", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coords), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "coords", 0))) __PYX_ERR(33, 1497, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_9NullSpace_10createRigidBody(((struct PyPetscNullSpaceObject *)__pyx_v_self), __pyx_v_coords);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_10createRigidBody(struct PyPetscNullSpaceObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_coords) {
  MatNullSpace __pyx_v_newnsp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("createRigidBody", 0);

  /* "PETSc/Mat.pyx":1498
 * 
 *     def createRigidBody(self, Vec coords not None):
 *         cdef PetscNullSpace newnsp = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatNullSpaceCreateRigidBody(coords.vec, &newnsp) )
 *         PetscCLEAR(self.obj); self.nsp = newnsp
 */
  __pyx_v_newnsp = NULL;

  /* "PETSc/Mat.pyx":1499
 *     def createRigidBody(self, Vec coords not None):
 *         cdef PetscNullSpace newnsp = NULL
 *         CHKERR( MatNullSpaceCreateRigidBody(coords.vec, &newnsp) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.nsp = newnsp
 *         return self
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatNullSpaceCreateRigidBody(__pyx_v_coords->vec, (&__pyx_v_newnsp))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1499, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1500
 *         cdef PetscNullSpace newnsp = NULL
 *         CHKERR( MatNullSpaceCreateRigidBody(coords.vec, &newnsp) )
 *         PetscCLEAR(self.obj); self.nsp = newnsp             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->nsp = __pyx_v_newnsp;

  /* "PETSc/Mat.pyx":1501
 *         CHKERR( MatNullSpaceCreateRigidBody(coords.vec, &newnsp) )
 *         PetscCLEAR(self.obj); self.nsp = newnsp
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setFunction(self, function, args=None, kargs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1497
 *         return self
 * 
 *     def createRigidBody(self, Vec coords not None):             # <<<<<<<<<<<<<<
 *         cdef PetscNullSpace newnsp = NULL
 *         CHKERR( MatNullSpaceCreateRigidBody(coords.vec, &newnsp) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.createRigidBody", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1503
 *         return self
 * 
 *     def setFunction(self, function, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if function is not None:
 *             CHKERR( MatNullSpaceSetFunction(
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_13setFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_9NullSpace_12setFunction[] = "NullSpace.setFunction(self, function, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_13setFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_function = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFunction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_function,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_function)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFunction") < 0)) __PYX_ERR(33, 1503, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_function = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFunction", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1503, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.setFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_9NullSpace_12setFunction(((struct PyPetscNullSpaceObject *)__pyx_v_self), __pyx_v_function, __pyx_v_args, __pyx_v_kargs);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_12setFunction(struct PyPetscNullSpaceObject *__pyx_v_self, PyObject *__pyx_v_function, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("setFunction", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/Mat.pyx":1504
 * 
 *     def setFunction(self, function, args=None, kargs=None):
 *         if function is not None:             # <<<<<<<<<<<<<<
 *             CHKERR( MatNullSpaceSetFunction(
 *                     self.nsp, NullSpace_Function, NULL) )
 */
  __pyx_t_1 = (__pyx_v_function != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/Mat.pyx":1505
 *     def setFunction(self, function, args=None, kargs=None):
 *         if function is not None:
 *             CHKERR( MatNullSpaceSetFunction(             # <<<<<<<<<<<<<<
 *                     self.nsp, NullSpace_Function, NULL) )
 *             if args is None: args = ()
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatNullSpaceSetFunction(__pyx_v_self->nsp, __pyx_f_8petsc4py_5PETSc_NullSpace_Function, NULL)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 1505, __pyx_L1_error)

    /* "PETSc/Mat.pyx":1507
 *             CHKERR( MatNullSpaceSetFunction(
 *                     self.nsp, NullSpace_Function, NULL) )
 *             if args is None: args = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             self.set_attr('__function__', (function, args, kargs))
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/Mat.pyx":1508
 *                     self.nsp, NullSpace_Function, NULL) )
 *             if args is None: args = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             self.set_attr('__function__', (function, args, kargs))
 *         else:
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1508, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_4);
      __pyx_t_4 = 0;
    }

    /* "PETSc/Mat.pyx":1509
 *             if args is None: args = ()
 *             if kargs is None: kargs = {}
 *             self.set_attr('__function__', (function, args, kargs))             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( MatNullSpaceSetFunction(self.nsp, NULL, NULL) )
 */
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 1509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_function);
    __Pyx_GIVEREF(__pyx_v_function);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_function);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_kargs);
    __pyx_t_5 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_NullSpace *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__function__"), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 1509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/Mat.pyx":1504
 * 
 *     def setFunction(self, function, args=None, kargs=None):
 *         if function is not None:             # <<<<<<<<<<<<<<
 *             CHKERR( MatNullSpaceSetFunction(
 *                     self.nsp, NullSpace_Function, NULL) )
 */
    goto __pyx_L3;
  }

  /* "PETSc/Mat.pyx":1511
 *             self.set_attr('__function__', (function, args, kargs))
 *         else:
 *             CHKERR( MatNullSpaceSetFunction(self.nsp, NULL, NULL) )             # <<<<<<<<<<<<<<
 *             self.set_attr('__function__', None)
 *     #
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatNullSpaceSetFunction(__pyx_v_self->nsp, NULL, NULL)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(33, 1511, __pyx_L1_error)

    /* "PETSc/Mat.pyx":1512
 *         else:
 *             CHKERR( MatNullSpaceSetFunction(self.nsp, NULL, NULL) )
 *             self.set_attr('__function__', None)             # <<<<<<<<<<<<<<
 *     #
 * 
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_NullSpace *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__function__"), Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(33, 1512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "PETSc/Mat.pyx":1503
 *         return self
 * 
 *     def setFunction(self, function, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if function is not None:
 *             CHKERR( MatNullSpaceSetFunction(
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.setFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1515
 *     #
 * 
 *     def hasConstant(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatNullSpaceGetVecs(self.nsp, &flag, NULL, NULL) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_15hasConstant(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_9NullSpace_14hasConstant[] = "NullSpace.hasConstant(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_15hasConstant(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hasConstant (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("hasConstant", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "hasConstant", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_9NullSpace_14hasConstant(((struct PyPetscNullSpaceObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_14hasConstant(struct PyPetscNullSpaceObject *__pyx_v_self) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("hasConstant", 0);

  /* "PETSc/Mat.pyx":1516
 * 
 *     def hasConstant(self):
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( MatNullSpaceGetVecs(self.nsp, &flag, NULL, NULL) )
 *         return <bint> flag
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/Mat.pyx":1517
 *     def hasConstant(self):
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatNullSpaceGetVecs(self.nsp, &flag, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         return <bint> flag
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatNullSpaceGetVecs(__pyx_v_self->nsp, (&__pyx_v_flag), NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1517, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1518
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatNullSpaceGetVecs(self.nsp, &flag, NULL, NULL) )
 *         return <bint> flag             # <<<<<<<<<<<<<<
 * 
 *     def getVecs(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1515
 *     #
 * 
 *     def hasConstant(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( MatNullSpaceGetVecs(self.nsp, &flag, NULL, NULL) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.hasConstant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1520
 *         return <bint> flag
 * 
 *     def getVecs(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i = 0, nv = 0
 *         cdef const_PetscVec *v = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_17getVecs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_9NullSpace_16getVecs[] = "NullSpace.getVecs(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_17getVecs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getVecs (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getVecs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getVecs", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_9NullSpace_16getVecs(((struct PyPetscNullSpaceObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_16getVecs(struct PyPetscNullSpaceObject *__pyx_v_self) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_nv;
  const Vec *__pyx_v_v;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_v_vectors = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscInt __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("getVecs", 0);

  /* "PETSc/Mat.pyx":1521
 * 
 *     def getVecs(self):
 *         cdef PetscInt i = 0, nv = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscVec *v = NULL
 *         CHKERR( MatNullSpaceGetVecs(self.nsp, NULL, &nv, &v) )
 */
  __pyx_v_i = 0;
  __pyx_v_nv = 0;

  /* "PETSc/Mat.pyx":1522
 *     def getVecs(self):
 *         cdef PetscInt i = 0, nv = 0
 *         cdef const_PetscVec *v = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( MatNullSpaceGetVecs(self.nsp, NULL, &nv, &v) )
 *         cdef Vec vec = None
 */
  __pyx_v_v = NULL;

  /* "PETSc/Mat.pyx":1523
 *         cdef PetscInt i = 0, nv = 0
 *         cdef const_PetscVec *v = NULL
 *         CHKERR( MatNullSpaceGetVecs(self.nsp, NULL, &nv, &v) )             # <<<<<<<<<<<<<<
 *         cdef Vec vec = None
 *         cdef list vectors = []
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatNullSpaceGetVecs(__pyx_v_self->nsp, NULL, (&__pyx_v_nv), (&__pyx_v_v))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1523, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1524
 *         cdef const_PetscVec *v = NULL
 *         CHKERR( MatNullSpaceGetVecs(self.nsp, NULL, &nv, &v) )
 *         cdef Vec vec = None             # <<<<<<<<<<<<<<
 *         cdef list vectors = []
 *         for i from 0 <= i < nv:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_vec = ((struct PyPetscVecObject *)Py_None);

  /* "PETSc/Mat.pyx":1525
 *         CHKERR( MatNullSpaceGetVecs(self.nsp, NULL, &nv, &v) )
 *         cdef Vec vec = None
 *         cdef list vectors = []             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < nv:
 *             vec = Vec()
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_vectors = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/Mat.pyx":1526
 *         cdef Vec vec = None
 *         cdef list vectors = []
 *         for i from 0 <= i < nv:             # <<<<<<<<<<<<<<
 *             vec = Vec()
 *             vec.vec = v[i]
 */
  __pyx_t_3 = __pyx_v_nv;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

    /* "PETSc/Mat.pyx":1527
 *         cdef list vectors = []
 *         for i from 0 <= i < nv:
 *             vec = Vec()             # <<<<<<<<<<<<<<
 *             vec.vec = v[i]
 *             PetscINCREF(vec.obj)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(33, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_vec, ((struct PyPetscVecObject *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "PETSc/Mat.pyx":1528
 *         for i from 0 <= i < nv:
 *             vec = Vec()
 *             vec.vec = v[i]             # <<<<<<<<<<<<<<
 *             PetscINCREF(vec.obj)
 *             vectors.append(vec)
 */
    __pyx_v_vec->vec = (__pyx_v_v[__pyx_v_i]);

    /* "PETSc/Mat.pyx":1529
 *             vec = Vec()
 *             vec.vec = v[i]
 *             PetscINCREF(vec.obj)             # <<<<<<<<<<<<<<
 *             vectors.append(vec)
 *         return vectors
 */
    __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_vec->__pyx_base.obj);

    /* "PETSc/Mat.pyx":1530
 *             vec.vec = v[i]
 *             PetscINCREF(vec.obj)
 *             vectors.append(vec)             # <<<<<<<<<<<<<<
 *         return vectors
 * 
 */
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_vectors, ((PyObject *)__pyx_v_vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(33, 1530, __pyx_L1_error)
  }

  /* "PETSc/Mat.pyx":1531
 *             PetscINCREF(vec.obj)
 *             vectors.append(vec)
 *         return vectors             # <<<<<<<<<<<<<<
 * 
 *     def getFunction(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_vectors);
  __pyx_r = __pyx_v_vectors;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1520
 *         return <bint> flag
 * 
 *     def getVecs(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i = 0, nv = 0
 *         cdef const_PetscVec *v = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.getVecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XDECREF(__pyx_v_vectors);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1533
 *         return vectors
 * 
 *     def getFunction(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__function__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_19getFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_9NullSpace_18getFunction[] = "NullSpace.getFunction(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_19getFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFunction (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getFunction", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getFunction", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_9NullSpace_18getFunction(((struct PyPetscNullSpaceObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_18getFunction(struct PyPetscNullSpaceObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getFunction", 0);

  /* "PETSc/Mat.pyx":1534
 * 
 *     def getFunction(self):
 *         return self.get_attr('__function__')             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_NullSpace *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__function__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 1534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/Mat.pyx":1533
 *         return vectors
 * 
 *     def getFunction(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__function__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.getFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Mat.pyx":1538
 *     #
 * 
 *     def remove(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatNullSpaceRemove(self.nsp, vec.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_21remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_9NullSpace_20remove[] = "NullSpace.remove(self, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_9NullSpace_21remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "remove") < 0)) __PYX_ERR(33, 1538, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(33, 1538, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(33, 1538, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_9NullSpace_20remove(((struct PyPetscNullSpaceObject *)__pyx_v_self), __pyx_v_vec);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_9NullSpace_20remove(struct PyPetscNullSpaceObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("remove", 0);

  /* "PETSc/Mat.pyx":1539
 * 
 *     def remove(self, Vec vec not None):
 *         CHKERR( MatNullSpaceRemove(self.nsp, vec.vec) )             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatNullSpaceRemove(__pyx_v_self->nsp, __pyx_v_vec->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(33, 1539, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1538
 *     #
 * 
 *     def remove(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( MatNullSpaceRemove(self.nsp, vec.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.NullSpace.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":119
 *     # --- xxx ---
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.pc
 *         self.pc = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2PC_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2PC_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC___cinit__(((struct PyPetscPCObject *)__pyx_v_self));

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

static int __pyx_pf_8petsc4py_5PETSc_2PC___cinit__(struct PyPetscPCObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/PC.pyx":120
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.pc             # <<<<<<<<<<<<<<
 *         self.pc = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->pc));

  /* "PETSc/PC.pyx":121
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.pc
 *         self.pc = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, x, y=None):
 */
  __pyx_v_self->pc = NULL;

  /* "PETSc/PC.pyx":119
 *     # --- xxx ---
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.pc
 *         self.pc = NULL
 */

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

/* "PETSc/PC.pyx":123
 *         self.pc = NULL
 * 
 *     def __call__(self, x, y=None):             # <<<<<<<<<<<<<<
 *         if y is None: # XXX do this better
 *             y = self.getOperators()[0].createVecLeft()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(34, 123, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 123, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_2__call__(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_2__call__(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  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;
  Py_ssize_t __pyx_t_7;
  __Pyx_RefNannySetupContext("__call__", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "PETSc/PC.pyx":124
 * 
 *     def __call__(self, x, y=None):
 *         if y is None: # XXX do this better             # <<<<<<<<<<<<<<
 *             y = self.getOperators()[0].createVecLeft()
 *         self.apply(x, y)
 */
  __pyx_t_1 = (__pyx_v_y == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/PC.pyx":125
 *     def __call__(self, x, y=None):
 *         if y is None: # XXX do this better
 *             y = self.getOperators()[0].createVecLeft()             # <<<<<<<<<<<<<<
 *         self.apply(x, y)
 *         return y
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getOperators); if (unlikely(!__pyx_t_5)) __PYX_ERR(34, 125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(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_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 125, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 125, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(34, 125, __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_createVecLeft); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 125, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 125, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/PC.pyx":124
 * 
 *     def __call__(self, x, y=None):
 *         if y is None: # XXX do this better             # <<<<<<<<<<<<<<
 *             y = self.getOperators()[0].createVecLeft()
 *         self.apply(x, y)
 */
  }

  /* "PETSc/PC.pyx":126
 *         if y is None: # XXX do this better
 *             y = self.getOperators()[0].createVecLeft()
 *         self.apply(x, y)             # <<<<<<<<<<<<<<
 *         return y
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_apply); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(34, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_y);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 126, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/PC.pyx":127
 *             y = self.getOperators()[0].createVecLeft()
 *         self.apply(x, y)
 *         return y             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_y);
  __pyx_r = __pyx_v_y;
  goto __pyx_L0;

  /* "PETSc/PC.pyx":123
 *         self.pc = NULL
 * 
 *     def __call__(self, x, y=None):             # <<<<<<<<<<<<<<
 *         if y is None: # XXX do this better
 *             y = self.getOperators()[0].createVecLeft()
 */

  /* 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_AddTraceback("petsc4py.PETSc.PC.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":131
 *     # --- xxx ---
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_4view[] = "PC.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(34, 131, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 131, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(34, 131, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_4view(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_viewer);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_4view(struct PyPetscPCObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/PC.pyx":132
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PCView(self.pc, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/PC.pyx":133
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( PCView(self.pc, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/PC.pyx":134
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PCView(self.pc, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCView(__pyx_v_self->pc, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(34, 134, __pyx_L1_error)

  /* "PETSc/PC.pyx":131
 *     # --- xxx ---
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":136
 *         CHKERR( PCView(self.pc, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PCDestroy(&self.pc) )
 *         self.pc = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_6destroy[] = "PC.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_6destroy(((struct PyPetscPCObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_6destroy(struct PyPetscPCObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/PC.pyx":137
 * 
 *     def destroy(self):
 *         CHKERR( PCDestroy(&self.pc) )             # <<<<<<<<<<<<<<
 *         self.pc = NULL
 *         return self
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCDestroy((&__pyx_v_self->pc))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 137, __pyx_L1_error)

  /* "PETSc/PC.pyx":138
 *     def destroy(self):
 *         CHKERR( PCDestroy(&self.pc) )
 *         self.pc = NULL             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->pc = NULL;

  /* "PETSc/PC.pyx":139
 *         CHKERR( PCDestroy(&self.pc) )
 *         self.pc = NULL
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":136
 *         CHKERR( PCView(self.pc, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PCDestroy(&self.pc) )
 *         self.pc = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":141
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscPC newpc = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_8create[] = "PC.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(34, 141, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 141, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_8create(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_comm);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_8create(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PC __pyx_v_newpc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/PC.pyx":142
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscPC newpc = NULL
 *         CHKERR( PCCreate(ccomm, &newpc) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(34, 142, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/PC.pyx":143
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscPC newpc = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PCCreate(ccomm, &newpc) )
 *         PetscCLEAR(self.obj); self.pc = newpc
 */
  __pyx_v_newpc = NULL;

  /* "PETSc/PC.pyx":144
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscPC newpc = NULL
 *         CHKERR( PCCreate(ccomm, &newpc) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.pc = newpc
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCCreate(__pyx_v_ccomm, (&__pyx_v_newpc))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 144, __pyx_L1_error)

  /* "PETSc/PC.pyx":145
 *         cdef PetscPC newpc = NULL
 *         CHKERR( PCCreate(ccomm, &newpc) )
 *         PetscCLEAR(self.obj); self.pc = newpc             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->pc = __pyx_v_newpc;

  /* "PETSc/PC.pyx":146
 *         CHKERR( PCCreate(ccomm, &newpc) )
 *         PetscCLEAR(self.obj); self.pc = newpc
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, pc_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":141
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscPC newpc = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":148
 *         return self
 * 
 *     def setType(self, pc_type):             # <<<<<<<<<<<<<<
 *         cdef PetscPCType cval = NULL
 *         pc_type = str2bytes(pc_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_11setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_10setType[] = "PC.setType(self, pc_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_11setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pc_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pc_type,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);
        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_pc_type)) != 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, "setType") < 0)) __PYX_ERR(34, 148, __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_pc_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 148, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_10setType(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_pc_type);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_10setType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_pc_type) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_pc_type);

  /* "PETSc/PC.pyx":149
 * 
 *     def setType(self, pc_type):
 *         cdef PetscPCType cval = NULL             # <<<<<<<<<<<<<<
 *         pc_type = str2bytes(pc_type, &cval)
 *         CHKERR( PCSetType(self.pc, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/PC.pyx":150
 *     def setType(self, pc_type):
 *         cdef PetscPCType cval = NULL
 *         pc_type = str2bytes(pc_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetType(self.pc, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_pc_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pc_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":151
 *         cdef PetscPCType cval = NULL
 *         pc_type = str2bytes(pc_type, &cval)
 *         CHKERR( PCSetType(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCSetType(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 151, __pyx_L1_error)

  /* "PETSc/PC.pyx":148
 *         return self
 * 
 *     def setType(self, pc_type):             # <<<<<<<<<<<<<<
 *         cdef PetscPCType cval = NULL
 *         pc_type = str2bytes(pc_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pc_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":153
 *         CHKERR( PCSetType(self.pc, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscPCType cval = NULL
 *         CHKERR( PCGetType(self.pc, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_13getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_12getType[] = "PC.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_13getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_12getType(((struct PyPetscPCObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_12getType(struct PyPetscPCObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/PC.pyx":154
 * 
 *     def getType(self):
 *         cdef PetscPCType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PCGetType(self.pc, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/PC.pyx":155
 *     def getType(self):
 *         cdef PetscPCType cval = NULL
 *         CHKERR( PCGetType(self.pc, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCGetType(__pyx_v_self->pc, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 155, __pyx_L1_error)

  /* "PETSc/PC.pyx":156
 *         cdef PetscPCType cval = NULL
 *         CHKERR( PCGetType(self.pc, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setOptionsPrefix(self, prefix):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/PC.pyx":153
 *         CHKERR( PCSetType(self.pc, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscPCType cval = NULL
 *         CHKERR( PCGetType(self.pc, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":158
 *         return bytes2str(cval)
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_15setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_14setOptionsPrefix[] = "PC.setOptionsPrefix(self, prefix)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_15setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOptionsPrefix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,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);
        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_prefix)) != 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, "setOptionsPrefix") < 0)) __PYX_ERR(34, 158, __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_prefix = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOptionsPrefix", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 158, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_14setOptionsPrefix(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_prefix);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_14setOptionsPrefix(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setOptionsPrefix", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "PETSc/PC.pyx":159
 * 
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( PCSetOptionsPrefix(self.pc, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/PC.pyx":160
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetOptionsPrefix(self.pc, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_prefix, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":161
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( PCSetOptionsPrefix(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getOptionsPrefix(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCSetOptionsPrefix(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 161, __pyx_L1_error)

  /* "PETSc/PC.pyx":158
 *         return bytes2str(cval)
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":163
 *         CHKERR( PCSetOptionsPrefix(self.pc, cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PCGetOptionsPrefix(self.pc, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_17getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_16getOptionsPrefix[] = "PC.getOptionsPrefix(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_17getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOptionsPrefix (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOptionsPrefix", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOptionsPrefix", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_16getOptionsPrefix(((struct PyPetscPCObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_16getOptionsPrefix(struct PyPetscPCObject *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getOptionsPrefix", 0);

  /* "PETSc/PC.pyx":164
 * 
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PCGetOptionsPrefix(self.pc, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/PC.pyx":165
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( PCGetOptionsPrefix(self.pc, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCGetOptionsPrefix(__pyx_v_self->pc, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 165, __pyx_L1_error)

  /* "PETSc/PC.pyx":166
 *         cdef const_char *cval = NULL
 *         CHKERR( PCGetOptionsPrefix(self.pc, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/PC.pyx":163
 *         CHKERR( PCSetOptionsPrefix(self.pc, cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( PCGetOptionsPrefix(self.pc, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":168
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetFromOptions(self.pc) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_19setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_18setFromOptions[] = "PC.setFromOptions(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_19setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_18setFromOptions(((struct PyPetscPCObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_18setFromOptions(struct PyPetscPCObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/PC.pyx":169
 * 
 *     def setFromOptions(self):
 *         CHKERR( PCSetFromOptions(self.pc) )             # <<<<<<<<<<<<<<
 * 
 *     def setOperators(self, Mat A=None, Mat P=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCSetFromOptions(__pyx_v_self->pc)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 169, __pyx_L1_error)

  /* "PETSc/PC.pyx":168
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetFromOptions(self.pc) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":171
 *         CHKERR( PCSetFromOptions(self.pc) )
 * 
 *     def setOperators(self, Mat A=None, Mat P=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat amat=NULL
 *         if A is not None: amat = A.mat
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_21setOperators(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_20setOperators[] = "PC.setOperators(self, Mat A=None, Mat P=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_21setOperators(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_A = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOperators (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_P,0};
    PyObject* values[2] = {0,0};
    values[0] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[1] = (PyObject *)((struct PyPetscMatObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_A);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setOperators") < 0)) __PYX_ERR(34, 171, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOperators", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 171, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setOperators", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_A), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "A", 0))) __PYX_ERR(34, 171, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(34, 171, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_20setOperators(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_A, __pyx_v_P);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_20setOperators(struct PyPetscPCObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_A, struct PyPetscMatObject *__pyx_v_P) {
  Mat __pyx_v_amat;
  Mat __pyx_v_pmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Mat __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setOperators", 0);

  /* "PETSc/PC.pyx":172
 * 
 *     def setOperators(self, Mat A=None, Mat P=None):
 *         cdef PetscMat amat=NULL             # <<<<<<<<<<<<<<
 *         if A is not None: amat = A.mat
 *         cdef PetscMat pmat=amat
 */
  __pyx_v_amat = NULL;

  /* "PETSc/PC.pyx":173
 *     def setOperators(self, Mat A=None, Mat P=None):
 *         cdef PetscMat amat=NULL
 *         if A is not None: amat = A.mat             # <<<<<<<<<<<<<<
 *         cdef PetscMat pmat=amat
 *         if P is not None: pmat = P.mat
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_A) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_A->mat;
    __pyx_v_amat = __pyx_t_3;
  }

  /* "PETSc/PC.pyx":174
 *         cdef PetscMat amat=NULL
 *         if A is not None: amat = A.mat
 *         cdef PetscMat pmat=amat             # <<<<<<<<<<<<<<
 *         if P is not None: pmat = P.mat
 *         CHKERR( PCSetOperators(self.pc, amat, pmat) )
 */
  __pyx_v_pmat = __pyx_v_amat;

  /* "PETSc/PC.pyx":175
 *         if A is not None: amat = A.mat
 *         cdef PetscMat pmat=amat
 *         if P is not None: pmat = P.mat             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetOperators(self.pc, amat, pmat) )
 * 
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_P->mat;
    __pyx_v_pmat = __pyx_t_3;
  }

  /* "PETSc/PC.pyx":176
 *         cdef PetscMat pmat=amat
 *         if P is not None: pmat = P.mat
 *         CHKERR( PCSetOperators(self.pc, amat, pmat) )             # <<<<<<<<<<<<<<
 * 
 *     def getOperators(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCSetOperators(__pyx_v_self->pc, __pyx_v_amat, __pyx_v_pmat)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(34, 176, __pyx_L1_error)

  /* "PETSc/PC.pyx":171
 *         CHKERR( PCSetFromOptions(self.pc) )
 * 
 *     def setOperators(self, Mat A=None, Mat P=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat amat=NULL
 *         if A is not None: amat = A.mat
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setOperators", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":178
 *         CHKERR( PCSetOperators(self.pc, amat, pmat) )
 * 
 *     def getOperators(self):             # <<<<<<<<<<<<<<
 *         cdef Mat A = Mat(), P = Mat()
 *         CHKERR( PCGetOperators(self.pc, &A.mat, &P.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_23getOperators(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_22getOperators[] = "PC.getOperators(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_23getOperators(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOperators (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOperators", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOperators", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_22getOperators(((struct PyPetscPCObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_22getOperators(struct PyPetscPCObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_A = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getOperators", 0);

  /* "PETSc/PC.pyx":179
 * 
 *     def getOperators(self):
 *         cdef Mat A = Mat(), P = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( PCGetOperators(self.pc, &A.mat, &P.mat) )
 *         PetscINCREF(A.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_A = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":180
 *     def getOperators(self):
 *         cdef Mat A = Mat(), P = Mat()
 *         CHKERR( PCGetOperators(self.pc, &A.mat, &P.mat) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(A.obj)
 *         PetscINCREF(P.obj)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCGetOperators(__pyx_v_self->pc, (&__pyx_v_A->mat), (&__pyx_v_P->mat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 180, __pyx_L1_error)

  /* "PETSc/PC.pyx":181
 *         cdef Mat A = Mat(), P = Mat()
 *         CHKERR( PCGetOperators(self.pc, &A.mat, &P.mat) )
 *         PetscINCREF(A.obj)             # <<<<<<<<<<<<<<
 *         PetscINCREF(P.obj)
 *         return (A, P)
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_A->__pyx_base.obj);

  /* "PETSc/PC.pyx":182
 *         CHKERR( PCGetOperators(self.pc, &A.mat, &P.mat) )
 *         PetscINCREF(A.obj)
 *         PetscINCREF(P.obj)             # <<<<<<<<<<<<<<
 *         return (A, P)
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_P->__pyx_base.obj);

  /* "PETSc/PC.pyx":183
 *         PetscINCREF(A.obj)
 *         PetscINCREF(P.obj)
 *         return (A, P)             # <<<<<<<<<<<<<<
 * 
 *     def setUseAmat(self, flag):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_A));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_A));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_A));
  __Pyx_INCREF(((PyObject *)__pyx_v_P));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_P));
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/PC.pyx":178
 *         CHKERR( PCSetOperators(self.pc, amat, pmat) )
 * 
 *     def getOperators(self):             # <<<<<<<<<<<<<<
 *         cdef Mat A = Mat(), P = Mat()
 *         CHKERR( PCGetOperators(self.pc, &A.mat, &P.mat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getOperators", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_A);
  __Pyx_XDECREF((PyObject *)__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":185
 *         return (A, P)
 * 
 *     def setUseAmat(self, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_25setUseAmat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_24setUseAmat[] = "PC.setUseAmat(self, flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_25setUseAmat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUseAmat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setUseAmat") < 0)) __PYX_ERR(34, 185, __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_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setUseAmat", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 185, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setUseAmat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_24setUseAmat(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_flag);

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_24setUseAmat(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_flag) {
  PetscBool __pyx_v_cflag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setUseAmat", 0);

  /* "PETSc/PC.pyx":186
 * 
 *     def setUseAmat(self, flag):
 *         cdef PetscBool cflag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if flag:
 *             cflag = PETSC_TRUE
 */
  __pyx_v_cflag = PETSC_FALSE;

  /* "PETSc/PC.pyx":187
 *     def setUseAmat(self, flag):
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag:             # <<<<<<<<<<<<<<
 *             cflag = PETSC_TRUE
 *         CHKERR( PCSetUseAmat(self.pc, cflag) )
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(34, 187, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/PC.pyx":188
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag:
 *             cflag = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetUseAmat(self.pc, cflag) )
 * 
 */
    __pyx_v_cflag = PETSC_TRUE;

    /* "PETSc/PC.pyx":187
 *     def setUseAmat(self, flag):
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag:             # <<<<<<<<<<<<<<
 *             cflag = PETSC_TRUE
 *         CHKERR( PCSetUseAmat(self.pc, cflag) )
 */
  }

  /* "PETSc/PC.pyx":189
 *         if flag:
 *             cflag = PETSC_TRUE
 *         CHKERR( PCSetUseAmat(self.pc, cflag) )             # <<<<<<<<<<<<<<
 * 
 *     def setUp(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCSetUseAmat(__pyx_v_self->pc, __pyx_v_cflag)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 189, __pyx_L1_error)

  /* "PETSc/PC.pyx":185
 *         return (A, P)
 * 
 *     def setUseAmat(self, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setUseAmat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":191
 *         CHKERR( PCSetUseAmat(self.pc, cflag) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetUp(self.pc) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_27setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_26setUp[] = "PC.setUp(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_27setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUp (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUp", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUp", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_26setUp(((struct PyPetscPCObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_26setUp(struct PyPetscPCObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUp", 0);

  /* "PETSc/PC.pyx":192
 * 
 *     def setUp(self):
 *         CHKERR( PCSetUp(self.pc) )             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCSetUp(__pyx_v_self->pc)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 192, __pyx_L1_error)

  /* "PETSc/PC.pyx":191
 *         CHKERR( PCSetUseAmat(self.pc, cflag) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetUp(self.pc) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":194
 *         CHKERR( PCSetUp(self.pc) )
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PCReset(self.pc) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_29reset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_28reset[] = "PC.reset(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_29reset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("reset", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "reset", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_28reset(((struct PyPetscPCObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_28reset(struct PyPetscPCObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "PETSc/PC.pyx":195
 * 
 *     def reset(self):
 *         CHKERR( PCReset(self.pc) )             # <<<<<<<<<<<<<<
 * 
 *     def setUpOnBlocks(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCReset(__pyx_v_self->pc)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 195, __pyx_L1_error)

  /* "PETSc/PC.pyx":194
 *         CHKERR( PCSetUp(self.pc) )
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PCReset(self.pc) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":197
 *         CHKERR( PCReset(self.pc) )
 * 
 *     def setUpOnBlocks(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetUpOnBlocks(self.pc) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_31setUpOnBlocks(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_30setUpOnBlocks[] = "PC.setUpOnBlocks(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_31setUpOnBlocks(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUpOnBlocks (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUpOnBlocks", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUpOnBlocks", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_30setUpOnBlocks(((struct PyPetscPCObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_30setUpOnBlocks(struct PyPetscPCObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUpOnBlocks", 0);

  /* "PETSc/PC.pyx":198
 * 
 *     def setUpOnBlocks(self):
 *         CHKERR( PCSetUpOnBlocks(self.pc) )             # <<<<<<<<<<<<<<
 * 
 *     def apply(self, Vec x not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCSetUpOnBlocks(__pyx_v_self->pc)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 198, __pyx_L1_error)

  /* "PETSc/PC.pyx":197
 *         CHKERR( PCReset(self.pc) )
 * 
 *     def setUpOnBlocks(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetUpOnBlocks(self.pc) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setUpOnBlocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":200
 *         CHKERR( PCSetUpOnBlocks(self.pc) )
 * 
 *     def apply(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCApply(self.pc, x.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_33apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_32apply[] = "PC.apply(self, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_33apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 2, 2, 1); __PYX_ERR(34, 200, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) __PYX_ERR(34, 200, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 200, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(34, 200, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(34, 200, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_32apply(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_32apply(struct PyPetscPCObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("apply", 0);

  /* "PETSc/PC.pyx":201
 * 
 *     def apply(self, Vec x not None, Vec y not None):
 *         CHKERR( PCApply(self.pc, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def applyTranspose(self, Vec x not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCApply(__pyx_v_self->pc, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 201, __pyx_L1_error)

  /* "PETSc/PC.pyx":200
 *         CHKERR( PCSetUpOnBlocks(self.pc) )
 * 
 *     def apply(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCApply(self.pc, x.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":203
 *         CHKERR( PCApply(self.pc, x.vec, y.vec) )
 * 
 *     def applyTranspose(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCApplyTranspose(self.pc, x.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_35applyTranspose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_34applyTranspose[] = "PC.applyTranspose(self, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_35applyTranspose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("applyTranspose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("applyTranspose", 1, 2, 2, 1); __PYX_ERR(34, 203, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "applyTranspose") < 0)) __PYX_ERR(34, 203, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("applyTranspose", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 203, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.applyTranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(34, 203, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(34, 203, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_34applyTranspose(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_34applyTranspose(struct PyPetscPCObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("applyTranspose", 0);

  /* "PETSc/PC.pyx":204
 * 
 *     def applyTranspose(self, Vec x not None, Vec y not None):
 *         CHKERR( PCApplyTranspose(self.pc, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def applySymmetricLeft(self, Vec x not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCApplyTranspose(__pyx_v_self->pc, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 204, __pyx_L1_error)

  /* "PETSc/PC.pyx":203
 *         CHKERR( PCApply(self.pc, x.vec, y.vec) )
 * 
 *     def applyTranspose(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCApplyTranspose(self.pc, x.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.applyTranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":206
 *         CHKERR( PCApplyTranspose(self.pc, x.vec, y.vec) )
 * 
 *     def applySymmetricLeft(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCApplySymmetricLeft(self.pc, x.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_37applySymmetricLeft(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_36applySymmetricLeft[] = "PC.applySymmetricLeft(self, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_37applySymmetricLeft(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("applySymmetricLeft (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("applySymmetricLeft", 1, 2, 2, 1); __PYX_ERR(34, 206, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "applySymmetricLeft") < 0)) __PYX_ERR(34, 206, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("applySymmetricLeft", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 206, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.applySymmetricLeft", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(34, 206, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(34, 206, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_36applySymmetricLeft(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_36applySymmetricLeft(struct PyPetscPCObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("applySymmetricLeft", 0);

  /* "PETSc/PC.pyx":207
 * 
 *     def applySymmetricLeft(self, Vec x not None, Vec y not None):
 *         CHKERR( PCApplySymmetricLeft(self.pc, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def applySymmetricRight(self, Vec x not None, Vec y not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCApplySymmetricLeft(__pyx_v_self->pc, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 207, __pyx_L1_error)

  /* "PETSc/PC.pyx":206
 *         CHKERR( PCApplyTranspose(self.pc, x.vec, y.vec) )
 * 
 *     def applySymmetricLeft(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCApplySymmetricLeft(self.pc, x.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.applySymmetricLeft", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":209
 *         CHKERR( PCApplySymmetricLeft(self.pc, x.vec, y.vec) )
 * 
 *     def applySymmetricRight(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCApplySymmetricRight(self.pc, x.vec, y.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_39applySymmetricRight(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_38applySymmetricRight[] = "PC.applySymmetricRight(self, Vec x, Vec y)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_39applySymmetricRight(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("applySymmetricRight (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("applySymmetricRight", 1, 2, 2, 1); __PYX_ERR(34, 209, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "applySymmetricRight") < 0)) __PYX_ERR(34, 209, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_y = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("applySymmetricRight", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 209, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.applySymmetricRight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(34, 209, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "y", 0))) __PYX_ERR(34, 209, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_38applySymmetricRight(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_38applySymmetricRight(struct PyPetscPCObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("applySymmetricRight", 0);

  /* "PETSc/PC.pyx":210
 * 
 *     def applySymmetricRight(self, Vec x not None, Vec y not None):
 *         CHKERR( PCApplySymmetricRight(self.pc, x.vec, y.vec) )             # <<<<<<<<<<<<<<
 * 
 *     # --- discretization space ---
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCApplySymmetricRight(__pyx_v_self->pc, __pyx_v_x->vec, __pyx_v_y->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 210, __pyx_L1_error)

  /* "PETSc/PC.pyx":209
 *         CHKERR( PCApplySymmetricLeft(self.pc, x.vec, y.vec) )
 * 
 *     def applySymmetricRight(self, Vec x not None, Vec y not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCApplySymmetricRight(self.pc, x.vec, y.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.applySymmetricRight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":214
 *     # --- discretization space ---
 * 
 *     def getDM(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( PCGetDM(self.pc, &newdm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_41getDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_40getDM[] = "PC.getDM(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_41getDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDM (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDM", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDM", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_40getDM(((struct PyPetscPCObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_40getDM(struct PyPetscPCObject *__pyx_v_self) {
  DM __pyx_v_newdm;
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getDM", 0);

  /* "PETSc/PC.pyx":215
 * 
 *     def getDM(self):
 *         cdef PetscDM newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PCGetDM(self.pc, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/PC.pyx":216
 *     def getDM(self):
 *         cdef PetscDM newdm = NULL
 *         CHKERR( PCGetDM(self.pc, &newdm) )             # <<<<<<<<<<<<<<
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCGetDM(__pyx_v_self->pc, (&__pyx_v_newdm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 216, __pyx_L1_error)

  /* "PETSc/PC.pyx":217
 *         cdef PetscDM newdm = NULL
 *         CHKERR( PCGetDM(self.pc, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()             # <<<<<<<<<<<<<<
 *         dm.dm = newdm
 *         PetscINCREF(dm.obj)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_newdm)); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(34, 217, __pyx_L1_error)
  __pyx_v_dm = ((struct PyPetscDMObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/PC.pyx":218
 *         CHKERR( PCGetDM(self.pc, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm             # <<<<<<<<<<<<<<
 *         PetscINCREF(dm.obj)
 *         return dm
 */
  __pyx_v_dm->dm = __pyx_v_newdm;

  /* "PETSc/PC.pyx":219
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm
 *         PetscINCREF(dm.obj)             # <<<<<<<<<<<<<<
 *         return dm
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_dm->__pyx_base.obj);

  /* "PETSc/PC.pyx":220
 *         dm.dm = newdm
 *         PetscINCREF(dm.obj)
 *         return dm             # <<<<<<<<<<<<<<
 * 
 *     def setDM(self, DM dm not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dm));
  __pyx_r = ((PyObject *)__pyx_v_dm);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":214
 *     # --- discretization space ---
 * 
 *     def getDM(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( PCGetDM(self.pc, &newdm) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":222
 *         return dm
 * 
 *     def setDM(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetDM(self.pc, dm.dm) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_43setDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_42setDM[] = "PC.setDM(self, DM dm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_43setDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDM (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dm,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);
        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_dm)) != 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, "setDM") < 0)) __PYX_ERR(34, 222, __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_dm = ((struct PyPetscDMObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDM", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 222, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_8petsc4py_5PETSc_DM, 0, "dm", 0))) __PYX_ERR(34, 222, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_42setDM(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_dm);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_42setDM(struct PyPetscPCObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setDM", 0);

  /* "PETSc/PC.pyx":223
 * 
 *     def setDM(self, DM dm not None):
 *         CHKERR( PCSetDM(self.pc, dm.dm) )             # <<<<<<<<<<<<<<
 * 
 *     def setCoordinates(self, coordinates):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCSetDM(__pyx_v_self->pc, __pyx_v_dm->dm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 223, __pyx_L1_error)

  /* "PETSc/PC.pyx":222
 *         return dm
 * 
 *     def setDM(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetDM(self.pc, dm.dm) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":225
 *         CHKERR( PCSetDM(self.pc, dm.dm) )
 * 
 *     def setCoordinates(self, coordinates):             # <<<<<<<<<<<<<<
 *         cdef ndarray xyz = iarray(coordinates, NPY_PETSC_REAL)
 *         if PyArray_ISFORTRAN(xyz): xyz = PyArray_Copy(xyz)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_45setCoordinates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_44setCoordinates[] = "PC.setCoordinates(self, coordinates)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_45setCoordinates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_coordinates = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCoordinates (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coordinates,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);
        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_coordinates)) != 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, "setCoordinates") < 0)) __PYX_ERR(34, 225, __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_coordinates = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCoordinates", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 225, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setCoordinates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_44setCoordinates(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_coordinates);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_44setCoordinates(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_coordinates) {
  PyArrayObject *__pyx_v_xyz = 0;
  PetscInt __pyx_v_nvtx;
  PetscInt __pyx_v_ndim;
  PetscReal *__pyx_v_coords;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setCoordinates", 0);

  /* "PETSc/PC.pyx":226
 * 
 *     def setCoordinates(self, coordinates):
 *         cdef ndarray xyz = iarray(coordinates, NPY_PETSC_REAL)             # <<<<<<<<<<<<<<
 *         if PyArray_ISFORTRAN(xyz): xyz = PyArray_Copy(xyz)
 *         if PyArray_NDIM(xyz) != 2: raise ValueError(
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray(__pyx_v_coordinates, NPY_PETSC_REAL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xyz = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":227
 *     def setCoordinates(self, coordinates):
 *         cdef ndarray xyz = iarray(coordinates, NPY_PETSC_REAL)
 *         if PyArray_ISFORTRAN(xyz): xyz = PyArray_Copy(xyz)             # <<<<<<<<<<<<<<
 *         if PyArray_NDIM(xyz) != 2: raise ValueError(
 *             ("coordinates must have two dimensions: "
 */
  __pyx_t_2 = (PyArray_ISFORTRAN(__pyx_v_xyz) != 0);
  if (__pyx_t_2) {
    __pyx_t_1 = ((PyObject *)PyArray_Copy(__pyx_v_xyz)); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_xyz, ((PyArrayObject *)__pyx_t_1));
    __pyx_t_1 = 0;
  }

  /* "PETSc/PC.pyx":228
 *         cdef ndarray xyz = iarray(coordinates, NPY_PETSC_REAL)
 *         if PyArray_ISFORTRAN(xyz): xyz = PyArray_Copy(xyz)
 *         if PyArray_NDIM(xyz) != 2: raise ValueError(             # <<<<<<<<<<<<<<
 *             ("coordinates must have two dimensions: "
 *              "coordinates.ndim=%d") % (PyArray_NDIM(xyz)) )
 */
  __pyx_t_2 = ((PyArray_NDIM(__pyx_v_xyz) != 2) != 0);
  if (__pyx_t_2) {

    /* "PETSc/PC.pyx":230
 *         if PyArray_NDIM(xyz) != 2: raise ValueError(
 *             ("coordinates must have two dimensions: "
 *              "coordinates.ndim=%d") % (PyArray_NDIM(xyz)) )             # <<<<<<<<<<<<<<
 *         cdef PetscInt nvtx = <PetscInt> PyArray_DIM(xyz, 0)
 *         cdef PetscInt ndim = <PetscInt> PyArray_DIM(xyz, 1)
 */
    __pyx_t_1 = __Pyx_PyInt_From_int(PyArray_NDIM(__pyx_v_xyz)); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_coordinates_must_have_two_dimens, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PETSc/PC.pyx":228
 *         cdef ndarray xyz = iarray(coordinates, NPY_PETSC_REAL)
 *         if PyArray_ISFORTRAN(xyz): xyz = PyArray_Copy(xyz)
 *         if PyArray_NDIM(xyz) != 2: raise ValueError(             # <<<<<<<<<<<<<<
 *             ("coordinates must have two dimensions: "
 *              "coordinates.ndim=%d") % (PyArray_NDIM(xyz)) )
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 228, __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_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(34, 228, __pyx_L1_error)
  }

  /* "PETSc/PC.pyx":231
 *             ("coordinates must have two dimensions: "
 *              "coordinates.ndim=%d") % (PyArray_NDIM(xyz)) )
 *         cdef PetscInt nvtx = <PetscInt> PyArray_DIM(xyz, 0)             # <<<<<<<<<<<<<<
 *         cdef PetscInt ndim = <PetscInt> PyArray_DIM(xyz, 1)
 *         cdef PetscReal *coords = <PetscReal*> PyArray_DATA(xyz)
 */
  __pyx_v_nvtx = ((PetscInt)PyArray_DIM(__pyx_v_xyz, 0));

  /* "PETSc/PC.pyx":232
 *              "coordinates.ndim=%d") % (PyArray_NDIM(xyz)) )
 *         cdef PetscInt nvtx = <PetscInt> PyArray_DIM(xyz, 0)
 *         cdef PetscInt ndim = <PetscInt> PyArray_DIM(xyz, 1)             # <<<<<<<<<<<<<<
 *         cdef PetscReal *coords = <PetscReal*> PyArray_DATA(xyz)
 *         CHKERR( PCSetCoordinates(self.pc, ndim, nvtx, coords) )
 */
  __pyx_v_ndim = ((PetscInt)PyArray_DIM(__pyx_v_xyz, 1));

  /* "PETSc/PC.pyx":233
 *         cdef PetscInt nvtx = <PetscInt> PyArray_DIM(xyz, 0)
 *         cdef PetscInt ndim = <PetscInt> PyArray_DIM(xyz, 1)
 *         cdef PetscReal *coords = <PetscReal*> PyArray_DATA(xyz)             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetCoordinates(self.pc, ndim, nvtx, coords) )
 * 
 */
  __pyx_v_coords = ((PetscReal *)PyArray_DATA(__pyx_v_xyz));

  /* "PETSc/PC.pyx":234
 *         cdef PetscInt ndim = <PetscInt> PyArray_DIM(xyz, 1)
 *         cdef PetscReal *coords = <PetscReal*> PyArray_DATA(xyz)
 *         CHKERR( PCSetCoordinates(self.pc, ndim, nvtx, coords) )             # <<<<<<<<<<<<<<
 * 
 *     # --- Python ---
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCSetCoordinates(__pyx_v_self->pc, __pyx_v_ndim, __pyx_v_nvtx, __pyx_v_coords)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(34, 234, __pyx_L1_error)

  /* "PETSc/PC.pyx":225
 *         CHKERR( PCSetDM(self.pc, dm.dm) )
 * 
 *     def setCoordinates(self, coordinates):             # <<<<<<<<<<<<<<
 *         cdef ndarray xyz = iarray(coordinates, NPY_PETSC_REAL)
 *         if PyArray_ISFORTRAN(xyz): xyz = PyArray_Copy(xyz)
 */

  /* 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_3);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setCoordinates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_xyz);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":238
 *     # --- Python ---
 * 
 *     def createPython(self, context=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscPC newpc = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_47createPython(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_46createPython[] = "PC.createPython(self, context=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_47createPython(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createPython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_comm,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createPython") < 0)) __PYX_ERR(34, 238, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_context = values[0];
    __pyx_v_comm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createPython", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 238, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.createPython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_46createPython(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_context, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_46createPython(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PC __pyx_v_newpc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createPython", 0);

  /* "PETSc/PC.pyx":239
 * 
 *     def createPython(self, context=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscPC newpc = NULL
 *         CHKERR( PCCreate(ccomm, &newpc) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(34, 239, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/PC.pyx":240
 *     def createPython(self, context=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscPC newpc = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PCCreate(ccomm, &newpc) )
 *         PetscCLEAR(self.obj); self.pc = newpc
 */
  __pyx_v_newpc = NULL;

  /* "PETSc/PC.pyx":241
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscPC newpc = NULL
 *         CHKERR( PCCreate(ccomm, &newpc) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.pc = newpc
 *         CHKERR( PCSetType(self.pc, PCPYTHON) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCCreate(__pyx_v_ccomm, (&__pyx_v_newpc))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 241, __pyx_L1_error)

  /* "PETSc/PC.pyx":242
 *         cdef PetscPC newpc = NULL
 *         CHKERR( PCCreate(ccomm, &newpc) )
 *         PetscCLEAR(self.obj); self.pc = newpc             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetType(self.pc, PCPYTHON) )
 *         CHKERR( PCPythonSetContext(self.pc, <void*>context) )
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->pc = __pyx_v_newpc;

  /* "PETSc/PC.pyx":243
 *         CHKERR( PCCreate(ccomm, &newpc) )
 *         PetscCLEAR(self.obj); self.pc = newpc
 *         CHKERR( PCSetType(self.pc, PCPYTHON) )             # <<<<<<<<<<<<<<
 *         CHKERR( PCPythonSetContext(self.pc, <void*>context) )
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCSetType(__pyx_v_self->pc, PCPYTHON)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 243, __pyx_L1_error)

  /* "PETSc/PC.pyx":244
 *         PetscCLEAR(self.obj); self.pc = newpc
 *         CHKERR( PCSetType(self.pc, PCPYTHON) )
 *         CHKERR( PCPythonSetContext(self.pc, <void*>context) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCPythonSetContext(__pyx_v_self->pc, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 244, __pyx_L1_error)

  /* "PETSc/PC.pyx":245
 *         CHKERR( PCSetType(self.pc, PCPYTHON) )
 *         CHKERR( PCPythonSetContext(self.pc, <void*>context) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setPythonContext(self, context):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":238
 *     # --- Python ---
 * 
 *     def createPython(self, context=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscPC newpc = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.createPython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":247
 *         return self
 * 
 *     def setPythonContext(self, context):             # <<<<<<<<<<<<<<
 *         CHKERR( PCPythonSetContext(self.pc, <void*>context) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_49setPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_48setPythonContext[] = "PC.setPythonContext(self, context)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_49setPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPythonContext (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,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);
        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_context)) != 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, "setPythonContext") < 0)) __PYX_ERR(34, 247, __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_context = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPythonContext", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 247, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_48setPythonContext(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_context);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_48setPythonContext(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_context) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setPythonContext", 0);

  /* "PETSc/PC.pyx":248
 * 
 *     def setPythonContext(self, context):
 *         CHKERR( PCPythonSetContext(self.pc, <void*>context) )             # <<<<<<<<<<<<<<
 * 
 *     def getPythonContext(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCPythonSetContext(__pyx_v_self->pc, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 248, __pyx_L1_error)

  /* "PETSc/PC.pyx":247
 *         return self
 * 
 *     def setPythonContext(self, context):             # <<<<<<<<<<<<<<
 *         CHKERR( PCPythonSetContext(self.pc, <void*>context) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":250
 *         CHKERR( PCPythonSetContext(self.pc, <void*>context) )
 * 
 *     def getPythonContext(self):             # <<<<<<<<<<<<<<
 *         cdef void *context = NULL
 *         CHKERR( PCPythonGetContext(self.pc, &context) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_51getPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_50getPythonContext[] = "PC.getPythonContext(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_51getPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPythonContext (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getPythonContext", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getPythonContext", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_50getPythonContext(((struct PyPetscPCObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_50getPythonContext(struct PyPetscPCObject *__pyx_v_self) {
  void *__pyx_v_context;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getPythonContext", 0);

  /* "PETSc/PC.pyx":251
 * 
 *     def getPythonContext(self):
 *         cdef void *context = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PCPythonGetContext(self.pc, &context) )
 *         if context == NULL: return None
 */
  __pyx_v_context = NULL;

  /* "PETSc/PC.pyx":252
 *     def getPythonContext(self):
 *         cdef void *context = NULL
 *         CHKERR( PCPythonGetContext(self.pc, &context) )             # <<<<<<<<<<<<<<
 *         if context == NULL: return None
 *         else: return <object> context
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCPythonGetContext(__pyx_v_self->pc, (&__pyx_v_context))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 252, __pyx_L1_error)

  /* "PETSc/PC.pyx":253
 *         cdef void *context = NULL
 *         CHKERR( PCPythonGetContext(self.pc, &context) )
 *         if context == NULL: return None             # <<<<<<<<<<<<<<
 *         else: return <object> context
 * 
 */
  __pyx_t_2 = ((__pyx_v_context == NULL) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "PETSc/PC.pyx":254
 *         CHKERR( PCPythonGetContext(self.pc, &context) )
 *         if context == NULL: return None
 *         else: return <object> context             # <<<<<<<<<<<<<<
 * 
 *     def setPythonType(self, py_type):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_context));
    __pyx_r = ((PyObject *)__pyx_v_context);
    goto __pyx_L0;
  }

  /* "PETSc/PC.pyx":250
 *         CHKERR( PCPythonSetContext(self.pc, <void*>context) )
 * 
 *     def getPythonContext(self):             # <<<<<<<<<<<<<<
 *         cdef void *context = NULL
 *         CHKERR( PCPythonGetContext(self.pc, &context) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":256
 *         else: return <object> context
 * 
 *     def setPythonType(self, py_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_53setPythonType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_52setPythonType[] = "PC.setPythonType(self, py_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_53setPythonType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_py_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPythonType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_py_type,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);
        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_py_type)) != 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, "setPythonType") < 0)) __PYX_ERR(34, 256, __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_py_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPythonType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 256, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setPythonType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_52setPythonType(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_py_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_52setPythonType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_py_type) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setPythonType", 0);
  __Pyx_INCREF(__pyx_v_py_type);

  /* "PETSc/PC.pyx":257
 * 
 *     def setPythonType(self, py_type):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         py_type = str2bytes(py_type, &cval)
 *         CHKERR( PCPythonSetType(self.pc, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/PC.pyx":258
 *     def setPythonType(self, py_type):
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PCPythonSetType(self.pc, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_py_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_py_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":259
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 *         CHKERR( PCPythonSetType(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     # --- ASM ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCPythonSetType(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 259, __pyx_L1_error)

  /* "PETSc/PC.pyx":256
 *         else: return <object> context
 * 
 *     def setPythonType(self, py_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setPythonType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":263
 *     # --- ASM ---
 * 
 *     def setASMType(self, asmtype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCASMType cval = asmtype
 *         CHKERR( PCASMSetType(self.pc, cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_55setASMType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_54setASMType[] = "PC.setASMType(self, asmtype)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_55setASMType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_asmtype = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setASMType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_asmtype,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);
        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_asmtype)) != 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, "setASMType") < 0)) __PYX_ERR(34, 263, __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_asmtype = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setASMType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 263, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setASMType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_54setASMType(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_asmtype);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_54setASMType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_asmtype) {
  PCASMType __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PCASMType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setASMType", 0);

  /* "PETSc/PC.pyx":264
 * 
 *     def setASMType(self, asmtype):
 *         cdef PetscPCASMType cval = asmtype             # <<<<<<<<<<<<<<
 *         CHKERR( PCASMSetType(self.pc, cval) )
 * 
 */
  __pyx_t_1 = ((PCASMType)__Pyx_PyInt_As_PCASMType(__pyx_v_asmtype)); if (unlikely(PyErr_Occurred())) __PYX_ERR(34, 264, __pyx_L1_error)
  __pyx_v_cval = __pyx_t_1;

  /* "PETSc/PC.pyx":265
 *     def setASMType(self, asmtype):
 *         cdef PetscPCASMType cval = asmtype
 *         CHKERR( PCASMSetType(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def setASMOverlap(self, overlap):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCASMSetType(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 265, __pyx_L1_error)

  /* "PETSc/PC.pyx":263
 *     # --- ASM ---
 * 
 *     def setASMType(self, asmtype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCASMType cval = asmtype
 *         CHKERR( PCASMSetType(self.pc, cval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setASMType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":267
 *         CHKERR( PCASMSetType(self.pc, cval) )
 * 
 *     def setASMOverlap(self, overlap):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(overlap)
 *         CHKERR( PCASMSetOverlap(self.pc, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_57setASMOverlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_56setASMOverlap[] = "PC.setASMOverlap(self, overlap)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_57setASMOverlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_overlap = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setASMOverlap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_overlap,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);
        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_overlap)) != 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, "setASMOverlap") < 0)) __PYX_ERR(34, 267, __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_overlap = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setASMOverlap", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 267, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setASMOverlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_56setASMOverlap(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_overlap);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_56setASMOverlap(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_overlap) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setASMOverlap", 0);

  /* "PETSc/PC.pyx":268
 * 
 *     def setASMOverlap(self, overlap):
 *         cdef PetscInt ival = asInt(overlap)             # <<<<<<<<<<<<<<
 *         CHKERR( PCASMSetOverlap(self.pc, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_overlap); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 268, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/PC.pyx":269
 *     def setASMOverlap(self, overlap):
 *         cdef PetscInt ival = asInt(overlap)
 *         CHKERR( PCASMSetOverlap(self.pc, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def setASMLocalSubdomains(self, nsd):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCASMSetOverlap(__pyx_v_self->pc, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 269, __pyx_L1_error)

  /* "PETSc/PC.pyx":267
 *         CHKERR( PCASMSetType(self.pc, cval) )
 * 
 *     def setASMOverlap(self, overlap):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(overlap)
 *         CHKERR( PCASMSetOverlap(self.pc, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setASMOverlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":271
 *         CHKERR( PCASMSetOverlap(self.pc, ival) )
 * 
 *     def setASMLocalSubdomains(self, nsd):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = asInt(nsd)
 *         CHKERR( PCASMSetLocalSubdomains(self.pc, n, NULL, NULL) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_59setASMLocalSubdomains(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_58setASMLocalSubdomains[] = "PC.setASMLocalSubdomains(self, nsd)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_59setASMLocalSubdomains(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nsd = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setASMLocalSubdomains (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nsd,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);
        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_nsd)) != 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, "setASMLocalSubdomains") < 0)) __PYX_ERR(34, 271, __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_nsd = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setASMLocalSubdomains", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 271, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setASMLocalSubdomains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_58setASMLocalSubdomains(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_nsd);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_58setASMLocalSubdomains(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_nsd) {
  PetscInt __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setASMLocalSubdomains", 0);

  /* "PETSc/PC.pyx":272
 * 
 *     def setASMLocalSubdomains(self, nsd):
 *         cdef PetscInt n = asInt(nsd)             # <<<<<<<<<<<<<<
 *         CHKERR( PCASMSetLocalSubdomains(self.pc, n, NULL, NULL) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_nsd); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 272, __pyx_L1_error)
  __pyx_v_n = __pyx_t_1;

  /* "PETSc/PC.pyx":273
 *     def setASMLocalSubdomains(self, nsd):
 *         cdef PetscInt n = asInt(nsd)
 *         CHKERR( PCASMSetLocalSubdomains(self.pc, n, NULL, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def setASMTotalSubdomains(self, nsd):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCASMSetLocalSubdomains(__pyx_v_self->pc, __pyx_v_n, NULL, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 273, __pyx_L1_error)

  /* "PETSc/PC.pyx":271
 *         CHKERR( PCASMSetOverlap(self.pc, ival) )
 * 
 *     def setASMLocalSubdomains(self, nsd):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = asInt(nsd)
 *         CHKERR( PCASMSetLocalSubdomains(self.pc, n, NULL, NULL) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setASMLocalSubdomains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":275
 *         CHKERR( PCASMSetLocalSubdomains(self.pc, n, NULL, NULL) )
 * 
 *     def setASMTotalSubdomains(self, nsd):             # <<<<<<<<<<<<<<
 *         cdef PetscInt N = asInt(nsd)
 *         CHKERR( PCASMSetTotalSubdomains(self.pc, N, NULL, NULL) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_61setASMTotalSubdomains(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_60setASMTotalSubdomains[] = "PC.setASMTotalSubdomains(self, nsd)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_61setASMTotalSubdomains(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nsd = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setASMTotalSubdomains (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nsd,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);
        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_nsd)) != 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, "setASMTotalSubdomains") < 0)) __PYX_ERR(34, 275, __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_nsd = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setASMTotalSubdomains", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 275, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setASMTotalSubdomains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_60setASMTotalSubdomains(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_nsd);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_60setASMTotalSubdomains(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_nsd) {
  PetscInt __pyx_v_N;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setASMTotalSubdomains", 0);

  /* "PETSc/PC.pyx":276
 * 
 *     def setASMTotalSubdomains(self, nsd):
 *         cdef PetscInt N = asInt(nsd)             # <<<<<<<<<<<<<<
 *         CHKERR( PCASMSetTotalSubdomains(self.pc, N, NULL, NULL) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_nsd); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 276, __pyx_L1_error)
  __pyx_v_N = __pyx_t_1;

  /* "PETSc/PC.pyx":277
 *     def setASMTotalSubdomains(self, nsd):
 *         cdef PetscInt N = asInt(nsd)
 *         CHKERR( PCASMSetTotalSubdomains(self.pc, N, NULL, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def getASMSubKSP(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCASMSetTotalSubdomains(__pyx_v_self->pc, __pyx_v_N, NULL, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 277, __pyx_L1_error)

  /* "PETSc/PC.pyx":275
 *         CHKERR( PCASMSetLocalSubdomains(self.pc, n, NULL, NULL) )
 * 
 *     def setASMTotalSubdomains(self, nsd):             # <<<<<<<<<<<<<<
 *         cdef PetscInt N = asInt(nsd)
 *         CHKERR( PCASMSetTotalSubdomains(self.pc, N, NULL, NULL) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setASMTotalSubdomains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":279
 *         CHKERR( PCASMSetTotalSubdomains(self.pc, N, NULL, NULL) )
 * 
 *     def getASMSubKSP(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i = 0, n = 0
 *         cdef PetscKSP *p = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_63getASMSubKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_62getASMSubKSP[] = "PC.getASMSubKSP(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_63getASMSubKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getASMSubKSP (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getASMSubKSP", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getASMSubKSP", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_62getASMSubKSP(((struct PyPetscPCObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_62getASMSubKSP(struct PyPetscPCObject *__pyx_v_self) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_n;
  KSP *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("getASMSubKSP", 0);

  /* "PETSc/PC.pyx":280
 * 
 *     def getASMSubKSP(self):
 *         cdef PetscInt i = 0, n = 0             # <<<<<<<<<<<<<<
 *         cdef PetscKSP *p = NULL
 *         CHKERR( PCASMGetSubKSP(self.pc, &n, NULL, &p) )
 */
  __pyx_v_i = 0;
  __pyx_v_n = 0;

  /* "PETSc/PC.pyx":281
 *     def getASMSubKSP(self):
 *         cdef PetscInt i = 0, n = 0
 *         cdef PetscKSP *p = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PCASMGetSubKSP(self.pc, &n, NULL, &p) )
 *         return [ref_KSP(p[i]) for i from 0 <= i <n]
 */
  __pyx_v_p = NULL;

  /* "PETSc/PC.pyx":282
 *         cdef PetscInt i = 0, n = 0
 *         cdef PetscKSP *p = NULL
 *         CHKERR( PCASMGetSubKSP(self.pc, &n, NULL, &p) )             # <<<<<<<<<<<<<<
 *         return [ref_KSP(p[i]) for i from 0 <= i <n]
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCASMGetSubKSP(__pyx_v_self->pc, (&__pyx_v_n), NULL, (&__pyx_v_p))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 282, __pyx_L1_error)

  /* "PETSc/PC.pyx":283
 *         cdef PetscKSP *p = NULL
 *         CHKERR( PCASMGetSubKSP(self.pc, &n, NULL, &p) )
 *         return [ref_KSP(p[i]) for i from 0 <= i <n]             # <<<<<<<<<<<<<<
 * 
 *     # --- GASM ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
    __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_KSP((__pyx_v_p[__pyx_v_i]))); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_4))) __PYX_ERR(34, 283, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/PC.pyx":279
 *         CHKERR( PCASMSetTotalSubdomains(self.pc, N, NULL, NULL) )
 * 
 *     def getASMSubKSP(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i = 0, n = 0
 *         cdef PetscKSP *p = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getASMSubKSP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":287
 *     # --- GASM ---
 * 
 *     def setGASMType(self, gasmtype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCGASMType cval = gasmtype
 *         CHKERR( PCGASMSetType(self.pc, cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_65setGASMType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_64setGASMType[] = "PC.setGASMType(self, gasmtype)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_65setGASMType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gasmtype = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setGASMType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gasmtype,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);
        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_gasmtype)) != 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, "setGASMType") < 0)) __PYX_ERR(34, 287, __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_gasmtype = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setGASMType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 287, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setGASMType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_64setGASMType(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_gasmtype);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_64setGASMType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_gasmtype) {
  PCGASMType __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PCGASMType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setGASMType", 0);

  /* "PETSc/PC.pyx":288
 * 
 *     def setGASMType(self, gasmtype):
 *         cdef PetscPCGASMType cval = gasmtype             # <<<<<<<<<<<<<<
 *         CHKERR( PCGASMSetType(self.pc, cval) )
 * 
 */
  __pyx_t_1 = ((PCGASMType)__Pyx_PyInt_As_PCGASMType(__pyx_v_gasmtype)); if (unlikely(PyErr_Occurred())) __PYX_ERR(34, 288, __pyx_L1_error)
  __pyx_v_cval = __pyx_t_1;

  /* "PETSc/PC.pyx":289
 *     def setGASMType(self, gasmtype):
 *         cdef PetscPCGASMType cval = gasmtype
 *         CHKERR( PCGASMSetType(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def setGASMOverlap(self, overlap):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCGASMSetType(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 289, __pyx_L1_error)

  /* "PETSc/PC.pyx":287
 *     # --- GASM ---
 * 
 *     def setGASMType(self, gasmtype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCGASMType cval = gasmtype
 *         CHKERR( PCGASMSetType(self.pc, cval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setGASMType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":291
 *         CHKERR( PCGASMSetType(self.pc, cval) )
 * 
 *     def setGASMOverlap(self, overlap):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(overlap)
 *         CHKERR( PCGASMSetOverlap(self.pc, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_67setGASMOverlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_66setGASMOverlap[] = "PC.setGASMOverlap(self, overlap)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_67setGASMOverlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_overlap = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setGASMOverlap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_overlap,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);
        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_overlap)) != 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, "setGASMOverlap") < 0)) __PYX_ERR(34, 291, __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_overlap = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setGASMOverlap", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 291, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setGASMOverlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_66setGASMOverlap(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_overlap);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_66setGASMOverlap(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_overlap) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setGASMOverlap", 0);

  /* "PETSc/PC.pyx":292
 * 
 *     def setGASMOverlap(self, overlap):
 *         cdef PetscInt ival = asInt(overlap)             # <<<<<<<<<<<<<<
 *         CHKERR( PCGASMSetOverlap(self.pc, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_overlap); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 292, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/PC.pyx":293
 *     def setGASMOverlap(self, overlap):
 *         cdef PetscInt ival = asInt(overlap)
 *         CHKERR( PCGASMSetOverlap(self.pc, ival) )             # <<<<<<<<<<<<<<
 * 
 *     # --- GAMG ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCGASMSetOverlap(__pyx_v_self->pc, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 293, __pyx_L1_error)

  /* "PETSc/PC.pyx":291
 *         CHKERR( PCGASMSetType(self.pc, cval) )
 * 
 *     def setGASMOverlap(self, overlap):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(overlap)
 *         CHKERR( PCGASMSetOverlap(self.pc, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setGASMOverlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":297
 *     # --- GAMG ---
 * 
 *     def setGAMGType(self, gamgtype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCGAMGType cval = NULL
 *         gamgtype = str2bytes(gamgtype, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_69setGAMGType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_68setGAMGType[] = "PC.setGAMGType(self, gamgtype)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_69setGAMGType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gamgtype = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setGAMGType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gamgtype,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);
        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_gamgtype)) != 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, "setGAMGType") < 0)) __PYX_ERR(34, 297, __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_gamgtype = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setGAMGType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 297, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setGAMGType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_68setGAMGType(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_gamgtype);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_68setGAMGType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_gamgtype) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setGAMGType", 0);
  __Pyx_INCREF(__pyx_v_gamgtype);

  /* "PETSc/PC.pyx":298
 * 
 *     def setGAMGType(self, gamgtype):
 *         cdef PetscPCGAMGType cval = NULL             # <<<<<<<<<<<<<<
 *         gamgtype = str2bytes(gamgtype, &cval)
 *         CHKERR( PCGAMGSetType(self.pc, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/PC.pyx":299
 *     def setGAMGType(self, gamgtype):
 *         cdef PetscPCGAMGType cval = NULL
 *         gamgtype = str2bytes(gamgtype, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PCGAMGSetType(self.pc, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_gamgtype, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gamgtype, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":300
 *         cdef PetscPCGAMGType cval = NULL
 *         gamgtype = str2bytes(gamgtype, &cval)
 *         CHKERR( PCGAMGSetType(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def setGAMGLevels(self, levels):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCGAMGSetType(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 300, __pyx_L1_error)

  /* "PETSc/PC.pyx":297
 *     # --- GAMG ---
 * 
 *     def setGAMGType(self, gamgtype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCGAMGType cval = NULL
 *         gamgtype = str2bytes(gamgtype, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setGAMGType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gamgtype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":302
 *         CHKERR( PCGAMGSetType(self.pc, cval) )
 * 
 *     def setGAMGLevels(self, levels):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(levels)
 *         CHKERR( PCGAMGSetNlevels(self.pc, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_71setGAMGLevels(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_70setGAMGLevels[] = "PC.setGAMGLevels(self, levels)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_71setGAMGLevels(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_levels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setGAMGLevels (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_levels,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);
        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_levels)) != 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, "setGAMGLevels") < 0)) __PYX_ERR(34, 302, __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_levels = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setGAMGLevels", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 302, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setGAMGLevels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_70setGAMGLevels(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_levels);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_70setGAMGLevels(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_levels) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setGAMGLevels", 0);

  /* "PETSc/PC.pyx":303
 * 
 *     def setGAMGLevels(self, levels):
 *         cdef PetscInt ival = asInt(levels)             # <<<<<<<<<<<<<<
 *         CHKERR( PCGAMGSetNlevels(self.pc, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_levels); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 303, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/PC.pyx":304
 *     def setGAMGLevels(self, levels):
 *         cdef PetscInt ival = asInt(levels)
 *         CHKERR( PCGAMGSetNlevels(self.pc, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def setGAMGSmooths(self, smooths):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCGAMGSetNlevels(__pyx_v_self->pc, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 304, __pyx_L1_error)

  /* "PETSc/PC.pyx":302
 *         CHKERR( PCGAMGSetType(self.pc, cval) )
 * 
 *     def setGAMGLevels(self, levels):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(levels)
 *         CHKERR( PCGAMGSetNlevels(self.pc, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setGAMGLevels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":306
 *         CHKERR( PCGAMGSetNlevels(self.pc, ival) )
 * 
 *     def setGAMGSmooths(self, smooths):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(smooths)
 *         CHKERR( PCGAMGSetNSmooths(self.pc, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_73setGAMGSmooths(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_72setGAMGSmooths[] = "PC.setGAMGSmooths(self, smooths)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_73setGAMGSmooths(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_smooths = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setGAMGSmooths (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_smooths,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);
        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_smooths)) != 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, "setGAMGSmooths") < 0)) __PYX_ERR(34, 306, __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_smooths = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setGAMGSmooths", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 306, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setGAMGSmooths", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_72setGAMGSmooths(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_smooths);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_72setGAMGSmooths(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_smooths) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setGAMGSmooths", 0);

  /* "PETSc/PC.pyx":307
 * 
 *     def setGAMGSmooths(self, smooths):
 *         cdef PetscInt ival = asInt(smooths)             # <<<<<<<<<<<<<<
 *         CHKERR( PCGAMGSetNSmooths(self.pc, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_smooths); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 307, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/PC.pyx":308
 *     def setGAMGSmooths(self, smooths):
 *         cdef PetscInt ival = asInt(smooths)
 *         CHKERR( PCGAMGSetNSmooths(self.pc, ival) )             # <<<<<<<<<<<<<<
 * 
 *     # --- Hypre ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCGAMGSetNSmooths(__pyx_v_self->pc, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 308, __pyx_L1_error)

  /* "PETSc/PC.pyx":306
 *         CHKERR( PCGAMGSetNlevels(self.pc, ival) )
 * 
 *     def setGAMGSmooths(self, smooths):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(smooths)
 *         CHKERR( PCGAMGSetNSmooths(self.pc, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setGAMGSmooths", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":312
 *     # --- Hypre ---
 * 
 *     def getHYPREType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscPCHYPREType cval = NULL
 *         CHKERR( PCHYPREGetType(self.pc, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_75getHYPREType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_74getHYPREType[] = "PC.getHYPREType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_75getHYPREType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getHYPREType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getHYPREType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getHYPREType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_74getHYPREType(((struct PyPetscPCObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_74getHYPREType(struct PyPetscPCObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getHYPREType", 0);

  /* "PETSc/PC.pyx":313
 * 
 *     def getHYPREType(self):
 *         cdef PetscPCHYPREType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PCHYPREGetType(self.pc, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/PC.pyx":314
 *     def getHYPREType(self):
 *         cdef PetscPCHYPREType cval = NULL
 *         CHKERR( PCHYPREGetType(self.pc, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCHYPREGetType(__pyx_v_self->pc, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 314, __pyx_L1_error)

  /* "PETSc/PC.pyx":315
 *         cdef PetscPCHYPREType cval = NULL
 *         CHKERR( PCHYPREGetType(self.pc, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setHYPREType(self, hypretype):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/PC.pyx":312
 *     # --- Hypre ---
 * 
 *     def getHYPREType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscPCHYPREType cval = NULL
 *         CHKERR( PCHYPREGetType(self.pc, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getHYPREType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":317
 *         return bytes2str(cval)
 * 
 *     def setHYPREType(self, hypretype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCHYPREType cval = NULL
 *         hypretype = str2bytes(hypretype, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_77setHYPREType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_76setHYPREType[] = "PC.setHYPREType(self, hypretype)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_77setHYPREType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_hypretype = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setHYPREType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hypretype,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);
        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_hypretype)) != 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, "setHYPREType") < 0)) __PYX_ERR(34, 317, __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_hypretype = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setHYPREType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 317, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setHYPREType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_76setHYPREType(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_hypretype);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_76setHYPREType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_hypretype) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setHYPREType", 0);
  __Pyx_INCREF(__pyx_v_hypretype);

  /* "PETSc/PC.pyx":318
 * 
 *     def setHYPREType(self, hypretype):
 *         cdef PetscPCHYPREType cval = NULL             # <<<<<<<<<<<<<<
 *         hypretype = str2bytes(hypretype, &cval)
 *         CHKERR( PCHYPRESetType(self.pc, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/PC.pyx":319
 *     def setHYPREType(self, hypretype):
 *         cdef PetscPCHYPREType cval = NULL
 *         hypretype = str2bytes(hypretype, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PCHYPRESetType(self.pc, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_hypretype, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_hypretype, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":320
 *         cdef PetscPCHYPREType cval = NULL
 *         hypretype = str2bytes(hypretype, &cval)
 *         CHKERR( PCHYPRESetType(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def setHYPREDiscreteCurl(self, Mat mat not None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCHYPRESetType(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 320, __pyx_L1_error)

  /* "PETSc/PC.pyx":317
 *         return bytes2str(cval)
 * 
 *     def setHYPREType(self, hypretype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCHYPREType cval = NULL
 *         hypretype = str2bytes(hypretype, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setHYPREType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_hypretype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":322
 *         CHKERR( PCHYPRESetType(self.pc, cval) )
 * 
 *     def setHYPREDiscreteCurl(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCHYPRESetDiscreteCurl(self.pc, mat.mat) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_79setHYPREDiscreteCurl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_78setHYPREDiscreteCurl[] = "PC.setHYPREDiscreteCurl(self, Mat mat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_79setHYPREDiscreteCurl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setHYPREDiscreteCurl (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,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);
        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_mat)) != 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, "setHYPREDiscreteCurl") < 0)) __PYX_ERR(34, 322, __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_mat = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setHYPREDiscreteCurl", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 322, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setHYPREDiscreteCurl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(34, 322, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_78setHYPREDiscreteCurl(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_mat);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_78setHYPREDiscreteCurl(struct PyPetscPCObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setHYPREDiscreteCurl", 0);

  /* "PETSc/PC.pyx":323
 * 
 *     def setHYPREDiscreteCurl(self, Mat mat not None):
 *         CHKERR( PCHYPRESetDiscreteCurl(self.pc, mat.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def setHYPREDiscreteGradient(self, Mat mat not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCHYPRESetDiscreteCurl(__pyx_v_self->pc, __pyx_v_mat->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 323, __pyx_L1_error)

  /* "PETSc/PC.pyx":322
 *         CHKERR( PCHYPRESetType(self.pc, cval) )
 * 
 *     def setHYPREDiscreteCurl(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCHYPRESetDiscreteCurl(self.pc, mat.mat) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setHYPREDiscreteCurl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":325
 *         CHKERR( PCHYPRESetDiscreteCurl(self.pc, mat.mat) )
 * 
 *     def setHYPREDiscreteGradient(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCHYPRESetDiscreteGradient(self.pc, mat.mat) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_81setHYPREDiscreteGradient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_80setHYPREDiscreteGradient[] = "PC.setHYPREDiscreteGradient(self, Mat mat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_81setHYPREDiscreteGradient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setHYPREDiscreteGradient (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,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);
        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_mat)) != 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, "setHYPREDiscreteGradient") < 0)) __PYX_ERR(34, 325, __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_mat = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setHYPREDiscreteGradient", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 325, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setHYPREDiscreteGradient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(34, 325, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_80setHYPREDiscreteGradient(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_mat);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_80setHYPREDiscreteGradient(struct PyPetscPCObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setHYPREDiscreteGradient", 0);

  /* "PETSc/PC.pyx":326
 * 
 *     def setHYPREDiscreteGradient(self, Mat mat not None):
 *         CHKERR( PCHYPRESetDiscreteGradient(self.pc, mat.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def setHYPRESetAlphaPoissonMatrix(self, Mat mat not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCHYPRESetDiscreteGradient(__pyx_v_self->pc, __pyx_v_mat->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 326, __pyx_L1_error)

  /* "PETSc/PC.pyx":325
 *         CHKERR( PCHYPRESetDiscreteCurl(self.pc, mat.mat) )
 * 
 *     def setHYPREDiscreteGradient(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCHYPRESetDiscreteGradient(self.pc, mat.mat) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setHYPREDiscreteGradient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":328
 *         CHKERR( PCHYPRESetDiscreteGradient(self.pc, mat.mat) )
 * 
 *     def setHYPRESetAlphaPoissonMatrix(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCHYPRESetAlphaPoissonMatrix(self.pc, mat.mat) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_83setHYPRESetAlphaPoissonMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_82setHYPRESetAlphaPoissonMatrix[] = "PC.setHYPRESetAlphaPoissonMatrix(self, Mat mat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_83setHYPRESetAlphaPoissonMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setHYPRESetAlphaPoissonMatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,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);
        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_mat)) != 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, "setHYPRESetAlphaPoissonMatrix") < 0)) __PYX_ERR(34, 328, __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_mat = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setHYPRESetAlphaPoissonMatrix", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 328, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setHYPRESetAlphaPoissonMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(34, 328, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_82setHYPRESetAlphaPoissonMatrix(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_mat);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_82setHYPRESetAlphaPoissonMatrix(struct PyPetscPCObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setHYPRESetAlphaPoissonMatrix", 0);

  /* "PETSc/PC.pyx":329
 * 
 *     def setHYPRESetAlphaPoissonMatrix(self, Mat mat not None):
 *         CHKERR( PCHYPRESetAlphaPoissonMatrix(self.pc, mat.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def setHYPRESetBetaPoissonMatrix(self, Mat mat=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCHYPRESetAlphaPoissonMatrix(__pyx_v_self->pc, __pyx_v_mat->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 329, __pyx_L1_error)

  /* "PETSc/PC.pyx":328
 *         CHKERR( PCHYPRESetDiscreteGradient(self.pc, mat.mat) )
 * 
 *     def setHYPRESetAlphaPoissonMatrix(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         CHKERR( PCHYPRESetAlphaPoissonMatrix(self.pc, mat.mat) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setHYPRESetAlphaPoissonMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":331
 *         CHKERR( PCHYPRESetAlphaPoissonMatrix(self.pc, mat.mat) )
 * 
 *     def setHYPRESetBetaPoissonMatrix(self, Mat mat=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat pmat = NULL
 *         if mat is not None: pmat = mat.mat
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_85setHYPRESetBetaPoissonMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_84setHYPRESetBetaPoissonMatrix[] = "PC.setHYPRESetBetaPoissonMatrix(self, Mat mat=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_85setHYPRESetBetaPoissonMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setHYPRESetBetaPoissonMatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscMatObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mat);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setHYPRESetBetaPoissonMatrix") < 0)) __PYX_ERR(34, 331, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mat = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setHYPRESetBetaPoissonMatrix", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 331, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setHYPRESetBetaPoissonMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "mat", 0))) __PYX_ERR(34, 331, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_84setHYPRESetBetaPoissonMatrix(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_mat);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_84setHYPRESetBetaPoissonMatrix(struct PyPetscPCObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat) {
  Mat __pyx_v_pmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Mat __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setHYPRESetBetaPoissonMatrix", 0);

  /* "PETSc/PC.pyx":332
 * 
 *     def setHYPRESetBetaPoissonMatrix(self, Mat mat=None):
 *         cdef PetscMat pmat = NULL             # <<<<<<<<<<<<<<
 *         if mat is not None: pmat = mat.mat
 *         CHKERR( PCHYPRESetBetaPoissonMatrix(self.pc, pmat) )
 */
  __pyx_v_pmat = NULL;

  /* "PETSc/PC.pyx":333
 *     def setHYPRESetBetaPoissonMatrix(self, Mat mat=None):
 *         cdef PetscMat pmat = NULL
 *         if mat is not None: pmat = mat.mat             # <<<<<<<<<<<<<<
 *         CHKERR( PCHYPRESetBetaPoissonMatrix(self.pc, pmat) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_mat) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_mat->mat;
    __pyx_v_pmat = __pyx_t_3;
  }

  /* "PETSc/PC.pyx":334
 *         cdef PetscMat pmat = NULL
 *         if mat is not None: pmat = mat.mat
 *         CHKERR( PCHYPRESetBetaPoissonMatrix(self.pc, pmat) )             # <<<<<<<<<<<<<<
 * 
 *     def setHYPRESetEdgeConstantVectors(self, Vec ozz not None,
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCHYPRESetBetaPoissonMatrix(__pyx_v_self->pc, __pyx_v_pmat)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(34, 334, __pyx_L1_error)

  /* "PETSc/PC.pyx":331
 *         CHKERR( PCHYPRESetAlphaPoissonMatrix(self.pc, mat.mat) )
 * 
 *     def setHYPRESetBetaPoissonMatrix(self, Mat mat=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat pmat = NULL
 *         if mat is not None: pmat = mat.mat
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setHYPRESetBetaPoissonMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":336
 *         CHKERR( PCHYPRESetBetaPoissonMatrix(self.pc, pmat) )
 * 
 *     def setHYPRESetEdgeConstantVectors(self, Vec ozz not None,             # <<<<<<<<<<<<<<
 *                                        Vec zoz not None, Vec zzo=None):
 *         cdef PetscVec zzo_vec = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_87setHYPRESetEdgeConstantVectors(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_86setHYPRESetEdgeConstantVectors[] = "PC.setHYPRESetEdgeConstantVectors(self, Vec ozz, Vec zoz, Vec zzo=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_87setHYPRESetEdgeConstantVectors(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_ozz = 0;
  struct PyPetscVecObject *__pyx_v_zoz = 0;
  struct PyPetscVecObject *__pyx_v_zzo = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setHYPRESetEdgeConstantVectors (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ozz,&__pyx_n_s_zoz,&__pyx_n_s_zzo,0};
    PyObject* values[3] = {0,0,0};

    /* "PETSc/PC.pyx":337
 * 
 *     def setHYPRESetEdgeConstantVectors(self, Vec ozz not None,
 *                                        Vec zoz not None, Vec zzo=None):             # <<<<<<<<<<<<<<
 *         cdef PetscVec zzo_vec = NULL
 *         if zzo is not None: zzo_vec = zzo.vec
 */
    values[2] = (PyObject *)((struct PyPetscVecObject *)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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_ozz)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zoz)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setHYPRESetEdgeConstantVectors", 0, 2, 3, 1); __PYX_ERR(34, 336, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zzo);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setHYPRESetEdgeConstantVectors") < 0)) __PYX_ERR(34, 336, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_ozz = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_zoz = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_zzo = ((struct PyPetscVecObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setHYPRESetEdgeConstantVectors", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 336, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setHYPRESetEdgeConstantVectors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ozz), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "ozz", 0))) __PYX_ERR(34, 336, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_zoz), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "zoz", 0))) __PYX_ERR(34, 337, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_zzo), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "zzo", 0))) __PYX_ERR(34, 337, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_86setHYPRESetEdgeConstantVectors(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_ozz, __pyx_v_zoz, __pyx_v_zzo);

  /* "PETSc/PC.pyx":336
 *         CHKERR( PCHYPRESetBetaPoissonMatrix(self.pc, pmat) )
 * 
 *     def setHYPRESetEdgeConstantVectors(self, Vec ozz not None,             # <<<<<<<<<<<<<<
 *                                        Vec zoz not None, Vec zzo=None):
 *         cdef PetscVec zzo_vec = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_86setHYPRESetEdgeConstantVectors(struct PyPetscPCObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_ozz, struct PyPetscVecObject *__pyx_v_zoz, struct PyPetscVecObject *__pyx_v_zzo) {
  Vec __pyx_v_zzo_vec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Vec __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setHYPRESetEdgeConstantVectors", 0);

  /* "PETSc/PC.pyx":338
 *     def setHYPRESetEdgeConstantVectors(self, Vec ozz not None,
 *                                        Vec zoz not None, Vec zzo=None):
 *         cdef PetscVec zzo_vec = NULL             # <<<<<<<<<<<<<<
 *         if zzo is not None: zzo_vec = zzo.vec
 *         CHKERR( PCHYPRESetEdgeConstantVectors(self.pc, ozz.vec, zoz.vec,
 */
  __pyx_v_zzo_vec = NULL;

  /* "PETSc/PC.pyx":339
 *                                        Vec zoz not None, Vec zzo=None):
 *         cdef PetscVec zzo_vec = NULL
 *         if zzo is not None: zzo_vec = zzo.vec             # <<<<<<<<<<<<<<
 *         CHKERR( PCHYPRESetEdgeConstantVectors(self.pc, ozz.vec, zoz.vec,
 *                                               zzo_vec) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_zzo) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_zzo->vec;
    __pyx_v_zzo_vec = __pyx_t_3;
  }

  /* "PETSc/PC.pyx":340
 *         cdef PetscVec zzo_vec = NULL
 *         if zzo is not None: zzo_vec = zzo.vec
 *         CHKERR( PCHYPRESetEdgeConstantVectors(self.pc, ozz.vec, zoz.vec,             # <<<<<<<<<<<<<<
 *                                               zzo_vec) )
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCHYPRESetEdgeConstantVectors(__pyx_v_self->pc, __pyx_v_ozz->vec, __pyx_v_zoz->vec, __pyx_v_zzo_vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(34, 340, __pyx_L1_error)

  /* "PETSc/PC.pyx":336
 *         CHKERR( PCHYPRESetBetaPoissonMatrix(self.pc, pmat) )
 * 
 *     def setHYPRESetEdgeConstantVectors(self, Vec ozz not None,             # <<<<<<<<<<<<<<
 *                                        Vec zoz not None, Vec zzo=None):
 *         cdef PetscVec zzo_vec = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setHYPRESetEdgeConstantVectors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":345
 *     # --- Factor ---
 * 
 *     def setFactorSolverPackage(self, solver):             # <<<<<<<<<<<<<<
 *         cdef PetscMatSolverPackage cval = NULL
 *         solver = str2bytes(solver, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_89setFactorSolverPackage(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_88setFactorSolverPackage[] = "PC.setFactorSolverPackage(self, solver)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_89setFactorSolverPackage(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_solver = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFactorSolverPackage (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_solver,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);
        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_solver)) != 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, "setFactorSolverPackage") < 0)) __PYX_ERR(34, 345, __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_solver = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFactorSolverPackage", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 345, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFactorSolverPackage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_88setFactorSolverPackage(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_solver);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_88setFactorSolverPackage(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_solver) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFactorSolverPackage", 0);
  __Pyx_INCREF(__pyx_v_solver);

  /* "PETSc/PC.pyx":346
 * 
 *     def setFactorSolverPackage(self, solver):
 *         cdef PetscMatSolverPackage cval = NULL             # <<<<<<<<<<<<<<
 *         solver = str2bytes(solver, &cval)
 *         CHKERR( PCFactorSetMatSolverPackage(self.pc, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/PC.pyx":347
 *     def setFactorSolverPackage(self, solver):
 *         cdef PetscMatSolverPackage cval = NULL
 *         solver = str2bytes(solver, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PCFactorSetMatSolverPackage(self.pc, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_solver, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_solver, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":348
 *         cdef PetscMatSolverPackage cval = NULL
 *         solver = str2bytes(solver, &cval)
 *         CHKERR( PCFactorSetMatSolverPackage(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getFactorSolverPackage(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFactorSetMatSolverPackage(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 348, __pyx_L1_error)

  /* "PETSc/PC.pyx":345
 *     # --- Factor ---
 * 
 *     def setFactorSolverPackage(self, solver):             # <<<<<<<<<<<<<<
 *         cdef PetscMatSolverPackage cval = NULL
 *         solver = str2bytes(solver, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFactorSolverPackage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_solver);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":350
 *         CHKERR( PCFactorSetMatSolverPackage(self.pc, cval) )
 * 
 *     def getFactorSolverPackage(self):             # <<<<<<<<<<<<<<
 *         cdef PetscMatSolverPackage cval = NULL
 *         CHKERR( PCFactorGetMatSolverPackage(self.pc, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_91getFactorSolverPackage(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_90getFactorSolverPackage[] = "PC.getFactorSolverPackage(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_91getFactorSolverPackage(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFactorSolverPackage (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getFactorSolverPackage", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getFactorSolverPackage", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_90getFactorSolverPackage(((struct PyPetscPCObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_90getFactorSolverPackage(struct PyPetscPCObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getFactorSolverPackage", 0);

  /* "PETSc/PC.pyx":351
 * 
 *     def getFactorSolverPackage(self):
 *         cdef PetscMatSolverPackage cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PCFactorGetMatSolverPackage(self.pc, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/PC.pyx":352
 *     def getFactorSolverPackage(self):
 *         cdef PetscMatSolverPackage cval = NULL
 *         CHKERR( PCFactorGetMatSolverPackage(self.pc, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFactorGetMatSolverPackage(__pyx_v_self->pc, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 352, __pyx_L1_error)

  /* "PETSc/PC.pyx":353
 *         cdef PetscMatSolverPackage cval = NULL
 *         CHKERR( PCFactorGetMatSolverPackage(self.pc, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setFactorOrdering(self, ord_type=None, nzdiag=None, reuse=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/PC.pyx":350
 *         CHKERR( PCFactorSetMatSolverPackage(self.pc, cval) )
 * 
 *     def getFactorSolverPackage(self):             # <<<<<<<<<<<<<<
 *         cdef PetscMatSolverPackage cval = NULL
 *         CHKERR( PCFactorGetMatSolverPackage(self.pc, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getFactorSolverPackage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":355
 *         return bytes2str(cval)
 * 
 *     def setFactorOrdering(self, ord_type=None, nzdiag=None, reuse=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatOrderingType cval = NULL
 *         if ord_type is not None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_93setFactorOrdering(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_92setFactorOrdering[] = "PC.setFactorOrdering(self, ord_type=None, nzdiag=None, reuse=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_93setFactorOrdering(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ord_type = 0;
  PyObject *__pyx_v_nzdiag = 0;
  PyObject *__pyx_v_reuse = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFactorOrdering (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ord_type,&__pyx_n_s_nzdiag,&__pyx_n_s_reuse,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ord_type);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nzdiag);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reuse);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFactorOrdering") < 0)) __PYX_ERR(34, 355, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ord_type = values[0];
    __pyx_v_nzdiag = values[1];
    __pyx_v_reuse = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFactorOrdering", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 355, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFactorOrdering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_92setFactorOrdering(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_ord_type, __pyx_v_nzdiag, __pyx_v_reuse);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_92setFactorOrdering(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_ord_type, PyObject *__pyx_v_nzdiag, PyObject *__pyx_v_reuse) {
  const char* __pyx_v_cval;
  PetscReal __pyx_v_rval;
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PetscReal __pyx_t_5;
  PetscBool __pyx_t_6;
  __Pyx_RefNannySetupContext("setFactorOrdering", 0);
  __Pyx_INCREF(__pyx_v_ord_type);

  /* "PETSc/PC.pyx":356
 * 
 *     def setFactorOrdering(self, ord_type=None, nzdiag=None, reuse=None):
 *         cdef PetscMatOrderingType cval = NULL             # <<<<<<<<<<<<<<
 *         if ord_type is not None:
 *             ord_type = str2bytes(ord_type, &cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/PC.pyx":357
 *     def setFactorOrdering(self, ord_type=None, nzdiag=None, reuse=None):
 *         cdef PetscMatOrderingType cval = NULL
 *         if ord_type is not None:             # <<<<<<<<<<<<<<
 *             ord_type = str2bytes(ord_type, &cval)
 *             CHKERR( PCFactorSetMatOrderingType(self.pc, cval) )
 */
  __pyx_t_1 = (__pyx_v_ord_type != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/PC.pyx":358
 *         cdef PetscMatOrderingType cval = NULL
 *         if ord_type is not None:
 *             ord_type = str2bytes(ord_type, &cval)             # <<<<<<<<<<<<<<
 *             CHKERR( PCFactorSetMatOrderingType(self.pc, cval) )
 *         cdef PetscReal rval = 0
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_ord_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_ord_type, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/PC.pyx":359
 *         if ord_type is not None:
 *             ord_type = str2bytes(ord_type, &cval)
 *             CHKERR( PCFactorSetMatOrderingType(self.pc, cval) )             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         if nzdiag is not None:
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFactorSetMatOrderingType(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(34, 359, __pyx_L1_error)

    /* "PETSc/PC.pyx":357
 *     def setFactorOrdering(self, ord_type=None, nzdiag=None, reuse=None):
 *         cdef PetscMatOrderingType cval = NULL
 *         if ord_type is not None:             # <<<<<<<<<<<<<<
 *             ord_type = str2bytes(ord_type, &cval)
 *             CHKERR( PCFactorSetMatOrderingType(self.pc, cval) )
 */
  }

  /* "PETSc/PC.pyx":360
 *             ord_type = str2bytes(ord_type, &cval)
 *             CHKERR( PCFactorSetMatOrderingType(self.pc, cval) )
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         if nzdiag is not None:
 *             rval = asReal(nzdiag)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/PC.pyx":361
 *             CHKERR( PCFactorSetMatOrderingType(self.pc, cval) )
 *         cdef PetscReal rval = 0
 *         if nzdiag is not None:             # <<<<<<<<<<<<<<
 *             rval = asReal(nzdiag)
 *             CHKERR( PCFactorReorderForNonzeroDiagonal(self.pc, rval) )
 */
  __pyx_t_2 = (__pyx_v_nzdiag != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/PC.pyx":362
 *         cdef PetscReal rval = 0
 *         if nzdiag is not None:
 *             rval = asReal(nzdiag)             # <<<<<<<<<<<<<<
 *             CHKERR( PCFactorReorderForNonzeroDiagonal(self.pc, rval) )
 *         cdef PetscBool bval = PETSC_FALSE
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_nzdiag); if (unlikely(__pyx_t_5 == -1.0 && PyErr_Occurred())) __PYX_ERR(34, 362, __pyx_L1_error)
    __pyx_v_rval = __pyx_t_5;

    /* "PETSc/PC.pyx":363
 *         if nzdiag is not None:
 *             rval = asReal(nzdiag)
 *             CHKERR( PCFactorReorderForNonzeroDiagonal(self.pc, rval) )             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = PETSC_FALSE
 *         if reuse is not None:
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFactorReorderForNonzeroDiagonal(__pyx_v_self->pc, __pyx_v_rval)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(34, 363, __pyx_L1_error)

    /* "PETSc/PC.pyx":361
 *             CHKERR( PCFactorSetMatOrderingType(self.pc, cval) )
 *         cdef PetscReal rval = 0
 *         if nzdiag is not None:             # <<<<<<<<<<<<<<
 *             rval = asReal(nzdiag)
 *             CHKERR( PCFactorReorderForNonzeroDiagonal(self.pc, rval) )
 */
  }

  /* "PETSc/PC.pyx":364
 *             rval = asReal(nzdiag)
 *             CHKERR( PCFactorReorderForNonzeroDiagonal(self.pc, rval) )
 *         cdef PetscBool bval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if reuse is not None:
 *             bval = PETSC_TRUE if reuse else PETSC_FALSE
 */
  __pyx_v_bval = PETSC_FALSE;

  /* "PETSc/PC.pyx":365
 *             CHKERR( PCFactorReorderForNonzeroDiagonal(self.pc, rval) )
 *         cdef PetscBool bval = PETSC_FALSE
 *         if reuse is not None:             # <<<<<<<<<<<<<<
 *             bval = PETSC_TRUE if reuse else PETSC_FALSE
 *             CHKERR( PCFactorSetReuseOrdering(self.pc, bval) )
 */
  __pyx_t_1 = (__pyx_v_reuse != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/PC.pyx":366
 *         cdef PetscBool bval = PETSC_FALSE
 *         if reuse is not None:
 *             bval = PETSC_TRUE if reuse else PETSC_FALSE             # <<<<<<<<<<<<<<
 *             CHKERR( PCFactorSetReuseOrdering(self.pc, bval) )
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_reuse); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(34, 366, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_t_6 = PETSC_TRUE;
    } else {
      __pyx_t_6 = PETSC_FALSE;
    }
    __pyx_v_bval = __pyx_t_6;

    /* "PETSc/PC.pyx":367
 *         if reuse is not None:
 *             bval = PETSC_TRUE if reuse else PETSC_FALSE
 *             CHKERR( PCFactorSetReuseOrdering(self.pc, bval) )             # <<<<<<<<<<<<<<
 * 
 *     def setFactorPivot(self, zeropivot=None, inblocks=None):
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFactorSetReuseOrdering(__pyx_v_self->pc, __pyx_v_bval)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(34, 367, __pyx_L1_error)

    /* "PETSc/PC.pyx":365
 *             CHKERR( PCFactorReorderForNonzeroDiagonal(self.pc, rval) )
 *         cdef PetscBool bval = PETSC_FALSE
 *         if reuse is not None:             # <<<<<<<<<<<<<<
 *             bval = PETSC_TRUE if reuse else PETSC_FALSE
 *             CHKERR( PCFactorSetReuseOrdering(self.pc, bval) )
 */
  }

  /* "PETSc/PC.pyx":355
 *         return bytes2str(cval)
 * 
 *     def setFactorOrdering(self, ord_type=None, nzdiag=None, reuse=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatOrderingType cval = NULL
 *         if ord_type is not None:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFactorOrdering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ord_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":369
 *             CHKERR( PCFactorSetReuseOrdering(self.pc, bval) )
 * 
 *     def setFactorPivot(self, zeropivot=None, inblocks=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         if zeropivot is not None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_95setFactorPivot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_94setFactorPivot[] = "PC.setFactorPivot(self, zeropivot=None, inblocks=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_95setFactorPivot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_zeropivot = 0;
  PyObject *__pyx_v_inblocks = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFactorPivot (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_zeropivot,&__pyx_n_s_inblocks,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zeropivot);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_inblocks);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFactorPivot") < 0)) __PYX_ERR(34, 369, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_zeropivot = values[0];
    __pyx_v_inblocks = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFactorPivot", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 369, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFactorPivot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_94setFactorPivot(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_zeropivot, __pyx_v_inblocks);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_94setFactorPivot(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_zeropivot, PyObject *__pyx_v_inblocks) {
  PetscReal __pyx_v_rval;
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscReal __pyx_t_3;
  int __pyx_t_4;
  PetscBool __pyx_t_5;
  __Pyx_RefNannySetupContext("setFactorPivot", 0);

  /* "PETSc/PC.pyx":370
 * 
 *     def setFactorPivot(self, zeropivot=None, inblocks=None):
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         if zeropivot is not None:
 *             rval = asReal(zeropivot)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/PC.pyx":371
 *     def setFactorPivot(self, zeropivot=None, inblocks=None):
 *         cdef PetscReal rval = 0
 *         if zeropivot is not None:             # <<<<<<<<<<<<<<
 *             rval = asReal(zeropivot)
 *             CHKERR( PCFactorSetZeroPivot(self.pc, rval) )
 */
  __pyx_t_1 = (__pyx_v_zeropivot != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/PC.pyx":372
 *         cdef PetscReal rval = 0
 *         if zeropivot is not None:
 *             rval = asReal(zeropivot)             # <<<<<<<<<<<<<<
 *             CHKERR( PCFactorSetZeroPivot(self.pc, rval) )
 *         cdef PetscBool bval = PETSC_FALSE
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_zeropivot); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(34, 372, __pyx_L1_error)
    __pyx_v_rval = __pyx_t_3;

    /* "PETSc/PC.pyx":373
 *         if zeropivot is not None:
 *             rval = asReal(zeropivot)
 *             CHKERR( PCFactorSetZeroPivot(self.pc, rval) )             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = PETSC_FALSE
 *         if inblocks is not None:
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFactorSetZeroPivot(__pyx_v_self->pc, __pyx_v_rval)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(34, 373, __pyx_L1_error)

    /* "PETSc/PC.pyx":371
 *     def setFactorPivot(self, zeropivot=None, inblocks=None):
 *         cdef PetscReal rval = 0
 *         if zeropivot is not None:             # <<<<<<<<<<<<<<
 *             rval = asReal(zeropivot)
 *             CHKERR( PCFactorSetZeroPivot(self.pc, rval) )
 */
  }

  /* "PETSc/PC.pyx":374
 *             rval = asReal(zeropivot)
 *             CHKERR( PCFactorSetZeroPivot(self.pc, rval) )
 *         cdef PetscBool bval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if inblocks is not None:
 *             bval = PETSC_TRUE if inblocks else PETSC_FALSE
 */
  __pyx_v_bval = PETSC_FALSE;

  /* "PETSc/PC.pyx":375
 *             CHKERR( PCFactorSetZeroPivot(self.pc, rval) )
 *         cdef PetscBool bval = PETSC_FALSE
 *         if inblocks is not None:             # <<<<<<<<<<<<<<
 *             bval = PETSC_TRUE if inblocks else PETSC_FALSE
 *             CHKERR( PCFactorSetPivotInBlocks(self.pc, bval) )
 */
  __pyx_t_2 = (__pyx_v_inblocks != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/PC.pyx":376
 *         cdef PetscBool bval = PETSC_FALSE
 *         if inblocks is not None:
 *             bval = PETSC_TRUE if inblocks else PETSC_FALSE             # <<<<<<<<<<<<<<
 *             CHKERR( PCFactorSetPivotInBlocks(self.pc, bval) )
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_inblocks); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(34, 376, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_t_5 = PETSC_TRUE;
    } else {
      __pyx_t_5 = PETSC_FALSE;
    }
    __pyx_v_bval = __pyx_t_5;

    /* "PETSc/PC.pyx":377
 *         if inblocks is not None:
 *             bval = PETSC_TRUE if inblocks else PETSC_FALSE
 *             CHKERR( PCFactorSetPivotInBlocks(self.pc, bval) )             # <<<<<<<<<<<<<<
 * 
 *     def setFactorShift(self, shift_type=None, amount=None):
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFactorSetPivotInBlocks(__pyx_v_self->pc, __pyx_v_bval)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(34, 377, __pyx_L1_error)

    /* "PETSc/PC.pyx":375
 *             CHKERR( PCFactorSetZeroPivot(self.pc, rval) )
 *         cdef PetscBool bval = PETSC_FALSE
 *         if inblocks is not None:             # <<<<<<<<<<<<<<
 *             bval = PETSC_TRUE if inblocks else PETSC_FALSE
 *             CHKERR( PCFactorSetPivotInBlocks(self.pc, bval) )
 */
  }

  /* "PETSc/PC.pyx":369
 *             CHKERR( PCFactorSetReuseOrdering(self.pc, bval) )
 * 
 *     def setFactorPivot(self, zeropivot=None, inblocks=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         if zeropivot is not None:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFactorPivot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":379
 *             CHKERR( PCFactorSetPivotInBlocks(self.pc, bval) )
 * 
 *     def setFactorShift(self, shift_type=None, amount=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatFactorShiftType cval = MAT_SHIFT_NONE
 *         if shift_type is not None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_97setFactorShift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_96setFactorShift[] = "PC.setFactorShift(self, shift_type=None, amount=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_97setFactorShift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_shift_type = 0;
  PyObject *__pyx_v_amount = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFactorShift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shift_type,&__pyx_n_s_amount,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shift_type);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_amount);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFactorShift") < 0)) __PYX_ERR(34, 379, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_shift_type = values[0];
    __pyx_v_amount = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFactorShift", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 379, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFactorShift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_96setFactorShift(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_shift_type, __pyx_v_amount);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_96setFactorShift(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_shift_type, PyObject *__pyx_v_amount) {
  MatFactorShiftType __pyx_v_cval;
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  MatFactorShiftType __pyx_t_3;
  int __pyx_t_4;
  PetscReal __pyx_t_5;
  __Pyx_RefNannySetupContext("setFactorShift", 0);

  /* "PETSc/PC.pyx":380
 * 
 *     def setFactorShift(self, shift_type=None, amount=None):
 *         cdef PetscMatFactorShiftType cval = MAT_SHIFT_NONE             # <<<<<<<<<<<<<<
 *         if shift_type is not None:
 *             cval = matfactorshifttype(shift_type)
 */
  __pyx_v_cval = MAT_SHIFT_NONE;

  /* "PETSc/PC.pyx":381
 *     def setFactorShift(self, shift_type=None, amount=None):
 *         cdef PetscMatFactorShiftType cval = MAT_SHIFT_NONE
 *         if shift_type is not None:             # <<<<<<<<<<<<<<
 *             cval = matfactorshifttype(shift_type)
 *             CHKERR( PCFactorSetShiftType(self.pc, cval) )
 */
  __pyx_t_1 = (__pyx_v_shift_type != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/PC.pyx":382
 *         cdef PetscMatFactorShiftType cval = MAT_SHIFT_NONE
 *         if shift_type is not None:
 *             cval = matfactorshifttype(shift_type)             # <<<<<<<<<<<<<<
 *             CHKERR( PCFactorSetShiftType(self.pc, cval) )
 *         cdef PetscReal rval = 0
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_matfactorshifttype(__pyx_v_shift_type); if (unlikely(__pyx_t_3 == ((MatFactorShiftType)-1L))) __PYX_ERR(34, 382, __pyx_L1_error)
    __pyx_v_cval = __pyx_t_3;

    /* "PETSc/PC.pyx":383
 *         if shift_type is not None:
 *             cval = matfactorshifttype(shift_type)
 *             CHKERR( PCFactorSetShiftType(self.pc, cval) )             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         if amount is not None:
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFactorSetShiftType(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(34, 383, __pyx_L1_error)

    /* "PETSc/PC.pyx":381
 *     def setFactorShift(self, shift_type=None, amount=None):
 *         cdef PetscMatFactorShiftType cval = MAT_SHIFT_NONE
 *         if shift_type is not None:             # <<<<<<<<<<<<<<
 *             cval = matfactorshifttype(shift_type)
 *             CHKERR( PCFactorSetShiftType(self.pc, cval) )
 */
  }

  /* "PETSc/PC.pyx":384
 *             cval = matfactorshifttype(shift_type)
 *             CHKERR( PCFactorSetShiftType(self.pc, cval) )
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         if amount is not None:
 *             rval = asReal(amount)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/PC.pyx":385
 *             CHKERR( PCFactorSetShiftType(self.pc, cval) )
 *         cdef PetscReal rval = 0
 *         if amount is not None:             # <<<<<<<<<<<<<<
 *             rval = asReal(amount)
 *             CHKERR( PCFactorSetShiftAmount(self.pc, rval) )
 */
  __pyx_t_2 = (__pyx_v_amount != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/PC.pyx":386
 *         cdef PetscReal rval = 0
 *         if amount is not None:
 *             rval = asReal(amount)             # <<<<<<<<<<<<<<
 *             CHKERR( PCFactorSetShiftAmount(self.pc, rval) )
 * 
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_amount); if (unlikely(__pyx_t_5 == -1.0 && PyErr_Occurred())) __PYX_ERR(34, 386, __pyx_L1_error)
    __pyx_v_rval = __pyx_t_5;

    /* "PETSc/PC.pyx":387
 *         if amount is not None:
 *             rval = asReal(amount)
 *             CHKERR( PCFactorSetShiftAmount(self.pc, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def setFactorLevels(self, levels):
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFactorSetShiftAmount(__pyx_v_self->pc, __pyx_v_rval)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(34, 387, __pyx_L1_error)

    /* "PETSc/PC.pyx":385
 *             CHKERR( PCFactorSetShiftType(self.pc, cval) )
 *         cdef PetscReal rval = 0
 *         if amount is not None:             # <<<<<<<<<<<<<<
 *             rval = asReal(amount)
 *             CHKERR( PCFactorSetShiftAmount(self.pc, rval) )
 */
  }

  /* "PETSc/PC.pyx":379
 *             CHKERR( PCFactorSetPivotInBlocks(self.pc, bval) )
 * 
 *     def setFactorShift(self, shift_type=None, amount=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMatFactorShiftType cval = MAT_SHIFT_NONE
 *         if shift_type is not None:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFactorShift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":389
 *             CHKERR( PCFactorSetShiftAmount(self.pc, rval) )
 * 
 *     def setFactorLevels(self, levels):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(levels)
 *         CHKERR( PCFactorSetLevels(self.pc, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_99setFactorLevels(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_98setFactorLevels[] = "PC.setFactorLevels(self, levels)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_99setFactorLevels(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_levels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFactorLevels (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_levels,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);
        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_levels)) != 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, "setFactorLevels") < 0)) __PYX_ERR(34, 389, __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_levels = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFactorLevels", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 389, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFactorLevels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_98setFactorLevels(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_levels);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_98setFactorLevels(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_levels) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFactorLevels", 0);

  /* "PETSc/PC.pyx":390
 * 
 *     def setFactorLevels(self, levels):
 *         cdef PetscInt ival = asInt(levels)             # <<<<<<<<<<<<<<
 *         CHKERR( PCFactorSetLevels(self.pc, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_levels); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 390, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/PC.pyx":391
 *     def setFactorLevels(self, levels):
 *         cdef PetscInt ival = asInt(levels)
 *         CHKERR( PCFactorSetLevels(self.pc, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def getFactorMatrix(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFactorSetLevels(__pyx_v_self->pc, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 391, __pyx_L1_error)

  /* "PETSc/PC.pyx":389
 *             CHKERR( PCFactorSetShiftAmount(self.pc, rval) )
 * 
 *     def setFactorLevels(self, levels):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(levels)
 *         CHKERR( PCFactorSetLevels(self.pc, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFactorLevels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":393
 *         CHKERR( PCFactorSetLevels(self.pc, ival) )
 * 
 *     def getFactorMatrix(self):             # <<<<<<<<<<<<<<
 *         cdef Mat mat = Mat()
 *         CHKERR( PCFactorGetMatrix(self.pc, &mat.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_101getFactorMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_100getFactorMatrix[] = "PC.getFactorMatrix(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_101getFactorMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFactorMatrix (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getFactorMatrix", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getFactorMatrix", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_100getFactorMatrix(((struct PyPetscPCObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_100getFactorMatrix(struct PyPetscPCObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getFactorMatrix", 0);

  /* "PETSc/PC.pyx":394
 * 
 *     def getFactorMatrix(self):
 *         cdef Mat mat = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( PCFactorGetMatrix(self.pc, &mat.mat) )
 *         PetscINCREF(mat.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":395
 *     def getFactorMatrix(self):
 *         cdef Mat mat = Mat()
 *         CHKERR( PCFactorGetMatrix(self.pc, &mat.mat) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(mat.obj)
 *         return mat
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFactorGetMatrix(__pyx_v_self->pc, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 395, __pyx_L1_error)

  /* "PETSc/PC.pyx":396
 *         cdef Mat mat = Mat()
 *         CHKERR( PCFactorGetMatrix(self.pc, &mat.mat) )
 *         PetscINCREF(mat.obj)             # <<<<<<<<<<<<<<
 *         return mat
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_mat->__pyx_base.obj);

  /* "PETSc/PC.pyx":397
 *         CHKERR( PCFactorGetMatrix(self.pc, &mat.mat) )
 *         PetscINCREF(mat.obj)
 *         return mat             # <<<<<<<<<<<<<<
 * 
 *    # --- FieldSplit ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = ((PyObject *)__pyx_v_mat);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":393
 *         CHKERR( PCFactorSetLevels(self.pc, ival) )
 * 
 *     def getFactorMatrix(self):             # <<<<<<<<<<<<<<
 *         cdef Mat mat = Mat()
 *         CHKERR( PCFactorGetMatrix(self.pc, &mat.mat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getFactorMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":401
 *    # --- FieldSplit ---
 * 
 *     def setFieldSplitType(self, ctype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCCompositeType cval = ctype
 *         CHKERR( PCFieldSplitSetType(self.pc, cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_103setFieldSplitType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_102setFieldSplitType[] = "PC.setFieldSplitType(self, ctype)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_103setFieldSplitType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ctype = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFieldSplitType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ctype,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);
        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_ctype)) != 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, "setFieldSplitType") < 0)) __PYX_ERR(34, 401, __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_ctype = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFieldSplitType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 401, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFieldSplitType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_102setFieldSplitType(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_ctype);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_102setFieldSplitType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_ctype) {
  PCCompositeType __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PCCompositeType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFieldSplitType", 0);

  /* "PETSc/PC.pyx":402
 * 
 *     def setFieldSplitType(self, ctype):
 *         cdef PetscPCCompositeType cval = ctype             # <<<<<<<<<<<<<<
 *         CHKERR( PCFieldSplitSetType(self.pc, cval) )
 * 
 */
  __pyx_t_1 = ((PCCompositeType)__Pyx_PyInt_As_PCCompositeType(__pyx_v_ctype)); if (unlikely(PyErr_Occurred())) __PYX_ERR(34, 402, __pyx_L1_error)
  __pyx_v_cval = __pyx_t_1;

  /* "PETSc/PC.pyx":403
 *     def setFieldSplitType(self, ctype):
 *         cdef PetscPCCompositeType cval = ctype
 *         CHKERR( PCFieldSplitSetType(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def setFieldSplitIS(self, *fields):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFieldSplitSetType(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 403, __pyx_L1_error)

  /* "PETSc/PC.pyx":401
 *    # --- FieldSplit ---
 * 
 *     def setFieldSplitType(self, ctype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCCompositeType cval = ctype
 *         CHKERR( PCFieldSplitSetType(self.pc, cval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFieldSplitType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":405
 *         CHKERR( PCFieldSplitSetType(self.pc, cval) )
 * 
 *     def setFieldSplitIS(self, *fields):             # <<<<<<<<<<<<<<
 *         cdef object name = None
 *         cdef IS field = None
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_105setFieldSplitIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_104setFieldSplitIS[] = "PC.setFieldSplitIS(self, *fields)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_105setFieldSplitIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFieldSplitIS (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFieldSplitIS", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_fields = __pyx_args;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_104setFieldSplitIS(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_fields);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_104setFieldSplitIS(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_fields) {
  PyObject *__pyx_v_name = 0;
  struct PyPetscISObject *__pyx_v_field = 0;
  const char *__pyx_v_cname;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __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)(PyObject *);
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("setFieldSplitIS", 0);

  /* "PETSc/PC.pyx":406
 * 
 *     def setFieldSplitIS(self, *fields):
 *         cdef object name = None             # <<<<<<<<<<<<<<
 *         cdef IS field = None
 *         cdef const_char *cname = NULL
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_name = Py_None;

  /* "PETSc/PC.pyx":407
 *     def setFieldSplitIS(self, *fields):
 *         cdef object name = None
 *         cdef IS field = None             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         for name, field in fields:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_field = ((struct PyPetscISObject *)Py_None);

  /* "PETSc/PC.pyx":408
 *         cdef object name = None
 *         cdef IS field = None
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         for name, field in fields:
 *             name = str2bytes(name, &cname)
 */
  __pyx_v_cname = NULL;

  /* "PETSc/PC.pyx":409
 *         cdef IS field = None
 *         cdef const_char *cname = NULL
 *         for name, field in fields:             # <<<<<<<<<<<<<<
 *             name = str2bytes(name, &cname)
 *             CHKERR( PCFieldSplitSetIS(self.pc, cname, field.iset) )
 */
  __pyx_t_1 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __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(34, 409, __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(34, 409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(34, 409, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_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(34, 409, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(34, 409, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(34, 409, __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;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(34, 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(34, 409, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_8petsc4py_5PETSc_IS))))) __PYX_ERR(34, 409, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_field, ((struct PyPetscISObject *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "PETSc/PC.pyx":410
 *         cdef const_char *cname = NULL
 *         for name, field in fields:
 *             name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *             CHKERR( PCFieldSplitSetIS(self.pc, cname, field.iset) )
 * 
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/PC.pyx":411
 *         for name, field in fields:
 *             name = str2bytes(name, &cname)
 *             CHKERR( PCFieldSplitSetIS(self.pc, cname, field.iset) )             # <<<<<<<<<<<<<<
 * 
 *     def setFieldSplitFields(self, bsize, *fields):
 */
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFieldSplitSetIS(__pyx_v_self->pc, __pyx_v_cname, __pyx_v_field->iset)); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(34, 411, __pyx_L1_error)

    /* "PETSc/PC.pyx":409
 *         cdef IS field = None
 *         cdef const_char *cname = NULL
 *         for name, field in fields:             # <<<<<<<<<<<<<<
 *             name = str2bytes(name, &cname)
 *             CHKERR( PCFieldSplitSetIS(self.pc, cname, field.iset) )
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":405
 *         CHKERR( PCFieldSplitSetType(self.pc, cval) )
 * 
 *     def setFieldSplitIS(self, *fields):             # <<<<<<<<<<<<<<
 *         cdef object name = None
 *         cdef IS field = None
 */

  /* 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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFieldSplitIS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF((PyObject *)__pyx_v_field);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":413
 *             CHKERR( PCFieldSplitSetIS(self.pc, cname, field.iset) )
 * 
 *     def setFieldSplitFields(self, bsize, *fields):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = asInt(bsize)
 *         CHKERR( PCFieldSplitSetBlockSize(self.pc, bs) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_107setFieldSplitFields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_106setFieldSplitFields[] = "PC.setFieldSplitFields(self, bsize, *fields)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_107setFieldSplitFields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bsize = 0;
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFieldSplitFields (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_fields = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_fields)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_fields);
  } else {
    __pyx_v_fields = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bsize,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) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bsize)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "setFieldSplitFields") < 0)) __PYX_ERR(34, 413, __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_bsize = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFieldSplitFields", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 413, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_fields); __pyx_v_fields = 0;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFieldSplitFields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_106setFieldSplitFields(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_bsize, __pyx_v_fields);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_106setFieldSplitFields(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_bsize, PyObject *__pyx_v_fields) {
  PetscInt __pyx_v_bs;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_field = 0;
  const char *__pyx_v_cname;
  PetscInt __pyx_v_nfields;
  PetscInt *__pyx_v_ifields;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  __Pyx_RefNannySetupContext("setFieldSplitFields", 0);

  /* "PETSc/PC.pyx":414
 * 
 *     def setFieldSplitFields(self, bsize, *fields):
 *         cdef PetscInt bs = asInt(bsize)             # <<<<<<<<<<<<<<
 *         CHKERR( PCFieldSplitSetBlockSize(self.pc, bs) )
 *         cdef object name = None
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_bsize); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 414, __pyx_L1_error)
  __pyx_v_bs = __pyx_t_1;

  /* "PETSc/PC.pyx":415
 *     def setFieldSplitFields(self, bsize, *fields):
 *         cdef PetscInt bs = asInt(bsize)
 *         CHKERR( PCFieldSplitSetBlockSize(self.pc, bs) )             # <<<<<<<<<<<<<<
 *         cdef object name = None
 *         cdef object field = None
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFieldSplitSetBlockSize(__pyx_v_self->pc, __pyx_v_bs)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 415, __pyx_L1_error)

  /* "PETSc/PC.pyx":416
 *         cdef PetscInt bs = asInt(bsize)
 *         CHKERR( PCFieldSplitSetBlockSize(self.pc, bs) )
 *         cdef object name = None             # <<<<<<<<<<<<<<
 *         cdef object field = None
 *         cdef const_char *cname = NULL
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_name = Py_None;

  /* "PETSc/PC.pyx":417
 *         CHKERR( PCFieldSplitSetBlockSize(self.pc, bs) )
 *         cdef object name = None
 *         cdef object field = None             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         cdef PetscInt nfields = 0, *ifields = NULL
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_field = Py_None;

  /* "PETSc/PC.pyx":418
 *         cdef object name = None
 *         cdef object field = None
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt nfields = 0, *ifields = NULL
 *         for name, field in fields:
 */
  __pyx_v_cname = NULL;

  /* "PETSc/PC.pyx":419
 *         cdef object field = None
 *         cdef const_char *cname = NULL
 *         cdef PetscInt nfields = 0, *ifields = NULL             # <<<<<<<<<<<<<<
 *         for name, field in fields:
 *             name = str2bytes(name, &cname)
 */
  __pyx_v_nfields = 0;
  __pyx_v_ifields = NULL;

  /* "PETSc/PC.pyx":420
 *         cdef const_char *cname = NULL
 *         cdef PetscInt nfields = 0, *ifields = NULL
 *         for name, field in fields:             # <<<<<<<<<<<<<<
 *             name = str2bytes(name, &cname)
 *             field = iarray_i(field, &nfields, &ifields)
 */
  __pyx_t_3 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(34, 420, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(34, 420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(34, 420, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(34, 420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(34, 420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(34, 420, __pyx_L1_error)
      __pyx_t_9 = 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_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(34, 420, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_field, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "PETSc/PC.pyx":421
 *         cdef PetscInt nfields = 0, *ifields = NULL
 *         for name, field in fields:
 *             name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *             field = iarray_i(field, &nfields, &ifields)
 *             CHKERR( PCFieldSplitSetFields(self.pc, cname,
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_5)) __PYX_ERR(34, 421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PETSc/PC.pyx":422
 *         for name, field in fields:
 *             name = str2bytes(name, &cname)
 *             field = iarray_i(field, &nfields, &ifields)             # <<<<<<<<<<<<<<
 *             CHKERR( PCFieldSplitSetFields(self.pc, cname,
 *                                           nfields, ifields, ifields) )
 */
    __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_field, (&__pyx_v_nfields), (&__pyx_v_ifields))); if (unlikely(!__pyx_t_5)) __PYX_ERR(34, 422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_field, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PETSc/PC.pyx":423
 *             name = str2bytes(name, &cname)
 *             field = iarray_i(field, &nfields, &ifields)
 *             CHKERR( PCFieldSplitSetFields(self.pc, cname,             # <<<<<<<<<<<<<<
 *                                           nfields, ifields, ifields) )
 * 
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFieldSplitSetFields(__pyx_v_self->pc, __pyx_v_cname, __pyx_v_nfields, __pyx_v_ifields, __pyx_v_ifields)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 423, __pyx_L1_error)

    /* "PETSc/PC.pyx":420
 *         cdef const_char *cname = NULL
 *         cdef PetscInt nfields = 0, *ifields = NULL
 *         for name, field in fields:             # <<<<<<<<<<<<<<
 *             name = str2bytes(name, &cname)
 *             field = iarray_i(field, &nfields, &ifields)
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/PC.pyx":413
 *             CHKERR( PCFieldSplitSetIS(self.pc, cname, field.iset) )
 * 
 *     def setFieldSplitFields(self, bsize, *fields):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = asInt(bsize)
 *         CHKERR( PCFieldSplitSetBlockSize(self.pc, bs) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFieldSplitFields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_field);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":426
 *                                           nfields, ifields, ifields) )
 * 
 *     def getFieldSplitSubKSP(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i = 0, n = 0
 *         cdef PetscKSP *p = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_109getFieldSplitSubKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_108getFieldSplitSubKSP[] = "PC.getFieldSplitSubKSP(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_109getFieldSplitSubKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFieldSplitSubKSP (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getFieldSplitSubKSP", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getFieldSplitSubKSP", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_108getFieldSplitSubKSP(((struct PyPetscPCObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_108getFieldSplitSubKSP(struct PyPetscPCObject *__pyx_v_self) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_n;
  KSP *__pyx_v_p;
  PyObject *__pyx_v_subksp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  char const *__pyx_t_6;
  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;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("getFieldSplitSubKSP", 0);

  /* "PETSc/PC.pyx":427
 * 
 *     def getFieldSplitSubKSP(self):
 *         cdef PetscInt i = 0, n = 0             # <<<<<<<<<<<<<<
 *         cdef PetscKSP *p = NULL
 *         cdef object subksp = None
 */
  __pyx_v_i = 0;
  __pyx_v_n = 0;

  /* "PETSc/PC.pyx":428
 *     def getFieldSplitSubKSP(self):
 *         cdef PetscInt i = 0, n = 0
 *         cdef PetscKSP *p = NULL             # <<<<<<<<<<<<<<
 *         cdef object subksp = None
 *         try:
 */
  __pyx_v_p = NULL;

  /* "PETSc/PC.pyx":429
 *         cdef PetscInt i = 0, n = 0
 *         cdef PetscKSP *p = NULL
 *         cdef object subksp = None             # <<<<<<<<<<<<<<
 *         try:
 *             CHKERR( PCFieldSplitGetSubKSP(self.pc, &n, &p) )
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_subksp = Py_None;

  /* "PETSc/PC.pyx":430
 *         cdef PetscKSP *p = NULL
 *         cdef object subksp = None
 *         try:             # <<<<<<<<<<<<<<
 *             CHKERR( PCFieldSplitGetSubKSP(self.pc, &n, &p) )
 *             subksp = [ref_KSP(p[i]) for i from 0 <= i <n]
 */
  /*try:*/ {

    /* "PETSc/PC.pyx":431
 *         cdef object subksp = None
 *         try:
 *             CHKERR( PCFieldSplitGetSubKSP(self.pc, &n, &p) )             # <<<<<<<<<<<<<<
 *             subksp = [ref_KSP(p[i]) for i from 0 <= i <n]
 *         finally:
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFieldSplitGetSubKSP(__pyx_v_self->pc, (&__pyx_v_n), (&__pyx_v_p))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 431, __pyx_L4_error)

    /* "PETSc/PC.pyx":432
 *         try:
 *             CHKERR( PCFieldSplitGetSubKSP(self.pc, &n, &p) )
 *             subksp = [ref_KSP(p[i]) for i from 0 <= i <n]             # <<<<<<<<<<<<<<
 *         finally:
 *             CHKERR( PetscFree(p) )
 */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 432, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_v_n;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
      __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_KSP((__pyx_v_p[__pyx_v_i]))); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 432, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_4))) __PYX_ERR(34, 432, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF_SET(__pyx_v_subksp, __pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "PETSc/PC.pyx":434
 *             subksp = [ref_KSP(p[i]) for i from 0 <= i <n]
 *         finally:
 *             CHKERR( PetscFree(p) )             # <<<<<<<<<<<<<<
 *         return subksp
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscFree(__pyx_v_p)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 434, __pyx_L1_error)
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L4_error:;
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __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_XGOTREF(__pyx_t_12);
      __pyx_t_1 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        __pyx_t_13 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscFree(__pyx_v_p)); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(34, 434, __pyx_L9_error)
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
      __pyx_L9_error:;
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "PETSc/PC.pyx":435
 *         finally:
 *             CHKERR( PetscFree(p) )
 *         return subksp             # <<<<<<<<<<<<<<
 * 
 *     def setFieldSplitSchurFactType(self, ctype):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_subksp);
  __pyx_r = __pyx_v_subksp;
  goto __pyx_L0;

  /* "PETSc/PC.pyx":426
 *                                           nfields, ifields, ifields) )
 * 
 *     def getFieldSplitSubKSP(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i = 0, n = 0
 *         cdef PetscKSP *p = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getFieldSplitSubKSP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_subksp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":437
 *         return subksp
 * 
 *     def setFieldSplitSchurFactType(self, ctype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCFieldSplitSchurFactType cval = ctype
 *         CHKERR( PCFieldSplitSetSchurFactType(self.pc, cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_111setFieldSplitSchurFactType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_110setFieldSplitSchurFactType[] = "PC.setFieldSplitSchurFactType(self, ctype)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_111setFieldSplitSchurFactType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ctype = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFieldSplitSchurFactType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ctype,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);
        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_ctype)) != 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, "setFieldSplitSchurFactType") < 0)) __PYX_ERR(34, 437, __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_ctype = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFieldSplitSchurFactType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 437, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFieldSplitSchurFactType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_110setFieldSplitSchurFactType(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_ctype);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_110setFieldSplitSchurFactType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_ctype) {
  PCFieldSplitSchurFactType __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PCFieldSplitSchurFactType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFieldSplitSchurFactType", 0);

  /* "PETSc/PC.pyx":438
 * 
 *     def setFieldSplitSchurFactType(self, ctype):
 *         cdef PetscPCFieldSplitSchurFactType cval = ctype             # <<<<<<<<<<<<<<
 *         CHKERR( PCFieldSplitSetSchurFactType(self.pc, cval) )
 * 
 */
  __pyx_t_1 = ((PCFieldSplitSchurFactType)__Pyx_PyInt_As_PCFieldSplitSchurFactType(__pyx_v_ctype)); if (unlikely(PyErr_Occurred())) __PYX_ERR(34, 438, __pyx_L1_error)
  __pyx_v_cval = __pyx_t_1;

  /* "PETSc/PC.pyx":439
 *     def setFieldSplitSchurFactType(self, ctype):
 *         cdef PetscPCFieldSplitSchurFactType cval = ctype
 *         CHKERR( PCFieldSplitSetSchurFactType(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def setFieldSplitSchurPreType(self, ptype, Mat pre=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFieldSplitSetSchurFactType(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 439, __pyx_L1_error)

  /* "PETSc/PC.pyx":437
 *         return subksp
 * 
 *     def setFieldSplitSchurFactType(self, ctype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCFieldSplitSchurFactType cval = ctype
 *         CHKERR( PCFieldSplitSetSchurFactType(self.pc, cval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFieldSplitSchurFactType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":441
 *         CHKERR( PCFieldSplitSetSchurFactType(self.pc, cval) )
 * 
 *     def setFieldSplitSchurPreType(self, ptype, Mat pre=None):             # <<<<<<<<<<<<<<
 *         cdef PetscPCFieldSplitSchurPreType pval = ptype
 *         cdef PetscMat pmat = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_113setFieldSplitSchurPreType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_112setFieldSplitSchurPreType[] = "PC.setFieldSplitSchurPreType(self, ptype, Mat pre=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_113setFieldSplitSchurPreType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ptype = 0;
  struct PyPetscMatObject *__pyx_v_pre = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFieldSplitSchurPreType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ptype,&__pyx_n_s_pre,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct PyPetscMatObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_ptype)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pre);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFieldSplitSchurPreType") < 0)) __PYX_ERR(34, 441, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ptype = values[0];
    __pyx_v_pre = ((struct PyPetscMatObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFieldSplitSchurPreType", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 441, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFieldSplitSchurPreType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pre), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "pre", 0))) __PYX_ERR(34, 441, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_112setFieldSplitSchurPreType(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_ptype, __pyx_v_pre);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_112setFieldSplitSchurPreType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_ptype, struct PyPetscMatObject *__pyx_v_pre) {
  PCFieldSplitSchurPreType __pyx_v_pval;
  Mat __pyx_v_pmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PCFieldSplitSchurPreType __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Mat __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setFieldSplitSchurPreType", 0);

  /* "PETSc/PC.pyx":442
 * 
 *     def setFieldSplitSchurPreType(self, ptype, Mat pre=None):
 *         cdef PetscPCFieldSplitSchurPreType pval = ptype             # <<<<<<<<<<<<<<
 *         cdef PetscMat pmat = NULL
 *         if pre is not None: pmat = pre.mat
 */
  __pyx_t_1 = ((PCFieldSplitSchurPreType)__Pyx_PyInt_As_PCFieldSplitSchurPreType(__pyx_v_ptype)); if (unlikely(PyErr_Occurred())) __PYX_ERR(34, 442, __pyx_L1_error)
  __pyx_v_pval = __pyx_t_1;

  /* "PETSc/PC.pyx":443
 *     def setFieldSplitSchurPreType(self, ptype, Mat pre=None):
 *         cdef PetscPCFieldSplitSchurPreType pval = ptype
 *         cdef PetscMat pmat = NULL             # <<<<<<<<<<<<<<
 *         if pre is not None: pmat = pre.mat
 *         CHKERR( PCFieldSplitSetSchurPre(self.pc, pval, pmat) )
 */
  __pyx_v_pmat = NULL;

  /* "PETSc/PC.pyx":444
 *         cdef PetscPCFieldSplitSchurPreType pval = ptype
 *         cdef PetscMat pmat = NULL
 *         if pre is not None: pmat = pre.mat             # <<<<<<<<<<<<<<
 *         CHKERR( PCFieldSplitSetSchurPre(self.pc, pval, pmat) )
 * 
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_pre) != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = __pyx_v_pre->mat;
    __pyx_v_pmat = __pyx_t_4;
  }

  /* "PETSc/PC.pyx":445
 *         cdef PetscMat pmat = NULL
 *         if pre is not None: pmat = pre.mat
 *         CHKERR( PCFieldSplitSetSchurPre(self.pc, pval, pmat) )             # <<<<<<<<<<<<<<
 * 
 *     def setReusePreconditioner(self, flag):
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCFieldSplitSetSchurPre(__pyx_v_self->pc, __pyx_v_pval, __pyx_v_pmat)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(34, 445, __pyx_L1_error)

  /* "PETSc/PC.pyx":441
 *         CHKERR( PCFieldSplitSetSchurFactType(self.pc, cval) )
 * 
 *     def setFieldSplitSchurPreType(self, ptype, Mat pre=None):             # <<<<<<<<<<<<<<
 *         cdef PetscPCFieldSplitSchurPreType pval = ptype
 *         cdef PetscMat pmat = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setFieldSplitSchurPreType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":447
 *         CHKERR( PCFieldSplitSetSchurPre(self.pc, pval, pmat) )
 * 
 *     def setReusePreconditioner(self, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_115setReusePreconditioner(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_114setReusePreconditioner[] = "PC.setReusePreconditioner(self, flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_115setReusePreconditioner(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setReusePreconditioner (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setReusePreconditioner") < 0)) __PYX_ERR(34, 447, __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_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setReusePreconditioner", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 447, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setReusePreconditioner", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_114setReusePreconditioner(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_114setReusePreconditioner(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_flag) {
  PetscBool __pyx_v_cflag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setReusePreconditioner", 0);

  /* "PETSc/PC.pyx":448
 * 
 *     def setReusePreconditioner(self, flag):
 *         cdef PetscBool cflag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if flag:
 *             cflag = PETSC_TRUE
 */
  __pyx_v_cflag = PETSC_FALSE;

  /* "PETSc/PC.pyx":449
 *     def setReusePreconditioner(self, flag):
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag:             # <<<<<<<<<<<<<<
 *             cflag = PETSC_TRUE
 *         CHKERR( PCSetReusePreconditioner(self.pc, cflag) )
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(34, 449, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "PETSc/PC.pyx":450
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag:
 *             cflag = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         CHKERR( PCSetReusePreconditioner(self.pc, cflag) )
 * 
 */
    __pyx_v_cflag = PETSC_TRUE;

    /* "PETSc/PC.pyx":449
 *     def setReusePreconditioner(self, flag):
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag:             # <<<<<<<<<<<<<<
 *             cflag = PETSC_TRUE
 *         CHKERR( PCSetReusePreconditioner(self.pc, cflag) )
 */
  }

  /* "PETSc/PC.pyx":451
 *         if flag:
 *             cflag = PETSC_TRUE
 *         CHKERR( PCSetReusePreconditioner(self.pc, cflag) )             # <<<<<<<<<<<<<<
 * 
 *     # --- COMPOSITE ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCSetReusePreconditioner(__pyx_v_self->pc, __pyx_v_cflag)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 451, __pyx_L1_error)

  /* "PETSc/PC.pyx":447
 *         CHKERR( PCFieldSplitSetSchurPre(self.pc, pval, pmat) )
 * 
 *     def setReusePreconditioner(self, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setReusePreconditioner", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":455
 *     # --- COMPOSITE ---
 * 
 *     def setCompositeType(self, ctype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCCompositeType cval = ctype
 *         CHKERR( PCCompositeSetType(self.pc, cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_117setCompositeType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_116setCompositeType[] = "PC.setCompositeType(self, ctype)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_117setCompositeType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ctype = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCompositeType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ctype,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);
        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_ctype)) != 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, "setCompositeType") < 0)) __PYX_ERR(34, 455, __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_ctype = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCompositeType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 455, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setCompositeType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_116setCompositeType(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_ctype);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_116setCompositeType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_ctype) {
  PCCompositeType __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PCCompositeType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setCompositeType", 0);

  /* "PETSc/PC.pyx":456
 * 
 *     def setCompositeType(self, ctype):
 *         cdef PetscPCCompositeType cval = ctype             # <<<<<<<<<<<<<<
 *         CHKERR( PCCompositeSetType(self.pc, cval) )
 * 
 */
  __pyx_t_1 = ((PCCompositeType)__Pyx_PyInt_As_PCCompositeType(__pyx_v_ctype)); if (unlikely(PyErr_Occurred())) __PYX_ERR(34, 456, __pyx_L1_error)
  __pyx_v_cval = __pyx_t_1;

  /* "PETSc/PC.pyx":457
 *     def setCompositeType(self, ctype):
 *         cdef PetscPCCompositeType cval = ctype
 *         CHKERR( PCCompositeSetType(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getCompositePC(self, n):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCCompositeSetType(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 457, __pyx_L1_error)

  /* "PETSc/PC.pyx":455
 *     # --- COMPOSITE ---
 * 
 *     def setCompositeType(self, ctype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCCompositeType cval = ctype
 *         CHKERR( PCCompositeSetType(self.pc, cval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setCompositeType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":459
 *         CHKERR( PCCompositeSetType(self.pc, cval) )
 * 
 *     def getCompositePC(self, n):             # <<<<<<<<<<<<<<
 *         cdef PC pc = PC()
 *         cdef cn = asInt(n)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_119getCompositePC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_118getCompositePC[] = "PC.getCompositePC(self, n)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_119getCompositePC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCompositePC (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,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);
        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_n)) != 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, "getCompositePC") < 0)) __PYX_ERR(34, 459, __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_n = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getCompositePC", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 459, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getCompositePC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_118getCompositePC(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_118getCompositePC(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_n) {
  struct PyPetscPCObject *__pyx_v_pc = 0;
  PyObject *__pyx_v_cn = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PetscInt __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getCompositePC", 0);

  /* "PETSc/PC.pyx":460
 * 
 *     def getCompositePC(self, n):
 *         cdef PC pc = PC()             # <<<<<<<<<<<<<<
 *         cdef cn = asInt(n)
 *         CHKERR( PCCompositeGetPC(self.pc, cn, &pc.pc) )
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_PC), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pc = ((struct PyPetscPCObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":461
 *     def getCompositePC(self, n):
 *         cdef PC pc = PC()
 *         cdef cn = asInt(n)             # <<<<<<<<<<<<<<
 *         CHKERR( PCCompositeGetPC(self.pc, cn, &pc.pc) )
 *         PetscINCREF(pc.obj)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_n); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(34, 461, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyInt_From_PetscInt(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cn = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":462
 *         cdef PC pc = PC()
 *         cdef cn = asInt(n)
 *         CHKERR( PCCompositeGetPC(self.pc, cn, &pc.pc) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(pc.obj)
 *         return pc
 */
  __pyx_t_2 = __Pyx_PyInt_As_PetscInt(__pyx_v_cn); if (unlikely((__pyx_t_2 == (PetscInt)-1) && PyErr_Occurred())) __PYX_ERR(34, 462, __pyx_L1_error)
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCCompositeGetPC(__pyx_v_self->pc, __pyx_t_2, (&__pyx_v_pc->pc))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(34, 462, __pyx_L1_error)

  /* "PETSc/PC.pyx":463
 *         cdef cn = asInt(n)
 *         CHKERR( PCCompositeGetPC(self.pc, cn, &pc.pc) )
 *         PetscINCREF(pc.obj)             # <<<<<<<<<<<<<<
 *         return pc
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_pc->__pyx_base.obj);

  /* "PETSc/PC.pyx":464
 *         CHKERR( PCCompositeGetPC(self.pc, cn, &pc.pc) )
 *         PetscINCREF(pc.obj)
 *         return pc             # <<<<<<<<<<<<<<
 * 
 *     def addCompositePC(self, pc_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_pc));
  __pyx_r = ((PyObject *)__pyx_v_pc);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":459
 *         CHKERR( PCCompositeSetType(self.pc, cval) )
 * 
 *     def getCompositePC(self, n):             # <<<<<<<<<<<<<<
 *         cdef PC pc = PC()
 *         cdef cn = asInt(n)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getCompositePC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pc);
  __Pyx_XDECREF(__pyx_v_cn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":466
 *         return pc
 * 
 *     def addCompositePC(self, pc_type):             # <<<<<<<<<<<<<<
 *         cdef PetscPCType cval = NULL
 *         pc_type = str2bytes(pc_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_121addCompositePC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_120addCompositePC[] = "PC.addCompositePC(self, pc_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_121addCompositePC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pc_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addCompositePC (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pc_type,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);
        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_pc_type)) != 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, "addCompositePC") < 0)) __PYX_ERR(34, 466, __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_pc_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addCompositePC", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 466, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.addCompositePC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_120addCompositePC(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_pc_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_120addCompositePC(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_pc_type) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("addCompositePC", 0);
  __Pyx_INCREF(__pyx_v_pc_type);

  /* "PETSc/PC.pyx":467
 * 
 *     def addCompositePC(self, pc_type):
 *         cdef PetscPCType cval = NULL             # <<<<<<<<<<<<<<
 *         pc_type = str2bytes(pc_type, &cval)
 *         CHKERR( PCCompositeAddPC(self.pc, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/PC.pyx":468
 *     def addCompositePC(self, pc_type):
 *         cdef PetscPCType cval = NULL
 *         pc_type = str2bytes(pc_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PCCompositeAddPC(self.pc, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_pc_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pc_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":469
 *         cdef PetscPCType cval = NULL
 *         pc_type = str2bytes(pc_type, &cval)
 *         CHKERR( PCCompositeAddPC(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     # --- KSP ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCCompositeAddPC(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 469, __pyx_L1_error)

  /* "PETSc/PC.pyx":466
 *         return pc
 * 
 *     def addCompositePC(self, pc_type):             # <<<<<<<<<<<<<<
 *         cdef PetscPCType cval = NULL
 *         pc_type = str2bytes(pc_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.addCompositePC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pc_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":473
 *     # --- KSP ---
 * 
 *     def getKSP(self):             # <<<<<<<<<<<<<<
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCKSPGetKSP(self.pc, &ksp.ksp) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_123getKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_122getKSP[] = "PC.getKSP(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_123getKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getKSP (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getKSP", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getKSP", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_122getKSP(((struct PyPetscPCObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_122getKSP(struct PyPetscPCObject *__pyx_v_self) {
  struct PyPetscKSPObject *__pyx_v_ksp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getKSP", 0);

  /* "PETSc/PC.pyx":474
 * 
 *     def getKSP(self):
 *         cdef KSP ksp = KSP()             # <<<<<<<<<<<<<<
 *         CHKERR( PCKSPGetKSP(self.pc, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ksp = ((struct PyPetscKSPObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":475
 *     def getKSP(self):
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCKSPGetKSP(self.pc, &ksp.ksp) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(ksp.obj)
 *         return ksp
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCKSPGetKSP(__pyx_v_self->pc, (&__pyx_v_ksp->ksp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 475, __pyx_L1_error)

  /* "PETSc/PC.pyx":476
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCKSPGetKSP(self.pc, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)             # <<<<<<<<<<<<<<
 *         return ksp
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ksp->__pyx_base.obj);

  /* "PETSc/PC.pyx":477
 *         CHKERR( PCKSPGetKSP(self.pc, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 *         return ksp             # <<<<<<<<<<<<<<
 * 
 *     # --- MG ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ksp));
  __pyx_r = ((PyObject *)__pyx_v_ksp);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":473
 *     # --- KSP ---
 * 
 *     def getKSP(self):             # <<<<<<<<<<<<<<
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCKSPGetKSP(self.pc, &ksp.ksp) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getKSP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ksp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":481
 *     # --- MG ---
 * 
 *     def getMGType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscPCMGType cval = PC_MG_ADDITIVE
 *         CHKERR( PCMGGetType(self.pc, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_125getMGType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_124getMGType[] = "PC.getMGType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_125getMGType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMGType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMGType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMGType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_124getMGType(((struct PyPetscPCObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_124getMGType(struct PyPetscPCObject *__pyx_v_self) {
  PCMGType __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getMGType", 0);

  /* "PETSc/PC.pyx":482
 * 
 *     def getMGType(self):
 *         cdef PetscPCMGType cval = PC_MG_ADDITIVE             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGGetType(self.pc, &cval) )
 *         return cval
 */
  __pyx_v_cval = PC_MG_ADDITIVE;

  /* "PETSc/PC.pyx":483
 *     def getMGType(self):
 *         cdef PetscPCMGType cval = PC_MG_ADDITIVE
 *         CHKERR( PCMGGetType(self.pc, &cval) )             # <<<<<<<<<<<<<<
 *         return cval
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGGetType(__pyx_v_self->pc, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 483, __pyx_L1_error)

  /* "PETSc/PC.pyx":484
 *         cdef PetscPCMGType cval = PC_MG_ADDITIVE
 *         CHKERR( PCMGGetType(self.pc, &cval) )
 *         return cval             # <<<<<<<<<<<<<<
 * 
 *     def setMGType(self, mgtype):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PCMGType(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/PC.pyx":481
 *     # --- MG ---
 * 
 *     def getMGType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscPCMGType cval = PC_MG_ADDITIVE
 *         CHKERR( PCMGGetType(self.pc, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":486
 *         return cval
 * 
 *     def setMGType(self, mgtype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCMGType cval = mgtype
 *         CHKERR( PCMGSetType(self.pc, cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_127setMGType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_126setMGType[] = "PC.setMGType(self, mgtype)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_127setMGType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mgtype = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMGType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mgtype,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);
        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_mgtype)) != 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, "setMGType") < 0)) __PYX_ERR(34, 486, __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_mgtype = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMGType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 486, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_126setMGType(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_mgtype);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_126setMGType(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_mgtype) {
  PCMGType __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PCMGType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMGType", 0);

  /* "PETSc/PC.pyx":487
 * 
 *     def setMGType(self, mgtype):
 *         cdef PetscPCMGType cval = mgtype             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGSetType(self.pc, cval) )
 * 
 */
  __pyx_t_1 = ((PCMGType)__Pyx_PyInt_As_PCMGType(__pyx_v_mgtype)); if (unlikely(PyErr_Occurred())) __PYX_ERR(34, 487, __pyx_L1_error)
  __pyx_v_cval = __pyx_t_1;

  /* "PETSc/PC.pyx":488
 *     def setMGType(self, mgtype):
 *         cdef PetscPCMGType cval = mgtype
 *         CHKERR( PCMGSetType(self.pc, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getMGLevels(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGSetType(__pyx_v_self->pc, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 488, __pyx_L1_error)

  /* "PETSc/PC.pyx":486
 *         return cval
 * 
 *     def setMGType(self, mgtype):             # <<<<<<<<<<<<<<
 *         cdef PetscPCMGType cval = mgtype
 *         CHKERR( PCMGSetType(self.pc, cval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":490
 *         CHKERR( PCMGSetType(self.pc, cval) )
 * 
 *     def getMGLevels(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt levels = 0
 *         CHKERR( PCMGGetLevels(self.pc, &levels) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_129getMGLevels(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_128getMGLevels[] = "PC.getMGLevels(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_129getMGLevels(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMGLevels (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMGLevels", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMGLevels", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_128getMGLevels(((struct PyPetscPCObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_128getMGLevels(struct PyPetscPCObject *__pyx_v_self) {
  PetscInt __pyx_v_levels;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getMGLevels", 0);

  /* "PETSc/PC.pyx":491
 * 
 *     def getMGLevels(self):
 *         cdef PetscInt levels = 0             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGGetLevels(self.pc, &levels) )
 *         return toInt(levels)
 */
  __pyx_v_levels = 0;

  /* "PETSc/PC.pyx":492
 *     def getMGLevels(self):
 *         cdef PetscInt levels = 0
 *         CHKERR( PCMGGetLevels(self.pc, &levels) )             # <<<<<<<<<<<<<<
 *         return toInt(levels)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGGetLevels(__pyx_v_self->pc, (&__pyx_v_levels))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(34, 492, __pyx_L1_error)

  /* "PETSc/PC.pyx":493
 *         cdef PetscInt levels = 0
 *         CHKERR( PCMGGetLevels(self.pc, &levels) )
 *         return toInt(levels)             # <<<<<<<<<<<<<<
 * 
 *     def getMGCoarseSolve(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_levels); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/PC.pyx":490
 *         CHKERR( PCMGSetType(self.pc, cval) )
 * 
 *     def getMGLevels(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt levels = 0
 *         CHKERR( PCMGGetLevels(self.pc, &levels) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGLevels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":495
 *         return toInt(levels)
 * 
 *     def getMGCoarseSolve(self):             # <<<<<<<<<<<<<<
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetCoarseSolve(self.pc, &ksp.ksp) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_131getMGCoarseSolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_130getMGCoarseSolve[] = "PC.getMGCoarseSolve(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_131getMGCoarseSolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMGCoarseSolve (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMGCoarseSolve", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMGCoarseSolve", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_130getMGCoarseSolve(((struct PyPetscPCObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_130getMGCoarseSolve(struct PyPetscPCObject *__pyx_v_self) {
  struct PyPetscKSPObject *__pyx_v_ksp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getMGCoarseSolve", 0);

  /* "PETSc/PC.pyx":496
 * 
 *     def getMGCoarseSolve(self):
 *         cdef KSP ksp = KSP()             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGGetCoarseSolve(self.pc, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ksp = ((struct PyPetscKSPObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PC.pyx":497
 *     def getMGCoarseSolve(self):
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetCoarseSolve(self.pc, &ksp.ksp) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(ksp.obj)
 *         return ksp
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGGetCoarseSolve(__pyx_v_self->pc, (&__pyx_v_ksp->ksp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 497, __pyx_L1_error)

  /* "PETSc/PC.pyx":498
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetCoarseSolve(self.pc, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)             # <<<<<<<<<<<<<<
 *         return ksp
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ksp->__pyx_base.obj);

  /* "PETSc/PC.pyx":499
 *         CHKERR( PCMGGetCoarseSolve(self.pc, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 *         return ksp             # <<<<<<<<<<<<<<
 * 
 *     def setMGInterpolation(self, level, Mat mat not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ksp));
  __pyx_r = ((PyObject *)__pyx_v_ksp);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":495
 *         return toInt(levels)
 * 
 *     def getMGCoarseSolve(self):             # <<<<<<<<<<<<<<
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetCoarseSolve(self.pc, &ksp.ksp) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGCoarseSolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ksp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":501
 *         return ksp
 * 
 *     def setMGInterpolation(self, level, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetInterpolation(self.pc, clevel, mat.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_133setMGInterpolation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_132setMGInterpolation[] = "PC.setMGInterpolation(self, level, Mat mat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_133setMGInterpolation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMGInterpolation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_mat,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_level)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mat)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setMGInterpolation", 1, 2, 2, 1); __PYX_ERR(34, 501, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMGInterpolation") < 0)) __PYX_ERR(34, 501, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_level = values[0];
    __pyx_v_mat = ((struct PyPetscMatObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMGInterpolation", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 501, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(34, 501, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_132setMGInterpolation(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level, __pyx_v_mat);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_132setMGInterpolation(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscMatObject *__pyx_v_mat) {
  PetscInt __pyx_v_clevel;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMGInterpolation", 0);

  /* "PETSc/PC.pyx":502
 * 
 *     def setMGInterpolation(self, level, Mat mat not None):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGSetInterpolation(self.pc, clevel, mat.mat) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 502, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":503
 *     def setMGInterpolation(self, level, Mat mat not None):
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetInterpolation(self.pc, clevel, mat.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def getMGInterpolation(self, level):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGSetInterpolation(__pyx_v_self->pc, __pyx_v_clevel, __pyx_v_mat->mat)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 503, __pyx_L1_error)

  /* "PETSc/PC.pyx":501
 *         return ksp
 * 
 *     def setMGInterpolation(self, level, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetInterpolation(self.pc, clevel, mat.mat) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":505
 *         CHKERR( PCMGSetInterpolation(self.pc, clevel, mat.mat) )
 * 
 *     def getMGInterpolation(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat interpolation = Mat()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_135getMGInterpolation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_134getMGInterpolation[] = "PC.getMGInterpolation(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_135getMGInterpolation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMGInterpolation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getMGInterpolation") < 0)) __PYX_ERR(34, 505, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMGInterpolation", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 505, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_134getMGInterpolation(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_134getMGInterpolation(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscMatObject *__pyx_v_interpolation = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getMGInterpolation", 0);

  /* "PETSc/PC.pyx":506
 * 
 *     def getMGInterpolation(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef Mat interpolation = Mat()
 *         CHKERR( PCMGGetInterpolation(self.pc, clevel, &interpolation.mat) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 506, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":507
 *     def getMGInterpolation(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat interpolation = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGGetInterpolation(self.pc, clevel, &interpolation.mat) )
 *         PetscINCREF(interpolation.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_interpolation = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/PC.pyx":508
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat interpolation = Mat()
 *         CHKERR( PCMGGetInterpolation(self.pc, clevel, &interpolation.mat) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(interpolation.obj)
 *         return interpolation
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGGetInterpolation(__pyx_v_self->pc, __pyx_v_clevel, (&__pyx_v_interpolation->mat))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(34, 508, __pyx_L1_error)

  /* "PETSc/PC.pyx":509
 *         cdef Mat interpolation = Mat()
 *         CHKERR( PCMGGetInterpolation(self.pc, clevel, &interpolation.mat) )
 *         PetscINCREF(interpolation.obj)             # <<<<<<<<<<<<<<
 *         return interpolation
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_interpolation->__pyx_base.obj);

  /* "PETSc/PC.pyx":510
 *         CHKERR( PCMGGetInterpolation(self.pc, clevel, &interpolation.mat) )
 *         PetscINCREF(interpolation.obj)
 *         return interpolation             # <<<<<<<<<<<<<<
 * 
 *     def setMGRestriction(self, level, Mat mat not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_interpolation));
  __pyx_r = ((PyObject *)__pyx_v_interpolation);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":505
 *         CHKERR( PCMGSetInterpolation(self.pc, clevel, mat.mat) )
 * 
 *     def getMGInterpolation(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat interpolation = Mat()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_interpolation);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":512
 *         return interpolation
 * 
 *     def setMGRestriction(self, level, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetRestriction(self.pc, clevel, mat.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_137setMGRestriction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_136setMGRestriction[] = "PC.setMGRestriction(self, level, Mat mat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_137setMGRestriction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMGRestriction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_mat,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_level)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mat)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setMGRestriction", 1, 2, 2, 1); __PYX_ERR(34, 512, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMGRestriction") < 0)) __PYX_ERR(34, 512, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_level = values[0];
    __pyx_v_mat = ((struct PyPetscMatObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMGRestriction", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 512, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGRestriction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(34, 512, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_136setMGRestriction(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level, __pyx_v_mat);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_136setMGRestriction(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscMatObject *__pyx_v_mat) {
  PetscInt __pyx_v_clevel;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMGRestriction", 0);

  /* "PETSc/PC.pyx":513
 * 
 *     def setMGRestriction(self, level, Mat mat not None):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGSetRestriction(self.pc, clevel, mat.mat) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 513, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":514
 *     def setMGRestriction(self, level, Mat mat not None):
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetRestriction(self.pc, clevel, mat.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def getMGRestriction(self, level):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGSetRestriction(__pyx_v_self->pc, __pyx_v_clevel, __pyx_v_mat->mat)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 514, __pyx_L1_error)

  /* "PETSc/PC.pyx":512
 *         return interpolation
 * 
 *     def setMGRestriction(self, level, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetRestriction(self.pc, clevel, mat.mat) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGRestriction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":516
 *         CHKERR( PCMGSetRestriction(self.pc, clevel, mat.mat) )
 * 
 *     def getMGRestriction(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat restriction = Mat()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_139getMGRestriction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_138getMGRestriction[] = "PC.getMGRestriction(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_139getMGRestriction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMGRestriction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getMGRestriction") < 0)) __PYX_ERR(34, 516, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMGRestriction", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 516, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGRestriction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_138getMGRestriction(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_138getMGRestriction(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscMatObject *__pyx_v_restriction = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getMGRestriction", 0);

  /* "PETSc/PC.pyx":517
 * 
 *     def getMGRestriction(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef Mat restriction = Mat()
 *         CHKERR( PCMGGetRestriction(self.pc, clevel, &restriction.mat) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 517, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":518
 *     def getMGRestriction(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat restriction = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGGetRestriction(self.pc, clevel, &restriction.mat) )
 *         PetscINCREF(restriction.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_restriction = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/PC.pyx":519
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat restriction = Mat()
 *         CHKERR( PCMGGetRestriction(self.pc, clevel, &restriction.mat) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(restriction.obj)
 *         return restriction
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGGetRestriction(__pyx_v_self->pc, __pyx_v_clevel, (&__pyx_v_restriction->mat))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(34, 519, __pyx_L1_error)

  /* "PETSc/PC.pyx":520
 *         cdef Mat restriction = Mat()
 *         CHKERR( PCMGGetRestriction(self.pc, clevel, &restriction.mat) )
 *         PetscINCREF(restriction.obj)             # <<<<<<<<<<<<<<
 *         return restriction
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_restriction->__pyx_base.obj);

  /* "PETSc/PC.pyx":521
 *         CHKERR( PCMGGetRestriction(self.pc, clevel, &restriction.mat) )
 *         PetscINCREF(restriction.obj)
 *         return restriction             # <<<<<<<<<<<<<<
 * 
 *     def setMGRScale(self, level, Vec rscale not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_restriction));
  __pyx_r = ((PyObject *)__pyx_v_restriction);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":516
 *         CHKERR( PCMGSetRestriction(self.pc, clevel, mat.mat) )
 * 
 *     def getMGRestriction(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat restriction = Mat()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGRestriction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_restriction);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":523
 *         return restriction
 * 
 *     def setMGRScale(self, level, Vec rscale not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetRScale(self.pc, clevel, rscale.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_141setMGRScale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_140setMGRScale[] = "PC.setMGRScale(self, level, Vec rscale)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_141setMGRScale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  struct PyPetscVecObject *__pyx_v_rscale = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMGRScale (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_rscale,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_level)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rscale)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setMGRScale", 1, 2, 2, 1); __PYX_ERR(34, 523, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMGRScale") < 0)) __PYX_ERR(34, 523, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_level = values[0];
    __pyx_v_rscale = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMGRScale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 523, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGRScale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rscale), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "rscale", 0))) __PYX_ERR(34, 523, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_140setMGRScale(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level, __pyx_v_rscale);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_140setMGRScale(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscVecObject *__pyx_v_rscale) {
  PetscInt __pyx_v_clevel;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMGRScale", 0);

  /* "PETSc/PC.pyx":524
 * 
 *     def setMGRScale(self, level, Vec rscale not None):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGSetRScale(self.pc, clevel, rscale.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 524, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":525
 *     def setMGRScale(self, level, Vec rscale not None):
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetRScale(self.pc, clevel, rscale.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def getMGRScale(self, level):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGSetRScale(__pyx_v_self->pc, __pyx_v_clevel, __pyx_v_rscale->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 525, __pyx_L1_error)

  /* "PETSc/PC.pyx":523
 *         return restriction
 * 
 *     def setMGRScale(self, level, Vec rscale not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetRScale(self.pc, clevel, rscale.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGRScale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":527
 *         CHKERR( PCMGSetRScale(self.pc, clevel, rscale.vec) )
 * 
 *     def getMGRScale(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Vec rscale = Vec()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_143getMGRScale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_142getMGRScale[] = "PC.getMGRScale(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_143getMGRScale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMGRScale (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getMGRScale") < 0)) __PYX_ERR(34, 527, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMGRScale", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 527, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGRScale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_142getMGRScale(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_142getMGRScale(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscVecObject *__pyx_v_rscale = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getMGRScale", 0);

  /* "PETSc/PC.pyx":528
 * 
 *     def getMGRScale(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef Vec rscale = Vec()
 *         CHKERR( PCMGGetRScale(self.pc, clevel, &rscale.vec) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 528, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":529
 *     def getMGRScale(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Vec rscale = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGGetRScale(self.pc, clevel, &rscale.vec) )
 *         PetscINCREF(rscale.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_rscale = ((struct PyPetscVecObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/PC.pyx":530
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Vec rscale = Vec()
 *         CHKERR( PCMGGetRScale(self.pc, clevel, &rscale.vec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(rscale.obj)
 *         return rscale
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGGetRScale(__pyx_v_self->pc, __pyx_v_clevel, (&__pyx_v_rscale->vec))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(34, 530, __pyx_L1_error)

  /* "PETSc/PC.pyx":531
 *         cdef Vec rscale = Vec()
 *         CHKERR( PCMGGetRScale(self.pc, clevel, &rscale.vec) )
 *         PetscINCREF(rscale.obj)             # <<<<<<<<<<<<<<
 *         return rscale
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_rscale->__pyx_base.obj);

  /* "PETSc/PC.pyx":532
 *         CHKERR( PCMGGetRScale(self.pc, clevel, &rscale.vec) )
 *         PetscINCREF(rscale.obj)
 *         return rscale             # <<<<<<<<<<<<<<
 * 
 *     def getMGSmoother(self, level):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_rscale));
  __pyx_r = ((PyObject *)__pyx_v_rscale);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":527
 *         CHKERR( PCMGSetRScale(self.pc, clevel, rscale.vec) )
 * 
 *     def getMGRScale(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Vec rscale = Vec()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGRScale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rscale);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":534
 *         return rscale
 * 
 *     def getMGSmoother(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef KSP ksp = KSP()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_145getMGSmoother(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_144getMGSmoother[] = "PC.getMGSmoother(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_145getMGSmoother(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMGSmoother (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getMGSmoother") < 0)) __PYX_ERR(34, 534, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMGSmoother", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 534, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGSmoother", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_144getMGSmoother(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_144getMGSmoother(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscKSPObject *__pyx_v_ksp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getMGSmoother", 0);

  /* "PETSc/PC.pyx":535
 * 
 *     def getMGSmoother(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetSmoother(self.pc, clevel, &ksp.ksp) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 535, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":536
 *     def getMGSmoother(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef KSP ksp = KSP()             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGGetSmoother(self.pc, clevel, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ksp = ((struct PyPetscKSPObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/PC.pyx":537
 *         cdef PetscInt clevel = asInt(level)
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetSmoother(self.pc, clevel, &ksp.ksp) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(ksp.obj)
 *         return ksp
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGGetSmoother(__pyx_v_self->pc, __pyx_v_clevel, (&__pyx_v_ksp->ksp))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(34, 537, __pyx_L1_error)

  /* "PETSc/PC.pyx":538
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetSmoother(self.pc, clevel, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)             # <<<<<<<<<<<<<<
 *         return ksp
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ksp->__pyx_base.obj);

  /* "PETSc/PC.pyx":539
 *         CHKERR( PCMGGetSmoother(self.pc, clevel, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 *         return ksp             # <<<<<<<<<<<<<<
 * 
 *     def getMGSmootherDown(self, level):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ksp));
  __pyx_r = ((PyObject *)__pyx_v_ksp);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":534
 *         return rscale
 * 
 *     def getMGSmoother(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef KSP ksp = KSP()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGSmoother", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ksp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":541
 *         return ksp
 * 
 *     def getMGSmootherDown(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef KSP ksp = KSP()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_147getMGSmootherDown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_146getMGSmootherDown[] = "PC.getMGSmootherDown(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_147getMGSmootherDown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMGSmootherDown (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getMGSmootherDown") < 0)) __PYX_ERR(34, 541, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMGSmootherDown", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 541, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGSmootherDown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_146getMGSmootherDown(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_146getMGSmootherDown(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscKSPObject *__pyx_v_ksp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getMGSmootherDown", 0);

  /* "PETSc/PC.pyx":542
 * 
 *     def getMGSmootherDown(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetSmootherDown(self.pc, clevel, &ksp.ksp) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 542, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":543
 *     def getMGSmootherDown(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef KSP ksp = KSP()             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGGetSmootherDown(self.pc, clevel, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ksp = ((struct PyPetscKSPObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/PC.pyx":544
 *         cdef PetscInt clevel = asInt(level)
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetSmootherDown(self.pc, clevel, &ksp.ksp) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(ksp.obj)
 *         return ksp
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGGetSmootherDown(__pyx_v_self->pc, __pyx_v_clevel, (&__pyx_v_ksp->ksp))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(34, 544, __pyx_L1_error)

  /* "PETSc/PC.pyx":545
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetSmootherDown(self.pc, clevel, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)             # <<<<<<<<<<<<<<
 *         return ksp
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ksp->__pyx_base.obj);

  /* "PETSc/PC.pyx":546
 *         CHKERR( PCMGGetSmootherDown(self.pc, clevel, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 *         return ksp             # <<<<<<<<<<<<<<
 * 
 *     def getMGSmootherUp(self, level):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ksp));
  __pyx_r = ((PyObject *)__pyx_v_ksp);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":541
 *         return ksp
 * 
 *     def getMGSmootherDown(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef KSP ksp = KSP()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGSmootherDown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ksp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":548
 *         return ksp
 * 
 *     def getMGSmootherUp(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef KSP ksp = KSP()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_149getMGSmootherUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_148getMGSmootherUp[] = "PC.getMGSmootherUp(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_149getMGSmootherUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMGSmootherUp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getMGSmootherUp") < 0)) __PYX_ERR(34, 548, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMGSmootherUp", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 548, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGSmootherUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_148getMGSmootherUp(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_148getMGSmootherUp(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscKSPObject *__pyx_v_ksp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getMGSmootherUp", 0);

  /* "PETSc/PC.pyx":549
 * 
 *     def getMGSmootherUp(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetSmootherUp(self.pc, clevel, &ksp.ksp) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 549, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":550
 *     def getMGSmootherUp(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef KSP ksp = KSP()             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGGetSmootherUp(self.pc, clevel, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(34, 550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ksp = ((struct PyPetscKSPObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/PC.pyx":551
 *         cdef PetscInt clevel = asInt(level)
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetSmootherUp(self.pc, clevel, &ksp.ksp) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(ksp.obj)
 *         return ksp
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGGetSmootherUp(__pyx_v_self->pc, __pyx_v_clevel, (&__pyx_v_ksp->ksp))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(34, 551, __pyx_L1_error)

  /* "PETSc/PC.pyx":552
 *         cdef KSP ksp = KSP()
 *         CHKERR( PCMGGetSmootherUp(self.pc, clevel, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)             # <<<<<<<<<<<<<<
 *         return ksp
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ksp->__pyx_base.obj);

  /* "PETSc/PC.pyx":553
 *         CHKERR( PCMGGetSmootherUp(self.pc, clevel, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 *         return ksp             # <<<<<<<<<<<<<<
 * 
 *     def setMGCyclesOnLevel(self, level, ncycle):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ksp));
  __pyx_r = ((PyObject *)__pyx_v_ksp);
  goto __pyx_L0;

  /* "PETSc/PC.pyx":548
 *         return ksp
 * 
 *     def getMGSmootherUp(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef KSP ksp = KSP()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PC.getMGSmootherUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ksp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":555
 *         return ksp
 * 
 *     def setMGCyclesOnLevel(self, level, ncycle):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef PetscInt c = asInt(ncycle)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_151setMGCyclesOnLevel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_150setMGCyclesOnLevel[] = "PC.setMGCyclesOnLevel(self, level, ncycle)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_151setMGCyclesOnLevel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_v_ncycle = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMGCyclesOnLevel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_ncycle,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_level)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ncycle)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setMGCyclesOnLevel", 1, 2, 2, 1); __PYX_ERR(34, 555, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMGCyclesOnLevel") < 0)) __PYX_ERR(34, 555, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_level = values[0];
    __pyx_v_ncycle = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMGCyclesOnLevel", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 555, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGCyclesOnLevel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_150setMGCyclesOnLevel(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level, __pyx_v_ncycle);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_150setMGCyclesOnLevel(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, PyObject *__pyx_v_ncycle) {
  PetscInt __pyx_v_clevel;
  PetscInt __pyx_v_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMGCyclesOnLevel", 0);

  /* "PETSc/PC.pyx":556
 * 
 *     def setMGCyclesOnLevel(self, level, ncycle):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef PetscInt c = asInt(ncycle)
 *         CHKERR( PCMGSetCyclesOnLevel(self.pc, clevel, c) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 556, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":557
 *     def setMGCyclesOnLevel(self, level, ncycle):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef PetscInt c = asInt(ncycle)             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGSetCyclesOnLevel(self.pc, clevel, c) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_ncycle); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 557, __pyx_L1_error)
  __pyx_v_c = __pyx_t_1;

  /* "PETSc/PC.pyx":558
 *         cdef PetscInt clevel = asInt(level)
 *         cdef PetscInt c = asInt(ncycle)
 *         CHKERR( PCMGSetCyclesOnLevel(self.pc, clevel, c) )             # <<<<<<<<<<<<<<
 * 
 *     def setMGRhs(self, level, Vec rhs not None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGSetCyclesOnLevel(__pyx_v_self->pc, __pyx_v_clevel, __pyx_v_c)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 558, __pyx_L1_error)

  /* "PETSc/PC.pyx":555
 *         return ksp
 * 
 *     def setMGCyclesOnLevel(self, level, ncycle):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef PetscInt c = asInt(ncycle)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGCyclesOnLevel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":560
 *         CHKERR( PCMGSetCyclesOnLevel(self.pc, clevel, c) )
 * 
 *     def setMGRhs(self, level, Vec rhs not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetRhs(self.pc, clevel, rhs.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_153setMGRhs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_152setMGRhs[] = "PC.setMGRhs(self, level, Vec rhs)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_153setMGRhs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  struct PyPetscVecObject *__pyx_v_rhs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMGRhs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_rhs,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_level)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rhs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setMGRhs", 1, 2, 2, 1); __PYX_ERR(34, 560, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMGRhs") < 0)) __PYX_ERR(34, 560, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_level = values[0];
    __pyx_v_rhs = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMGRhs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 560, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGRhs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rhs), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "rhs", 0))) __PYX_ERR(34, 560, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_152setMGRhs(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level, __pyx_v_rhs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_152setMGRhs(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscVecObject *__pyx_v_rhs) {
  PetscInt __pyx_v_clevel;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMGRhs", 0);

  /* "PETSc/PC.pyx":561
 * 
 *     def setMGRhs(self, level, Vec rhs not None):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGSetRhs(self.pc, clevel, rhs.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 561, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":562
 *     def setMGRhs(self, level, Vec rhs not None):
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetRhs(self.pc, clevel, rhs.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def setMGX(self, level, Vec x not None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGSetRhs(__pyx_v_self->pc, __pyx_v_clevel, __pyx_v_rhs->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 562, __pyx_L1_error)

  /* "PETSc/PC.pyx":560
 *         CHKERR( PCMGSetCyclesOnLevel(self.pc, clevel, c) )
 * 
 *     def setMGRhs(self, level, Vec rhs not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetRhs(self.pc, clevel, rhs.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGRhs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":564
 *         CHKERR( PCMGSetRhs(self.pc, clevel, rhs.vec) )
 * 
 *     def setMGX(self, level, Vec x not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetX(self.pc, clevel, x.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_155setMGX(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_154setMGX[] = "PC.setMGX(self, level, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_155setMGX(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMGX (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_x,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_level)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setMGX", 1, 2, 2, 1); __PYX_ERR(34, 564, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMGX") < 0)) __PYX_ERR(34, 564, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_level = values[0];
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMGX", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 564, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGX", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(34, 564, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_154setMGX(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level, __pyx_v_x);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_154setMGX(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscVecObject *__pyx_v_x) {
  PetscInt __pyx_v_clevel;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMGX", 0);

  /* "PETSc/PC.pyx":565
 * 
 *     def setMGX(self, level, Vec x not None):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGSetX(self.pc, clevel, x.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 565, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":566
 *     def setMGX(self, level, Vec x not None):
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetX(self.pc, clevel, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def setMGR(self, level, Vec r not None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGSetX(__pyx_v_self->pc, __pyx_v_clevel, __pyx_v_x->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 566, __pyx_L1_error)

  /* "PETSc/PC.pyx":564
 *         CHKERR( PCMGSetRhs(self.pc, clevel, rhs.vec) )
 * 
 *     def setMGX(self, level, Vec x not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetX(self.pc, clevel, x.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGX", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PC.pyx":568
 *         CHKERR( PCMGSetX(self.pc, clevel, x.vec) )
 * 
 *     def setMGR(self, level, Vec r not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetR(self.pc, clevel, r.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_157setMGR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2PC_156setMGR[] = "PC.setMGR(self, level, Vec r)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2PC_157setMGR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  struct PyPetscVecObject *__pyx_v_r = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMGR (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_r,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_level)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_r)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setMGR", 1, 2, 2, 1); __PYX_ERR(34, 568, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMGR") < 0)) __PYX_ERR(34, 568, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_level = values[0];
    __pyx_v_r = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMGR", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(34, 568, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_r), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "r", 0))) __PYX_ERR(34, 568, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2PC_156setMGR(((struct PyPetscPCObject *)__pyx_v_self), __pyx_v_level, __pyx_v_r);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2PC_156setMGR(struct PyPetscPCObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscVecObject *__pyx_v_r) {
  PetscInt __pyx_v_clevel;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMGR", 0);

  /* "PETSc/PC.pyx":569
 * 
 *     def setMGR(self, level, Vec r not None):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         CHKERR( PCMGSetR(self.pc, clevel, r.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(34, 569, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/PC.pyx":570
 *     def setMGR(self, level, Vec r not None):
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetR(self.pc, clevel, r.vec) )             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PCMGSetR(__pyx_v_self->pc, __pyx_v_clevel, __pyx_v_r->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(34, 570, __pyx_L1_error)

  /* "PETSc/PC.pyx":568
 *         CHKERR( PCMGSetX(self.pc, clevel, x.vec) )
 * 
 *     def setMGR(self, level, Vec r not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( PCMGSetR(self.pc, clevel, r.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.PC.setMGR", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":94
 *     # --- xxx ---
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.ksp
 *         self.ksp = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP___cinit__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP___cinit__(struct PyPetscKSPObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/KSP.pyx":95
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.ksp             # <<<<<<<<<<<<<<
 *         self.ksp = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->ksp));

  /* "PETSc/KSP.pyx":96
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.ksp
 *         self.ksp = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, b, x=None):
 */
  __pyx_v_self->ksp = NULL;

  /* "PETSc/KSP.pyx":94
 *     # --- xxx ---
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.ksp
 *         self.ksp = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":98
 *         self.ksp = NULL
 * 
 *     def __call__(self, b, x=None):             # <<<<<<<<<<<<<<
 *         if x is None: # XXX do this better
 *             x = self.getOperators()[0].createVecLeft()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_x,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(35, 98, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_b = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 98, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_2__call__(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_b, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_2__call__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_b, PyObject *__pyx_v_x) {
  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;
  Py_ssize_t __pyx_t_7;
  __Pyx_RefNannySetupContext("__call__", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "PETSc/KSP.pyx":99
 * 
 *     def __call__(self, b, x=None):
 *         if x is None: # XXX do this better             # <<<<<<<<<<<<<<
 *             x = self.getOperators()[0].createVecLeft()
 *         self.solve(b, x)
 */
  __pyx_t_1 = (__pyx_v_x == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/KSP.pyx":100
 *     def __call__(self, b, x=None):
 *         if x is None: # XXX do this better
 *             x = self.getOperators()[0].createVecLeft()             # <<<<<<<<<<<<<<
 *         self.solve(b, x)
 *         return x
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getOperators); if (unlikely(!__pyx_t_5)) __PYX_ERR(35, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(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_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 100, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 100, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(35, 100, __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_createVecLeft); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 100, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 100, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/KSP.pyx":99
 * 
 *     def __call__(self, b, x=None):
 *         if x is None: # XXX do this better             # <<<<<<<<<<<<<<
 *             x = self.getOperators()[0].createVecLeft()
 *         self.solve(b, x)
 */
  }

  /* "PETSc/KSP.pyx":101
 *         if x is None: # XXX do this better
 *             x = self.getOperators()[0].createVecLeft()
 *         self.solve(b, x)             # <<<<<<<<<<<<<<
 *         return x
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_solve); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(35, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_GIVEREF(__pyx_v_b);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_b);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_x);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 101, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":102
 *             x = self.getOperators()[0].createVecLeft()
 *         self.solve(b, x)
 *         return x             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_x);
  __pyx_r = __pyx_v_x;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":98
 *         self.ksp = NULL
 * 
 *     def __call__(self, b, x=None):             # <<<<<<<<<<<<<<
 *         if x is None: # XXX do this better
 *             x = self.getOperators()[0].createVecLeft()
 */

  /* 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_AddTraceback("petsc4py.PETSc.KSP.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":106
 *     # --- xxx ---
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_4view[] = "KSP.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(35, 106, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 106, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(35, 106, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_4view(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_viewer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_4view(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/KSP.pyx":107
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( KSPView(self.ksp, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/KSP.pyx":108
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( KSPView(self.ksp, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/KSP.pyx":109
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( KSPView(self.ksp, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPView(__pyx_v_self->ksp, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(35, 109, __pyx_L1_error)

  /* "PETSc/KSP.pyx":106
 *     # --- xxx ---
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":111
 *         CHKERR( KSPView(self.ksp, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPDestroy(&self.ksp) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_6destroy[] = "KSP.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_6destroy(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6destroy(struct PyPetscKSPObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/KSP.pyx":112
 * 
 *     def destroy(self):
 *         CHKERR( KSPDestroy(&self.ksp) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPDestroy((&__pyx_v_self->ksp))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 112, __pyx_L1_error)

  /* "PETSc/KSP.pyx":113
 *     def destroy(self):
 *         CHKERR( KSPDestroy(&self.ksp) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":111
 *         CHKERR( KSPView(self.ksp, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPDestroy(&self.ksp) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":115
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscKSP newksp = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_8create[] = "KSP.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(35, 115, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 115, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_8create(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_8create(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  KSP __pyx_v_newksp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/KSP.pyx":116
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscKSP newksp = NULL
 *         CHKERR( KSPCreate(ccomm, &newksp) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(35, 116, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/KSP.pyx":117
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscKSP newksp = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( KSPCreate(ccomm, &newksp) )
 *         PetscCLEAR(self.obj); self.ksp = newksp
 */
  __pyx_v_newksp = NULL;

  /* "PETSc/KSP.pyx":118
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscKSP newksp = NULL
 *         CHKERR( KSPCreate(ccomm, &newksp) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.ksp = newksp
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPCreate(__pyx_v_ccomm, (&__pyx_v_newksp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 118, __pyx_L1_error)

  /* "PETSc/KSP.pyx":119
 *         cdef PetscKSP newksp = NULL
 *         CHKERR( KSPCreate(ccomm, &newksp) )
 *         PetscCLEAR(self.obj); self.ksp = newksp             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->ksp = __pyx_v_newksp;

  /* "PETSc/KSP.pyx":120
 *         CHKERR( KSPCreate(ccomm, &newksp) )
 *         PetscCLEAR(self.obj); self.ksp = newksp
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, ksp_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":115
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscKSP newksp = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":122
 *         return self
 * 
 *     def setType(self, ksp_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         ksp_type = str2bytes(ksp_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_11setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_10setType[] = "KSP.setType(self, ksp_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_11setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ksp_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ksp_type,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);
        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_ksp_type)) != 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, "setType") < 0)) __PYX_ERR(35, 122, __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_ksp_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 122, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_10setType(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_ksp_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_10setType(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_ksp_type) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_ksp_type);

  /* "PETSc/KSP.pyx":123
 * 
 *     def setType(self, ksp_type):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         ksp_type = str2bytes(ksp_type, &cval)
 *         CHKERR( KSPSetType(self.ksp, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/KSP.pyx":124
 *     def setType(self, ksp_type):
 *         cdef const_char *cval = NULL
 *         ksp_type = str2bytes(ksp_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetType(self.ksp, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_ksp_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_ksp_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":125
 *         cdef const_char *cval = NULL
 *         ksp_type = str2bytes(ksp_type, &cval)
 *         CHKERR( KSPSetType(self.ksp, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetType(__pyx_v_self->ksp, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 125, __pyx_L1_error)

  /* "PETSc/KSP.pyx":122
 *         return self
 * 
 *     def setType(self, ksp_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         ksp_type = str2bytes(ksp_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ksp_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":127
 *         CHKERR( KSPSetType(self.ksp, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( KSPGetType(self.ksp, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_13getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_12getType[] = "KSP.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_13getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_12getType(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_12getType(struct PyPetscKSPObject *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/KSP.pyx":128
 * 
 *     def getType(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetType(self.ksp, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/KSP.pyx":129
 *     def getType(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( KSPGetType(self.ksp, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetType(__pyx_v_self->ksp, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 129, __pyx_L1_error)

  /* "PETSc/KSP.pyx":130
 *         cdef const_char *cval = NULL
 *         CHKERR( KSPGetType(self.ksp, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setOptionsPrefix(self, prefix):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":127
 *         CHKERR( KSPSetType(self.ksp, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( KSPGetType(self.ksp, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":132
 *         return bytes2str(cval)
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_15setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_14setOptionsPrefix[] = "KSP.setOptionsPrefix(self, prefix)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_15setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOptionsPrefix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,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);
        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_prefix)) != 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, "setOptionsPrefix") < 0)) __PYX_ERR(35, 132, __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_prefix = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOptionsPrefix", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 132, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_14setOptionsPrefix(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_prefix);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_14setOptionsPrefix(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setOptionsPrefix", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "PETSc/KSP.pyx":133
 * 
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( KSPSetOptionsPrefix(self.ksp, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/KSP.pyx":134
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetOptionsPrefix(self.ksp, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_prefix, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":135
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( KSPSetOptionsPrefix(self.ksp, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getOptionsPrefix(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetOptionsPrefix(__pyx_v_self->ksp, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 135, __pyx_L1_error)

  /* "PETSc/KSP.pyx":132
 *         return bytes2str(cval)
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":137
 *         CHKERR( KSPSetOptionsPrefix(self.ksp, cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( KSPGetOptionsPrefix(self.ksp, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_17getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_16getOptionsPrefix[] = "KSP.getOptionsPrefix(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_17getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOptionsPrefix (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOptionsPrefix", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOptionsPrefix", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_16getOptionsPrefix(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_16getOptionsPrefix(struct PyPetscKSPObject *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getOptionsPrefix", 0);

  /* "PETSc/KSP.pyx":138
 * 
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetOptionsPrefix(self.ksp, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/KSP.pyx":139
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( KSPGetOptionsPrefix(self.ksp, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetOptionsPrefix(__pyx_v_self->ksp, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 139, __pyx_L1_error)

  /* "PETSc/KSP.pyx":140
 *         cdef const_char *cval = NULL
 *         CHKERR( KSPGetOptionsPrefix(self.ksp, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":137
 *         CHKERR( KSPSetOptionsPrefix(self.ksp, cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( KSPGetOptionsPrefix(self.ksp, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":142
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetFromOptions(self.ksp) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_19setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_18setFromOptions[] = "KSP.setFromOptions(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_19setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_18setFromOptions(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_18setFromOptions(struct PyPetscKSPObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/KSP.pyx":143
 * 
 *     def setFromOptions(self):
 *         CHKERR( KSPSetFromOptions(self.ksp) )             # <<<<<<<<<<<<<<
 * 
 *     # --- application context ---
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetFromOptions(__pyx_v_self->ksp)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 143, __pyx_L1_error)

  /* "PETSc/KSP.pyx":142
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetFromOptions(self.ksp) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":147
 *     # --- application context ---
 * 
 *     def setAppCtx(self, appctx):             # <<<<<<<<<<<<<<
 *         self.set_attr('__appctx__', appctx)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_21setAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_20setAppCtx[] = "KSP.setAppCtx(self, appctx)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_21setAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_appctx = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setAppCtx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_appctx,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);
        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_appctx)) != 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, "setAppCtx") < 0)) __PYX_ERR(35, 147, __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_appctx = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setAppCtx", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 147, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_20setAppCtx(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_appctx);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_20setAppCtx(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_appctx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setAppCtx", 0);

  /* "PETSc/KSP.pyx":148
 * 
 *     def setAppCtx(self, appctx):
 *         self.set_attr('__appctx__', appctx)             # <<<<<<<<<<<<<<
 * 
 *     def getAppCtx(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__appctx__"), __pyx_v_appctx); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":147
 *     # --- application context ---
 * 
 *     def setAppCtx(self, appctx):             # <<<<<<<<<<<<<<
 *         self.set_attr('__appctx__', appctx)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":150
 *         self.set_attr('__appctx__', appctx)
 * 
 *     def getAppCtx(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__appctx__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_23getAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_22getAppCtx[] = "KSP.getAppCtx(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_23getAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getAppCtx (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getAppCtx", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getAppCtx", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_22getAppCtx(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_22getAppCtx(struct PyPetscKSPObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getAppCtx", 0);

  /* "PETSc/KSP.pyx":151
 * 
 *     def getAppCtx(self):
 *         return self.get_attr('__appctx__')             # <<<<<<<<<<<<<<
 * 
 *     # --- discretization space ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__appctx__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":150
 *         self.set_attr('__appctx__', appctx)
 * 
 *     def getAppCtx(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__appctx__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":155
 *     # --- discretization space ---
 * 
 *     def getDM(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( KSPGetDM(self.ksp, &newdm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_25getDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_24getDM[] = "KSP.getDM(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_25getDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDM (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDM", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDM", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_24getDM(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_24getDM(struct PyPetscKSPObject *__pyx_v_self) {
  DM __pyx_v_newdm;
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getDM", 0);

  /* "PETSc/KSP.pyx":156
 * 
 *     def getDM(self):
 *         cdef PetscDM newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetDM(self.ksp, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/KSP.pyx":157
 *     def getDM(self):
 *         cdef PetscDM newdm = NULL
 *         CHKERR( KSPGetDM(self.ksp, &newdm) )             # <<<<<<<<<<<<<<
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetDM(__pyx_v_self->ksp, (&__pyx_v_newdm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 157, __pyx_L1_error)

  /* "PETSc/KSP.pyx":158
 *         cdef PetscDM newdm = NULL
 *         CHKERR( KSPGetDM(self.ksp, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()             # <<<<<<<<<<<<<<
 *         dm.dm = newdm
 *         PetscINCREF(dm.obj)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_newdm)); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(35, 158, __pyx_L1_error)
  __pyx_v_dm = ((struct PyPetscDMObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":159
 *         CHKERR( KSPGetDM(self.ksp, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm             # <<<<<<<<<<<<<<
 *         PetscINCREF(dm.obj)
 *         return dm
 */
  __pyx_v_dm->dm = __pyx_v_newdm;

  /* "PETSc/KSP.pyx":160
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm
 *         PetscINCREF(dm.obj)             # <<<<<<<<<<<<<<
 *         return dm
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_dm->__pyx_base.obj);

  /* "PETSc/KSP.pyx":161
 *         dm.dm = newdm
 *         PetscINCREF(dm.obj)
 *         return dm             # <<<<<<<<<<<<<<
 * 
 *     def setDM(self, DM dm not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dm));
  __pyx_r = ((PyObject *)__pyx_v_dm);
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":155
 *     # --- discretization space ---
 * 
 *     def getDM(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( KSPGetDM(self.ksp, &newdm) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":163
 *         return dm
 * 
 *     def setDM(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetDM(self.ksp, dm.dm) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_27setDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_26setDM[] = "KSP.setDM(self, DM dm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_27setDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDM (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dm,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);
        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_dm)) != 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, "setDM") < 0)) __PYX_ERR(35, 163, __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_dm = ((struct PyPetscDMObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDM", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 163, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_8petsc4py_5PETSc_DM, 0, "dm", 0))) __PYX_ERR(35, 163, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_26setDM(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_dm);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_26setDM(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setDM", 0);

  /* "PETSc/KSP.pyx":164
 * 
 *     def setDM(self, DM dm not None):
 *         CHKERR( KSPSetDM(self.ksp, dm.dm) )             # <<<<<<<<<<<<<<
 * 
 *     def setDMActive(self, bint flag):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetDM(__pyx_v_self->ksp, __pyx_v_dm->dm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 164, __pyx_L1_error)

  /* "PETSc/KSP.pyx":163
 *         return dm
 * 
 *     def setDM(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetDM(self.ksp, dm.dm) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":166
 *         CHKERR( KSPSetDM(self.ksp, dm.dm) )
 * 
 *     def setDMActive(self, bint flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag: cflag = PETSC_TRUE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_29setDMActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_28setDMActive[] = "KSP.setDMActive(self, bool flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_29setDMActive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDMActive (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setDMActive") < 0)) __PYX_ERR(35, 166, __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_flag = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_flag == (int)-1) && PyErr_Occurred())) __PYX_ERR(35, 166, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDMActive", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 166, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setDMActive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_28setDMActive(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_28setDMActive(struct PyPetscKSPObject *__pyx_v_self, int __pyx_v_flag) {
  PetscBool __pyx_v_cflag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setDMActive", 0);

  /* "PETSc/KSP.pyx":167
 * 
 *     def setDMActive(self, bint flag):
 *         cdef PetscBool cflag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if flag: cflag = PETSC_TRUE
 *         CHKERR( KSPSetDMActive(self.ksp, cflag) )
 */
  __pyx_v_cflag = PETSC_FALSE;

  /* "PETSc/KSP.pyx":168
 *     def setDMActive(self, bint flag):
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag: cflag = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetDMActive(self.ksp, cflag) )
 * 
 */
  __pyx_t_1 = (__pyx_v_flag != 0);
  if (__pyx_t_1) {
    __pyx_v_cflag = PETSC_TRUE;
  }

  /* "PETSc/KSP.pyx":169
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag: cflag = PETSC_TRUE
 *         CHKERR( KSPSetDMActive(self.ksp, cflag) )             # <<<<<<<<<<<<<<
 * 
 *     # --- operators and preconditioner ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetDMActive(__pyx_v_self->ksp, __pyx_v_cflag)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 169, __pyx_L1_error)

  /* "PETSc/KSP.pyx":166
 *         CHKERR( KSPSetDM(self.ksp, dm.dm) )
 * 
 *     def setDMActive(self, bint flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool cflag = PETSC_FALSE
 *         if flag: cflag = PETSC_TRUE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setDMActive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":173
 *     # --- operators and preconditioner ---
 * 
 *     def setComputeRHS(self, rhs, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_31setComputeRHS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_30setComputeRHS[] = "KSP.setComputeRHS(self, rhs, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_31setComputeRHS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rhs = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setComputeRHS (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rhs,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_rhs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setComputeRHS") < 0)) __PYX_ERR(35, 173, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rhs = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setComputeRHS", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 173, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setComputeRHS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_30setComputeRHS(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_rhs, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_30setComputeRHS(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_rhs, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setComputeRHS", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/KSP.pyx":174
 * 
 *     def setComputeRHS(self, rhs, args=None, kargs=None):
 *         if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         context = (rhs, args, kargs)
 */
  __pyx_t_1 = (__pyx_v_args == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/KSP.pyx":175
 *     def setComputeRHS(self, rhs, args=None, kargs=None):
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         context = (rhs, args, kargs)
 *         self.set_attr('__rhs__', context)
 */
  __pyx_t_2 = (__pyx_v_kargs == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "PETSc/KSP.pyx":176
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}
 *         context = (rhs, args, kargs)             # <<<<<<<<<<<<<<
 *         self.set_attr('__rhs__', context)
 *         CHKERR( KSPSetComputeRHS(self.ksp, KSP_ComputeRHS, <void*>context) )
 */
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_rhs);
  __Pyx_GIVEREF(__pyx_v_rhs);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_rhs);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
  __pyx_v_context = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":177
 *         if kargs is None: kargs = {}
 *         context = (rhs, args, kargs)
 *         self.set_attr('__rhs__', context)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetComputeRHS(self.ksp, KSP_ComputeRHS, <void*>context) )
 * 
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__rhs__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":178
 *         context = (rhs, args, kargs)
 *         self.set_attr('__rhs__', context)
 *         CHKERR( KSPSetComputeRHS(self.ksp, KSP_ComputeRHS, <void*>context) )             # <<<<<<<<<<<<<<
 * 
 *     def setComputeOperators(self, operators, args=None, kargs=None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetComputeRHS(__pyx_v_self->ksp, __pyx_f_8petsc4py_5PETSc_KSP_ComputeRHS, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(35, 178, __pyx_L1_error)

  /* "PETSc/KSP.pyx":173
 *     # --- operators and preconditioner ---
 * 
 *     def setComputeRHS(self, rhs, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setComputeRHS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":180
 *         CHKERR( KSPSetComputeRHS(self.ksp, KSP_ComputeRHS, <void*>context) )
 * 
 *     def setComputeOperators(self, operators, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_33setComputeOperators(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_32setComputeOperators[] = "KSP.setComputeOperators(self, operators, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_33setComputeOperators(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_operators = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setComputeOperators (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_operators,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_operators)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setComputeOperators") < 0)) __PYX_ERR(35, 180, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_operators = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setComputeOperators", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 180, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setComputeOperators", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_32setComputeOperators(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_operators, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_32setComputeOperators(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_operators, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setComputeOperators", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/KSP.pyx":181
 * 
 *     def setComputeOperators(self, operators, args=None, kargs=None):
 *         if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         context = (operators, args, kargs)
 */
  __pyx_t_1 = (__pyx_v_args == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/KSP.pyx":182
 *     def setComputeOperators(self, operators, args=None, kargs=None):
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         context = (operators, args, kargs)
 *         self.set_attr('__operators__', context)
 */
  __pyx_t_2 = (__pyx_v_kargs == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "PETSc/KSP.pyx":183
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}
 *         context = (operators, args, kargs)             # <<<<<<<<<<<<<<
 *         self.set_attr('__operators__', context)
 *         CHKERR( KSPSetComputeOperators(self.ksp, KSP_ComputeOps, <void*>context) )
 */
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_operators);
  __Pyx_GIVEREF(__pyx_v_operators);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_operators);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
  __pyx_v_context = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":184
 *         if kargs is None: kargs = {}
 *         context = (operators, args, kargs)
 *         self.set_attr('__operators__', context)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetComputeOperators(self.ksp, KSP_ComputeOps, <void*>context) )
 * 
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__operators__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":185
 *         context = (operators, args, kargs)
 *         self.set_attr('__operators__', context)
 *         CHKERR( KSPSetComputeOperators(self.ksp, KSP_ComputeOps, <void*>context) )             # <<<<<<<<<<<<<<
 * 
 *     def setOperators(self, Mat A=None, Mat P=None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetComputeOperators(__pyx_v_self->ksp, __pyx_f_8petsc4py_5PETSc_KSP_ComputeOps, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(35, 185, __pyx_L1_error)

  /* "PETSc/KSP.pyx":180
 *         CHKERR( KSPSetComputeRHS(self.ksp, KSP_ComputeRHS, <void*>context) )
 * 
 *     def setComputeOperators(self, operators, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setComputeOperators", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":187
 *         CHKERR( KSPSetComputeOperators(self.ksp, KSP_ComputeOps, <void*>context) )
 * 
 *     def setOperators(self, Mat A=None, Mat P=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat amat=NULL
 *         if A is not None: amat = A.mat
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_35setOperators(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_34setOperators[] = "KSP.setOperators(self, Mat A=None, Mat P=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_35setOperators(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_A = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOperators (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_P,0};
    PyObject* values[2] = {0,0};
    values[0] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[1] = (PyObject *)((struct PyPetscMatObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_A);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setOperators") < 0)) __PYX_ERR(35, 187, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = ((struct PyPetscMatObject *)values[0]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOperators", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 187, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setOperators", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_A), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "A", 0))) __PYX_ERR(35, 187, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(35, 187, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_34setOperators(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_A, __pyx_v_P);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_34setOperators(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_A, struct PyPetscMatObject *__pyx_v_P) {
  Mat __pyx_v_amat;
  Mat __pyx_v_pmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Mat __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setOperators", 0);

  /* "PETSc/KSP.pyx":188
 * 
 *     def setOperators(self, Mat A=None, Mat P=None):
 *         cdef PetscMat amat=NULL             # <<<<<<<<<<<<<<
 *         if A is not None: amat = A.mat
 *         cdef PetscMat pmat=amat
 */
  __pyx_v_amat = NULL;

  /* "PETSc/KSP.pyx":189
 *     def setOperators(self, Mat A=None, Mat P=None):
 *         cdef PetscMat amat=NULL
 *         if A is not None: amat = A.mat             # <<<<<<<<<<<<<<
 *         cdef PetscMat pmat=amat
 *         if P is not None: pmat = P.mat
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_A) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_A->mat;
    __pyx_v_amat = __pyx_t_3;
  }

  /* "PETSc/KSP.pyx":190
 *         cdef PetscMat amat=NULL
 *         if A is not None: amat = A.mat
 *         cdef PetscMat pmat=amat             # <<<<<<<<<<<<<<
 *         if P is not None: pmat = P.mat
 *         CHKERR( KSPSetOperators(self.ksp, amat, pmat) )
 */
  __pyx_v_pmat = __pyx_v_amat;

  /* "PETSc/KSP.pyx":191
 *         if A is not None: amat = A.mat
 *         cdef PetscMat pmat=amat
 *         if P is not None: pmat = P.mat             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetOperators(self.ksp, amat, pmat) )
 * 
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_P->mat;
    __pyx_v_pmat = __pyx_t_3;
  }

  /* "PETSc/KSP.pyx":192
 *         cdef PetscMat pmat=amat
 *         if P is not None: pmat = P.mat
 *         CHKERR( KSPSetOperators(self.ksp, amat, pmat) )             # <<<<<<<<<<<<<<
 * 
 *     def getOperators(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetOperators(__pyx_v_self->ksp, __pyx_v_amat, __pyx_v_pmat)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(35, 192, __pyx_L1_error)

  /* "PETSc/KSP.pyx":187
 *         CHKERR( KSPSetComputeOperators(self.ksp, KSP_ComputeOps, <void*>context) )
 * 
 *     def setOperators(self, Mat A=None, Mat P=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat amat=NULL
 *         if A is not None: amat = A.mat
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setOperators", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":194
 *         CHKERR( KSPSetOperators(self.ksp, amat, pmat) )
 * 
 *     def getOperators(self):             # <<<<<<<<<<<<<<
 *         cdef Mat A = Mat(), P = Mat()
 *         CHKERR( KSPGetOperators(self.ksp, &A.mat, &P.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_37getOperators(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_36getOperators[] = "KSP.getOperators(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_37getOperators(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOperators (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOperators", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOperators", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_36getOperators(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_36getOperators(struct PyPetscKSPObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_A = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getOperators", 0);

  /* "PETSc/KSP.pyx":195
 * 
 *     def getOperators(self):
 *         cdef Mat A = Mat(), P = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetOperators(self.ksp, &A.mat, &P.mat) )
 *         PetscINCREF(A.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_A = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":196
 *     def getOperators(self):
 *         cdef Mat A = Mat(), P = Mat()
 *         CHKERR( KSPGetOperators(self.ksp, &A.mat, &P.mat) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(A.obj)
 *         PetscINCREF(P.obj)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetOperators(__pyx_v_self->ksp, (&__pyx_v_A->mat), (&__pyx_v_P->mat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 196, __pyx_L1_error)

  /* "PETSc/KSP.pyx":197
 *         cdef Mat A = Mat(), P = Mat()
 *         CHKERR( KSPGetOperators(self.ksp, &A.mat, &P.mat) )
 *         PetscINCREF(A.obj)             # <<<<<<<<<<<<<<
 *         PetscINCREF(P.obj)
 *         return (A, P)
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_A->__pyx_base.obj);

  /* "PETSc/KSP.pyx":198
 *         CHKERR( KSPGetOperators(self.ksp, &A.mat, &P.mat) )
 *         PetscINCREF(A.obj)
 *         PetscINCREF(P.obj)             # <<<<<<<<<<<<<<
 *         return (A, P)
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_P->__pyx_base.obj);

  /* "PETSc/KSP.pyx":199
 *         PetscINCREF(A.obj)
 *         PetscINCREF(P.obj)
 *         return (A, P)             # <<<<<<<<<<<<<<
 * 
 *     def setPC(self, PC pc not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_A));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_A));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_A));
  __Pyx_INCREF(((PyObject *)__pyx_v_P));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_P));
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":194
 *         CHKERR( KSPSetOperators(self.ksp, amat, pmat) )
 * 
 *     def getOperators(self):             # <<<<<<<<<<<<<<
 *         cdef Mat A = Mat(), P = Mat()
 *         CHKERR( KSPGetOperators(self.ksp, &A.mat, &P.mat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getOperators", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_A);
  __Pyx_XDECREF((PyObject *)__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":201
 *         return (A, P)
 * 
 *     def setPC(self, PC pc not None):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetPC(self.ksp, pc.pc) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_39setPC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_38setPC[] = "KSP.setPC(self, PC pc)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_39setPC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscPCObject *__pyx_v_pc = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPC (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pc,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);
        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_pc)) != 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, "setPC") < 0)) __PYX_ERR(35, 201, __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_pc = ((struct PyPetscPCObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPC", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 201, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setPC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pc), __pyx_ptype_8petsc4py_5PETSc_PC, 0, "pc", 0))) __PYX_ERR(35, 201, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_38setPC(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_pc);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_38setPC(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscPCObject *__pyx_v_pc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setPC", 0);

  /* "PETSc/KSP.pyx":202
 * 
 *     def setPC(self, PC pc not None):
 *         CHKERR( KSPSetPC(self.ksp, pc.pc) )             # <<<<<<<<<<<<<<
 * 
 *     def getPC(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetPC(__pyx_v_self->ksp, __pyx_v_pc->pc)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 202, __pyx_L1_error)

  /* "PETSc/KSP.pyx":201
 *         return (A, P)
 * 
 *     def setPC(self, PC pc not None):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetPC(self.ksp, pc.pc) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setPC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":204
 *         CHKERR( KSPSetPC(self.ksp, pc.pc) )
 * 
 *     def getPC(self):             # <<<<<<<<<<<<<<
 *         cdef PC pc = PC()
 *         CHKERR( KSPGetPC(self.ksp, &pc.pc) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_41getPC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_40getPC[] = "KSP.getPC(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_41getPC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPC (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getPC", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getPC", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_40getPC(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_40getPC(struct PyPetscKSPObject *__pyx_v_self) {
  struct PyPetscPCObject *__pyx_v_pc = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getPC", 0);

  /* "PETSc/KSP.pyx":205
 * 
 *     def getPC(self):
 *         cdef PC pc = PC()             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetPC(self.ksp, &pc.pc) )
 *         PetscINCREF(pc.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_PC), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pc = ((struct PyPetscPCObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":206
 *     def getPC(self):
 *         cdef PC pc = PC()
 *         CHKERR( KSPGetPC(self.ksp, &pc.pc) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(pc.obj)
 *         return pc
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetPC(__pyx_v_self->ksp, (&__pyx_v_pc->pc))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 206, __pyx_L1_error)

  /* "PETSc/KSP.pyx":207
 *         cdef PC pc = PC()
 *         CHKERR( KSPGetPC(self.ksp, &pc.pc) )
 *         PetscINCREF(pc.obj)             # <<<<<<<<<<<<<<
 *         return pc
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_pc->__pyx_base.obj);

  /* "PETSc/KSP.pyx":208
 *         CHKERR( KSPGetPC(self.ksp, &pc.pc) )
 *         PetscINCREF(pc.obj)
 *         return pc             # <<<<<<<<<<<<<<
 * 
 *     # --- tolerances and convergence ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_pc));
  __pyx_r = ((PyObject *)__pyx_v_pc);
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":204
 *         CHKERR( KSPSetPC(self.ksp, pc.pc) )
 * 
 *     def getPC(self):             # <<<<<<<<<<<<<<
 *         cdef PC pc = PC()
 *         CHKERR( KSPGetPC(self.ksp, &pc.pc) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getPC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":212
 *     # --- tolerances and convergence ---
 * 
 *     def setTolerances(self, rtol=None, atol=None, divtol=None, max_it=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal crtol, catol, cdivtol
 *         crtol = catol = cdivtol = PETSC_DEFAULT;
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_43setTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_42setTolerances[] = "KSP.setTolerances(self, rtol=None, atol=None, divtol=None, max_it=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_43setTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rtol = 0;
  PyObject *__pyx_v_atol = 0;
  PyObject *__pyx_v_divtol = 0;
  PyObject *__pyx_v_max_it = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTolerances (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rtol,&__pyx_n_s_atol,&__pyx_n_s_divtol,&__pyx_n_s_max_it,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rtol);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_atol);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_divtol);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_it);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setTolerances") < 0)) __PYX_ERR(35, 212, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rtol = values[0];
    __pyx_v_atol = values[1];
    __pyx_v_divtol = values[2];
    __pyx_v_max_it = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTolerances", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 212, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_42setTolerances(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_rtol, __pyx_v_atol, __pyx_v_divtol, __pyx_v_max_it);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_42setTolerances(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_rtol, PyObject *__pyx_v_atol, PyObject *__pyx_v_divtol, PyObject *__pyx_v_max_it) {
  PetscReal __pyx_v_crtol;
  PetscReal __pyx_v_catol;
  PetscReal __pyx_v_cdivtol;
  PetscInt __pyx_v_cmaxits;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscReal __pyx_t_3;
  PetscInt __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setTolerances", 0);

  /* "PETSc/KSP.pyx":214
 *     def setTolerances(self, rtol=None, atol=None, divtol=None, max_it=None):
 *         cdef PetscReal crtol, catol, cdivtol
 *         crtol = catol = cdivtol = PETSC_DEFAULT;             # <<<<<<<<<<<<<<
 *         if rtol   is not None: crtol   = asReal(rtol)
 *         if atol   is not None: catol   = asReal(atol)
 */
  __pyx_v_crtol = PETSC_DEFAULT;
  __pyx_v_catol = PETSC_DEFAULT;
  __pyx_v_cdivtol = PETSC_DEFAULT;

  /* "PETSc/KSP.pyx":215
 *         cdef PetscReal crtol, catol, cdivtol
 *         crtol = catol = cdivtol = PETSC_DEFAULT;
 *         if rtol   is not None: crtol   = asReal(rtol)             # <<<<<<<<<<<<<<
 *         if atol   is not None: catol   = asReal(atol)
 *         if divtol is not None: cdivtol = asReal(divtol)
 */
  __pyx_t_1 = (__pyx_v_rtol != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_rtol); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(35, 215, __pyx_L1_error)
    __pyx_v_crtol = __pyx_t_3;
  }

  /* "PETSc/KSP.pyx":216
 *         crtol = catol = cdivtol = PETSC_DEFAULT;
 *         if rtol   is not None: crtol   = asReal(rtol)
 *         if atol   is not None: catol   = asReal(atol)             # <<<<<<<<<<<<<<
 *         if divtol is not None: cdivtol = asReal(divtol)
 *         cdef PetscInt cmaxits = PETSC_DEFAULT
 */
  __pyx_t_2 = (__pyx_v_atol != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_atol); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(35, 216, __pyx_L1_error)
    __pyx_v_catol = __pyx_t_3;
  }

  /* "PETSc/KSP.pyx":217
 *         if rtol   is not None: crtol   = asReal(rtol)
 *         if atol   is not None: catol   = asReal(atol)
 *         if divtol is not None: cdivtol = asReal(divtol)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cmaxits = PETSC_DEFAULT
 *         if max_it is not None: cmaxits = asInt(max_it)
 */
  __pyx_t_1 = (__pyx_v_divtol != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_divtol); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(35, 217, __pyx_L1_error)
    __pyx_v_cdivtol = __pyx_t_3;
  }

  /* "PETSc/KSP.pyx":218
 *         if atol   is not None: catol   = asReal(atol)
 *         if divtol is not None: cdivtol = asReal(divtol)
 *         cdef PetscInt cmaxits = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         if max_it is not None: cmaxits = asInt(max_it)
 *         CHKERR( KSPSetTolerances(self.ksp, crtol, catol, cdivtol, cmaxits) )
 */
  __pyx_v_cmaxits = PETSC_DEFAULT;

  /* "PETSc/KSP.pyx":219
 *         if divtol is not None: cdivtol = asReal(divtol)
 *         cdef PetscInt cmaxits = PETSC_DEFAULT
 *         if max_it is not None: cmaxits = asInt(max_it)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetTolerances(self.ksp, crtol, catol, cdivtol, cmaxits) )
 * 
 */
  __pyx_t_2 = (__pyx_v_max_it != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_max_it); if (unlikely(__pyx_t_4 == -1L && PyErr_Occurred())) __PYX_ERR(35, 219, __pyx_L1_error)
    __pyx_v_cmaxits = __pyx_t_4;
  }

  /* "PETSc/KSP.pyx":220
 *         cdef PetscInt cmaxits = PETSC_DEFAULT
 *         if max_it is not None: cmaxits = asInt(max_it)
 *         CHKERR( KSPSetTolerances(self.ksp, crtol, catol, cdivtol, cmaxits) )             # <<<<<<<<<<<<<<
 * 
 *     def getTolerances(self):
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetTolerances(__pyx_v_self->ksp, __pyx_v_crtol, __pyx_v_catol, __pyx_v_cdivtol, __pyx_v_cmaxits)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(35, 220, __pyx_L1_error)

  /* "PETSc/KSP.pyx":212
 *     # --- tolerances and convergence ---
 * 
 *     def setTolerances(self, rtol=None, atol=None, divtol=None, max_it=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal crtol, catol, cdivtol
 *         crtol = catol = cdivtol = PETSC_DEFAULT;
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":222
 *         CHKERR( KSPSetTolerances(self.ksp, crtol, catol, cdivtol, cmaxits) )
 * 
 *     def getTolerances(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal crtol=0, catol=0, cdivtol=0
 *         cdef PetscInt cmaxits=0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_45getTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_44getTolerances[] = "KSP.getTolerances(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_45getTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTolerances (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getTolerances", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getTolerances", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_44getTolerances(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_44getTolerances(struct PyPetscKSPObject *__pyx_v_self) {
  PetscReal __pyx_v_crtol;
  PetscReal __pyx_v_catol;
  PetscReal __pyx_v_cdivtol;
  PetscInt __pyx_v_cmaxits;
  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;
  __Pyx_RefNannySetupContext("getTolerances", 0);

  /* "PETSc/KSP.pyx":223
 * 
 *     def getTolerances(self):
 *         cdef PetscReal crtol=0, catol=0, cdivtol=0             # <<<<<<<<<<<<<<
 *         cdef PetscInt cmaxits=0
 *         CHKERR( KSPGetTolerances(self.ksp, &crtol, &catol, &cdivtol, &cmaxits) )
 */
  __pyx_v_crtol = 0.0;
  __pyx_v_catol = 0.0;
  __pyx_v_cdivtol = 0.0;

  /* "PETSc/KSP.pyx":224
 *     def getTolerances(self):
 *         cdef PetscReal crtol=0, catol=0, cdivtol=0
 *         cdef PetscInt cmaxits=0             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetTolerances(self.ksp, &crtol, &catol, &cdivtol, &cmaxits) )
 *         return (toReal(crtol), toReal(catol), toReal(cdivtol), toInt(cmaxits))
 */
  __pyx_v_cmaxits = 0;

  /* "PETSc/KSP.pyx":225
 *         cdef PetscReal crtol=0, catol=0, cdivtol=0
 *         cdef PetscInt cmaxits=0
 *         CHKERR( KSPGetTolerances(self.ksp, &crtol, &catol, &cdivtol, &cmaxits) )             # <<<<<<<<<<<<<<
 *         return (toReal(crtol), toReal(catol), toReal(cdivtol), toInt(cmaxits))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetTolerances(__pyx_v_self->ksp, (&__pyx_v_crtol), (&__pyx_v_catol), (&__pyx_v_cdivtol), (&__pyx_v_cmaxits))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 225, __pyx_L1_error)

  /* "PETSc/KSP.pyx":226
 *         cdef PetscInt cmaxits=0
 *         CHKERR( KSPGetTolerances(self.ksp, &crtol, &catol, &cdivtol, &cmaxits) )
 *         return (toReal(crtol), toReal(catol), toReal(cdivtol), toInt(cmaxits))             # <<<<<<<<<<<<<<
 * 
 *     def setConvergenceTest(self, converged, args=None, kargs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_crtol); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_catol); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_cdivtol); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_cmaxits); if (unlikely(!__pyx_t_5)) __PYX_ERR(35, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(35, 226, __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_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":222
 *         CHKERR( KSPSetTolerances(self.ksp, crtol, catol, cdivtol, cmaxits) )
 * 
 *     def getTolerances(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal crtol=0, catol=0, cdivtol=0
 *         cdef PetscInt cmaxits=0
 */

  /* 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("petsc4py.PETSc.KSP.getTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":228
 *         return (toReal(crtol), toReal(catol), toReal(cdivtol), toInt(cmaxits))
 * 
 *     def setConvergenceTest(self, converged, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscKSPNormType normtype = KSP_NORM_NONE
 *         cdef void* cctx = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_47setConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_46setConvergenceTest[] = "KSP.setConvergenceTest(self, converged, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_47setConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_converged = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvergenceTest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_converged,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_converged)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConvergenceTest") < 0)) __PYX_ERR(35, 228, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_converged = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvergenceTest", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 228, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_46setConvergenceTest(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_converged, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_46setConvergenceTest(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_converged, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  KSPNormType __pyx_v_normtype;
  void *__pyx_v_cctx;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("setConvergenceTest", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/KSP.pyx":229
 * 
 *     def setConvergenceTest(self, converged, args=None, kargs=None):
 *         cdef PetscKSPNormType normtype = KSP_NORM_NONE             # <<<<<<<<<<<<<<
 *         cdef void* cctx = NULL
 *         if converged is not None:
 */
  __pyx_v_normtype = KSP_NORM_NONE;

  /* "PETSc/KSP.pyx":230
 *     def setConvergenceTest(self, converged, args=None, kargs=None):
 *         cdef PetscKSPNormType normtype = KSP_NORM_NONE
 *         cdef void* cctx = NULL             # <<<<<<<<<<<<<<
 *         if converged is not None:
 *             CHKERR( KSPSetConvergenceTest(
 */
  __pyx_v_cctx = NULL;

  /* "PETSc/KSP.pyx":231
 *         cdef PetscKSPNormType normtype = KSP_NORM_NONE
 *         cdef void* cctx = NULL
 *         if converged is not None:             # <<<<<<<<<<<<<<
 *             CHKERR( KSPSetConvergenceTest(
 *                     self.ksp, KSP_Converged, NULL, NULL) )
 */
  __pyx_t_1 = (__pyx_v_converged != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/KSP.pyx":232
 *         cdef void* cctx = NULL
 *         if converged is not None:
 *             CHKERR( KSPSetConvergenceTest(             # <<<<<<<<<<<<<<
 *                     self.ksp, KSP_Converged, NULL, NULL) )
 *             if args is None: args = ()
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetConvergenceTest(__pyx_v_self->ksp, __pyx_f_8petsc4py_5PETSc_KSP_Converged, NULL, NULL)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(35, 232, __pyx_L1_error)

    /* "PETSc/KSP.pyx":234
 *             CHKERR( KSPSetConvergenceTest(
 *                     self.ksp, KSP_Converged, NULL, NULL) )
 *             if args is None: args = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             self.set_attr('__converged__', (converged, args, kargs))
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/KSP.pyx":235
 *                     self.ksp, KSP_Converged, NULL, NULL) )
 *             if args is None: args = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             self.set_attr('__converged__', (converged, args, kargs))
 *         else:
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_4);
      __pyx_t_4 = 0;
    }

    /* "PETSc/KSP.pyx":236
 *             if args is None: args = ()
 *             if kargs is None: kargs = {}
 *             self.set_attr('__converged__', (converged, args, kargs))             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( KSPGetNormType(self.ksp, &normtype) )
 */
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_converged);
    __Pyx_GIVEREF(__pyx_v_converged);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_converged);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_kargs);
    __pyx_t_5 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__converged__"), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(35, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/KSP.pyx":231
 *         cdef PetscKSPNormType normtype = KSP_NORM_NONE
 *         cdef void* cctx = NULL
 *         if converged is not None:             # <<<<<<<<<<<<<<
 *             CHKERR( KSPSetConvergenceTest(
 *                     self.ksp, KSP_Converged, NULL, NULL) )
 */
    goto __pyx_L3;
  }

  /* "PETSc/KSP.pyx":238
 *             self.set_attr('__converged__', (converged, args, kargs))
 *         else:
 *             CHKERR( KSPGetNormType(self.ksp, &normtype) )             # <<<<<<<<<<<<<<
 *             if normtype != KSP_NORM_NONE:
 *                 CHKERR( KSPConvergedDefaultCreate(&cctx) )
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetNormType(__pyx_v_self->ksp, (&__pyx_v_normtype))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(35, 238, __pyx_L1_error)

    /* "PETSc/KSP.pyx":239
 *         else:
 *             CHKERR( KSPGetNormType(self.ksp, &normtype) )
 *             if normtype != KSP_NORM_NONE:             # <<<<<<<<<<<<<<
 *                 CHKERR( KSPConvergedDefaultCreate(&cctx) )
 *                 CHKERR( KSPSetConvergenceTest(
 */
    __pyx_t_2 = ((__pyx_v_normtype != KSP_NORM_NONE) != 0);
    if (__pyx_t_2) {

      /* "PETSc/KSP.pyx":240
 *             CHKERR( KSPGetNormType(self.ksp, &normtype) )
 *             if normtype != KSP_NORM_NONE:
 *                 CHKERR( KSPConvergedDefaultCreate(&cctx) )             # <<<<<<<<<<<<<<
 *                 CHKERR( KSPSetConvergenceTest(
 *                         self.ksp, KSPConvergedDefault,
 */
      __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPConvergedDefaultCreate((&__pyx_v_cctx))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(35, 240, __pyx_L1_error)

      /* "PETSc/KSP.pyx":241
 *             if normtype != KSP_NORM_NONE:
 *                 CHKERR( KSPConvergedDefaultCreate(&cctx) )
 *                 CHKERR( KSPSetConvergenceTest(             # <<<<<<<<<<<<<<
 *                         self.ksp, KSPConvergedDefault,
 *                         cctx, KSPConvergedDefaultDestroy) )
 */
      __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetConvergenceTest(__pyx_v_self->ksp, KSPConvergedDefault, __pyx_v_cctx, KSPConvergedDefaultDestroy)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(35, 241, __pyx_L1_error)

      /* "PETSc/KSP.pyx":239
 *         else:
 *             CHKERR( KSPGetNormType(self.ksp, &normtype) )
 *             if normtype != KSP_NORM_NONE:             # <<<<<<<<<<<<<<
 *                 CHKERR( KSPConvergedDefaultCreate(&cctx) )
 *                 CHKERR( KSPSetConvergenceTest(
 */
      goto __pyx_L6;
    }

    /* "PETSc/KSP.pyx":245
 *                         cctx, KSPConvergedDefaultDestroy) )
 *             else:
 *                 CHKERR( KSPSetConvergenceTest(             # <<<<<<<<<<<<<<
 *                         self.ksp, KSPConvergedSkip,
 *                         NULL, NULL) )
 */
    /*else*/ {

      /* "PETSc/KSP.pyx":247
 *                 CHKERR( KSPSetConvergenceTest(
 *                         self.ksp, KSPConvergedSkip,
 *                         NULL, NULL) )             # <<<<<<<<<<<<<<
 *             self.set_attr('__converged__', None)
 * 
 */
      __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetConvergenceTest(__pyx_v_self->ksp, KSPConvergedSkip, NULL, NULL)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(35, 245, __pyx_L1_error)
    }
    __pyx_L6:;

    /* "PETSc/KSP.pyx":248
 *                         self.ksp, KSPConvergedSkip,
 *                         NULL, NULL) )
 *             self.set_attr('__converged__', None)             # <<<<<<<<<<<<<<
 * 
 *     def getConvergenceTest(self):
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__converged__"), Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(35, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "PETSc/KSP.pyx":228
 *         return (toReal(crtol), toReal(catol), toReal(cdivtol), toInt(cmaxits))
 * 
 *     def setConvergenceTest(self, converged, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscKSPNormType normtype = KSP_NORM_NONE
 *         cdef void* cctx = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":250
 *             self.set_attr('__converged__', None)
 * 
 *     def getConvergenceTest(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__converged__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_49getConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_48getConvergenceTest[] = "KSP.getConvergenceTest(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_49getConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvergenceTest (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getConvergenceTest", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getConvergenceTest", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_48getConvergenceTest(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_48getConvergenceTest(struct PyPetscKSPObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getConvergenceTest", 0);

  /* "PETSc/KSP.pyx":251
 * 
 *     def getConvergenceTest(self):
 *         return self.get_attr('__converged__')             # <<<<<<<<<<<<<<
 * 
 *     def callConvergenceTest(self, its, rnorm):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__converged__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":250
 *             self.set_attr('__converged__', None)
 * 
 *     def getConvergenceTest(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__converged__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":253
 *         return self.get_attr('__converged__')
 * 
 *     def callConvergenceTest(self, its, rnorm):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = asInt(its)
 *         cdef PetscReal rval = asReal(rnorm)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_51callConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_50callConvergenceTest[] = "KSP.callConvergenceTest(self, its, rnorm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_51callConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_its = 0;
  PyObject *__pyx_v_rnorm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("callConvergenceTest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_its,&__pyx_n_s_rnorm,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_its)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rnorm)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("callConvergenceTest", 1, 2, 2, 1); __PYX_ERR(35, 253, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "callConvergenceTest") < 0)) __PYX_ERR(35, 253, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_its = values[0];
    __pyx_v_rnorm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("callConvergenceTest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 253, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.callConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_50callConvergenceTest(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_its, __pyx_v_rnorm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_50callConvergenceTest(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_its, PyObject *__pyx_v_rnorm) {
  PetscInt __pyx_v_ival;
  PetscReal __pyx_v_rval;
  KSPConvergedReason __pyx_v_reason;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscReal __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("callConvergenceTest", 0);

  /* "PETSc/KSP.pyx":254
 * 
 *     def callConvergenceTest(self, its, rnorm):
 *         cdef PetscInt  ival = asInt(its)             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(rnorm)
 *         cdef PetscKSPConvergedReason reason = KSP_CONVERGED_ITERATING
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_its); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(35, 254, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/KSP.pyx":255
 *     def callConvergenceTest(self, its, rnorm):
 *         cdef PetscInt  ival = asInt(its)
 *         cdef PetscReal rval = asReal(rnorm)             # <<<<<<<<<<<<<<
 *         cdef PetscKSPConvergedReason reason = KSP_CONVERGED_ITERATING
 *         CHKERR( KSPConvergenceTestCall(self.ksp, ival, rval, &reason) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_rnorm); if (unlikely(__pyx_t_2 == -1.0 && PyErr_Occurred())) __PYX_ERR(35, 255, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_2;

  /* "PETSc/KSP.pyx":256
 *         cdef PetscInt  ival = asInt(its)
 *         cdef PetscReal rval = asReal(rnorm)
 *         cdef PetscKSPConvergedReason reason = KSP_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *         CHKERR( KSPConvergenceTestCall(self.ksp, ival, rval, &reason) )
 *         return reason
 */
  __pyx_v_reason = KSP_CONVERGED_ITERATING;

  /* "PETSc/KSP.pyx":257
 *         cdef PetscReal rval = asReal(rnorm)
 *         cdef PetscKSPConvergedReason reason = KSP_CONVERGED_ITERATING
 *         CHKERR( KSPConvergenceTestCall(self.ksp, ival, rval, &reason) )             # <<<<<<<<<<<<<<
 *         return reason
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPConvergenceTestCall(__pyx_v_self->ksp, __pyx_v_ival, __pyx_v_rval, (&__pyx_v_reason))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(35, 257, __pyx_L1_error)

  /* "PETSc/KSP.pyx":258
 *         cdef PetscKSPConvergedReason reason = KSP_CONVERGED_ITERATING
 *         CHKERR( KSPConvergenceTestCall(self.ksp, ival, rval, &reason) )
 *         return reason             # <<<<<<<<<<<<<<
 * 
 *     def setConvergenceHistory(self, length=None, reset=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_From_KSPConvergedReason(__pyx_v_reason); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":253
 *         return self.get_attr('__converged__')
 * 
 *     def callConvergenceTest(self, its, rnorm):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = asInt(its)
 *         cdef PetscReal rval = asReal(rnorm)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.callConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":260
 *         return reason
 * 
 *     def setConvergenceHistory(self, length=None, reset=False):             # <<<<<<<<<<<<<<
 *         cdef PetscReal *data = NULL
 *         cdef PetscInt   size = 10000
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_53setConvergenceHistory(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_52setConvergenceHistory[] = "KSP.setConvergenceHistory(self, length=None, reset=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_53setConvergenceHistory(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_length = 0;
  PyObject *__pyx_v_reset = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvergenceHistory (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_length,&__pyx_n_s_reset,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_length);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reset);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConvergenceHistory") < 0)) __PYX_ERR(35, 260, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_length = values[0];
    __pyx_v_reset = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvergenceHistory", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 260, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setConvergenceHistory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_52setConvergenceHistory(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_length, __pyx_v_reset);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_52setConvergenceHistory(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_length, PyObject *__pyx_v_reset) {
  PetscReal *__pyx_v_data;
  PetscInt __pyx_v_size;
  PetscBool __pyx_v_flag;
  PyObject *__pyx_v_hist = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("setConvergenceHistory", 0);

  /* "PETSc/KSP.pyx":261
 * 
 *     def setConvergenceHistory(self, length=None, reset=False):
 *         cdef PetscReal *data = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt   size = 10000
 *         cdef PetscBool flag = PETSC_FALSE
 */
  __pyx_v_data = NULL;

  /* "PETSc/KSP.pyx":262
 *     def setConvergenceHistory(self, length=None, reset=False):
 *         cdef PetscReal *data = NULL
 *         cdef PetscInt   size = 10000             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         if   length is True:     pass
 */
  __pyx_v_size = 0x2710;

  /* "PETSc/KSP.pyx":263
 *         cdef PetscReal *data = NULL
 *         cdef PetscInt   size = 10000
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if   length is True:     pass
 *         elif length is not None: size = asInt(length)
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/KSP.pyx":264
 *         cdef PetscInt   size = 10000
 *         cdef PetscBool flag = PETSC_FALSE
 *         if   length is True:     pass             # <<<<<<<<<<<<<<
 *         elif length is not None: size = asInt(length)
 *         if size < 0: size = 10000
 */
  __pyx_t_1 = (__pyx_v_length == Py_True);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    goto __pyx_L3;
  }

  /* "PETSc/KSP.pyx":265
 *         cdef PetscBool flag = PETSC_FALSE
 *         if   length is True:     pass
 *         elif length is not None: size = asInt(length)             # <<<<<<<<<<<<<<
 *         if size < 0: size = 10000
 *         if reset: flag = PETSC_TRUE
 */
  __pyx_t_2 = (__pyx_v_length != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_length); if (unlikely(__pyx_t_3 == -1L && PyErr_Occurred())) __PYX_ERR(35, 265, __pyx_L1_error)
    __pyx_v_size = __pyx_t_3;
  }
  __pyx_L3:;

  /* "PETSc/KSP.pyx":266
 *         if   length is True:     pass
 *         elif length is not None: size = asInt(length)
 *         if size < 0: size = 10000             # <<<<<<<<<<<<<<
 *         if reset: flag = PETSC_TRUE
 *         cdef object hist = oarray_r(empty_r(size), NULL, &data)
 */
  __pyx_t_1 = ((__pyx_v_size < 0) != 0);
  if (__pyx_t_1) {
    __pyx_v_size = 0x2710;
  }

  /* "PETSc/KSP.pyx":267
 *         elif length is not None: size = asInt(length)
 *         if size < 0: size = 10000
 *         if reset: flag = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         cdef object hist = oarray_r(empty_r(size), NULL, &data)
 *         self.set_attr('__history__', hist)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reset); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(35, 267, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_v_flag = PETSC_TRUE;
  }

  /* "PETSc/KSP.pyx":268
 *         if size < 0: size = 10000
 *         if reset: flag = PETSC_TRUE
 *         cdef object hist = oarray_r(empty_r(size), NULL, &data)             # <<<<<<<<<<<<<<
 *         self.set_attr('__history__', hist)
 *         CHKERR( KSPSetResidualHistory(self.ksp, data, size, flag) )
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_r(__pyx_v_size)); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_r(__pyx_t_4, NULL, (&__pyx_v_data))); if (unlikely(!__pyx_t_5)) __PYX_ERR(35, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_hist = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "PETSc/KSP.pyx":269
 *         if reset: flag = PETSC_TRUE
 *         cdef object hist = oarray_r(empty_r(size), NULL, &data)
 *         self.set_attr('__history__', hist)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetResidualHistory(self.ksp, data, size, flag) )
 * 
 */
  __pyx_t_5 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__history__"), __pyx_v_hist); if (unlikely(!__pyx_t_5)) __PYX_ERR(35, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/KSP.pyx":270
 *         cdef object hist = oarray_r(empty_r(size), NULL, &data)
 *         self.set_attr('__history__', hist)
 *         CHKERR( KSPSetResidualHistory(self.ksp, data, size, flag) )             # <<<<<<<<<<<<<<
 * 
 *     def getConvergenceHistory(self):
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetResidualHistory(__pyx_v_self->ksp, __pyx_v_data, __pyx_v_size, __pyx_v_flag)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(35, 270, __pyx_L1_error)

  /* "PETSc/KSP.pyx":260
 *         return reason
 * 
 *     def setConvergenceHistory(self, length=None, reset=False):             # <<<<<<<<<<<<<<
 *         cdef PetscReal *data = NULL
 *         cdef PetscInt   size = 10000
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setConvergenceHistory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_hist);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":272
 *         CHKERR( KSPSetResidualHistory(self.ksp, data, size, flag) )
 * 
 *     def getConvergenceHistory(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal *data = NULL
 *         cdef PetscInt   size = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_55getConvergenceHistory(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_54getConvergenceHistory[] = "KSP.getConvergenceHistory(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_55getConvergenceHistory(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvergenceHistory (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getConvergenceHistory", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getConvergenceHistory", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_54getConvergenceHistory(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_54getConvergenceHistory(struct PyPetscKSPObject *__pyx_v_self) {
  PetscReal *__pyx_v_data;
  PetscInt __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvergenceHistory", 0);

  /* "PETSc/KSP.pyx":273
 * 
 *     def getConvergenceHistory(self):
 *         cdef PetscReal *data = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt   size = 0
 *         CHKERR( KSPGetResidualHistory(self.ksp, &data, &size) )
 */
  __pyx_v_data = NULL;

  /* "PETSc/KSP.pyx":274
 *     def getConvergenceHistory(self):
 *         cdef PetscReal *data = NULL
 *         cdef PetscInt   size = 0             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetResidualHistory(self.ksp, &data, &size) )
 *         return array_r(size, data)
 */
  __pyx_v_size = 0;

  /* "PETSc/KSP.pyx":275
 *         cdef PetscReal *data = NULL
 *         cdef PetscInt   size = 0
 *         CHKERR( KSPGetResidualHistory(self.ksp, &data, &size) )             # <<<<<<<<<<<<<<
 *         return array_r(size, data)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetResidualHistory(__pyx_v_self->ksp, (&__pyx_v_data), (&__pyx_v_size))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 275, __pyx_L1_error)

  /* "PETSc/KSP.pyx":276
 *         cdef PetscInt   size = 0
 *         CHKERR( KSPGetResidualHistory(self.ksp, &data, &size) )
 *         return array_r(size, data)             # <<<<<<<<<<<<<<
 * 
 *     def logConvergenceHistory(self, rnorm):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_r(__pyx_v_size, __pyx_v_data)); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":272
 *         CHKERR( KSPSetResidualHistory(self.ksp, data, size, flag) )
 * 
 *     def getConvergenceHistory(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal *data = NULL
 *         cdef PetscInt   size = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getConvergenceHistory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":278
 *         return array_r(size, data)
 * 
 *     def logConvergenceHistory(self, rnorm):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(rnorm)
 *         CHKERR( KSPLogResidualHistory(self.ksp, rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_57logConvergenceHistory(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_56logConvergenceHistory[] = "KSP.logConvergenceHistory(self, rnorm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_57logConvergenceHistory(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnorm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("logConvergenceHistory (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnorm,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);
        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_rnorm)) != 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, "logConvergenceHistory") < 0)) __PYX_ERR(35, 278, __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_rnorm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("logConvergenceHistory", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 278, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.logConvergenceHistory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_56logConvergenceHistory(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_rnorm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_56logConvergenceHistory(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_rnorm) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("logConvergenceHistory", 0);

  /* "PETSc/KSP.pyx":279
 * 
 *     def logConvergenceHistory(self, rnorm):
 *         cdef PetscReal rval = asReal(rnorm)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPLogResidualHistory(self.ksp, rval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_rnorm); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(35, 279, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/KSP.pyx":280
 *     def logConvergenceHistory(self, rnorm):
 *         cdef PetscReal rval = asReal(rnorm)
 *         CHKERR( KSPLogResidualHistory(self.ksp, rval) )             # <<<<<<<<<<<<<<
 * 
 *     # --- monitoring ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPLogResidualHistory(__pyx_v_self->ksp, __pyx_v_rval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 280, __pyx_L1_error)

  /* "PETSc/KSP.pyx":278
 *         return array_r(size, data)
 * 
 *     def logConvergenceHistory(self, rnorm):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(rnorm)
 *         CHKERR( KSPLogResidualHistory(self.ksp, rval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.logConvergenceHistory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":284
 *     # --- monitoring ---
 * 
 *     def setMonitor(self, monitor, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_59setMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_58setMonitor[] = "KSP.setMonitor(self, monitor, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_59setMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_monitor = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMonitor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_monitor,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_monitor)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMonitor") < 0)) __PYX_ERR(35, 284, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_monitor = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMonitor", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 284, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_58setMonitor(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_monitor, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_58setMonitor(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_monitor, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_monitorlist = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setMonitor", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/KSP.pyx":285
 * 
 *     def setMonitor(self, monitor, args=None, kargs=None):
 *         if monitor is None: return             # <<<<<<<<<<<<<<
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:
 */
  __pyx_t_1 = (__pyx_v_monitor == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "PETSc/KSP.pyx":286
 *     def setMonitor(self, monitor, args=None, kargs=None):
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')             # <<<<<<<<<<<<<<
 *         if monitorlist is None:
 *             monitorlist = []
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__")); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_monitorlist = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":287
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:             # <<<<<<<<<<<<<<
 *             monitorlist = []
 *             self.set_attr('__monitor__', monitorlist)
 */
  __pyx_t_2 = (__pyx_v_monitorlist == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/KSP.pyx":288
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:
 *             monitorlist = []             # <<<<<<<<<<<<<<
 *             self.set_attr('__monitor__', monitorlist)
 *             CHKERR( KSPMonitorSet(self.ksp, KSP_Monitor, NULL, NULL) )
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_monitorlist, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/KSP.pyx":289
 *         if monitorlist is None:
 *             monitorlist = []
 *             self.set_attr('__monitor__', monitorlist)             # <<<<<<<<<<<<<<
 *             CHKERR( KSPMonitorSet(self.ksp, KSP_Monitor, NULL, NULL) )
 *         if args is None: args = ()
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__"), __pyx_v_monitorlist); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/KSP.pyx":290
 *             monitorlist = []
 *             self.set_attr('__monitor__', monitorlist)
 *             CHKERR( KSPMonitorSet(self.ksp, KSP_Monitor, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPMonitorSet(__pyx_v_self->ksp, __pyx_f_8petsc4py_5PETSc_KSP_Monitor, NULL, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(35, 290, __pyx_L1_error)

    /* "PETSc/KSP.pyx":287
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:             # <<<<<<<<<<<<<<
 *             monitorlist = []
 *             self.set_attr('__monitor__', monitorlist)
 */
  }

  /* "PETSc/KSP.pyx":291
 *             self.set_attr('__monitor__', monitorlist)
 *             CHKERR( KSPMonitorSet(self.ksp, KSP_Monitor, NULL, NULL) )
 *         if args is None: args = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         monitorlist.append((monitor, args, kargs))
 */
  __pyx_t_1 = (__pyx_v_args == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/KSP.pyx":292
 *             CHKERR( KSPMonitorSet(self.ksp, KSP_Monitor, NULL, NULL) )
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         monitorlist.append((monitor, args, kargs))
 * 
 */
  __pyx_t_2 = (__pyx_v_kargs == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "PETSc/KSP.pyx":293
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 *         monitorlist.append((monitor, args, kargs))             # <<<<<<<<<<<<<<
 * 
 *     def getMonitor(self):
 */
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_monitor);
  __Pyx_GIVEREF(__pyx_v_monitor);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_monitor);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
  __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_monitorlist, __pyx_t_3); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(35, 293, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":284
 *     # --- monitoring ---
 * 
 *     def setMonitor(self, monitor, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_monitorlist);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":295
 *         monitorlist.append((monitor, args, kargs))
 * 
 *     def getMonitor(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__monitor__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_61getMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_60getMonitor[] = "KSP.getMonitor(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_61getMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMonitor (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMonitor", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMonitor", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_60getMonitor(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_60getMonitor(struct PyPetscKSPObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getMonitor", 0);

  /* "PETSc/KSP.pyx":296
 * 
 *     def getMonitor(self):
 *         return self.get_attr('__monitor__')             # <<<<<<<<<<<<<<
 * 
 *     def cancelMonitor(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":295
 *         monitorlist.append((monitor, args, kargs))
 * 
 *     def getMonitor(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__monitor__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":298
 *         return self.get_attr('__monitor__')
 * 
 *     def cancelMonitor(self):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPMonitorCancel(self.ksp) )
 *         self.set_attr('__monitor__', None)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_63cancelMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_62cancelMonitor[] = "KSP.cancelMonitor(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_63cancelMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cancelMonitor (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("cancelMonitor", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "cancelMonitor", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_62cancelMonitor(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_62cancelMonitor(struct PyPetscKSPObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("cancelMonitor", 0);

  /* "PETSc/KSP.pyx":299
 * 
 *     def cancelMonitor(self):
 *         CHKERR( KSPMonitorCancel(self.ksp) )             # <<<<<<<<<<<<<<
 *         self.set_attr('__monitor__', None)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPMonitorCancel(__pyx_v_self->ksp)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 299, __pyx_L1_error)

  /* "PETSc/KSP.pyx":300
 *     def cancelMonitor(self):
 *         CHKERR( KSPMonitorCancel(self.ksp) )
 *         self.set_attr('__monitor__', None)             # <<<<<<<<<<<<<<
 * 
 *     def monitor(self, its, rnorm):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_KSP *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__"), Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/KSP.pyx":298
 *         return self.get_attr('__monitor__')
 * 
 *     def cancelMonitor(self):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPMonitorCancel(self.ksp) )
 *         self.set_attr('__monitor__', None)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.cancelMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":302
 *         self.set_attr('__monitor__', None)
 * 
 *     def monitor(self, its, rnorm):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = asInt(its)
 *         cdef PetscReal rval = asReal(rnorm)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_65monitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_64monitor[] = "KSP.monitor(self, its, rnorm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_65monitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_its = 0;
  PyObject *__pyx_v_rnorm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("monitor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_its,&__pyx_n_s_rnorm,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_its)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rnorm)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("monitor", 1, 2, 2, 1); __PYX_ERR(35, 302, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "monitor") < 0)) __PYX_ERR(35, 302, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_its = values[0];
    __pyx_v_rnorm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("monitor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 302, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_64monitor(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_its, __pyx_v_rnorm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_64monitor(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_its, PyObject *__pyx_v_rnorm) {
  PetscInt __pyx_v_ival;
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscReal __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("monitor", 0);

  /* "PETSc/KSP.pyx":303
 * 
 *     def monitor(self, its, rnorm):
 *         cdef PetscInt  ival = asInt(its)             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(rnorm)
 *         CHKERR( KSPMonitor(self.ksp, ival, rval) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_its); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(35, 303, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/KSP.pyx":304
 *     def monitor(self, its, rnorm):
 *         cdef PetscInt  ival = asInt(its)
 *         cdef PetscReal rval = asReal(rnorm)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPMonitor(self.ksp, ival, rval) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_rnorm); if (unlikely(__pyx_t_2 == -1.0 && PyErr_Occurred())) __PYX_ERR(35, 304, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_2;

  /* "PETSc/KSP.pyx":305
 *         cdef PetscInt  ival = asInt(its)
 *         cdef PetscReal rval = asReal(rnorm)
 *         CHKERR( KSPMonitor(self.ksp, ival, rval) )             # <<<<<<<<<<<<<<
 * 
 *     # --- customization ---
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPMonitor(__pyx_v_self->ksp, __pyx_v_ival, __pyx_v_rval)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(35, 305, __pyx_L1_error)

  /* "PETSc/KSP.pyx":302
 *         self.set_attr('__monitor__', None)
 * 
 *     def monitor(self, its, rnorm):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = asInt(its)
 *         cdef PetscReal rval = asReal(rnorm)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":309
 *     # --- customization ---
 * 
 *     def setPCSide(self, side):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetPCSide(self.ksp, side) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_67setPCSide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_66setPCSide[] = "KSP.setPCSide(self, side)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_67setPCSide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_side = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPCSide (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_side,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);
        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_side)) != 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, "setPCSide") < 0)) __PYX_ERR(35, 309, __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_side = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPCSide", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 309, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setPCSide", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_66setPCSide(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_side);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_66setPCSide(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_side) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PCSide __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setPCSide", 0);

  /* "PETSc/KSP.pyx":310
 * 
 *     def setPCSide(self, side):
 *         CHKERR( KSPSetPCSide(self.ksp, side) )             # <<<<<<<<<<<<<<
 * 
 *     def getPCSide(self):
 */
  __pyx_t_1 = ((PCSide)__Pyx_PyInt_As_PCSide(__pyx_v_side)); if (unlikely(PyErr_Occurred())) __PYX_ERR(35, 310, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetPCSide(__pyx_v_self->ksp, __pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 310, __pyx_L1_error)

  /* "PETSc/KSP.pyx":309
 *     # --- customization ---
 * 
 *     def setPCSide(self, side):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetPCSide(self.ksp, side) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setPCSide", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":312
 *         CHKERR( KSPSetPCSide(self.ksp, side) )
 * 
 *     def getPCSide(self):             # <<<<<<<<<<<<<<
 *         cdef PetscPCSide side = PC_LEFT
 *         CHKERR( KSPGetPCSide(self.ksp, &side) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_69getPCSide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_68getPCSide[] = "KSP.getPCSide(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_69getPCSide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPCSide (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getPCSide", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getPCSide", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_68getPCSide(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_68getPCSide(struct PyPetscKSPObject *__pyx_v_self) {
  PCSide __pyx_v_side;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getPCSide", 0);

  /* "PETSc/KSP.pyx":313
 * 
 *     def getPCSide(self):
 *         cdef PetscPCSide side = PC_LEFT             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetPCSide(self.ksp, &side) )
 *         return side
 */
  __pyx_v_side = PC_LEFT;

  /* "PETSc/KSP.pyx":314
 *     def getPCSide(self):
 *         cdef PetscPCSide side = PC_LEFT
 *         CHKERR( KSPGetPCSide(self.ksp, &side) )             # <<<<<<<<<<<<<<
 *         return side
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetPCSide(__pyx_v_self->ksp, (&__pyx_v_side))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 314, __pyx_L1_error)

  /* "PETSc/KSP.pyx":315
 *         cdef PetscPCSide side = PC_LEFT
 *         CHKERR( KSPGetPCSide(self.ksp, &side) )
 *         return side             # <<<<<<<<<<<<<<
 * 
 *     def setNormType(self, normtype):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PCSide(__pyx_v_side); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":312
 *         CHKERR( KSPSetPCSide(self.ksp, side) )
 * 
 *     def getPCSide(self):             # <<<<<<<<<<<<<<
 *         cdef PetscPCSide side = PC_LEFT
 *         CHKERR( KSPGetPCSide(self.ksp, &side) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getPCSide", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":317
 *         return side
 * 
 *     def setNormType(self, normtype):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetNormType(self.ksp, normtype) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_71setNormType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_70setNormType[] = "KSP.setNormType(self, normtype)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_71setNormType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_normtype = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setNormType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_normtype,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);
        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_normtype)) != 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, "setNormType") < 0)) __PYX_ERR(35, 317, __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_normtype = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setNormType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 317, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setNormType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_70setNormType(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_normtype);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_70setNormType(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_normtype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  KSPNormType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setNormType", 0);

  /* "PETSc/KSP.pyx":318
 * 
 *     def setNormType(self, normtype):
 *         CHKERR( KSPSetNormType(self.ksp, normtype) )             # <<<<<<<<<<<<<<
 * 
 *     def getNormType(self):
 */
  __pyx_t_1 = ((KSPNormType)__Pyx_PyInt_As_KSPNormType(__pyx_v_normtype)); if (unlikely(PyErr_Occurred())) __PYX_ERR(35, 318, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetNormType(__pyx_v_self->ksp, __pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 318, __pyx_L1_error)

  /* "PETSc/KSP.pyx":317
 *         return side
 * 
 *     def setNormType(self, normtype):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetNormType(self.ksp, normtype) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setNormType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":320
 *         CHKERR( KSPSetNormType(self.ksp, normtype) )
 * 
 *     def getNormType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscKSPNormType normtype = KSP_NORM_NONE
 *         CHKERR( KSPGetNormType(self.ksp, &normtype) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_73getNormType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_72getNormType[] = "KSP.getNormType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_73getNormType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getNormType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getNormType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getNormType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_72getNormType(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_72getNormType(struct PyPetscKSPObject *__pyx_v_self) {
  KSPNormType __pyx_v_normtype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getNormType", 0);

  /* "PETSc/KSP.pyx":321
 * 
 *     def getNormType(self):
 *         cdef PetscKSPNormType normtype = KSP_NORM_NONE             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetNormType(self.ksp, &normtype) )
 *         return normtype
 */
  __pyx_v_normtype = KSP_NORM_NONE;

  /* "PETSc/KSP.pyx":322
 *     def getNormType(self):
 *         cdef PetscKSPNormType normtype = KSP_NORM_NONE
 *         CHKERR( KSPGetNormType(self.ksp, &normtype) )             # <<<<<<<<<<<<<<
 *         return normtype
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetNormType(__pyx_v_self->ksp, (&__pyx_v_normtype))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 322, __pyx_L1_error)

  /* "PETSc/KSP.pyx":323
 *         cdef PetscKSPNormType normtype = KSP_NORM_NONE
 *         CHKERR( KSPGetNormType(self.ksp, &normtype) )
 *         return normtype             # <<<<<<<<<<<<<<
 * 
 *     def setComputeEigenvalues(self, bint flag):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_KSPNormType(__pyx_v_normtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":320
 *         CHKERR( KSPSetNormType(self.ksp, normtype) )
 * 
 *     def getNormType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscKSPNormType normtype = KSP_NORM_NONE
 *         CHKERR( KSPGetNormType(self.ksp, &normtype) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getNormType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":325
 *         return normtype
 * 
 *     def setComputeEigenvalues(self, bint flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool compute = PETSC_FALSE
 *         if flag: compute = PETSC_TRUE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_75setComputeEigenvalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_74setComputeEigenvalues[] = "KSP.setComputeEigenvalues(self, bool flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_75setComputeEigenvalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setComputeEigenvalues (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setComputeEigenvalues") < 0)) __PYX_ERR(35, 325, __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_flag = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_flag == (int)-1) && PyErr_Occurred())) __PYX_ERR(35, 325, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setComputeEigenvalues", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 325, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setComputeEigenvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_74setComputeEigenvalues(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_74setComputeEigenvalues(struct PyPetscKSPObject *__pyx_v_self, int __pyx_v_flag) {
  PetscBool __pyx_v_compute;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setComputeEigenvalues", 0);

  /* "PETSc/KSP.pyx":326
 * 
 *     def setComputeEigenvalues(self, bint flag):
 *         cdef PetscBool compute = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if flag: compute = PETSC_TRUE
 *         CHKERR( KSPSetComputeEigenvalues(self.ksp, compute) )
 */
  __pyx_v_compute = PETSC_FALSE;

  /* "PETSc/KSP.pyx":327
 *     def setComputeEigenvalues(self, bint flag):
 *         cdef PetscBool compute = PETSC_FALSE
 *         if flag: compute = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetComputeEigenvalues(self.ksp, compute) )
 * 
 */
  __pyx_t_1 = (__pyx_v_flag != 0);
  if (__pyx_t_1) {
    __pyx_v_compute = PETSC_TRUE;
  }

  /* "PETSc/KSP.pyx":328
 *         cdef PetscBool compute = PETSC_FALSE
 *         if flag: compute = PETSC_TRUE
 *         CHKERR( KSPSetComputeEigenvalues(self.ksp, compute) )             # <<<<<<<<<<<<<<
 * 
 *     def getComputeEigenvalues(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetComputeEigenvalues(__pyx_v_self->ksp, __pyx_v_compute)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 328, __pyx_L1_error)

  /* "PETSc/KSP.pyx":325
 *         return normtype
 * 
 *     def setComputeEigenvalues(self, bint flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool compute = PETSC_FALSE
 *         if flag: compute = PETSC_TRUE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setComputeEigenvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":330
 *         CHKERR( KSPSetComputeEigenvalues(self.ksp, compute) )
 * 
 *     def getComputeEigenvalues(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool compute = PETSC_FALSE
 *         CHKERR( KSPGetComputeEigenvalues(self.ksp, &compute) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_77getComputeEigenvalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_76getComputeEigenvalues[] = "KSP.getComputeEigenvalues(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_77getComputeEigenvalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getComputeEigenvalues (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getComputeEigenvalues", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getComputeEigenvalues", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_76getComputeEigenvalues(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_76getComputeEigenvalues(struct PyPetscKSPObject *__pyx_v_self) {
  PetscBool __pyx_v_compute;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getComputeEigenvalues", 0);

  /* "PETSc/KSP.pyx":331
 * 
 *     def getComputeEigenvalues(self):
 *         cdef PetscBool compute = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetComputeEigenvalues(self.ksp, &compute) )
 *         return <bint>compute
 */
  __pyx_v_compute = PETSC_FALSE;

  /* "PETSc/KSP.pyx":332
 *     def getComputeEigenvalues(self):
 *         cdef PetscBool compute = PETSC_FALSE
 *         CHKERR( KSPGetComputeEigenvalues(self.ksp, &compute) )             # <<<<<<<<<<<<<<
 *         return <bint>compute
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetComputeEigenvalues(__pyx_v_self->ksp, (&__pyx_v_compute))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 332, __pyx_L1_error)

  /* "PETSc/KSP.pyx":333
 *         cdef PetscBool compute = PETSC_FALSE
 *         CHKERR( KSPGetComputeEigenvalues(self.ksp, &compute) )
 *         return <bint>compute             # <<<<<<<<<<<<<<
 * 
 *     def setComputeSingularValues(self, bint flag):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_compute); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":330
 *         CHKERR( KSPSetComputeEigenvalues(self.ksp, compute) )
 * 
 *     def getComputeEigenvalues(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool compute = PETSC_FALSE
 *         CHKERR( KSPGetComputeEigenvalues(self.ksp, &compute) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getComputeEigenvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":335
 *         return <bint>compute
 * 
 *     def setComputeSingularValues(self, bint flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool compute = PETSC_FALSE
 *         if flag: compute = PETSC_TRUE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_79setComputeSingularValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_78setComputeSingularValues[] = "KSP.setComputeSingularValues(self, bool flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_79setComputeSingularValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setComputeSingularValues (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setComputeSingularValues") < 0)) __PYX_ERR(35, 335, __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_flag = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_flag == (int)-1) && PyErr_Occurred())) __PYX_ERR(35, 335, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setComputeSingularValues", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 335, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setComputeSingularValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_78setComputeSingularValues(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_78setComputeSingularValues(struct PyPetscKSPObject *__pyx_v_self, int __pyx_v_flag) {
  PetscBool __pyx_v_compute;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setComputeSingularValues", 0);

  /* "PETSc/KSP.pyx":336
 * 
 *     def setComputeSingularValues(self, bint flag):
 *         cdef PetscBool compute = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if flag: compute = PETSC_TRUE
 *         CHKERR( KSPSetComputeSingularValues(self.ksp, compute) )
 */
  __pyx_v_compute = PETSC_FALSE;

  /* "PETSc/KSP.pyx":337
 *     def setComputeSingularValues(self, bint flag):
 *         cdef PetscBool compute = PETSC_FALSE
 *         if flag: compute = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetComputeSingularValues(self.ksp, compute) )
 * 
 */
  __pyx_t_1 = (__pyx_v_flag != 0);
  if (__pyx_t_1) {
    __pyx_v_compute = PETSC_TRUE;
  }

  /* "PETSc/KSP.pyx":338
 *         cdef PetscBool compute = PETSC_FALSE
 *         if flag: compute = PETSC_TRUE
 *         CHKERR( KSPSetComputeSingularValues(self.ksp, compute) )             # <<<<<<<<<<<<<<
 * 
 *     def getComputeSingularValues(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetComputeSingularValues(__pyx_v_self->ksp, __pyx_v_compute)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 338, __pyx_L1_error)

  /* "PETSc/KSP.pyx":335
 *         return <bint>compute
 * 
 *     def setComputeSingularValues(self, bint flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool compute = PETSC_FALSE
 *         if flag: compute = PETSC_TRUE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setComputeSingularValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":340
 *         CHKERR( KSPSetComputeSingularValues(self.ksp, compute) )
 * 
 *     def getComputeSingularValues(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool compute = PETSC_FALSE
 *         CHKERR( KSPGetComputeSingularValues(self.ksp, &compute) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_81getComputeSingularValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_80getComputeSingularValues[] = "KSP.getComputeSingularValues(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_81getComputeSingularValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getComputeSingularValues (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getComputeSingularValues", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getComputeSingularValues", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_80getComputeSingularValues(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_80getComputeSingularValues(struct PyPetscKSPObject *__pyx_v_self) {
  PetscBool __pyx_v_compute;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getComputeSingularValues", 0);

  /* "PETSc/KSP.pyx":341
 * 
 *     def getComputeSingularValues(self):
 *         cdef PetscBool compute = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetComputeSingularValues(self.ksp, &compute) )
 *         return <bint>compute
 */
  __pyx_v_compute = PETSC_FALSE;

  /* "PETSc/KSP.pyx":342
 *     def getComputeSingularValues(self):
 *         cdef PetscBool compute = PETSC_FALSE
 *         CHKERR( KSPGetComputeSingularValues(self.ksp, &compute) )             # <<<<<<<<<<<<<<
 *         return <bint>compute
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetComputeSingularValues(__pyx_v_self->ksp, (&__pyx_v_compute))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 342, __pyx_L1_error)

  /* "PETSc/KSP.pyx":343
 *         cdef PetscBool compute = PETSC_FALSE
 *         CHKERR( KSPGetComputeSingularValues(self.ksp, &compute) )
 *         return <bint>compute             # <<<<<<<<<<<<<<
 * 
 *     # --- initial guess ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_compute); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":340
 *         CHKERR( KSPSetComputeSingularValues(self.ksp, compute) )
 * 
 *     def getComputeSingularValues(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool compute = PETSC_FALSE
 *         CHKERR( KSPGetComputeSingularValues(self.ksp, &compute) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getComputeSingularValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":347
 *     # --- initial guess ---
 * 
 *     def setInitialGuessNonzero(self, bint flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool guess_nonzero = PETSC_FALSE
 *         if flag: guess_nonzero = PETSC_TRUE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_83setInitialGuessNonzero(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_82setInitialGuessNonzero[] = "KSP.setInitialGuessNonzero(self, bool flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_83setInitialGuessNonzero(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setInitialGuessNonzero (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setInitialGuessNonzero") < 0)) __PYX_ERR(35, 347, __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_flag = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_flag == (int)-1) && PyErr_Occurred())) __PYX_ERR(35, 347, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setInitialGuessNonzero", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 347, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setInitialGuessNonzero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_82setInitialGuessNonzero(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_82setInitialGuessNonzero(struct PyPetscKSPObject *__pyx_v_self, int __pyx_v_flag) {
  PetscBool __pyx_v_guess_nonzero;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setInitialGuessNonzero", 0);

  /* "PETSc/KSP.pyx":348
 * 
 *     def setInitialGuessNonzero(self, bint flag):
 *         cdef PetscBool guess_nonzero = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if flag: guess_nonzero = PETSC_TRUE
 *         CHKERR( KSPSetInitialGuessNonzero(self.ksp, guess_nonzero) )
 */
  __pyx_v_guess_nonzero = PETSC_FALSE;

  /* "PETSc/KSP.pyx":349
 *     def setInitialGuessNonzero(self, bint flag):
 *         cdef PetscBool guess_nonzero = PETSC_FALSE
 *         if flag: guess_nonzero = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetInitialGuessNonzero(self.ksp, guess_nonzero) )
 * 
 */
  __pyx_t_1 = (__pyx_v_flag != 0);
  if (__pyx_t_1) {
    __pyx_v_guess_nonzero = PETSC_TRUE;
  }

  /* "PETSc/KSP.pyx":350
 *         cdef PetscBool guess_nonzero = PETSC_FALSE
 *         if flag: guess_nonzero = PETSC_TRUE
 *         CHKERR( KSPSetInitialGuessNonzero(self.ksp, guess_nonzero) )             # <<<<<<<<<<<<<<
 * 
 *     def getInitialGuessNonzero(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetInitialGuessNonzero(__pyx_v_self->ksp, __pyx_v_guess_nonzero)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 350, __pyx_L1_error)

  /* "PETSc/KSP.pyx":347
 *     # --- initial guess ---
 * 
 *     def setInitialGuessNonzero(self, bint flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool guess_nonzero = PETSC_FALSE
 *         if flag: guess_nonzero = PETSC_TRUE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setInitialGuessNonzero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":352
 *         CHKERR( KSPSetInitialGuessNonzero(self.ksp, guess_nonzero) )
 * 
 *     def getInitialGuessNonzero(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool guess_nonzero = PETSC_FALSE
 *         CHKERR( KSPGetInitialGuessNonzero(self.ksp, &guess_nonzero) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_85getInitialGuessNonzero(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_84getInitialGuessNonzero[] = "KSP.getInitialGuessNonzero(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_85getInitialGuessNonzero(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getInitialGuessNonzero (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getInitialGuessNonzero", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getInitialGuessNonzero", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_84getInitialGuessNonzero(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_84getInitialGuessNonzero(struct PyPetscKSPObject *__pyx_v_self) {
  PetscBool __pyx_v_guess_nonzero;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getInitialGuessNonzero", 0);

  /* "PETSc/KSP.pyx":353
 * 
 *     def getInitialGuessNonzero(self):
 *         cdef PetscBool guess_nonzero = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetInitialGuessNonzero(self.ksp, &guess_nonzero) )
 *         return <bint>guess_nonzero
 */
  __pyx_v_guess_nonzero = PETSC_FALSE;

  /* "PETSc/KSP.pyx":354
 *     def getInitialGuessNonzero(self):
 *         cdef PetscBool guess_nonzero = PETSC_FALSE
 *         CHKERR( KSPGetInitialGuessNonzero(self.ksp, &guess_nonzero) )             # <<<<<<<<<<<<<<
 *         return <bint>guess_nonzero
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetInitialGuessNonzero(__pyx_v_self->ksp, (&__pyx_v_guess_nonzero))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 354, __pyx_L1_error)

  /* "PETSc/KSP.pyx":355
 *         cdef PetscBool guess_nonzero = PETSC_FALSE
 *         CHKERR( KSPGetInitialGuessNonzero(self.ksp, &guess_nonzero) )
 *         return <bint>guess_nonzero             # <<<<<<<<<<<<<<
 * 
 *     def setInitialGuessKnoll(self, bint flag):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_guess_nonzero); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":352
 *         CHKERR( KSPSetInitialGuessNonzero(self.ksp, guess_nonzero) )
 * 
 *     def getInitialGuessNonzero(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool guess_nonzero = PETSC_FALSE
 *         CHKERR( KSPGetInitialGuessNonzero(self.ksp, &guess_nonzero) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getInitialGuessNonzero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":357
 *         return <bint>guess_nonzero
 * 
 *     def setInitialGuessKnoll(self, bint flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool guess_knoll = PETSC_FALSE
 *         if flag: guess_knoll = PETSC_TRUE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_87setInitialGuessKnoll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_86setInitialGuessKnoll[] = "KSP.setInitialGuessKnoll(self, bool flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_87setInitialGuessKnoll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setInitialGuessKnoll (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setInitialGuessKnoll") < 0)) __PYX_ERR(35, 357, __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_flag = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_flag == (int)-1) && PyErr_Occurred())) __PYX_ERR(35, 357, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setInitialGuessKnoll", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 357, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setInitialGuessKnoll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_86setInitialGuessKnoll(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_86setInitialGuessKnoll(struct PyPetscKSPObject *__pyx_v_self, int __pyx_v_flag) {
  PetscBool __pyx_v_guess_knoll;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setInitialGuessKnoll", 0);

  /* "PETSc/KSP.pyx":358
 * 
 *     def setInitialGuessKnoll(self, bint flag):
 *         cdef PetscBool guess_knoll = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if flag: guess_knoll = PETSC_TRUE
 *         CHKERR( KSPSetInitialGuessKnoll(self.ksp, guess_knoll) )
 */
  __pyx_v_guess_knoll = PETSC_FALSE;

  /* "PETSc/KSP.pyx":359
 *     def setInitialGuessKnoll(self, bint flag):
 *         cdef PetscBool guess_knoll = PETSC_FALSE
 *         if flag: guess_knoll = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetInitialGuessKnoll(self.ksp, guess_knoll) )
 * 
 */
  __pyx_t_1 = (__pyx_v_flag != 0);
  if (__pyx_t_1) {
    __pyx_v_guess_knoll = PETSC_TRUE;
  }

  /* "PETSc/KSP.pyx":360
 *         cdef PetscBool guess_knoll = PETSC_FALSE
 *         if flag: guess_knoll = PETSC_TRUE
 *         CHKERR( KSPSetInitialGuessKnoll(self.ksp, guess_knoll) )             # <<<<<<<<<<<<<<
 * 
 *     def getInitialGuessKnoll(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetInitialGuessKnoll(__pyx_v_self->ksp, __pyx_v_guess_knoll)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 360, __pyx_L1_error)

  /* "PETSc/KSP.pyx":357
 *         return <bint>guess_nonzero
 * 
 *     def setInitialGuessKnoll(self, bint flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool guess_knoll = PETSC_FALSE
 *         if flag: guess_knoll = PETSC_TRUE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setInitialGuessKnoll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":362
 *         CHKERR( KSPSetInitialGuessKnoll(self.ksp, guess_knoll) )
 * 
 *     def getInitialGuessKnoll(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool guess_knoll = PETSC_FALSE
 *         CHKERR( KSPGetInitialGuessKnoll(self.ksp, &guess_knoll) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_89getInitialGuessKnoll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_88getInitialGuessKnoll[] = "KSP.getInitialGuessKnoll(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_89getInitialGuessKnoll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getInitialGuessKnoll (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getInitialGuessKnoll", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getInitialGuessKnoll", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_88getInitialGuessKnoll(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_88getInitialGuessKnoll(struct PyPetscKSPObject *__pyx_v_self) {
  PetscBool __pyx_v_guess_knoll;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getInitialGuessKnoll", 0);

  /* "PETSc/KSP.pyx":363
 * 
 *     def getInitialGuessKnoll(self):
 *         cdef PetscBool guess_knoll = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetInitialGuessKnoll(self.ksp, &guess_knoll) )
 *         return <bint>guess_knoll
 */
  __pyx_v_guess_knoll = PETSC_FALSE;

  /* "PETSc/KSP.pyx":364
 *     def getInitialGuessKnoll(self):
 *         cdef PetscBool guess_knoll = PETSC_FALSE
 *         CHKERR( KSPGetInitialGuessKnoll(self.ksp, &guess_knoll) )             # <<<<<<<<<<<<<<
 *         return <bint>guess_knoll
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetInitialGuessKnoll(__pyx_v_self->ksp, (&__pyx_v_guess_knoll))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 364, __pyx_L1_error)

  /* "PETSc/KSP.pyx":365
 *         cdef PetscBool guess_knoll = PETSC_FALSE
 *         CHKERR( KSPGetInitialGuessKnoll(self.ksp, &guess_knoll) )
 *         return <bint>guess_knoll             # <<<<<<<<<<<<<<
 * 
 *     def setUseFischerGuess(self, model, size):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_guess_knoll); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":362
 *         CHKERR( KSPSetInitialGuessKnoll(self.ksp, guess_knoll) )
 * 
 *     def getInitialGuessKnoll(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool guess_knoll = PETSC_FALSE
 *         CHKERR( KSPGetInitialGuessKnoll(self.ksp, &guess_knoll) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getInitialGuessKnoll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":367
 *         return <bint>guess_knoll
 * 
 *     def setUseFischerGuess(self, model, size):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival1 = asInt(model)
 *         cdef PetscInt ival2 = asInt(size)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_91setUseFischerGuess(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_90setUseFischerGuess[] = "KSP.setUseFischerGuess(self, model, size)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_91setUseFischerGuess(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_model = 0;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUseFischerGuess (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_model,&__pyx_n_s_size,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_model)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setUseFischerGuess", 1, 2, 2, 1); __PYX_ERR(35, 367, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setUseFischerGuess") < 0)) __PYX_ERR(35, 367, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_model = values[0];
    __pyx_v_size = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setUseFischerGuess", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 367, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setUseFischerGuess", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_90setUseFischerGuess(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_model, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_90setUseFischerGuess(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_model, PyObject *__pyx_v_size) {
  PetscInt __pyx_v_ival1;
  PetscInt __pyx_v_ival2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setUseFischerGuess", 0);

  /* "PETSc/KSP.pyx":368
 * 
 *     def setUseFischerGuess(self, model, size):
 *         cdef PetscInt ival1 = asInt(model)             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival2 = asInt(size)
 *         CHKERR( KSPSetUseFischerGuess(self.ksp, ival1, ival2) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_model); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(35, 368, __pyx_L1_error)
  __pyx_v_ival1 = __pyx_t_1;

  /* "PETSc/KSP.pyx":369
 *     def setUseFischerGuess(self, model, size):
 *         cdef PetscInt ival1 = asInt(model)
 *         cdef PetscInt ival2 = asInt(size)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetUseFischerGuess(self.ksp, ival1, ival2) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_size); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(35, 369, __pyx_L1_error)
  __pyx_v_ival2 = __pyx_t_1;

  /* "PETSc/KSP.pyx":370
 *         cdef PetscInt ival1 = asInt(model)
 *         cdef PetscInt ival2 = asInt(size)
 *         CHKERR( KSPSetUseFischerGuess(self.ksp, ival1, ival2) )             # <<<<<<<<<<<<<<
 * 
 *     # --- solving ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetUseFischerGuess(__pyx_v_self->ksp, __pyx_v_ival1, __pyx_v_ival2)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 370, __pyx_L1_error)

  /* "PETSc/KSP.pyx":367
 *         return <bint>guess_knoll
 * 
 *     def setUseFischerGuess(self, model, size):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival1 = asInt(model)
 *         cdef PetscInt ival2 = asInt(size)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setUseFischerGuess", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":374
 *     # --- solving ---
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetUp(self.ksp) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_93setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_92setUp[] = "KSP.setUp(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_93setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUp (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUp", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUp", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_92setUp(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_92setUp(struct PyPetscKSPObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUp", 0);

  /* "PETSc/KSP.pyx":375
 * 
 *     def setUp(self):
 *         CHKERR( KSPSetUp(self.ksp) )             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetUp(__pyx_v_self->ksp)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 375, __pyx_L1_error)

  /* "PETSc/KSP.pyx":374
 *     # --- solving ---
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetUp(self.ksp) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":377
 *         CHKERR( KSPSetUp(self.ksp) )
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPReset(self.ksp) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_95reset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_94reset[] = "KSP.reset(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_95reset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("reset", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "reset", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_94reset(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_94reset(struct PyPetscKSPObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "PETSc/KSP.pyx":378
 * 
 *     def reset(self):
 *         CHKERR( KSPReset(self.ksp) )             # <<<<<<<<<<<<<<
 * 
 *     def setUpOnBlocks(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPReset(__pyx_v_self->ksp)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 378, __pyx_L1_error)

  /* "PETSc/KSP.pyx":377
 *         CHKERR( KSPSetUp(self.ksp) )
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPReset(self.ksp) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":380
 *         CHKERR( KSPReset(self.ksp) )
 * 
 *     def setUpOnBlocks(self):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetUpOnBlocks(self.ksp) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_97setUpOnBlocks(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_96setUpOnBlocks[] = "KSP.setUpOnBlocks(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_97setUpOnBlocks(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUpOnBlocks (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUpOnBlocks", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUpOnBlocks", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_96setUpOnBlocks(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_96setUpOnBlocks(struct PyPetscKSPObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUpOnBlocks", 0);

  /* "PETSc/KSP.pyx":381
 * 
 *     def setUpOnBlocks(self):
 *         CHKERR( KSPSetUpOnBlocks(self.ksp) )             # <<<<<<<<<<<<<<
 * 
 *     def solve(self, Vec b not None, Vec x not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetUpOnBlocks(__pyx_v_self->ksp)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 381, __pyx_L1_error)

  /* "PETSc/KSP.pyx":380
 *         CHKERR( KSPReset(self.ksp) )
 * 
 *     def setUpOnBlocks(self):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetUpOnBlocks(self.ksp) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setUpOnBlocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":383
 *         CHKERR( KSPSetUpOnBlocks(self.ksp) )
 * 
 *     def solve(self, Vec b not None, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSolve(self.ksp, b.vec, x.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_99solve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_98solve[] = "KSP.solve(self, Vec b, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_99solve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_b = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_x,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solve", 1, 2, 2, 1); __PYX_ERR(35, 383, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solve") < 0)) __PYX_ERR(35, 383, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_b = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 383, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "b", 0))) __PYX_ERR(35, 383, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(35, 383, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_98solve(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_b, __pyx_v_x);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_98solve(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("solve", 0);

  /* "PETSc/KSP.pyx":384
 * 
 *     def solve(self, Vec b not None, Vec x not None):
 *         CHKERR( KSPSolve(self.ksp, b.vec, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def solveTranspose(self, Vec b not None, Vec x not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSolve(__pyx_v_self->ksp, __pyx_v_b->vec, __pyx_v_x->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 384, __pyx_L1_error)

  /* "PETSc/KSP.pyx":383
 *         CHKERR( KSPSetUpOnBlocks(self.ksp) )
 * 
 *     def solve(self, Vec b not None, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSolve(self.ksp, b.vec, x.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":386
 *         CHKERR( KSPSolve(self.ksp, b.vec, x.vec) )
 * 
 *     def solveTranspose(self, Vec b not None, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSolveTranspose(self.ksp, b.vec, x.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_101solveTranspose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_100solveTranspose[] = "KSP.solveTranspose(self, Vec b, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_101solveTranspose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_b = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solveTranspose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_x,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solveTranspose", 1, 2, 2, 1); __PYX_ERR(35, 386, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solveTranspose") < 0)) __PYX_ERR(35, 386, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_b = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solveTranspose", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 386, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.solveTranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "b", 0))) __PYX_ERR(35, 386, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(35, 386, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_100solveTranspose(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_b, __pyx_v_x);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_100solveTranspose(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("solveTranspose", 0);

  /* "PETSc/KSP.pyx":387
 * 
 *     def solveTranspose(self, Vec b not None, Vec x not None):
 *         CHKERR( KSPSolveTranspose(self.ksp, b.vec, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def setIterationNumber(self, its):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSolveTranspose(__pyx_v_self->ksp, __pyx_v_b->vec, __pyx_v_x->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 387, __pyx_L1_error)

  /* "PETSc/KSP.pyx":386
 *         CHKERR( KSPSolve(self.ksp, b.vec, x.vec) )
 * 
 *     def solveTranspose(self, Vec b not None, Vec x not None):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSolveTranspose(self.ksp, b.vec, x.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.solveTranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":389
 *         CHKERR( KSPSolveTranspose(self.ksp, b.vec, x.vec) )
 * 
 *     def setIterationNumber(self, its):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(its)
 *         CHKERR( KSPSetIterationNumber(self.ksp, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_103setIterationNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_102setIterationNumber[] = "KSP.setIterationNumber(self, its)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_103setIterationNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_its = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setIterationNumber (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_its,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);
        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_its)) != 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, "setIterationNumber") < 0)) __PYX_ERR(35, 389, __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_its = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setIterationNumber", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 389, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setIterationNumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_102setIterationNumber(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_its);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_102setIterationNumber(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_its) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setIterationNumber", 0);

  /* "PETSc/KSP.pyx":390
 * 
 *     def setIterationNumber(self, its):
 *         cdef PetscInt ival = asInt(its)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetIterationNumber(self.ksp, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_its); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(35, 390, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/KSP.pyx":391
 *     def setIterationNumber(self, its):
 *         cdef PetscInt ival = asInt(its)
 *         CHKERR( KSPSetIterationNumber(self.ksp, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def getIterationNumber(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetIterationNumber(__pyx_v_self->ksp, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 391, __pyx_L1_error)

  /* "PETSc/KSP.pyx":389
 *         CHKERR( KSPSolveTranspose(self.ksp, b.vec, x.vec) )
 * 
 *     def setIterationNumber(self, its):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(its)
 *         CHKERR( KSPSetIterationNumber(self.ksp, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setIterationNumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":393
 *         CHKERR( KSPSetIterationNumber(self.ksp, ival) )
 * 
 *     def getIterationNumber(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( KSPGetIterationNumber(self.ksp, &ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_105getIterationNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_104getIterationNumber[] = "KSP.getIterationNumber(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_105getIterationNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getIterationNumber (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getIterationNumber", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getIterationNumber", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_104getIterationNumber(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_104getIterationNumber(struct PyPetscKSPObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getIterationNumber", 0);

  /* "PETSc/KSP.pyx":394
 * 
 *     def getIterationNumber(self):
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetIterationNumber(self.ksp, &ival) )
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/KSP.pyx":395
 *     def getIterationNumber(self):
 *         cdef PetscInt ival = 0
 *         CHKERR( KSPGetIterationNumber(self.ksp, &ival) )             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetIterationNumber(__pyx_v_self->ksp, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 395, __pyx_L1_error)

  /* "PETSc/KSP.pyx":396
 *         cdef PetscInt ival = 0
 *         CHKERR( KSPGetIterationNumber(self.ksp, &ival) )
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def setResidualNorm(self, rnorm):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":393
 *         CHKERR( KSPSetIterationNumber(self.ksp, ival) )
 * 
 *     def getIterationNumber(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( KSPGetIterationNumber(self.ksp, &ival) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getIterationNumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":398
 *         return toInt(ival)
 * 
 *     def setResidualNorm(self, rnorm):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(rnorm)
 *         CHKERR( KSPSetResidualNorm(self.ksp, rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_107setResidualNorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_106setResidualNorm[] = "KSP.setResidualNorm(self, rnorm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_107setResidualNorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnorm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setResidualNorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnorm,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);
        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_rnorm)) != 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, "setResidualNorm") < 0)) __PYX_ERR(35, 398, __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_rnorm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setResidualNorm", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 398, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setResidualNorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_106setResidualNorm(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_rnorm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_106setResidualNorm(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_rnorm) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setResidualNorm", 0);

  /* "PETSc/KSP.pyx":399
 * 
 *     def setResidualNorm(self, rnorm):
 *         cdef PetscReal rval = asReal(rnorm)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetResidualNorm(self.ksp, rval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_rnorm); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(35, 399, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/KSP.pyx":400
 *     def setResidualNorm(self, rnorm):
 *         cdef PetscReal rval = asReal(rnorm)
 *         CHKERR( KSPSetResidualNorm(self.ksp, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def getResidualNorm(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetResidualNorm(__pyx_v_self->ksp, __pyx_v_rval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 400, __pyx_L1_error)

  /* "PETSc/KSP.pyx":398
 *         return toInt(ival)
 * 
 *     def setResidualNorm(self, rnorm):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(rnorm)
 *         CHKERR( KSPSetResidualNorm(self.ksp, rval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setResidualNorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":402
 *         CHKERR( KSPSetResidualNorm(self.ksp, rval) )
 * 
 *     def getResidualNorm(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( KSPGetResidualNorm(self.ksp, &rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_109getResidualNorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_108getResidualNorm[] = "KSP.getResidualNorm(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_109getResidualNorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getResidualNorm (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getResidualNorm", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getResidualNorm", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_108getResidualNorm(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_108getResidualNorm(struct PyPetscKSPObject *__pyx_v_self) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getResidualNorm", 0);

  /* "PETSc/KSP.pyx":403
 * 
 *     def getResidualNorm(self):
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetResidualNorm(self.ksp, &rval) )
 *         return toReal(rval)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/KSP.pyx":404
 *     def getResidualNorm(self):
 *         cdef PetscReal rval = 0
 *         CHKERR( KSPGetResidualNorm(self.ksp, &rval) )             # <<<<<<<<<<<<<<
 *         return toReal(rval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetResidualNorm(__pyx_v_self->ksp, (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 404, __pyx_L1_error)

  /* "PETSc/KSP.pyx":405
 *         cdef PetscReal rval = 0
 *         CHKERR( KSPGetResidualNorm(self.ksp, &rval) )
 *         return toReal(rval)             # <<<<<<<<<<<<<<
 * 
 *     def setConvergedReason(self, reason):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":402
 *         CHKERR( KSPSetResidualNorm(self.ksp, rval) )
 * 
 *     def getResidualNorm(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( KSPGetResidualNorm(self.ksp, &rval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getResidualNorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":407
 *         return toReal(rval)
 * 
 *     def setConvergedReason(self, reason):             # <<<<<<<<<<<<<<
 *         cdef PetscKSPConvergedReason val = reason
 *         CHKERR( KSPSetConvergedReason(self.ksp, val) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_111setConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_110setConvergedReason[] = "KSP.setConvergedReason(self, reason)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_111setConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_reason = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvergedReason (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reason,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);
        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_reason)) != 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, "setConvergedReason") < 0)) __PYX_ERR(35, 407, __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_reason = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvergedReason", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 407, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_110setConvergedReason(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_reason);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_110setConvergedReason(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_reason) {
  KSPConvergedReason __pyx_v_val;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  KSPConvergedReason __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setConvergedReason", 0);

  /* "PETSc/KSP.pyx":408
 * 
 *     def setConvergedReason(self, reason):
 *         cdef PetscKSPConvergedReason val = reason             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetConvergedReason(self.ksp, val) )
 * 
 */
  __pyx_t_1 = ((KSPConvergedReason)__Pyx_PyInt_As_KSPConvergedReason(__pyx_v_reason)); if (unlikely(PyErr_Occurred())) __PYX_ERR(35, 408, __pyx_L1_error)
  __pyx_v_val = __pyx_t_1;

  /* "PETSc/KSP.pyx":409
 *     def setConvergedReason(self, reason):
 *         cdef PetscKSPConvergedReason val = reason
 *         CHKERR( KSPSetConvergedReason(self.ksp, val) )             # <<<<<<<<<<<<<<
 * 
 *     def getConvergedReason(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetConvergedReason(__pyx_v_self->ksp, __pyx_v_val)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 409, __pyx_L1_error)

  /* "PETSc/KSP.pyx":407
 *         return toReal(rval)
 * 
 *     def setConvergedReason(self, reason):             # <<<<<<<<<<<<<<
 *         cdef PetscKSPConvergedReason val = reason
 *         CHKERR( KSPSetConvergedReason(self.ksp, val) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":411
 *         CHKERR( KSPSetConvergedReason(self.ksp, val) )
 * 
 *     def getConvergedReason(self):             # <<<<<<<<<<<<<<
 *         cdef PetscKSPConvergedReason reason = KSP_CONVERGED_ITERATING
 *         CHKERR( KSPGetConvergedReason(self.ksp, &reason) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_113getConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_112getConvergedReason[] = "KSP.getConvergedReason(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_113getConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvergedReason (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getConvergedReason", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getConvergedReason", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_112getConvergedReason(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_112getConvergedReason(struct PyPetscKSPObject *__pyx_v_self) {
  KSPConvergedReason __pyx_v_reason;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvergedReason", 0);

  /* "PETSc/KSP.pyx":412
 * 
 *     def getConvergedReason(self):
 *         cdef PetscKSPConvergedReason reason = KSP_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetConvergedReason(self.ksp, &reason) )
 *         return reason
 */
  __pyx_v_reason = KSP_CONVERGED_ITERATING;

  /* "PETSc/KSP.pyx":413
 *     def getConvergedReason(self):
 *         cdef PetscKSPConvergedReason reason = KSP_CONVERGED_ITERATING
 *         CHKERR( KSPGetConvergedReason(self.ksp, &reason) )             # <<<<<<<<<<<<<<
 *         return reason
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetConvergedReason(__pyx_v_self->ksp, (&__pyx_v_reason))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 413, __pyx_L1_error)

  /* "PETSc/KSP.pyx":414
 *         cdef PetscKSPConvergedReason reason = KSP_CONVERGED_ITERATING
 *         CHKERR( KSPGetConvergedReason(self.ksp, &reason) )
 *         return reason             # <<<<<<<<<<<<<<
 * 
 *     def getRhs(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_KSPConvergedReason(__pyx_v_reason); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":411
 *         CHKERR( KSPSetConvergedReason(self.ksp, val) )
 * 
 *     def getConvergedReason(self):             # <<<<<<<<<<<<<<
 *         cdef PetscKSPConvergedReason reason = KSP_CONVERGED_ITERATING
 *         CHKERR( KSPGetConvergedReason(self.ksp, &reason) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":416
 *         return reason
 * 
 *     def getRhs(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vec = Vec()
 *         CHKERR( KSPGetRhs(self.ksp, &vec.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_115getRhs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_114getRhs[] = "KSP.getRhs(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_115getRhs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRhs (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getRhs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getRhs", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_114getRhs(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_114getRhs(struct PyPetscKSPObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getRhs", 0);

  /* "PETSc/KSP.pyx":417
 * 
 *     def getRhs(self):
 *         cdef Vec vec = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetRhs(self.ksp, &vec.vec) )
 *         PetscINCREF(vec.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":418
 *     def getRhs(self):
 *         cdef Vec vec = Vec()
 *         CHKERR( KSPGetRhs(self.ksp, &vec.vec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(vec.obj)
 *         return vec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetRhs(__pyx_v_self->ksp, (&__pyx_v_vec->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 418, __pyx_L1_error)

  /* "PETSc/KSP.pyx":419
 *         cdef Vec vec = Vec()
 *         CHKERR( KSPGetRhs(self.ksp, &vec.vec) )
 *         PetscINCREF(vec.obj)             # <<<<<<<<<<<<<<
 *         return vec
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_vec->__pyx_base.obj);

  /* "PETSc/KSP.pyx":420
 *         CHKERR( KSPGetRhs(self.ksp, &vec.vec) )
 *         PetscINCREF(vec.obj)
 *         return vec             # <<<<<<<<<<<<<<
 * 
 *     def getSolution(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = ((PyObject *)__pyx_v_vec);
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":416
 *         return reason
 * 
 *     def getRhs(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vec = Vec()
 *         CHKERR( KSPGetRhs(self.ksp, &vec.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getRhs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":422
 *         return vec
 * 
 *     def getSolution(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vec = Vec()
 *         CHKERR( KSPGetSolution(self.ksp, &vec.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_117getSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_116getSolution[] = "KSP.getSolution(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_117getSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSolution (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSolution", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSolution", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_116getSolution(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_116getSolution(struct PyPetscKSPObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getSolution", 0);

  /* "PETSc/KSP.pyx":423
 * 
 *     def getSolution(self):
 *         cdef Vec vec = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetSolution(self.ksp, &vec.vec) )
 *         PetscINCREF(vec.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":424
 *     def getSolution(self):
 *         cdef Vec vec = Vec()
 *         CHKERR( KSPGetSolution(self.ksp, &vec.vec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(vec.obj)
 *         return vec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetSolution(__pyx_v_self->ksp, (&__pyx_v_vec->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 424, __pyx_L1_error)

  /* "PETSc/KSP.pyx":425
 *         cdef Vec vec = Vec()
 *         CHKERR( KSPGetSolution(self.ksp, &vec.vec) )
 *         PetscINCREF(vec.obj)             # <<<<<<<<<<<<<<
 *         return vec
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_vec->__pyx_base.obj);

  /* "PETSc/KSP.pyx":426
 *         CHKERR( KSPGetSolution(self.ksp, &vec.vec) )
 *         PetscINCREF(vec.obj)
 *         return vec             # <<<<<<<<<<<<<<
 * 
 *     def getWorkVecs(self, right=None, left=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = ((PyObject *)__pyx_v_vec);
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":422
 *         return vec
 * 
 *     def getSolution(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vec = Vec()
 *         CHKERR( KSPGetSolution(self.ksp, &vec.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getSolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":428
 *         return vec
 * 
 *     def getWorkVecs(self, right=None, left=None):             # <<<<<<<<<<<<<<
 *         cdef bint R = right is not None
 *         cdef bint L = left is not None
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_119getWorkVecs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_118getWorkVecs[] = "KSP.getWorkVecs(self, right=None, left=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_119getWorkVecs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_right = 0;
  PyObject *__pyx_v_left = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getWorkVecs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_right,&__pyx_n_s_left,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_right);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_left);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getWorkVecs") < 0)) __PYX_ERR(35, 428, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_right = values[0];
    __pyx_v_left = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getWorkVecs", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 428, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getWorkVecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_118getWorkVecs(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_right, __pyx_v_left);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_118getWorkVecs(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_right, PyObject *__pyx_v_left) {
  int __pyx_v_R;
  int __pyx_v_L;
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_nr;
  PetscInt __pyx_v_nl;
  Vec *__pyx_v_vr;
  Vec *__pyx_v_vl;
  PyObject *__pyx_v_vecsr = 0;
  PyObject *__pyx_v_vecsl = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PetscInt __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;
  int __pyx_t_8;
  char const *__pyx_t_9;
  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;
  __Pyx_RefNannySetupContext("getWorkVecs", 0);

  /* "PETSc/KSP.pyx":429
 * 
 *     def getWorkVecs(self, right=None, left=None):
 *         cdef bint R = right is not None             # <<<<<<<<<<<<<<
 *         cdef bint L = left is not None
 *         cdef PetscInt i=0, nr=0, nl=0
 */
  __pyx_t_1 = (__pyx_v_right != Py_None);
  __pyx_v_R = __pyx_t_1;

  /* "PETSc/KSP.pyx":430
 *     def getWorkVecs(self, right=None, left=None):
 *         cdef bint R = right is not None
 *         cdef bint L = left is not None             # <<<<<<<<<<<<<<
 *         cdef PetscInt i=0, nr=0, nl=0
 *         cdef PetscVec *vr=NULL, *vl=NULL
 */
  __pyx_t_1 = (__pyx_v_left != Py_None);
  __pyx_v_L = __pyx_t_1;

  /* "PETSc/KSP.pyx":431
 *         cdef bint R = right is not None
 *         cdef bint L = left is not None
 *         cdef PetscInt i=0, nr=0, nl=0             # <<<<<<<<<<<<<<
 *         cdef PetscVec *vr=NULL, *vl=NULL
 *         if R: nr = asInt(right)
 */
  __pyx_v_i = 0;
  __pyx_v_nr = 0;
  __pyx_v_nl = 0;

  /* "PETSc/KSP.pyx":432
 *         cdef bint L = left is not None
 *         cdef PetscInt i=0, nr=0, nl=0
 *         cdef PetscVec *vr=NULL, *vl=NULL             # <<<<<<<<<<<<<<
 *         if R: nr = asInt(right)
 *         if L: nl = asInt(left)
 */
  __pyx_v_vr = NULL;
  __pyx_v_vl = NULL;

  /* "PETSc/KSP.pyx":433
 *         cdef PetscInt i=0, nr=0, nl=0
 *         cdef PetscVec *vr=NULL, *vl=NULL
 *         if R: nr = asInt(right)             # <<<<<<<<<<<<<<
 *         if L: nl = asInt(left)
 *         cdef object vecsr = [] if R else None
 */
  __pyx_t_1 = (__pyx_v_R != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_right); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(35, 433, __pyx_L1_error)
    __pyx_v_nr = __pyx_t_2;
  }

  /* "PETSc/KSP.pyx":434
 *         cdef PetscVec *vr=NULL, *vl=NULL
 *         if R: nr = asInt(right)
 *         if L: nl = asInt(left)             # <<<<<<<<<<<<<<
 *         cdef object vecsr = [] if R else None
 *         cdef object vecsl = [] if L else None
 */
  __pyx_t_1 = (__pyx_v_L != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_left); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(35, 434, __pyx_L1_error)
    __pyx_v_nl = __pyx_t_2;
  }

  /* "PETSc/KSP.pyx":435
 *         if R: nr = asInt(right)
 *         if L: nl = asInt(left)
 *         cdef object vecsr = [] if R else None             # <<<<<<<<<<<<<<
 *         cdef object vecsl = [] if L else None
 *         CHKERR( KSPCreateVecs(self.ksp, nr, &vr, nl, &vr) )
 */
  if ((__pyx_v_R != 0)) {
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 435, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_3 = Py_None;
  }
  __pyx_v_vecsr = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":436
 *         if L: nl = asInt(left)
 *         cdef object vecsr = [] if R else None
 *         cdef object vecsl = [] if L else None             # <<<<<<<<<<<<<<
 *         CHKERR( KSPCreateVecs(self.ksp, nr, &vr, nl, &vr) )
 *         try:
 */
  if ((__pyx_v_L != 0)) {
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_3 = Py_None;
  }
  __pyx_v_vecsl = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":437
 *         cdef object vecsr = [] if R else None
 *         cdef object vecsl = [] if L else None
 *         CHKERR( KSPCreateVecs(self.ksp, nr, &vr, nl, &vr) )             # <<<<<<<<<<<<<<
 *         try:
 *             for i from 0 <= i < nr:
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPCreateVecs(__pyx_v_self->ksp, __pyx_v_nr, (&__pyx_v_vr), __pyx_v_nl, (&__pyx_v_vr))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(35, 437, __pyx_L1_error)

  /* "PETSc/KSP.pyx":438
 *         cdef object vecsl = [] if L else None
 *         CHKERR( KSPCreateVecs(self.ksp, nr, &vr, nl, &vr) )
 *         try:             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < nr:
 *                 vecsr.append(ref_Vec(vr[i]))
 */
  /*try:*/ {

    /* "PETSc/KSP.pyx":439
 *         CHKERR( KSPCreateVecs(self.ksp, nr, &vr, nl, &vr) )
 *         try:
 *             for i from 0 <= i < nr:             # <<<<<<<<<<<<<<
 *                 vecsr.append(ref_Vec(vr[i]))
 *             for i from 0 <= i < nl:
 */
    __pyx_t_2 = __pyx_v_nr;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {

      /* "PETSc/KSP.pyx":440
 *         try:
 *             for i from 0 <= i < nr:
 *                 vecsr.append(ref_Vec(vr[i]))             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < nl:
 *                 vecsl.append(ref_Vec(vl[i]))
 */
      __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec((__pyx_v_vr[__pyx_v_i]))); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 440, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_vecsr, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(35, 440, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }

    /* "PETSc/KSP.pyx":441
 *             for i from 0 <= i < nr:
 *                 vecsr.append(ref_Vec(vr[i]))
 *             for i from 0 <= i < nl:             # <<<<<<<<<<<<<<
 *                 vecsl.append(ref_Vec(vl[i]))
 *         finally:
 */
    __pyx_t_2 = __pyx_v_nl;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {

      /* "PETSc/KSP.pyx":442
 *                 vecsr.append(ref_Vec(vr[i]))
 *             for i from 0 <= i < nl:
 *                 vecsl.append(ref_Vec(vl[i]))             # <<<<<<<<<<<<<<
 *         finally:
 *             if nr > 0 and vr != NULL:
 */
      __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec((__pyx_v_vl[__pyx_v_i]))); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 442, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_vecsl, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(35, 442, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }

  /* "PETSc/KSP.pyx":444
 *                 vecsl.append(ref_Vec(vl[i]))
 *         finally:
 *             if nr > 0 and vr != NULL:             # <<<<<<<<<<<<<<
 *                 VecDestroyVecs(nr, &vr) # XXX errors?
 *             if nl > 0 and vl !=NULL:
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_7 = ((__pyx_v_nr > 0) != 0);
      if (__pyx_t_7) {
      } else {
        __pyx_t_1 = __pyx_t_7;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_7 = ((__pyx_v_vr != NULL) != 0);
      __pyx_t_1 = __pyx_t_7;
      __pyx_L13_bool_binop_done:;
      if (__pyx_t_1) {

        /* "PETSc/KSP.pyx":445
 *         finally:
 *             if nr > 0 and vr != NULL:
 *                 VecDestroyVecs(nr, &vr) # XXX errors?             # <<<<<<<<<<<<<<
 *             if nl > 0 and vl !=NULL:
 *                 VecDestroyVecs(nl, &vl) # XXX errors?
 */
        VecDestroyVecs(__pyx_v_nr, (&__pyx_v_vr));

        /* "PETSc/KSP.pyx":444
 *                 vecsl.append(ref_Vec(vl[i]))
 *         finally:
 *             if nr > 0 and vr != NULL:             # <<<<<<<<<<<<<<
 *                 VecDestroyVecs(nr, &vr) # XXX errors?
 *             if nl > 0 and vl !=NULL:
 */
      }

      /* "PETSc/KSP.pyx":446
 *             if nr > 0 and vr != NULL:
 *                 VecDestroyVecs(nr, &vr) # XXX errors?
 *             if nl > 0 and vl !=NULL:             # <<<<<<<<<<<<<<
 *                 VecDestroyVecs(nl, &vl) # XXX errors?
 *         #
 */
      __pyx_t_7 = ((__pyx_v_nl > 0) != 0);
      if (__pyx_t_7) {
      } else {
        __pyx_t_1 = __pyx_t_7;
        goto __pyx_L16_bool_binop_done;
      }
      __pyx_t_7 = ((__pyx_v_vl != NULL) != 0);
      __pyx_t_1 = __pyx_t_7;
      __pyx_L16_bool_binop_done:;
      if (__pyx_t_1) {

        /* "PETSc/KSP.pyx":447
 *                 VecDestroyVecs(nr, &vr) # XXX errors?
 *             if nl > 0 and vl !=NULL:
 *                 VecDestroyVecs(nl, &vl) # XXX errors?             # <<<<<<<<<<<<<<
 *         #
 *         if R and L: return (vecsr, vecsl)
 */
        VecDestroyVecs(__pyx_v_nl, (&__pyx_v_vl));

        /* "PETSc/KSP.pyx":446
 *             if nr > 0 and vr != NULL:
 *                 VecDestroyVecs(nr, &vr) # XXX errors?
 *             if nl > 0 and vl !=NULL:             # <<<<<<<<<<<<<<
 *                 VecDestroyVecs(nl, &vl) # XXX errors?
 *         #
 */
      }
      goto __pyx_L7;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L6_error:;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_5 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {

        /* "PETSc/KSP.pyx":444
 *                 vecsl.append(ref_Vec(vl[i]))
 *         finally:
 *             if nr > 0 and vr != NULL:             # <<<<<<<<<<<<<<
 *                 VecDestroyVecs(nr, &vr) # XXX errors?
 *             if nl > 0 and vl !=NULL:
 */
        __pyx_t_7 = ((__pyx_v_nr > 0) != 0);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L21_bool_binop_done;
        }
        __pyx_t_7 = ((__pyx_v_vr != NULL) != 0);
        __pyx_t_1 = __pyx_t_7;
        __pyx_L21_bool_binop_done:;
        if (__pyx_t_1) {

          /* "PETSc/KSP.pyx":445
 *         finally:
 *             if nr > 0 and vr != NULL:
 *                 VecDestroyVecs(nr, &vr) # XXX errors?             # <<<<<<<<<<<<<<
 *             if nl > 0 and vl !=NULL:
 *                 VecDestroyVecs(nl, &vl) # XXX errors?
 */
          VecDestroyVecs(__pyx_v_nr, (&__pyx_v_vr));

          /* "PETSc/KSP.pyx":444
 *                 vecsl.append(ref_Vec(vl[i]))
 *         finally:
 *             if nr > 0 and vr != NULL:             # <<<<<<<<<<<<<<
 *                 VecDestroyVecs(nr, &vr) # XXX errors?
 *             if nl > 0 and vl !=NULL:
 */
        }

        /* "PETSc/KSP.pyx":446
 *             if nr > 0 and vr != NULL:
 *                 VecDestroyVecs(nr, &vr) # XXX errors?
 *             if nl > 0 and vl !=NULL:             # <<<<<<<<<<<<<<
 *                 VecDestroyVecs(nl, &vl) # XXX errors?
 *         #
 */
        __pyx_t_7 = ((__pyx_v_nl > 0) != 0);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L24_bool_binop_done;
        }
        __pyx_t_7 = ((__pyx_v_vl != NULL) != 0);
        __pyx_t_1 = __pyx_t_7;
        __pyx_L24_bool_binop_done:;
        if (__pyx_t_1) {

          /* "PETSc/KSP.pyx":447
 *                 VecDestroyVecs(nr, &vr) # XXX errors?
 *             if nl > 0 and vl !=NULL:
 *                 VecDestroyVecs(nl, &vl) # XXX errors?             # <<<<<<<<<<<<<<
 *         #
 *         if R and L: return (vecsr, vecsl)
 */
          VecDestroyVecs(__pyx_v_nl, (&__pyx_v_vl));

          /* "PETSc/KSP.pyx":446
 *             if nr > 0 and vr != NULL:
 *                 VecDestroyVecs(nr, &vr) # XXX errors?
 *             if nl > 0 and vl !=NULL:             # <<<<<<<<<<<<<<
 *                 VecDestroyVecs(nl, &vl) # XXX errors?
 *         #
 */
        }
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "PETSc/KSP.pyx":449
 *                 VecDestroyVecs(nl, &vl) # XXX errors?
 *         #
 *         if R and L: return (vecsr, vecsl)             # <<<<<<<<<<<<<<
 *         elif R:     return vecsr
 *         elif L:     return vecsl
 */
  __pyx_t_7 = (__pyx_v_R != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L27_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_L != 0);
  __pyx_t_1 = __pyx_t_7;
  __pyx_L27_bool_binop_done:;
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_vecsr);
    __Pyx_GIVEREF(__pyx_v_vecsr);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_vecsr);
    __Pyx_INCREF(__pyx_v_vecsl);
    __Pyx_GIVEREF(__pyx_v_vecsl);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_vecsl);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "PETSc/KSP.pyx":450
 *         #
 *         if R and L: return (vecsr, vecsl)
 *         elif R:     return vecsr             # <<<<<<<<<<<<<<
 *         elif L:     return vecsl
 *         else:       return None
 */
  __pyx_t_1 = (__pyx_v_R != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_vecsr);
    __pyx_r = __pyx_v_vecsr;
    goto __pyx_L0;
  }

  /* "PETSc/KSP.pyx":451
 *         if R and L: return (vecsr, vecsl)
 *         elif R:     return vecsr
 *         elif L:     return vecsl             # <<<<<<<<<<<<<<
 *         else:       return None
 * 
 */
  __pyx_t_1 = (__pyx_v_L != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_vecsl);
    __pyx_r = __pyx_v_vecsl;
    goto __pyx_L0;
  }

  /* "PETSc/KSP.pyx":452
 *         elif R:     return vecsr
 *         elif L:     return vecsl
 *         else:       return None             # <<<<<<<<<<<<<<
 * 
 *     def buildSolution(self, Vec x=None):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "PETSc/KSP.pyx":428
 *         return vec
 * 
 *     def getWorkVecs(self, right=None, left=None):             # <<<<<<<<<<<<<<
 *         cdef bint R = right is not None
 *         cdef bint L = left is not None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getWorkVecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_vecsr);
  __Pyx_XDECREF(__pyx_v_vecsl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":454
 *         else:       return None
 * 
 *     def buildSolution(self, Vec x=None):             # <<<<<<<<<<<<<<
 *         if x is None: x = Vec()
 *         if x.vec == NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_121buildSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_120buildSolution[] = "KSP.buildSolution(self, Vec x=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_121buildSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("buildSolution (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscVecObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "buildSolution") < 0)) __PYX_ERR(35, 454, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("buildSolution", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 454, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.buildSolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "x", 0))) __PYX_ERR(35, 454, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_120buildSolution(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_x);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_120buildSolution(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("buildSolution", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_x);

  /* "PETSc/KSP.pyx":455
 * 
 *     def buildSolution(self, Vec x=None):
 *         if x is None: x = Vec()             # <<<<<<<<<<<<<<
 *         if x.vec == NULL:
 *             CHKERR( KSPGetSolution(self.ksp, &x.vec) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_x) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_x, ((struct PyPetscVecObject *)__pyx_t_3));
    __pyx_t_3 = 0;
  }

  /* "PETSc/KSP.pyx":456
 *     def buildSolution(self, Vec x=None):
 *         if x is None: x = Vec()
 *         if x.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( KSPGetSolution(self.ksp, &x.vec) )
 *             CHKERR( VecDuplicate(x.vec, &x.vec) )
 */
  __pyx_t_2 = ((__pyx_v_x->vec == NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/KSP.pyx":457
 *         if x is None: x = Vec()
 *         if x.vec == NULL:
 *             CHKERR( KSPGetSolution(self.ksp, &x.vec) )             # <<<<<<<<<<<<<<
 *             CHKERR( VecDuplicate(x.vec, &x.vec) )
 *         CHKERR( KSPBuildSolution(self.ksp, x.vec, NULL) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetSolution(__pyx_v_self->ksp, (&__pyx_v_x->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(35, 457, __pyx_L1_error)

    /* "PETSc/KSP.pyx":458
 *         if x.vec == NULL:
 *             CHKERR( KSPGetSolution(self.ksp, &x.vec) )
 *             CHKERR( VecDuplicate(x.vec, &x.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( KSPBuildSolution(self.ksp, x.vec, NULL) )
 *         return x
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecDuplicate(__pyx_v_x->vec, (&__pyx_v_x->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(35, 458, __pyx_L1_error)

    /* "PETSc/KSP.pyx":456
 *     def buildSolution(self, Vec x=None):
 *         if x is None: x = Vec()
 *         if x.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( KSPGetSolution(self.ksp, &x.vec) )
 *             CHKERR( VecDuplicate(x.vec, &x.vec) )
 */
  }

  /* "PETSc/KSP.pyx":459
 *             CHKERR( KSPGetSolution(self.ksp, &x.vec) )
 *             CHKERR( VecDuplicate(x.vec, &x.vec) )
 *         CHKERR( KSPBuildSolution(self.ksp, x.vec, NULL) )             # <<<<<<<<<<<<<<
 *         return x
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPBuildSolution(__pyx_v_self->ksp, __pyx_v_x->vec, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(35, 459, __pyx_L1_error)

  /* "PETSc/KSP.pyx":460
 *             CHKERR( VecDuplicate(x.vec, &x.vec) )
 *         CHKERR( KSPBuildSolution(self.ksp, x.vec, NULL) )
 *         return x             # <<<<<<<<<<<<<<
 * 
 *     def buildResidual(self, Vec r=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __pyx_r = ((PyObject *)__pyx_v_x);
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":454
 *         else:       return None
 * 
 *     def buildSolution(self, Vec x=None):             # <<<<<<<<<<<<<<
 *         if x is None: x = Vec()
 *         if x.vec == NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.buildSolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":462
 *         return x
 * 
 *     def buildResidual(self, Vec r=None):             # <<<<<<<<<<<<<<
 *         if r is None: r = Vec()
 *         if r.vec == NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_123buildResidual(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_122buildResidual[] = "KSP.buildResidual(self, Vec r=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_123buildResidual(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_r = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("buildResidual (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_r,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscVecObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_r);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "buildResidual") < 0)) __PYX_ERR(35, 462, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_r = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("buildResidual", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 462, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.buildResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_r), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "r", 0))) __PYX_ERR(35, 462, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_122buildResidual(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_r);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_122buildResidual(struct PyPetscKSPObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_r) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("buildResidual", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_r);

  /* "PETSc/KSP.pyx":463
 * 
 *     def buildResidual(self, Vec r=None):
 *         if r is None: r = Vec()             # <<<<<<<<<<<<<<
 *         if r.vec == NULL:
 *             CHKERR( KSPGetRhs(self.ksp, &r.vec) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_r) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_r, ((struct PyPetscVecObject *)__pyx_t_3));
    __pyx_t_3 = 0;
  }

  /* "PETSc/KSP.pyx":464
 *     def buildResidual(self, Vec r=None):
 *         if r is None: r = Vec()
 *         if r.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( KSPGetRhs(self.ksp, &r.vec) )
 *             CHKERR( VecDuplicate(r.vec, &r.vec) )
 */
  __pyx_t_2 = ((__pyx_v_r->vec == NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/KSP.pyx":465
 *         if r is None: r = Vec()
 *         if r.vec == NULL:
 *             CHKERR( KSPGetRhs(self.ksp, &r.vec) )             # <<<<<<<<<<<<<<
 *             CHKERR( VecDuplicate(r.vec, &r.vec) )
 *         CHKERR( KSPBuildResidual(self.ksp , NULL, r.vec, &r.vec) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetRhs(__pyx_v_self->ksp, (&__pyx_v_r->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(35, 465, __pyx_L1_error)

    /* "PETSc/KSP.pyx":466
 *         if r.vec == NULL:
 *             CHKERR( KSPGetRhs(self.ksp, &r.vec) )
 *             CHKERR( VecDuplicate(r.vec, &r.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( KSPBuildResidual(self.ksp , NULL, r.vec, &r.vec) )
 *         return r
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecDuplicate(__pyx_v_r->vec, (&__pyx_v_r->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(35, 466, __pyx_L1_error)

    /* "PETSc/KSP.pyx":464
 *     def buildResidual(self, Vec r=None):
 *         if r is None: r = Vec()
 *         if r.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( KSPGetRhs(self.ksp, &r.vec) )
 *             CHKERR( VecDuplicate(r.vec, &r.vec) )
 */
  }

  /* "PETSc/KSP.pyx":467
 *             CHKERR( KSPGetRhs(self.ksp, &r.vec) )
 *             CHKERR( VecDuplicate(r.vec, &r.vec) )
 *         CHKERR( KSPBuildResidual(self.ksp , NULL, r.vec, &r.vec) )             # <<<<<<<<<<<<<<
 *         return r
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPBuildResidual(__pyx_v_self->ksp, NULL, __pyx_v_r->vec, (&__pyx_v_r->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(35, 467, __pyx_L1_error)

  /* "PETSc/KSP.pyx":468
 *             CHKERR( VecDuplicate(r.vec, &r.vec) )
 *         CHKERR( KSPBuildResidual(self.ksp , NULL, r.vec, &r.vec) )
 *         return r             # <<<<<<<<<<<<<<
 * 
 *     def computeEigenvalues(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_r));
  __pyx_r = ((PyObject *)__pyx_v_r);
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":462
 *         return x
 * 
 *     def buildResidual(self, Vec r=None):             # <<<<<<<<<<<<<<
 *         if r is None: r = Vec()
 *         if r.vec == NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.buildResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_r);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":470
 *         return r
 * 
 *     def computeEigenvalues(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt its = 0
 *         cdef PetscInt neig = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_125computeEigenvalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_124computeEigenvalues[] = "KSP.computeEigenvalues(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_125computeEigenvalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeEigenvalues (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("computeEigenvalues", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "computeEigenvalues", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_124computeEigenvalues(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_124computeEigenvalues(struct PyPetscKSPObject *__pyx_v_self) {
  PetscInt __pyx_v_its;
  PetscInt __pyx_v_neig;
  PetscReal *__pyx_v_rdata;
  PetscReal *__pyx_v_idata;
  PyArrayObject *__pyx_v_r = 0;
  PyArrayObject *__pyx_v_i = 0;
  PyArrayObject *__pyx_v_eigen = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("computeEigenvalues", 0);

  /* "PETSc/KSP.pyx":471
 * 
 *     def computeEigenvalues(self):
 *         cdef PetscInt its = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt neig = 0
 *         cdef PetscReal *rdata = NULL
 */
  __pyx_v_its = 0;

  /* "PETSc/KSP.pyx":472
 *     def computeEigenvalues(self):
 *         cdef PetscInt its = 0
 *         cdef PetscInt neig = 0             # <<<<<<<<<<<<<<
 *         cdef PetscReal *rdata = NULL
 *         cdef PetscReal *idata = NULL
 */
  __pyx_v_neig = 0;

  /* "PETSc/KSP.pyx":473
 *         cdef PetscInt its = 0
 *         cdef PetscInt neig = 0
 *         cdef PetscReal *rdata = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscReal *idata = NULL
 *         CHKERR( KSPGetIterationNumber(self.ksp, &its) )
 */
  __pyx_v_rdata = NULL;

  /* "PETSc/KSP.pyx":474
 *         cdef PetscInt neig = 0
 *         cdef PetscReal *rdata = NULL
 *         cdef PetscReal *idata = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGetIterationNumber(self.ksp, &its) )
 *         cdef ndarray r = oarray_r(empty_r(its), NULL, &rdata)
 */
  __pyx_v_idata = NULL;

  /* "PETSc/KSP.pyx":475
 *         cdef PetscReal *rdata = NULL
 *         cdef PetscReal *idata = NULL
 *         CHKERR( KSPGetIterationNumber(self.ksp, &its) )             # <<<<<<<<<<<<<<
 *         cdef ndarray r = oarray_r(empty_r(its), NULL, &rdata)
 *         cdef ndarray i = oarray_r(empty_r(its), NULL, &idata)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGetIterationNumber(__pyx_v_self->ksp, (&__pyx_v_its))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 475, __pyx_L1_error)

  /* "PETSc/KSP.pyx":476
 *         cdef PetscReal *idata = NULL
 *         CHKERR( KSPGetIterationNumber(self.ksp, &its) )
 *         cdef ndarray r = oarray_r(empty_r(its), NULL, &rdata)             # <<<<<<<<<<<<<<
 *         cdef ndarray i = oarray_r(empty_r(its), NULL, &idata)
 *         CHKERR( KSPComputeEigenvalues(self.ksp, its, rdata, idata, &neig) )
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_r(__pyx_v_its)); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_r(__pyx_t_2, NULL, (&__pyx_v_rdata))); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_r = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":477
 *         CHKERR( KSPGetIterationNumber(self.ksp, &its) )
 *         cdef ndarray r = oarray_r(empty_r(its), NULL, &rdata)
 *         cdef ndarray i = oarray_r(empty_r(its), NULL, &idata)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPComputeEigenvalues(self.ksp, its, rdata, idata, &neig) )
 *         eigen = empty_c(neig)
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_r(__pyx_v_its)); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_r(__pyx_t_3, NULL, (&__pyx_v_idata))); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_i = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/KSP.pyx":478
 *         cdef ndarray r = oarray_r(empty_r(its), NULL, &rdata)
 *         cdef ndarray i = oarray_r(empty_r(its), NULL, &idata)
 *         CHKERR( KSPComputeEigenvalues(self.ksp, its, rdata, idata, &neig) )             # <<<<<<<<<<<<<<
 *         eigen = empty_c(neig)
 *         eigen.real = r[:neig]
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPComputeEigenvalues(__pyx_v_self->ksp, __pyx_v_its, __pyx_v_rdata, __pyx_v_idata, (&__pyx_v_neig))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 478, __pyx_L1_error)

  /* "PETSc/KSP.pyx":479
 *         cdef ndarray i = oarray_r(empty_r(its), NULL, &idata)
 *         CHKERR( KSPComputeEigenvalues(self.ksp, its, rdata, idata, &neig) )
 *         eigen = empty_c(neig)             # <<<<<<<<<<<<<<
 *         eigen.real = r[:neig]
 *         eigen.imag = i[:neig]
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_c(__pyx_v_neig)); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_eigen = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/KSP.pyx":480
 *         CHKERR( KSPComputeEigenvalues(self.ksp, its, rdata, idata, &neig) )
 *         eigen = empty_c(neig)
 *         eigen.real = r[:neig]             # <<<<<<<<<<<<<<
 *         eigen.imag = i[:neig]
 *         return eigen
 */
  __pyx_t_2 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_r), 0, __pyx_v_neig, NULL, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_eigen), __pyx_n_s_real, __pyx_t_2) < 0) __PYX_ERR(35, 480, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/KSP.pyx":481
 *         eigen = empty_c(neig)
 *         eigen.real = r[:neig]
 *         eigen.imag = i[:neig]             # <<<<<<<<<<<<<<
 *         return eigen
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_i), 0, __pyx_v_neig, NULL, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_eigen), __pyx_n_s_imag, __pyx_t_2) < 0) __PYX_ERR(35, 481, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/KSP.pyx":482
 *         eigen.real = r[:neig]
 *         eigen.imag = i[:neig]
 *         return eigen             # <<<<<<<<<<<<<<
 * 
 *     def computeExtremeSingularValues(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_eigen));
  __pyx_r = ((PyObject *)__pyx_v_eigen);
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":470
 *         return r
 * 
 *     def computeEigenvalues(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt its = 0
 *         cdef PetscInt neig = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.computeEigenvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_r);
  __Pyx_XDECREF((PyObject *)__pyx_v_i);
  __Pyx_XDECREF((PyObject *)__pyx_v_eigen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":484
 *         return eigen
 * 
 *     def computeExtremeSingularValues(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal smax = 0
 *         cdef PetscReal smin = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_127computeExtremeSingularValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_126computeExtremeSingularValues[] = "KSP.computeExtremeSingularValues(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_127computeExtremeSingularValues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeExtremeSingularValues (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("computeExtremeSingularValues", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "computeExtremeSingularValues", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_126computeExtremeSingularValues(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_126computeExtremeSingularValues(struct PyPetscKSPObject *__pyx_v_self) {
  PetscReal __pyx_v_smax;
  PetscReal __pyx_v_smin;
  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;
  __Pyx_RefNannySetupContext("computeExtremeSingularValues", 0);

  /* "PETSc/KSP.pyx":485
 * 
 *     def computeExtremeSingularValues(self):
 *         cdef PetscReal smax = 0             # <<<<<<<<<<<<<<
 *         cdef PetscReal smin = 0
 *         CHKERR( KSPComputeExtremeSingularValues(self.ksp, &smax, &smin) )
 */
  __pyx_v_smax = 0.0;

  /* "PETSc/KSP.pyx":486
 *     def computeExtremeSingularValues(self):
 *         cdef PetscReal smax = 0
 *         cdef PetscReal smin = 0             # <<<<<<<<<<<<<<
 *         CHKERR( KSPComputeExtremeSingularValues(self.ksp, &smax, &smin) )
 *         return smax, smin
 */
  __pyx_v_smin = 0.0;

  /* "PETSc/KSP.pyx":487
 *         cdef PetscReal smax = 0
 *         cdef PetscReal smin = 0
 *         CHKERR( KSPComputeExtremeSingularValues(self.ksp, &smax, &smin) )             # <<<<<<<<<<<<<<
 *         return smax, smin
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPComputeExtremeSingularValues(__pyx_v_self->ksp, (&__pyx_v_smax), (&__pyx_v_smin))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 487, __pyx_L1_error)

  /* "PETSc/KSP.pyx":488
 *         cdef PetscReal smin = 0
 *         CHKERR( KSPComputeExtremeSingularValues(self.ksp, &smax, &smin) )
 *         return smax, smin             # <<<<<<<<<<<<<<
 * 
 *     # --- GMRES ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_smax); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_smin); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 488, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":484
 *         return eigen
 * 
 *     def computeExtremeSingularValues(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal smax = 0
 *         cdef PetscReal smin = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.computeExtremeSingularValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":492
 *     # --- GMRES ---
 * 
 *     def setGMRESRestart(self, restart):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(restart)
 *         CHKERR( KSPGMRESSetRestart(self.ksp, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_129setGMRESRestart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_128setGMRESRestart[] = "KSP.setGMRESRestart(self, restart)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_129setGMRESRestart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_restart = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setGMRESRestart (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_restart,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);
        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_restart)) != 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, "setGMRESRestart") < 0)) __PYX_ERR(35, 492, __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_restart = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setGMRESRestart", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 492, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setGMRESRestart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_128setGMRESRestart(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_restart);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_128setGMRESRestart(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_restart) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setGMRESRestart", 0);

  /* "PETSc/KSP.pyx":493
 * 
 *     def setGMRESRestart(self, restart):
 *         cdef PetscInt ival = asInt(restart)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPGMRESSetRestart(self.ksp, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_restart); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(35, 493, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/KSP.pyx":494
 *     def setGMRESRestart(self, restart):
 *         cdef PetscInt ival = asInt(restart)
 *         CHKERR( KSPGMRESSetRestart(self.ksp, ival) )             # <<<<<<<<<<<<<<
 * 
 *     # --- Python ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPGMRESSetRestart(__pyx_v_self->ksp, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 494, __pyx_L1_error)

  /* "PETSc/KSP.pyx":492
 *     # --- GMRES ---
 * 
 *     def setGMRESRestart(self, restart):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(restart)
 *         CHKERR( KSPGMRESSetRestart(self.ksp, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setGMRESRestart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":498
 *     # --- Python ---
 * 
 *     def createPython(self, context=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscKSP newksp = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_131createPython(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_130createPython[] = "KSP.createPython(self, context=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_131createPython(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createPython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_comm,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createPython") < 0)) __PYX_ERR(35, 498, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_context = values[0];
    __pyx_v_comm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createPython", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 498, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.createPython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_130createPython(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_context, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_130createPython(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  KSP __pyx_v_newksp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createPython", 0);

  /* "PETSc/KSP.pyx":499
 * 
 *     def createPython(self, context=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscKSP newksp = NULL
 *         CHKERR( KSPCreate(ccomm, &newksp) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(35, 499, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/KSP.pyx":500
 *     def createPython(self, context=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscKSP newksp = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( KSPCreate(ccomm, &newksp) )
 *         PetscCLEAR(self.obj); self.ksp = newksp
 */
  __pyx_v_newksp = NULL;

  /* "PETSc/KSP.pyx":501
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscKSP newksp = NULL
 *         CHKERR( KSPCreate(ccomm, &newksp) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.ksp = newksp
 *         CHKERR( KSPSetType(self.ksp, KSPPYTHON) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPCreate(__pyx_v_ccomm, (&__pyx_v_newksp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 501, __pyx_L1_error)

  /* "PETSc/KSP.pyx":502
 *         cdef PetscKSP newksp = NULL
 *         CHKERR( KSPCreate(ccomm, &newksp) )
 *         PetscCLEAR(self.obj); self.ksp = newksp             # <<<<<<<<<<<<<<
 *         CHKERR( KSPSetType(self.ksp, KSPPYTHON) )
 *         CHKERR( KSPPythonSetContext(self.ksp, <void*>context) )
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->ksp = __pyx_v_newksp;

  /* "PETSc/KSP.pyx":503
 *         CHKERR( KSPCreate(ccomm, &newksp) )
 *         PetscCLEAR(self.obj); self.ksp = newksp
 *         CHKERR( KSPSetType(self.ksp, KSPPYTHON) )             # <<<<<<<<<<<<<<
 *         CHKERR( KSPPythonSetContext(self.ksp, <void*>context) )
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetType(__pyx_v_self->ksp, KSPPYTHON)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 503, __pyx_L1_error)

  /* "PETSc/KSP.pyx":504
 *         PetscCLEAR(self.obj); self.ksp = newksp
 *         CHKERR( KSPSetType(self.ksp, KSPPYTHON) )
 *         CHKERR( KSPPythonSetContext(self.ksp, <void*>context) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPPythonSetContext(__pyx_v_self->ksp, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 504, __pyx_L1_error)

  /* "PETSc/KSP.pyx":505
 *         CHKERR( KSPSetType(self.ksp, KSPPYTHON) )
 *         CHKERR( KSPPythonSetContext(self.ksp, <void*>context) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setPythonContext(self, context):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":498
 *     # --- Python ---
 * 
 *     def createPython(self, context=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscKSP newksp = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.createPython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":507
 *         return self
 * 
 *     def setPythonContext(self, context):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPPythonSetContext(self.ksp, <void*>context) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_133setPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_132setPythonContext[] = "KSP.setPythonContext(self, context)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_133setPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPythonContext (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,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);
        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_context)) != 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, "setPythonContext") < 0)) __PYX_ERR(35, 507, __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_context = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPythonContext", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 507, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_132setPythonContext(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_context);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_132setPythonContext(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_context) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setPythonContext", 0);

  /* "PETSc/KSP.pyx":508
 * 
 *     def setPythonContext(self, context):
 *         CHKERR( KSPPythonSetContext(self.ksp, <void*>context) )             # <<<<<<<<<<<<<<
 * 
 *     def getPythonContext(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPPythonSetContext(__pyx_v_self->ksp, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 508, __pyx_L1_error)

  /* "PETSc/KSP.pyx":507
 *         return self
 * 
 *     def setPythonContext(self, context):             # <<<<<<<<<<<<<<
 *         CHKERR( KSPPythonSetContext(self.ksp, <void*>context) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":510
 *         CHKERR( KSPPythonSetContext(self.ksp, <void*>context) )
 * 
 *     def getPythonContext(self):             # <<<<<<<<<<<<<<
 *         cdef void *context = NULL
 *         CHKERR( KSPPythonGetContext(self.ksp, &context) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_135getPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_134getPythonContext[] = "KSP.getPythonContext(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_135getPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPythonContext (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getPythonContext", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getPythonContext", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_134getPythonContext(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_134getPythonContext(struct PyPetscKSPObject *__pyx_v_self) {
  void *__pyx_v_context;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getPythonContext", 0);

  /* "PETSc/KSP.pyx":511
 * 
 *     def getPythonContext(self):
 *         cdef void *context = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( KSPPythonGetContext(self.ksp, &context) )
 *         if context == NULL: return None
 */
  __pyx_v_context = NULL;

  /* "PETSc/KSP.pyx":512
 *     def getPythonContext(self):
 *         cdef void *context = NULL
 *         CHKERR( KSPPythonGetContext(self.ksp, &context) )             # <<<<<<<<<<<<<<
 *         if context == NULL: return None
 *         else: return <object> context
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPPythonGetContext(__pyx_v_self->ksp, (&__pyx_v_context))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(35, 512, __pyx_L1_error)

  /* "PETSc/KSP.pyx":513
 *         cdef void *context = NULL
 *         CHKERR( KSPPythonGetContext(self.ksp, &context) )
 *         if context == NULL: return None             # <<<<<<<<<<<<<<
 *         else: return <object> context
 * 
 */
  __pyx_t_2 = ((__pyx_v_context == NULL) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "PETSc/KSP.pyx":514
 *         CHKERR( KSPPythonGetContext(self.ksp, &context) )
 *         if context == NULL: return None
 *         else: return <object> context             # <<<<<<<<<<<<<<
 * 
 *     def setPythonType(self, py_type):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_context));
    __pyx_r = ((PyObject *)__pyx_v_context);
    goto __pyx_L0;
  }

  /* "PETSc/KSP.pyx":510
 *         CHKERR( KSPPythonSetContext(self.ksp, <void*>context) )
 * 
 *     def getPythonContext(self):             # <<<<<<<<<<<<<<
 *         cdef void *context = NULL
 *         CHKERR( KSPPythonGetContext(self.ksp, &context) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.getPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":516
 *         else: return <object> context
 * 
 *     def setPythonType(self, py_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_137setPythonType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3KSP_136setPythonType[] = "KSP.setPythonType(self, py_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_137setPythonType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_py_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPythonType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_py_type,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);
        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_py_type)) != 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, "setPythonType") < 0)) __PYX_ERR(35, 516, __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_py_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPythonType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(35, 516, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setPythonType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_136setPythonType(((struct PyPetscKSPObject *)__pyx_v_self), __pyx_v_py_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_136setPythonType(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_py_type) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setPythonType", 0);
  __Pyx_INCREF(__pyx_v_py_type);

  /* "PETSc/KSP.pyx":517
 * 
 *     def setPythonType(self, py_type):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         py_type = str2bytes(py_type, &cval)
 *         CHKERR( KSPPythonSetType(self.ksp, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/KSP.pyx":518
 *     def setPythonType(self, py_type):
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( KSPPythonSetType(self.ksp, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_py_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_py_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":519
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 *         CHKERR( KSPPythonSetType(self.ksp, cval) )             # <<<<<<<<<<<<<<
 * 
 *     # --- application context ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPPythonSetType(__pyx_v_self->ksp, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(35, 519, __pyx_L1_error)

  /* "PETSc/KSP.pyx":516
 *         else: return <object> context
 * 
 *     def setPythonType(self, py_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.setPythonType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":524
 * 
 *     property appctx:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getAppCtx()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_6appctx_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_6appctx_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_6appctx___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6appctx___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":525
 *     property appctx:
 *         def __get__(self):
 *             return self.getAppCtx()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setAppCtx(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getAppCtx); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 525, __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(35, 525, __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;

  /* "PETSc/KSP.pyx":524
 * 
 *     property appctx:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getAppCtx()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.appctx.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":526
 *         def __get__(self):
 *             return self.getAppCtx()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setAppCtx(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_6appctx_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_6appctx_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_6appctx_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_6appctx_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":527
 *             return self.getAppCtx()
 *         def __set__(self, value):
 *             self.setAppCtx(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- discretization space ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setAppCtx); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 527, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 527, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":526
 *         def __get__(self):
 *             return self.getAppCtx()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setAppCtx(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.appctx.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":532
 * 
 *     property dm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getDM()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_2dm_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_2dm_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_2dm___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_2dm___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":533
 *     property dm:
 *         def __get__(self):
 *             return self.getDM()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setDM(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getDM); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 533, __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(35, 533, __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;

  /* "PETSc/KSP.pyx":532
 * 
 *     property dm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getDM()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.dm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":534
 *         def __get__(self):
 *             return self.getDM()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setDM(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_2dm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_2dm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_2dm_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_2dm_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":535
 *             return self.getDM()
 *         def __set__(self, value):
 *             self.setDM(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- vectors ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setDM); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 535, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 535, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":534
 *         def __get__(self):
 *             return self.getDM()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setDM(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.dm.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":540
 * 
 *     property vec_sol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolution()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_7vec_sol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_7vec_sol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_7vec_sol___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_7vec_sol___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":541
 *     property vec_sol:
 *         def __get__(self):
 *             return self.getSolution()             # <<<<<<<<<<<<<<
 * 
 *     property vec_rhs:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSolution); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 541, __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(35, 541, __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;

  /* "PETSc/KSP.pyx":540
 * 
 *     property vec_sol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolution()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.vec_sol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":544
 * 
 *     property vec_rhs:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getRhs()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_7vec_rhs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_7vec_rhs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_7vec_rhs___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_7vec_rhs___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":545
 *     property vec_rhs:
 *         def __get__(self):
 *             return self.getRhs()             # <<<<<<<<<<<<<<
 * 
 *     # --- operators ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getRhs); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 545, __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(35, 545, __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;

  /* "PETSc/KSP.pyx":544
 * 
 *     property vec_rhs:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getRhs()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.vec_rhs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":550
 * 
 *     property mat_op:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOperators()[0]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_6mat_op_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_6mat_op_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_6mat_op___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6mat_op___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":551
 *     property mat_op:
 *         def __get__(self):
 *             return self.getOperators()[0]             # <<<<<<<<<<<<<<
 * 
 *     property mat_pc:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getOperators); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 551, __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(35, 551, __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(35, 551, __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;

  /* "PETSc/KSP.pyx":550
 * 
 *     property mat_op:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOperators()[0]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.mat_op.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":554
 * 
 *     property mat_pc:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOperators()[1]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_6mat_pc_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_6mat_pc_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_6mat_pc___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6mat_pc___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":555
 *     property mat_pc:
 *         def __get__(self):
 *             return self.getOperators()[1]             # <<<<<<<<<<<<<<
 * 
 *     # --- initial guess ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getOperators); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 555, __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(35, 555, __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, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 555, __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;

  /* "PETSc/KSP.pyx":554
 * 
 *     property mat_pc:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getOperators()[1]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.mat_pc.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":560
 * 
 *     property guess_nonzero:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getInitialGuessNonzero()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_13guess_nonzero_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_13guess_nonzero_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_13guess_nonzero___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_13guess_nonzero___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":561
 *     property guess_nonzero:
 *         def __get__(self):
 *             return self.getInitialGuessNonzero()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setInitialGuessNonzero(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getInitialGuessNonzero); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 561, __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(35, 561, __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;

  /* "PETSc/KSP.pyx":560
 * 
 *     property guess_nonzero:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getInitialGuessNonzero()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.guess_nonzero.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":562
 *         def __get__(self):
 *             return self.getInitialGuessNonzero()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setInitialGuessNonzero(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_13guess_nonzero_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_13guess_nonzero_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_13guess_nonzero_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_13guess_nonzero_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":563
 *             return self.getInitialGuessNonzero()
 *         def __set__(self, value):
 *             self.setInitialGuessNonzero(value)             # <<<<<<<<<<<<<<
 * 
 *     property guess_knoll:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setInitialGuessNonzero); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 563, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 563, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":562
 *         def __get__(self):
 *             return self.getInitialGuessNonzero()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setInitialGuessNonzero(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.guess_nonzero.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":566
 * 
 *     property guess_knoll:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getInitialGuessKnoll()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_11guess_knoll_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_11guess_knoll_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_11guess_knoll___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_11guess_knoll___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":567
 *     property guess_knoll:
 *         def __get__(self):
 *             return self.getInitialGuessKnoll()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setInitialGuessKnoll(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getInitialGuessKnoll); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 567, __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(35, 567, __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;

  /* "PETSc/KSP.pyx":566
 * 
 *     property guess_knoll:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getInitialGuessKnoll()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.guess_knoll.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":568
 *         def __get__(self):
 *             return self.getInitialGuessKnoll()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setInitialGuessKnoll(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_11guess_knoll_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_11guess_knoll_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_11guess_knoll_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_11guess_knoll_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":569
 *             return self.getInitialGuessKnoll()
 *         def __set__(self, value):
 *             self.setInitialGuessKnoll(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- preconditioner ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setInitialGuessKnoll); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 569, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 569, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":568
 *         def __get__(self):
 *             return self.getInitialGuessKnoll()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setInitialGuessKnoll(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.guess_knoll.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":574
 * 
 *     property pc:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getPC()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_2pc_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_2pc_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_2pc___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_2pc___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":575
 *     property pc:
 *         def __get__(self):
 *             return self.getPC()             # <<<<<<<<<<<<<<
 * 
 *     property pc_side:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getPC); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 575, __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(35, 575, __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;

  /* "PETSc/KSP.pyx":574
 * 
 *     property pc:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getPC()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.pc.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":578
 * 
 *     property pc_side:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getPCSide()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_7pc_side_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_7pc_side_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_7pc_side___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_7pc_side___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":579
 *     property pc_side:
 *         def __get__(self):
 *             return self.getPCSide()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setPCSide(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getPCSide); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 579, __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(35, 579, __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;

  /* "PETSc/KSP.pyx":578
 * 
 *     property pc_side:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getPCSide()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.pc_side.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":580
 *         def __get__(self):
 *             return self.getPCSide()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setPCSide(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_7pc_side_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_7pc_side_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_7pc_side_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_7pc_side_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":581
 *             return self.getPCSide()
 *         def __set__(self, value):
 *             self.setPCSide(value)             # <<<<<<<<<<<<<<
 * 
 *     property norm_type:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setPCSide); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 581, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 581, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":580
 *         def __get__(self):
 *             return self.getPCSide()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setPCSide(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.pc_side.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":584
 * 
 *     property norm_type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getNormType()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_9norm_type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_9norm_type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_9norm_type___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_9norm_type___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":585
 *     property norm_type:
 *         def __get__(self):
 *             return self.getNormType()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setNormType(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getNormType); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 585, __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(35, 585, __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;

  /* "PETSc/KSP.pyx":584
 * 
 *     property norm_type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getNormType()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.norm_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":586
 *         def __get__(self):
 *             return self.getNormType()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setNormType(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_9norm_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_9norm_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_9norm_type_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_9norm_type_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":587
 *             return self.getNormType()
 *         def __set__(self, value):
 *             self.setNormType(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- tolerances ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setNormType); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 587, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 587, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 587, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":586
 *         def __get__(self):
 *             return self.getNormType()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setNormType(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.norm_type.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":592
 * 
 *     property rtol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[0]
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_4rtol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_4rtol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_4rtol___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_4rtol___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":593
 *     property rtol:
 *         def __get__(self):
 *             return self.getTolerances()[0]             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setTolerances(rtol=value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 593, __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(35, 593, __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(35, 593, __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;

  /* "PETSc/KSP.pyx":592
 * 
 *     property rtol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[0]
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.rtol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":594
 *         def __get__(self):
 *             return self.getTolerances()[0]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(rtol=value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_4rtol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_4rtol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_4rtol_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_4rtol_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":595
 *             return self.getTolerances()[0]
 *         def __set__(self, value):
 *             self.setTolerances(rtol=value)             # <<<<<<<<<<<<<<
 * 
 *     property atol:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setTolerances); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_rtol, __pyx_v_value) < 0) __PYX_ERR(35, 595, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 595, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":594
 *         def __get__(self):
 *             return self.getTolerances()[0]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(rtol=value)
 * 
 */

  /* 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("petsc4py.PETSc.KSP.rtol.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":598
 * 
 *     property atol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[1]
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_4atol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_4atol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_4atol___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_4atol___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":599
 *     property atol:
 *         def __get__(self):
 *             return self.getTolerances()[1]             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setTolerances(atol=value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 599, __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(35, 599, __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, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 599, __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;

  /* "PETSc/KSP.pyx":598
 * 
 *     property atol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[1]
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.atol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":600
 *         def __get__(self):
 *             return self.getTolerances()[1]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(atol=value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_4atol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_4atol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_4atol_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_4atol_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":601
 *             return self.getTolerances()[1]
 *         def __set__(self, value):
 *             self.setTolerances(atol=value)             # <<<<<<<<<<<<<<
 * 
 *     property divtol:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setTolerances); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_atol, __pyx_v_value) < 0) __PYX_ERR(35, 601, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 601, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":600
 *         def __get__(self):
 *             return self.getTolerances()[1]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(atol=value)
 * 
 */

  /* 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("petsc4py.PETSc.KSP.atol.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":604
 * 
 *     property divtol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[2]
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_6divtol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_6divtol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_6divtol___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6divtol___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":605
 *     property divtol:
 *         def __get__(self):
 *             return self.getTolerances()[2]             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setTolerances(divtol=value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 605, __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(35, 605, __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, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 605, __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;

  /* "PETSc/KSP.pyx":604
 * 
 *     property divtol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[2]
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.divtol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":606
 *         def __get__(self):
 *             return self.getTolerances()[2]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(divtol=value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_6divtol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_6divtol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_6divtol_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_6divtol_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":607
 *             return self.getTolerances()[2]
 *         def __set__(self, value):
 *             self.setTolerances(divtol=value)             # <<<<<<<<<<<<<<
 * 
 *     property max_it:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setTolerances); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_divtol, __pyx_v_value) < 0) __PYX_ERR(35, 607, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 607, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":606
 *         def __get__(self):
 *             return self.getTolerances()[2]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(divtol=value)
 * 
 */

  /* 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("petsc4py.PETSc.KSP.divtol.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":610
 * 
 *     property max_it:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[3]
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_6max_it_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_6max_it_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_6max_it___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6max_it___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":611
 *     property max_it:
 *         def __get__(self):
 *             return self.getTolerances()[3]             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setTolerances(max_it=value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 611, __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(35, 611, __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, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 611, __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;

  /* "PETSc/KSP.pyx":610
 * 
 *     property max_it:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[3]
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.max_it.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":612
 *         def __get__(self):
 *             return self.getTolerances()[3]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(max_it=value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_6max_it_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_6max_it_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_6max_it_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_6max_it_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":613
 *             return self.getTolerances()[3]
 *         def __set__(self, value):
 *             self.setTolerances(max_it=value)             # <<<<<<<<<<<<<<
 * 
 *     # --- iteration ---
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setTolerances); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_max_it, __pyx_v_value) < 0) __PYX_ERR(35, 613, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 613, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/KSP.pyx":612
 *         def __get__(self):
 *             return self.getTolerances()[3]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(max_it=value)
 * 
 */

  /* 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("petsc4py.PETSc.KSP.max_it.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":618
 * 
 *     property its:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getIterationNumber()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_3its_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_3its_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_3its___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_3its___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":619
 *     property its:
 *         def __get__(self):
 *             return self.getIterationNumber()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setIterationNumber(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getIterationNumber); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 619, __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(35, 619, __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;

  /* "PETSc/KSP.pyx":618
 * 
 *     property its:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getIterationNumber()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.its.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":620
 *         def __get__(self):
 *             return self.getIterationNumber()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setIterationNumber(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_3its_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_3its_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_3its_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_3its_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":621
 *             return self.getIterationNumber()
 *         def __set__(self, value):
 *             self.setIterationNumber(value)             # <<<<<<<<<<<<<<
 * 
 *     property norm:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setIterationNumber); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 621, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 621, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":620
 *         def __get__(self):
 *             return self.getIterationNumber()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setIterationNumber(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.its.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":624
 * 
 *     property norm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getResidualNorm()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_4norm_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_4norm_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_4norm___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_4norm___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":625
 *     property norm:
 *         def __get__(self):
 *             return self.getResidualNorm()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setResidualNorm(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getResidualNorm); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 625, __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(35, 625, __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;

  /* "PETSc/KSP.pyx":624
 * 
 *     property norm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getResidualNorm()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.norm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":626
 *         def __get__(self):
 *             return self.getResidualNorm()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setResidualNorm(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_4norm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_4norm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_4norm_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_4norm_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":627
 *             return self.getResidualNorm()
 *         def __set__(self, value):
 *             self.setResidualNorm(value)             # <<<<<<<<<<<<<<
 * 
 *     property history:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setResidualNorm); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 627, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 627, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 627, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":626
 *         def __get__(self):
 *             return self.getResidualNorm()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setResidualNorm(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.norm.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":630
 * 
 *     property history:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConvergenceHistory()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_7history_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_7history_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_7history___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_7history___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":631
 *     property history:
 *         def __get__(self):
 *             return self.getConvergenceHistory()             # <<<<<<<<<<<<<<
 * 
 *     # --- convergence ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getConvergenceHistory); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 631, __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(35, 631, __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;

  /* "PETSc/KSP.pyx":630
 * 
 *     property history:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConvergenceHistory()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.history.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":636
 * 
 *     property reason:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConvergedReason()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_6reason_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_6reason_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_6reason___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_6reason___get__(struct PyPetscKSPObject *__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);

  /* "PETSc/KSP.pyx":637
 *     property reason:
 *         def __get__(self):
 *             return self.getConvergedReason()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setConvergedReason(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getConvergedReason); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(35, 637, __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(35, 637, __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;

  /* "PETSc/KSP.pyx":636
 * 
 *     property reason:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConvergedReason()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.reason.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":638
 *         def __get__(self):
 *             return self.getConvergedReason()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setConvergedReason(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3KSP_6reason_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3KSP_6reason_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_6reason_2__set__(((struct PyPetscKSPObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3KSP_6reason_2__set__(struct PyPetscKSPObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/KSP.pyx":639
 *             return self.getConvergedReason()
 *         def __set__(self, value):
 *             self.setConvergedReason(value)             # <<<<<<<<<<<<<<
 * 
 *     property iterating:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setConvergedReason); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 639, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 639, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/KSP.pyx":638
 *         def __get__(self):
 *             return self.getConvergedReason()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setConvergedReason(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.reason.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":642
 * 
 *     property iterating:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason == 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_9iterating_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_9iterating_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_9iterating___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_9iterating___get__(struct PyPetscKSPObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/KSP.pyx":643
 *     property iterating:
 *         def __get__(self):
 *             return self.reason == 0             # <<<<<<<<<<<<<<
 * 
 *     property converged:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reason); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 643, __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;

  /* "PETSc/KSP.pyx":642
 * 
 *     property iterating:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason == 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.iterating.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":646
 * 
 *     property converged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason > 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_9converged_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_9converged_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_9converged___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_9converged___get__(struct PyPetscKSPObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/KSP.pyx":647
 *     property converged:
 *         def __get__(self):
 *             return self.reason > 0             # <<<<<<<<<<<<<<
 * 
 *     property diverged:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reason); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 647, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":646
 * 
 *     property converged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason > 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.converged.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/KSP.pyx":650
 * 
 *     property diverged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason < 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_8diverged_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3KSP_8diverged_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3KSP_8diverged___get__(((struct PyPetscKSPObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3KSP_8diverged___get__(struct PyPetscKSPObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/KSP.pyx":651
 *     property diverged:
 *         def __get__(self):
 *             return self.reason < 0             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reason); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(35, 651, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/KSP.pyx":650
 * 
 *     property diverged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason < 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.KSP.diverged.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":69
 *     # --- xxx ---
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj  = <PetscObject*> &self.snes
 *         self.snes = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES___cinit__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES___cinit__(struct PyPetscSNESObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/SNES.pyx":70
 * 
 *     def __cinit__(self):
 *         self.obj  = <PetscObject*> &self.snes             # <<<<<<<<<<<<<<
 *         self.snes = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->snes));

  /* "PETSc/SNES.pyx":71
 *     def __cinit__(self):
 *         self.obj  = <PetscObject*> &self.snes
 *         self.snes = NULL             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __pyx_v_self->snes = NULL;

  /* "PETSc/SNES.pyx":69
 *     # --- xxx ---
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj  = <PetscObject*> &self.snes
 *         self.snes = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":75
 *     # --- xxx ---
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_3view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_2view[] = "SNES.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_3view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(36, 75, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 75, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(36, 75, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_2view(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_viewer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_2view(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_cviewer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/SNES.pyx":76
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer cviewer = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: cviewer = viewer.vwr
 *         CHKERR( SNESView(self.snes, cviewer) )
 */
  __pyx_v_cviewer = NULL;

  /* "PETSc/SNES.pyx":77
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( SNESView(self.snes, cviewer) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_cviewer = __pyx_t_3;
  }

  /* "PETSc/SNES.pyx":78
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 *         CHKERR( SNESView(self.snes, cviewer) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESView(__pyx_v_self->snes, __pyx_v_cviewer)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 78, __pyx_L1_error)

  /* "PETSc/SNES.pyx":75
 *     # --- xxx ---
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":80
 *         CHKERR( SNESView(self.snes, cviewer) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESDestroy(&self.snes) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_5destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_4destroy[] = "SNES.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_5destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_4destroy(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_4destroy(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/SNES.pyx":81
 * 
 *     def destroy(self):
 *         CHKERR( SNESDestroy(&self.snes) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESDestroy((&__pyx_v_self->snes))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 81, __pyx_L1_error)

  /* "PETSc/SNES.pyx":82
 *     def destroy(self):
 *         CHKERR( SNESDestroy(&self.snes) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":80
 *         CHKERR( SNESView(self.snes, cviewer) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESDestroy(&self.snes) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":84
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSNES newsnes = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_7create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_6create[] = "SNES.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_7create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(36, 84, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 84, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6create(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6create(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  SNES __pyx_v_newsnes;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/SNES.pyx":85
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscSNES newsnes = NULL
 *         CHKERR( SNESCreate(ccomm, &newsnes) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(36, 85, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/SNES.pyx":86
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSNES newsnes = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( SNESCreate(ccomm, &newsnes) )
 *         PetscCLEAR(self.obj); self.snes = newsnes
 */
  __pyx_v_newsnes = NULL;

  /* "PETSc/SNES.pyx":87
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSNES newsnes = NULL
 *         CHKERR( SNESCreate(ccomm, &newsnes) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.snes = newsnes
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESCreate(__pyx_v_ccomm, (&__pyx_v_newsnes))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 87, __pyx_L1_error)

  /* "PETSc/SNES.pyx":88
 *         cdef PetscSNES newsnes = NULL
 *         CHKERR( SNESCreate(ccomm, &newsnes) )
 *         PetscCLEAR(self.obj); self.snes = newsnes             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->snes = __pyx_v_newsnes;

  /* "PETSc/SNES.pyx":89
 *         CHKERR( SNESCreate(ccomm, &newsnes) )
 *         PetscCLEAR(self.obj); self.snes = newsnes
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, snes_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":84
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSNES newsnes = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":91
 *         return self
 * 
 *     def setType(self, snes_type):             # <<<<<<<<<<<<<<
 *         cdef PetscSNESType cval = NULL
 *         snes_type = str2bytes(snes_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_9setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_8setType[] = "SNES.setType(self, snes_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_9setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_snes_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_snes_type,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);
        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_snes_type)) != 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, "setType") < 0)) __PYX_ERR(36, 91, __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_snes_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 91, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_8setType(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_snes_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_8setType(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_snes_type) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_snes_type);

  /* "PETSc/SNES.pyx":92
 * 
 *     def setType(self, snes_type):
 *         cdef PetscSNESType cval = NULL             # <<<<<<<<<<<<<<
 *         snes_type = str2bytes(snes_type, &cval)
 *         CHKERR( SNESSetType(self.snes, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/SNES.pyx":93
 *     def setType(self, snes_type):
 *         cdef PetscSNESType cval = NULL
 *         snes_type = str2bytes(snes_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetType(self.snes, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_snes_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_snes_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":94
 *         cdef PetscSNESType cval = NULL
 *         snes_type = str2bytes(snes_type, &cval)
 *         CHKERR( SNESSetType(self.snes, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetType(__pyx_v_self->snes, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 94, __pyx_L1_error)

  /* "PETSc/SNES.pyx":91
 *         return self
 * 
 *     def setType(self, snes_type):             # <<<<<<<<<<<<<<
 *         cdef PetscSNESType cval = NULL
 *         snes_type = str2bytes(snes_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_snes_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":96
 *         CHKERR( SNESSetType(self.snes, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscSNESType cval = NULL
 *         CHKERR( SNESGetType(self.snes, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_11getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_10getType[] = "SNES.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_11getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_10getType(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_10getType(struct PyPetscSNESObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/SNES.pyx":97
 * 
 *     def getType(self):
 *         cdef PetscSNESType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetType(self.snes, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/SNES.pyx":98
 *     def getType(self):
 *         cdef PetscSNESType cval = NULL
 *         CHKERR( SNESGetType(self.snes, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetType(__pyx_v_self->snes, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 98, __pyx_L1_error)

  /* "PETSc/SNES.pyx":99
 *         cdef PetscSNESType cval = NULL
 *         CHKERR( SNESGetType(self.snes, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setOptionsPrefix(self, prefix):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":96
 *         CHKERR( SNESSetType(self.snes, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscSNESType cval = NULL
 *         CHKERR( SNESGetType(self.snes, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":101
 *         return bytes2str(cval)
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_13setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_12setOptionsPrefix[] = "SNES.setOptionsPrefix(self, prefix)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_13setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOptionsPrefix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,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);
        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_prefix)) != 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, "setOptionsPrefix") < 0)) __PYX_ERR(36, 101, __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_prefix = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOptionsPrefix", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 101, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_12setOptionsPrefix(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_prefix);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_12setOptionsPrefix(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setOptionsPrefix", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "PETSc/SNES.pyx":102
 * 
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( SNESSetOptionsPrefix(self.snes, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/SNES.pyx":103
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetOptionsPrefix(self.snes, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_prefix, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":104
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( SNESSetOptionsPrefix(self.snes, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getOptionsPrefix(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetOptionsPrefix(__pyx_v_self->snes, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 104, __pyx_L1_error)

  /* "PETSc/SNES.pyx":101
 *         return bytes2str(cval)
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":106
 *         CHKERR( SNESSetOptionsPrefix(self.snes, cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( SNESGetOptionsPrefix(self.snes, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_15getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_14getOptionsPrefix[] = "SNES.getOptionsPrefix(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_15getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOptionsPrefix (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOptionsPrefix", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOptionsPrefix", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_14getOptionsPrefix(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_14getOptionsPrefix(struct PyPetscSNESObject *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getOptionsPrefix", 0);

  /* "PETSc/SNES.pyx":107
 * 
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetOptionsPrefix(self.snes, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/SNES.pyx":108
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( SNESGetOptionsPrefix(self.snes, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetOptionsPrefix(__pyx_v_self->snes, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 108, __pyx_L1_error)

  /* "PETSc/SNES.pyx":109
 *         cdef const_char *cval = NULL
 *         CHKERR( SNESGetOptionsPrefix(self.snes, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":106
 *         CHKERR( SNESSetOptionsPrefix(self.snes, cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( SNESGetOptionsPrefix(self.snes, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":111
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetFromOptions(self.snes) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_17setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_16setFromOptions[] = "SNES.setFromOptions(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_17setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_16setFromOptions(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_16setFromOptions(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/SNES.pyx":112
 * 
 *     def setFromOptions(self):
 *         CHKERR( SNESSetFromOptions(self.snes) )             # <<<<<<<<<<<<<<
 * 
 *     # --- application context ---
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetFromOptions(__pyx_v_self->snes)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 112, __pyx_L1_error)

  /* "PETSc/SNES.pyx":111
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetFromOptions(self.snes) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":116
 *     # --- application context ---
 * 
 *     def setAppCtx(self, appctx):             # <<<<<<<<<<<<<<
 *         self.set_attr('__appctx__', appctx)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_19setAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_18setAppCtx[] = "SNES.setAppCtx(self, appctx)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_19setAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_appctx = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setAppCtx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_appctx,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);
        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_appctx)) != 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, "setAppCtx") < 0)) __PYX_ERR(36, 116, __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_appctx = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setAppCtx", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 116, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_18setAppCtx(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_appctx);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_18setAppCtx(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_appctx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setAppCtx", 0);

  /* "PETSc/SNES.pyx":117
 * 
 *     def setAppCtx(self, appctx):
 *         self.set_attr('__appctx__', appctx)             # <<<<<<<<<<<<<<
 * 
 *     def getAppCtx(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__appctx__"), __pyx_v_appctx); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":116
 *     # --- application context ---
 * 
 *     def setAppCtx(self, appctx):             # <<<<<<<<<<<<<<
 *         self.set_attr('__appctx__', appctx)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":119
 *         self.set_attr('__appctx__', appctx)
 * 
 *     def getAppCtx(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__appctx__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_21getAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_20getAppCtx[] = "SNES.getAppCtx(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_21getAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getAppCtx (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getAppCtx", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getAppCtx", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_20getAppCtx(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_20getAppCtx(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getAppCtx", 0);

  /* "PETSc/SNES.pyx":120
 * 
 *     def getAppCtx(self):
 *         return self.get_attr('__appctx__')             # <<<<<<<<<<<<<<
 * 
 *     # --- discretization space ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__appctx__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":119
 *         self.set_attr('__appctx__', appctx)
 * 
 *     def getAppCtx(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__appctx__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":124
 *     # --- discretization space ---
 * 
 *     def getDM(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( SNESGetDM(self.snes, &newdm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_23getDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_22getDM[] = "SNES.getDM(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_23getDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDM (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDM", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDM", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_22getDM(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_22getDM(struct PyPetscSNESObject *__pyx_v_self) {
  DM __pyx_v_newdm;
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getDM", 0);

  /* "PETSc/SNES.pyx":125
 * 
 *     def getDM(self):
 *         cdef PetscDM newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetDM(self.snes, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/SNES.pyx":126
 *     def getDM(self):
 *         cdef PetscDM newdm = NULL
 *         CHKERR( SNESGetDM(self.snes, &newdm) )             # <<<<<<<<<<<<<<
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetDM(__pyx_v_self->snes, (&__pyx_v_newdm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 126, __pyx_L1_error)

  /* "PETSc/SNES.pyx":127
 *         cdef PetscDM newdm = NULL
 *         CHKERR( SNESGetDM(self.snes, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()             # <<<<<<<<<<<<<<
 *         dm.dm = newdm
 *         PetscINCREF(dm.obj)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_newdm)); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(36, 127, __pyx_L1_error)
  __pyx_v_dm = ((struct PyPetscDMObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":128
 *         CHKERR( SNESGetDM(self.snes, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm             # <<<<<<<<<<<<<<
 *         PetscINCREF(dm.obj)
 *         return dm
 */
  __pyx_v_dm->dm = __pyx_v_newdm;

  /* "PETSc/SNES.pyx":129
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm
 *         PetscINCREF(dm.obj)             # <<<<<<<<<<<<<<
 *         return dm
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_dm->__pyx_base.obj);

  /* "PETSc/SNES.pyx":130
 *         dm.dm = newdm
 *         PetscINCREF(dm.obj)
 *         return dm             # <<<<<<<<<<<<<<
 * 
 *     def setDM(self, DM dm not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dm));
  __pyx_r = ((PyObject *)__pyx_v_dm);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":124
 *     # --- discretization space ---
 * 
 *     def getDM(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( SNESGetDM(self.snes, &newdm) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":132
 *         return dm
 * 
 *     def setDM(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetDM(self.snes, dm.dm) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_25setDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_24setDM[] = "SNES.setDM(self, DM dm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_25setDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDM (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dm,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);
        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_dm)) != 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, "setDM") < 0)) __PYX_ERR(36, 132, __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_dm = ((struct PyPetscDMObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDM", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 132, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_8petsc4py_5PETSc_DM, 0, "dm", 0))) __PYX_ERR(36, 132, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_24setDM(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_dm);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_24setDM(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setDM", 0);

  /* "PETSc/SNES.pyx":133
 * 
 *     def setDM(self, DM dm not None):
 *         CHKERR( SNESSetDM(self.snes, dm.dm) )             # <<<<<<<<<<<<<<
 * 
 *     # --- FAS ---
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetDM(__pyx_v_self->snes, __pyx_v_dm->dm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 133, __pyx_L1_error)

  /* "PETSc/SNES.pyx":132
 *         return dm
 * 
 *     def setDM(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetDM(self.snes, dm.dm) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":136
 * 
 *     # --- FAS ---
 *     def setFASInterpolation(self, level, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( SNESFASSetInterpolation(self.snes, clevel, mat.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_27setFASInterpolation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_26setFASInterpolation[] = "SNES.setFASInterpolation(self, level, Mat mat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_27setFASInterpolation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFASInterpolation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_mat,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_level)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mat)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFASInterpolation", 1, 2, 2, 1); __PYX_ERR(36, 136, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFASInterpolation") < 0)) __PYX_ERR(36, 136, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_level = values[0];
    __pyx_v_mat = ((struct PyPetscMatObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFASInterpolation", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 136, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFASInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(36, 136, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_26setFASInterpolation(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_level, __pyx_v_mat);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_26setFASInterpolation(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscMatObject *__pyx_v_mat) {
  PetscInt __pyx_v_clevel;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFASInterpolation", 0);

  /* "PETSc/SNES.pyx":137
 *     # --- FAS ---
 *     def setFASInterpolation(self, level, Mat mat not None):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASSetInterpolation(self.snes, clevel, mat.mat) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 137, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/SNES.pyx":138
 *     def setFASInterpolation(self, level, Mat mat not None):
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( SNESFASSetInterpolation(self.snes, clevel, mat.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def getFASInterpolation(self, level):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASSetInterpolation(__pyx_v_self->snes, __pyx_v_clevel, __pyx_v_mat->mat)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 138, __pyx_L1_error)

  /* "PETSc/SNES.pyx":136
 * 
 *     # --- FAS ---
 *     def setFASInterpolation(self, level, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( SNESFASSetInterpolation(self.snes, clevel, mat.mat) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFASInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":140
 *         CHKERR( SNESFASSetInterpolation(self.snes, clevel, mat.mat) )
 * 
 *     def getFASInterpolation(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat mat = Mat()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_29getFASInterpolation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_28getFASInterpolation[] = "SNES.getFASInterpolation(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_29getFASInterpolation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFASInterpolation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getFASInterpolation") < 0)) __PYX_ERR(36, 140, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFASInterpolation", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 140, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_28getFASInterpolation(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_28getFASInterpolation(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getFASInterpolation", 0);

  /* "PETSc/SNES.pyx":141
 * 
 *     def getFASInterpolation(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef Mat mat = Mat()
 *         CHKERR( SNESFASGetInterpolation(self.snes, clevel, &mat.mat) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 141, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/SNES.pyx":142
 *     def getFASInterpolation(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat mat = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASGetInterpolation(self.snes, clevel, &mat.mat) )
 *         PetscINCREF(mat.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/SNES.pyx":143
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat mat = Mat()
 *         CHKERR( SNESFASGetInterpolation(self.snes, clevel, &mat.mat) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(mat.obj)
 *         return mat
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASGetInterpolation(__pyx_v_self->snes, __pyx_v_clevel, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(36, 143, __pyx_L1_error)

  /* "PETSc/SNES.pyx":144
 *         cdef Mat mat = Mat()
 *         CHKERR( SNESFASGetInterpolation(self.snes, clevel, &mat.mat) )
 *         PetscINCREF(mat.obj)             # <<<<<<<<<<<<<<
 *         return mat
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_mat->__pyx_base.obj);

  /* "PETSc/SNES.pyx":145
 *         CHKERR( SNESFASGetInterpolation(self.snes, clevel, &mat.mat) )
 *         PetscINCREF(mat.obj)
 *         return mat             # <<<<<<<<<<<<<<
 * 
 *     def setFASRestriction(self, level, Mat mat not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = ((PyObject *)__pyx_v_mat);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":140
 *         CHKERR( SNESFASSetInterpolation(self.snes, clevel, mat.mat) )
 * 
 *     def getFASInterpolation(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat mat = Mat()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":147
 *         return mat
 * 
 *     def setFASRestriction(self, level, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( SNESFASSetRestriction(self.snes, clevel, mat.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_31setFASRestriction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_30setFASRestriction[] = "SNES.setFASRestriction(self, level, Mat mat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_31setFASRestriction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFASRestriction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_mat,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_level)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mat)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFASRestriction", 1, 2, 2, 1); __PYX_ERR(36, 147, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFASRestriction") < 0)) __PYX_ERR(36, 147, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_level = values[0];
    __pyx_v_mat = ((struct PyPetscMatObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFASRestriction", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 147, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFASRestriction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(36, 147, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_30setFASRestriction(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_level, __pyx_v_mat);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_30setFASRestriction(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscMatObject *__pyx_v_mat) {
  PetscInt __pyx_v_clevel;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFASRestriction", 0);

  /* "PETSc/SNES.pyx":148
 * 
 *     def setFASRestriction(self, level, Mat mat not None):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASSetRestriction(self.snes, clevel, mat.mat) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 148, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/SNES.pyx":149
 *     def setFASRestriction(self, level, Mat mat not None):
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( SNESFASSetRestriction(self.snes, clevel, mat.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def getFASRestriction(self, level):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASSetRestriction(__pyx_v_self->snes, __pyx_v_clevel, __pyx_v_mat->mat)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 149, __pyx_L1_error)

  /* "PETSc/SNES.pyx":147
 *         return mat
 * 
 *     def setFASRestriction(self, level, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( SNESFASSetRestriction(self.snes, clevel, mat.mat) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFASRestriction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":151
 *         CHKERR( SNESFASSetRestriction(self.snes, clevel, mat.mat) )
 * 
 *     def getFASRestriction(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat mat = Mat()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_33getFASRestriction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_32getFASRestriction[] = "SNES.getFASRestriction(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_33getFASRestriction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFASRestriction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getFASRestriction") < 0)) __PYX_ERR(36, 151, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFASRestriction", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 151, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASRestriction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_32getFASRestriction(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_32getFASRestriction(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getFASRestriction", 0);

  /* "PETSc/SNES.pyx":152
 * 
 *     def getFASRestriction(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef Mat mat = Mat()
 *         CHKERR( SNESFASGetRestriction(self.snes, clevel, &mat.mat) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 152, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/SNES.pyx":153
 *     def getFASRestriction(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat mat = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASGetRestriction(self.snes, clevel, &mat.mat) )
 *         PetscINCREF(mat.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/SNES.pyx":154
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat mat = Mat()
 *         CHKERR( SNESFASGetRestriction(self.snes, clevel, &mat.mat) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(mat.obj)
 *         return mat
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASGetRestriction(__pyx_v_self->snes, __pyx_v_clevel, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(36, 154, __pyx_L1_error)

  /* "PETSc/SNES.pyx":155
 *         cdef Mat mat = Mat()
 *         CHKERR( SNESFASGetRestriction(self.snes, clevel, &mat.mat) )
 *         PetscINCREF(mat.obj)             # <<<<<<<<<<<<<<
 *         return mat
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_mat->__pyx_base.obj);

  /* "PETSc/SNES.pyx":156
 *         CHKERR( SNESFASGetRestriction(self.snes, clevel, &mat.mat) )
 *         PetscINCREF(mat.obj)
 *         return mat             # <<<<<<<<<<<<<<
 * 
 *     def setFASInjection(self, level, Mat mat not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = ((PyObject *)__pyx_v_mat);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":151
 *         CHKERR( SNESFASSetRestriction(self.snes, clevel, mat.mat) )
 * 
 *     def getFASRestriction(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat mat = Mat()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASRestriction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":158
 *         return mat
 * 
 *     def setFASInjection(self, level, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( SNESFASSetInjection(self.snes, clevel, mat.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_35setFASInjection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_34setFASInjection[] = "SNES.setFASInjection(self, level, Mat mat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_35setFASInjection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFASInjection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_mat,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_level)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mat)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFASInjection", 1, 2, 2, 1); __PYX_ERR(36, 158, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFASInjection") < 0)) __PYX_ERR(36, 158, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_level = values[0];
    __pyx_v_mat = ((struct PyPetscMatObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFASInjection", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 158, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFASInjection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(36, 158, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_34setFASInjection(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_level, __pyx_v_mat);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_34setFASInjection(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscMatObject *__pyx_v_mat) {
  PetscInt __pyx_v_clevel;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFASInjection", 0);

  /* "PETSc/SNES.pyx":159
 * 
 *     def setFASInjection(self, level, Mat mat not None):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASSetInjection(self.snes, clevel, mat.mat) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 159, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/SNES.pyx":160
 *     def setFASInjection(self, level, Mat mat not None):
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( SNESFASSetInjection(self.snes, clevel, mat.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def getFASInjection(self, level):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASSetInjection(__pyx_v_self->snes, __pyx_v_clevel, __pyx_v_mat->mat)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 160, __pyx_L1_error)

  /* "PETSc/SNES.pyx":158
 *         return mat
 * 
 *     def setFASInjection(self, level, Mat mat not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( SNESFASSetInjection(self.snes, clevel, mat.mat) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFASInjection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":162
 *         CHKERR( SNESFASSetInjection(self.snes, clevel, mat.mat) )
 * 
 *     def getFASInjection(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat mat = Mat()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_37getFASInjection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_36getFASInjection[] = "SNES.getFASInjection(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_37getFASInjection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFASInjection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getFASInjection") < 0)) __PYX_ERR(36, 162, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFASInjection", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 162, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASInjection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_36getFASInjection(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_36getFASInjection(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getFASInjection", 0);

  /* "PETSc/SNES.pyx":163
 * 
 *     def getFASInjection(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef Mat mat = Mat()
 *         CHKERR( SNESFASGetInjection(self.snes, clevel, &mat.mat) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 163, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/SNES.pyx":164
 *     def getFASInjection(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat mat = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASGetInjection(self.snes, clevel, &mat.mat) )
 *         PetscINCREF(mat.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/SNES.pyx":165
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat mat = Mat()
 *         CHKERR( SNESFASGetInjection(self.snes, clevel, &mat.mat) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(mat.obj)
 *         return mat
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASGetInjection(__pyx_v_self->snes, __pyx_v_clevel, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(36, 165, __pyx_L1_error)

  /* "PETSc/SNES.pyx":166
 *         cdef Mat mat = Mat()
 *         CHKERR( SNESFASGetInjection(self.snes, clevel, &mat.mat) )
 *         PetscINCREF(mat.obj)             # <<<<<<<<<<<<<<
 *         return mat
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_mat->__pyx_base.obj);

  /* "PETSc/SNES.pyx":167
 *         CHKERR( SNESFASGetInjection(self.snes, clevel, &mat.mat) )
 *         PetscINCREF(mat.obj)
 *         return mat             # <<<<<<<<<<<<<<
 * 
 *     def setFASRScale(self, level, Vec vec not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = ((PyObject *)__pyx_v_mat);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":162
 *         CHKERR( SNESFASSetInjection(self.snes, clevel, mat.mat) )
 * 
 *     def getFASInjection(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef Mat mat = Mat()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASInjection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":169
 *         return mat
 * 
 *     def setFASRScale(self, level, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( SNESFASSetRScale(self.snes, clevel, vec.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_39setFASRScale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_38setFASRScale[] = "SNES.setFASRScale(self, level, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_39setFASRScale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFASRScale (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_vec,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_level)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFASRScale", 1, 2, 2, 1); __PYX_ERR(36, 169, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFASRScale") < 0)) __PYX_ERR(36, 169, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_level = values[0];
    __pyx_v_vec = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFASRScale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 169, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFASRScale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(36, 169, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_38setFASRScale(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_level, __pyx_v_vec);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_38setFASRScale(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level, struct PyPetscVecObject *__pyx_v_vec) {
  PetscInt __pyx_v_clevel;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setFASRScale", 0);

  /* "PETSc/SNES.pyx":170
 * 
 *     def setFASRScale(self, level, Vec vec not None):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASSetRScale(self.snes, clevel, vec.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 170, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/SNES.pyx":171
 *     def setFASRScale(self, level, Vec vec not None):
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( SNESFASSetRScale(self.snes, clevel, vec.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def setFASLevels(self, levels, comms=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASSetRScale(__pyx_v_self->snes, __pyx_v_clevel, __pyx_v_vec->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 171, __pyx_L1_error)

  /* "PETSc/SNES.pyx":169
 *         return mat
 * 
 *     def setFASRScale(self, level, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         CHKERR( SNESFASSetRScale(self.snes, clevel, vec.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFASRScale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":173
 *         CHKERR( SNESFASSetRScale(self.snes, clevel, vec.vec) )
 * 
 *     def setFASLevels(self, levels, comms=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevels = asInt(levels)
 *         cdef MPI_Comm *ccomms = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_41setFASLevels(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_40setFASLevels[] = "SNES.setFASLevels(self, levels, comms=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_41setFASLevels(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_levels = 0;
  PyObject *__pyx_v_comms = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFASLevels (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_levels,&__pyx_n_s_comms,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_levels)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comms);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFASLevels") < 0)) __PYX_ERR(36, 173, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_levels = values[0];
    __pyx_v_comms = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFASLevels", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 173, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFASLevels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_40setFASLevels(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_levels, __pyx_v_comms);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_40setFASLevels(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_levels, PyObject *__pyx_v_comms) {
  PetscInt __pyx_v_clevels;
  MPI_Comm *__pyx_v_ccomms;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_comm = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  MPI_Comm __pyx_t_10;
  int __pyx_t_11;
  char const *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_t_19;
  __Pyx_RefNannySetupContext("setFASLevels", 0);

  /* "PETSc/SNES.pyx":174
 * 
 *     def setFASLevels(self, levels, comms=None):
 *         cdef PetscInt clevels = asInt(levels)             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm *ccomms = NULL
 *         cdef Py_ssize_t i = 0
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_levels); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 174, __pyx_L1_error)
  __pyx_v_clevels = __pyx_t_1;

  /* "PETSc/SNES.pyx":175
 *     def setFASLevels(self, levels, comms=None):
 *         cdef PetscInt clevels = asInt(levels)
 *         cdef MPI_Comm *ccomms = NULL             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i = 0
 *         if comms is not None:
 */
  __pyx_v_ccomms = NULL;

  /* "PETSc/SNES.pyx":176
 *         cdef PetscInt clevels = asInt(levels)
 *         cdef MPI_Comm *ccomms = NULL
 *         cdef Py_ssize_t i = 0             # <<<<<<<<<<<<<<
 *         if comms is not None:
 *             if clevels != <PetscInt>len(comms):
 */
  __pyx_v_i = 0;

  /* "PETSc/SNES.pyx":177
 *         cdef MPI_Comm *ccomms = NULL
 *         cdef Py_ssize_t i = 0
 *         if comms is not None:             # <<<<<<<<<<<<<<
 *             if clevels != <PetscInt>len(comms):
 *                 raise ValueError("Must provide as many communicators as levels")
 */
  __pyx_t_2 = (__pyx_v_comms != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/SNES.pyx":178
 *         cdef Py_ssize_t i = 0
 *         if comms is not None:
 *             if clevels != <PetscInt>len(comms):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Must provide as many communicators as levels")
 *             CHKERR( PetscMalloc(sizeof(MPI_Comm)*<size_t>clevels, &ccomms) )
 */
    __pyx_t_4 = PyObject_Length(__pyx_v_comms); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 178, __pyx_L1_error)
    __pyx_t_3 = ((__pyx_v_clevels != ((PetscInt)__pyx_t_4)) != 0);
    if (__pyx_t_3) {

      /* "PETSc/SNES.pyx":179
 *         if comms is not None:
 *             if clevels != <PetscInt>len(comms):
 *                 raise ValueError("Must provide as many communicators as levels")             # <<<<<<<<<<<<<<
 *             CHKERR( PetscMalloc(sizeof(MPI_Comm)*<size_t>clevels, &ccomms) )
 *             try:
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(36, 179, __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(36, 179, __pyx_L1_error)

      /* "PETSc/SNES.pyx":178
 *         cdef Py_ssize_t i = 0
 *         if comms is not None:
 *             if clevels != <PetscInt>len(comms):             # <<<<<<<<<<<<<<
 *                 raise ValueError("Must provide as many communicators as levels")
 *             CHKERR( PetscMalloc(sizeof(MPI_Comm)*<size_t>clevels, &ccomms) )
 */
    }

    /* "PETSc/SNES.pyx":180
 *             if clevels != <PetscInt>len(comms):
 *                 raise ValueError("Must provide as many communicators as levels")
 *             CHKERR( PetscMalloc(sizeof(MPI_Comm)*<size_t>clevels, &ccomms) )             # <<<<<<<<<<<<<<
 *             try:
 *                 for i, comm in enumerate(comms):
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscMalloc(((sizeof(MPI_Comm)) * ((size_t)__pyx_v_clevels)), (&__pyx_v_ccomms))); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(36, 180, __pyx_L1_error)

    /* "PETSc/SNES.pyx":181
 *                 raise ValueError("Must provide as many communicators as levels")
 *             CHKERR( PetscMalloc(sizeof(MPI_Comm)*<size_t>clevels, &ccomms) )
 *             try:             # <<<<<<<<<<<<<<
 *                 for i, comm in enumerate(comms):
 *                     ccomms[i] = def_Comm(comm, MPI_COMM_NULL)
 */
    /*try:*/ {

      /* "PETSc/SNES.pyx":182
 *             CHKERR( PetscMalloc(sizeof(MPI_Comm)*<size_t>clevels, &ccomms) )
 *             try:
 *                 for i, comm in enumerate(comms):             # <<<<<<<<<<<<<<
 *                     ccomms[i] = def_Comm(comm, MPI_COMM_NULL)
 *                 CHKERR( SNESFASSetLevels(self.snes, clevels, ccomms) )
 */
      __pyx_t_4 = 0;
      if (likely(PyList_CheckExact(__pyx_v_comms)) || PyTuple_CheckExact(__pyx_v_comms)) {
        __pyx_t_5 = __pyx_v_comms; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
      } else {
        __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_comms); if (unlikely(!__pyx_t_5)) __PYX_ERR(36, 182, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 182, __pyx_L6_error)
      }
      for (;;) {
        if (likely(!__pyx_t_8)) {
          if (likely(PyList_CheckExact(__pyx_t_5))) {
            if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_9 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(36, 182, __pyx_L6_error)
            #else
            __pyx_t_9 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(36, 182, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_9);
            #endif
          } else {
            if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(36, 182, __pyx_L6_error)
            #else
            __pyx_t_9 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(36, 182, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_9);
            #endif
          }
        } else {
          __pyx_t_9 = __pyx_t_8(__pyx_t_5);
          if (unlikely(!__pyx_t_9)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(36, 182, __pyx_L6_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_XDECREF_SET(__pyx_v_comm, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_v_i = __pyx_t_4;
        __pyx_t_4 = (__pyx_t_4 + 1);

        /* "PETSc/SNES.pyx":183
 *             try:
 *                 for i, comm in enumerate(comms):
 *                     ccomms[i] = def_Comm(comm, MPI_COMM_NULL)             # <<<<<<<<<<<<<<
 *                 CHKERR( SNESFASSetLevels(self.snes, clevels, ccomms) )
 *             finally:
 */
        __pyx_t_10 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, MPI_COMM_NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(36, 183, __pyx_L6_error)
        (__pyx_v_ccomms[__pyx_v_i]) = __pyx_t_10;

        /* "PETSc/SNES.pyx":182
 *             CHKERR( PetscMalloc(sizeof(MPI_Comm)*<size_t>clevels, &ccomms) )
 *             try:
 *                 for i, comm in enumerate(comms):             # <<<<<<<<<<<<<<
 *                     ccomms[i] = def_Comm(comm, MPI_COMM_NULL)
 *                 CHKERR( SNESFASSetLevels(self.snes, clevels, ccomms) )
 */
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "PETSc/SNES.pyx":184
 *                 for i, comm in enumerate(comms):
 *                     ccomms[i] = def_Comm(comm, MPI_COMM_NULL)
 *                 CHKERR( SNESFASSetLevels(self.snes, clevels, ccomms) )             # <<<<<<<<<<<<<<
 *             finally:
 *                 CHKERR( PetscFree(ccomms) )
 */
      __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASSetLevels(__pyx_v_self->snes, __pyx_v_clevels, __pyx_v_ccomms)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(36, 184, __pyx_L6_error)
    }

    /* "PETSc/SNES.pyx":186
 *                 CHKERR( SNESFASSetLevels(self.snes, clevels, ccomms) )
 *             finally:
 *                 CHKERR( PetscFree(ccomms) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( SNESFASSetLevels(self.snes, clevels, ccomms) )
 */
    /*finally:*/ {
      /*normal exit:*/{
        __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscFree(__pyx_v_ccomms)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(36, 186, __pyx_L1_error)
        goto __pyx_L7;
      }
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __pyx_L6_error:;
        __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
        __Pyx_PyThreadState_assign
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
        if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
        __Pyx_XGOTREF(__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_14);
        __Pyx_XGOTREF(__pyx_t_15);
        __Pyx_XGOTREF(__pyx_t_16);
        __Pyx_XGOTREF(__pyx_t_17);
        __Pyx_XGOTREF(__pyx_t_18);
        __pyx_t_6 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
        {
          __pyx_t_19 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscFree(__pyx_v_ccomms)); if (unlikely(__pyx_t_19 == -1)) __PYX_ERR(36, 186, __pyx_L11_error)
        }
        __Pyx_PyThreadState_assign
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_XGIVEREF(__pyx_t_18);
          __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
        }
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
        __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
        __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
        goto __pyx_L1_error;
        __pyx_L11_error:;
        __Pyx_PyThreadState_assign
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_XGIVEREF(__pyx_t_18);
          __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
        }
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
        goto __pyx_L1_error;
      }
      __pyx_L7:;
    }

    /* "PETSc/SNES.pyx":177
 *         cdef MPI_Comm *ccomms = NULL
 *         cdef Py_ssize_t i = 0
 *         if comms is not None:             # <<<<<<<<<<<<<<
 *             if clevels != <PetscInt>len(comms):
 *                 raise ValueError("Must provide as many communicators as levels")
 */
    goto __pyx_L3;
  }

  /* "PETSc/SNES.pyx":188
 *                 CHKERR( PetscFree(ccomms) )
 *         else:
 *             CHKERR( SNESFASSetLevels(self.snes, clevels, ccomms) )             # <<<<<<<<<<<<<<
 * 
 *     def getFASLevels(self):
 */
  /*else*/ {
    __pyx_t_11 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASSetLevels(__pyx_v_self->snes, __pyx_v_clevels, __pyx_v_ccomms)); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(36, 188, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/SNES.pyx":173
 *         CHKERR( SNESFASSetRScale(self.snes, clevel, vec.vec) )
 * 
 *     def setFASLevels(self, levels, comms=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevels = asInt(levels)
 *         cdef MPI_Comm *ccomms = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFASLevels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_comm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":190
 *             CHKERR( SNESFASSetLevels(self.snes, clevels, ccomms) )
 * 
 *     def getFASLevels(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt levels = 0
 *         CHKERR( SNESFASGetLevels(self.snes, &levels) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_43getFASLevels(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_42getFASLevels[] = "SNES.getFASLevels(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_43getFASLevels(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFASLevels (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getFASLevels", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getFASLevels", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_42getFASLevels(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_42getFASLevels(struct PyPetscSNESObject *__pyx_v_self) {
  PetscInt __pyx_v_levels;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getFASLevels", 0);

  /* "PETSc/SNES.pyx":191
 * 
 *     def getFASLevels(self):
 *         cdef PetscInt levels = 0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASGetLevels(self.snes, &levels) )
 *         return toInt(levels)
 */
  __pyx_v_levels = 0;

  /* "PETSc/SNES.pyx":192
 *     def getFASLevels(self):
 *         cdef PetscInt levels = 0
 *         CHKERR( SNESFASGetLevels(self.snes, &levels) )             # <<<<<<<<<<<<<<
 *         return toInt(levels)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASGetLevels(__pyx_v_self->snes, (&__pyx_v_levels))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 192, __pyx_L1_error)

  /* "PETSc/SNES.pyx":193
 *         cdef PetscInt levels = 0
 *         CHKERR( SNESFASGetLevels(self.snes, &levels) )
 *         return toInt(levels)             # <<<<<<<<<<<<<<
 * 
 *     def getFASCycleSNES(self, level):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_levels); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":190
 *             CHKERR( SNESFASSetLevels(self.snes, clevels, ccomms) )
 * 
 *     def getFASLevels(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt levels = 0
 *         CHKERR( SNESFASGetLevels(self.snes, &levels) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASLevels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":195
 *         return toInt(levels)
 * 
 *     def getFASCycleSNES(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES lsnes = SNES()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_45getFASCycleSNES(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_44getFASCycleSNES[] = "SNES.getFASCycleSNES(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_45getFASCycleSNES(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFASCycleSNES (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getFASCycleSNES") < 0)) __PYX_ERR(36, 195, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFASCycleSNES", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 195, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASCycleSNES", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_44getFASCycleSNES(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_44getFASCycleSNES(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscSNESObject *__pyx_v_lsnes = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getFASCycleSNES", 0);

  /* "PETSc/SNES.pyx":196
 * 
 *     def getFASCycleSNES(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef SNES lsnes = SNES()
 *         CHKERR( SNESFASGetCycleSNES(self.snes, clevel, &lsnes.snes) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 196, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/SNES.pyx":197
 *     def getFASCycleSNES(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES lsnes = SNES()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASGetCycleSNES(self.snes, clevel, &lsnes.snes) )
 *         PetscINCREF(lsnes.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_lsnes = ((struct PyPetscSNESObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/SNES.pyx":198
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES lsnes = SNES()
 *         CHKERR( SNESFASGetCycleSNES(self.snes, clevel, &lsnes.snes) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(lsnes.obj)
 *         return lsnes
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASGetCycleSNES(__pyx_v_self->snes, __pyx_v_clevel, (&__pyx_v_lsnes->snes))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(36, 198, __pyx_L1_error)

  /* "PETSc/SNES.pyx":199
 *         cdef SNES lsnes = SNES()
 *         CHKERR( SNESFASGetCycleSNES(self.snes, clevel, &lsnes.snes) )
 *         PetscINCREF(lsnes.obj)             # <<<<<<<<<<<<<<
 *         return lsnes
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_lsnes->__pyx_base.obj);

  /* "PETSc/SNES.pyx":200
 *         CHKERR( SNESFASGetCycleSNES(self.snes, clevel, &lsnes.snes) )
 *         PetscINCREF(lsnes.obj)
 *         return lsnes             # <<<<<<<<<<<<<<
 * 
 *     def getFASCoarseSolve(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_lsnes));
  __pyx_r = ((PyObject *)__pyx_v_lsnes);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":195
 *         return toInt(levels)
 * 
 *     def getFASCycleSNES(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES lsnes = SNES()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASCycleSNES", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lsnes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":202
 *         return lsnes
 * 
 *     def getFASCoarseSolve(self):             # <<<<<<<<<<<<<<
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetCoarseSolve(self.snes, &smooth.snes) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_47getFASCoarseSolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_46getFASCoarseSolve[] = "SNES.getFASCoarseSolve(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_47getFASCoarseSolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFASCoarseSolve (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getFASCoarseSolve", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getFASCoarseSolve", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_46getFASCoarseSolve(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_46getFASCoarseSolve(struct PyPetscSNESObject *__pyx_v_self) {
  struct PyPetscSNESObject *__pyx_v_smooth = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getFASCoarseSolve", 0);

  /* "PETSc/SNES.pyx":203
 * 
 *     def getFASCoarseSolve(self):
 *         cdef SNES smooth = SNES()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASGetCoarseSolve(self.snes, &smooth.snes) )
 *         PetscINCREF(smooth.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_smooth = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":204
 *     def getFASCoarseSolve(self):
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetCoarseSolve(self.snes, &smooth.snes) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(smooth.obj)
 *         return smooth
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASGetCoarseSolve(__pyx_v_self->snes, (&__pyx_v_smooth->snes))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 204, __pyx_L1_error)

  /* "PETSc/SNES.pyx":205
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetCoarseSolve(self.snes, &smooth.snes) )
 *         PetscINCREF(smooth.obj)             # <<<<<<<<<<<<<<
 *         return smooth
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_smooth->__pyx_base.obj);

  /* "PETSc/SNES.pyx":206
 *         CHKERR( SNESFASGetCoarseSolve(self.snes, &smooth.snes) )
 *         PetscINCREF(smooth.obj)
 *         return smooth             # <<<<<<<<<<<<<<
 * 
 *     def getFASSmoother(self, level):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_smooth));
  __pyx_r = ((PyObject *)__pyx_v_smooth);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":202
 *         return lsnes
 * 
 *     def getFASCoarseSolve(self):             # <<<<<<<<<<<<<<
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetCoarseSolve(self.snes, &smooth.snes) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASCoarseSolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_smooth);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":208
 *         return smooth
 * 
 *     def getFASSmoother(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES smooth = SNES()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_49getFASSmoother(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_48getFASSmoother[] = "SNES.getFASSmoother(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_49getFASSmoother(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFASSmoother (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getFASSmoother") < 0)) __PYX_ERR(36, 208, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFASSmoother", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 208, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASSmoother", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_48getFASSmoother(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_48getFASSmoother(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscSNESObject *__pyx_v_smooth = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getFASSmoother", 0);

  /* "PETSc/SNES.pyx":209
 * 
 *     def getFASSmoother(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetSmoother(self.snes, clevel, &smooth.snes) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 209, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/SNES.pyx":210
 *     def getFASSmoother(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES smooth = SNES()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASGetSmoother(self.snes, clevel, &smooth.snes) )
 *         PetscINCREF(smooth.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_smooth = ((struct PyPetscSNESObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/SNES.pyx":211
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetSmoother(self.snes, clevel, &smooth.snes) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(smooth.obj)
 *         return smooth
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASGetSmoother(__pyx_v_self->snes, __pyx_v_clevel, (&__pyx_v_smooth->snes))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(36, 211, __pyx_L1_error)

  /* "PETSc/SNES.pyx":212
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetSmoother(self.snes, clevel, &smooth.snes) )
 *         PetscINCREF(smooth.obj)             # <<<<<<<<<<<<<<
 *         return smooth
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_smooth->__pyx_base.obj);

  /* "PETSc/SNES.pyx":213
 *         CHKERR( SNESFASGetSmoother(self.snes, clevel, &smooth.snes) )
 *         PetscINCREF(smooth.obj)
 *         return smooth             # <<<<<<<<<<<<<<
 * 
 *     def getFASSmootherDown(self, level):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_smooth));
  __pyx_r = ((PyObject *)__pyx_v_smooth);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":208
 *         return smooth
 * 
 *     def getFASSmoother(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES smooth = SNES()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASSmoother", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_smooth);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":215
 *         return smooth
 * 
 *     def getFASSmootherDown(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES smooth = SNES()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_51getFASSmootherDown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_50getFASSmootherDown[] = "SNES.getFASSmootherDown(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_51getFASSmootherDown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFASSmootherDown (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getFASSmootherDown") < 0)) __PYX_ERR(36, 215, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFASSmootherDown", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 215, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASSmootherDown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_50getFASSmootherDown(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_50getFASSmootherDown(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscSNESObject *__pyx_v_smooth = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getFASSmootherDown", 0);

  /* "PETSc/SNES.pyx":216
 * 
 *     def getFASSmootherDown(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetSmootherDown(self.snes, clevel, &smooth.snes) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 216, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/SNES.pyx":217
 *     def getFASSmootherDown(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES smooth = SNES()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASGetSmootherDown(self.snes, clevel, &smooth.snes) )
 *         PetscINCREF(smooth.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_smooth = ((struct PyPetscSNESObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/SNES.pyx":218
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetSmootherDown(self.snes, clevel, &smooth.snes) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(smooth.obj)
 *         return smooth
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASGetSmootherDown(__pyx_v_self->snes, __pyx_v_clevel, (&__pyx_v_smooth->snes))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(36, 218, __pyx_L1_error)

  /* "PETSc/SNES.pyx":219
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetSmootherDown(self.snes, clevel, &smooth.snes) )
 *         PetscINCREF(smooth.obj)             # <<<<<<<<<<<<<<
 *         return smooth
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_smooth->__pyx_base.obj);

  /* "PETSc/SNES.pyx":220
 *         CHKERR( SNESFASGetSmootherDown(self.snes, clevel, &smooth.snes) )
 *         PetscINCREF(smooth.obj)
 *         return smooth             # <<<<<<<<<<<<<<
 * 
 *     def getFASSmootherUp(self, level):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_smooth));
  __pyx_r = ((PyObject *)__pyx_v_smooth);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":215
 *         return smooth
 * 
 *     def getFASSmootherDown(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES smooth = SNES()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASSmootherDown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_smooth);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":222
 *         return smooth
 * 
 *     def getFASSmootherUp(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES smooth = SNES()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_53getFASSmootherUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_52getFASSmootherUp[] = "SNES.getFASSmootherUp(self, level)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_53getFASSmootherUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFASSmootherUp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,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);
        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_level)) != 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, "getFASSmootherUp") < 0)) __PYX_ERR(36, 222, __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_level = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFASSmootherUp", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 222, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASSmootherUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_52getFASSmootherUp(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_52getFASSmootherUp(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PetscInt __pyx_v_clevel;
  struct PyPetscSNESObject *__pyx_v_smooth = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getFASSmootherUp", 0);

  /* "PETSc/SNES.pyx":223
 * 
 *     def getFASSmootherUp(self, level):
 *         cdef PetscInt clevel = asInt(level)             # <<<<<<<<<<<<<<
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetSmootherUp(self.snes, clevel, &smooth.snes) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_level); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 223, __pyx_L1_error)
  __pyx_v_clevel = __pyx_t_1;

  /* "PETSc/SNES.pyx":224
 *     def getFASSmootherUp(self, level):
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES smooth = SNES()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESFASGetSmootherUp(self.snes, clevel, &smooth.snes) )
 *         PetscINCREF(smooth.obj)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_smooth = ((struct PyPetscSNESObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/SNES.pyx":225
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetSmootherUp(self.snes, clevel, &smooth.snes) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(smooth.obj)
 *         return smooth
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESFASGetSmootherUp(__pyx_v_self->snes, __pyx_v_clevel, (&__pyx_v_smooth->snes))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(36, 225, __pyx_L1_error)

  /* "PETSc/SNES.pyx":226
 *         cdef SNES smooth = SNES()
 *         CHKERR( SNESFASGetSmootherUp(self.snes, clevel, &smooth.snes) )
 *         PetscINCREF(smooth.obj)             # <<<<<<<<<<<<<<
 *         return smooth
 *     # --- nonlinear preconditioner ---
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_smooth->__pyx_base.obj);

  /* "PETSc/SNES.pyx":227
 *         CHKERR( SNESFASGetSmootherUp(self.snes, clevel, &smooth.snes) )
 *         PetscINCREF(smooth.obj)
 *         return smooth             # <<<<<<<<<<<<<<
 *     # --- nonlinear preconditioner ---
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_smooth));
  __pyx_r = ((PyObject *)__pyx_v_smooth);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":222
 *         return smooth
 * 
 *     def getFASSmootherUp(self, level):             # <<<<<<<<<<<<<<
 *         cdef PetscInt clevel = asInt(level)
 *         cdef SNES smooth = SNES()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFASSmootherUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_smooth);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":230
 *     # --- nonlinear preconditioner ---
 * 
 *     def getNPC(self):             # <<<<<<<<<<<<<<
 *         cdef SNES snes = SNES()
 *         CHKERR( SNESGetNPC(self.snes, &snes.snes) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_55getNPC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_54getNPC[] = "SNES.getNPC(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_55getNPC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getNPC (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getNPC", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getNPC", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_54getNPC(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_54getNPC(struct PyPetscSNESObject *__pyx_v_self) {
  struct PyPetscSNESObject *__pyx_v_snes = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getNPC", 0);

  /* "PETSc/SNES.pyx":231
 * 
 *     def getNPC(self):
 *         cdef SNES snes = SNES()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetNPC(self.snes, &snes.snes) )
 *         PetscINCREF(snes.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_snes = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":232
 *     def getNPC(self):
 *         cdef SNES snes = SNES()
 *         CHKERR( SNESGetNPC(self.snes, &snes.snes) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(snes.obj)
 *         return snes
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetNPC(__pyx_v_self->snes, (&__pyx_v_snes->snes))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 232, __pyx_L1_error)

  /* "PETSc/SNES.pyx":233
 *         cdef SNES snes = SNES()
 *         CHKERR( SNESGetNPC(self.snes, &snes.snes) )
 *         PetscINCREF(snes.obj)             # <<<<<<<<<<<<<<
 *         return snes
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_snes->__pyx_base.obj);

  /* "PETSc/SNES.pyx":234
 *         CHKERR( SNESGetNPC(self.snes, &snes.snes) )
 *         PetscINCREF(snes.obj)
 *         return snes             # <<<<<<<<<<<<<<
 * 
 *     def hasNPC(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_snes));
  __pyx_r = ((PyObject *)__pyx_v_snes);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":230
 *     # --- nonlinear preconditioner ---
 * 
 *     def getNPC(self):             # <<<<<<<<<<<<<<
 *         cdef SNES snes = SNES()
 *         CHKERR( SNESGetNPC(self.snes, &snes.snes) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getNPC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_snes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":236
 *         return snes
 * 
 *     def hasNPC(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool has_npc = PETSC_FALSE
 *         CHKERR( SNESHasNPC(self.snes, &has_npc) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_57hasNPC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_56hasNPC[] = "SNES.hasNPC(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_57hasNPC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hasNPC (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("hasNPC", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "hasNPC", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_56hasNPC(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_56hasNPC(struct PyPetscSNESObject *__pyx_v_self) {
  PetscBool __pyx_v_has_npc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("hasNPC", 0);

  /* "PETSc/SNES.pyx":237
 * 
 *     def hasNPC(self):
 *         cdef PetscBool has_npc = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( SNESHasNPC(self.snes, &has_npc) )
 *         return <bint> has_npc
 */
  __pyx_v_has_npc = PETSC_FALSE;

  /* "PETSc/SNES.pyx":238
 *     def hasNPC(self):
 *         cdef PetscBool has_npc = PETSC_FALSE
 *         CHKERR( SNESHasNPC(self.snes, &has_npc) )             # <<<<<<<<<<<<<<
 *         return <bint> has_npc
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESHasNPC(__pyx_v_self->snes, (&__pyx_v_has_npc))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 238, __pyx_L1_error)

  /* "PETSc/SNES.pyx":239
 *         cdef PetscBool has_npc = PETSC_FALSE
 *         CHKERR( SNESHasNPC(self.snes, &has_npc) )
 *         return <bint> has_npc             # <<<<<<<<<<<<<<
 * 
 *     def setNPC(self, SNES snes not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_has_npc); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":236
 *         return snes
 * 
 *     def hasNPC(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool has_npc = PETSC_FALSE
 *         CHKERR( SNESHasNPC(self.snes, &has_npc) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.hasNPC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":241
 *         return <bint> has_npc
 * 
 *     def setNPC(self, SNES snes not None):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetNPC(self.snes, snes.snes) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_59setNPC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_58setNPC[] = "SNES.setNPC(self, SNES snes)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_59setNPC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscSNESObject *__pyx_v_snes = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setNPC (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_snes,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);
        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_snes)) != 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, "setNPC") < 0)) __PYX_ERR(36, 241, __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_snes = ((struct PyPetscSNESObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setNPC", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 241, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setNPC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_snes), __pyx_ptype_8petsc4py_5PETSc_SNES, 0, "snes", 0))) __PYX_ERR(36, 241, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_58setNPC(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_snes);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_58setNPC(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscSNESObject *__pyx_v_snes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setNPC", 0);

  /* "PETSc/SNES.pyx":242
 * 
 *     def setNPC(self, SNES snes not None):
 *         CHKERR( SNESSetNPC(self.snes, snes.snes) )             # <<<<<<<<<<<<<<
 * 
 *     # --- user Function/Jacobian routines ---
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetNPC(__pyx_v_self->snes, __pyx_v_snes->snes)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 242, __pyx_L1_error)

  /* "PETSc/SNES.pyx":241
 *         return <bint> has_npc
 * 
 *     def setNPC(self, SNES snes not None):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetNPC(self.snes, snes.snes) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setNPC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":246
 *     # --- user Function/Jacobian routines ---
 * 
 *     def setInitialGuess(self, initialguess, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if initialguess is not None:
 *             if args  is None: args  = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_61setInitialGuess(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_60setInitialGuess[] = "SNES.setInitialGuess(self, initialguess, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_61setInitialGuess(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_initialguess = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setInitialGuess (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_initialguess,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_initialguess)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setInitialGuess") < 0)) __PYX_ERR(36, 246, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_initialguess = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setInitialGuess", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 246, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setInitialGuess", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_60setInitialGuess(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_initialguess, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_60setInitialGuess(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_initialguess, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setInitialGuess", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/SNES.pyx":247
 * 
 *     def setInitialGuess(self, initialguess, args=None, kargs=None):
 *         if initialguess is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_initialguess != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/SNES.pyx":248
 *     def setInitialGuess(self, initialguess, args=None, kargs=None):
 *         if initialguess is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (initialguess, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/SNES.pyx":249
 *         if initialguess is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (initialguess, args, kargs)
 *             self.set_attr('__initialguess__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/SNES.pyx":250
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (initialguess, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__initialguess__', context)
 *             CHKERR( SNESSetInitialGuess(self.snes, SNES_InitialGuess, <void*>context) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_initialguess);
    __Pyx_GIVEREF(__pyx_v_initialguess);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_initialguess);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/SNES.pyx":251
 *             if kargs is None: kargs = {}
 *             context = (initialguess, args, kargs)
 *             self.set_attr('__initialguess__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( SNESSetInitialGuess(self.snes, SNES_InitialGuess, <void*>context) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__initialguess__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/SNES.pyx":252
 *             context = (initialguess, args, kargs)
 *             self.set_attr('__initialguess__', context)
 *             CHKERR( SNESSetInitialGuess(self.snes, SNES_InitialGuess, <void*>context) )             # <<<<<<<<<<<<<<
 *         else:
 *             self.set_attr('__initialguess__', None)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetComputeInitialGuess(__pyx_v_self->snes, __pyx_f_8petsc4py_5PETSc_SNES_InitialGuess, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 252, __pyx_L1_error)

    /* "PETSc/SNES.pyx":247
 * 
 *     def setInitialGuess(self, initialguess, args=None, kargs=None):
 *         if initialguess is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/SNES.pyx":254
 *             CHKERR( SNESSetInitialGuess(self.snes, SNES_InitialGuess, <void*>context) )
 *         else:
 *             self.set_attr('__initialguess__', None)             # <<<<<<<<<<<<<<
 *             CHKERR( SNESSetInitialGuess(self.snes, NULL, NULL) )
 * 
 */
  /*else*/ {
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__initialguess__"), Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/SNES.pyx":255
 *         else:
 *             self.set_attr('__initialguess__', None)
 *             CHKERR( SNESSetInitialGuess(self.snes, NULL, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def getInitialGuess(self):
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetComputeInitialGuess(__pyx_v_self->snes, NULL, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 255, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/SNES.pyx":246
 *     # --- user Function/Jacobian routines ---
 * 
 *     def setInitialGuess(self, initialguess, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if initialguess is not None:
 *             if args  is None: args  = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setInitialGuess", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":257
 *             CHKERR( SNESSetInitialGuess(self.snes, NULL, NULL) )
 * 
 *     def getInitialGuess(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__initialguess__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_63getInitialGuess(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_62getInitialGuess[] = "SNES.getInitialGuess(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_63getInitialGuess(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getInitialGuess (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getInitialGuess", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getInitialGuess", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_62getInitialGuess(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_62getInitialGuess(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getInitialGuess", 0);

  /* "PETSc/SNES.pyx":258
 * 
 *     def getInitialGuess(self):
 *         return self.get_attr('__initialguess__')             # <<<<<<<<<<<<<<
 * 
 *     def setFunction(self, function, Vec f, args=None, kargs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__initialguess__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":257
 *             CHKERR( SNESSetInitialGuess(self.snes, NULL, NULL) )
 * 
 *     def getInitialGuess(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__initialguess__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getInitialGuess", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":260
 *         return self.get_attr('__initialguess__')
 * 
 *     def setFunction(self, function, Vec f, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_65setFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_64setFunction[] = "SNES.setFunction(self, function, Vec f, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_65setFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_function = 0;
  struct PyPetscVecObject *__pyx_v_f = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFunction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_function,&__pyx_n_s_f,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_function)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFunction", 0, 2, 4, 1); __PYX_ERR(36, 260, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFunction") < 0)) __PYX_ERR(36, 260, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_function = values[0];
    __pyx_v_f = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_args = values[2];
    __pyx_v_kargs = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFunction", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 260, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "f", 0))) __PYX_ERR(36, 260, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_64setFunction(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_function, __pyx_v_f, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_64setFunction(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_function, struct PyPetscVecObject *__pyx_v_f, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  Vec __pyx_v_fvec;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Vec __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setFunction", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/SNES.pyx":261
 * 
 *     def setFunction(self, function, Vec f, args=None, kargs=None):
 *         cdef PetscVec fvec=NULL             # <<<<<<<<<<<<<<
 *         if f is not None: fvec = f.vec
 *         if function is not None:
 */
  __pyx_v_fvec = NULL;

  /* "PETSc/SNES.pyx":262
 *     def setFunction(self, function, Vec f, args=None, kargs=None):
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec             # <<<<<<<<<<<<<<
 *         if function is not None:
 *             if args  is None: args  = ()
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_f) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_f->vec;
    __pyx_v_fvec = __pyx_t_3;
  }

  /* "PETSc/SNES.pyx":263
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec
 *         if function is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_2 = (__pyx_v_function != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/SNES.pyx":264
 *         if f is not None: fvec = f.vec
 *         if function is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (function, args, kargs)
 */
    __pyx_t_1 = (__pyx_v_args == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/SNES.pyx":265
 *         if function is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (function, args, kargs)
 *             self.set_attr('__function__', context)
 */
    __pyx_t_2 = (__pyx_v_kargs == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_4);
      __pyx_t_4 = 0;
    }

    /* "PETSc/SNES.pyx":266
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (function, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__function__', context)
 *             CHKERR( SNESSetFunction(self.snes, fvec, SNES_Function, <void*>context) )
 */
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_function);
    __Pyx_GIVEREF(__pyx_v_function);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_function);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/SNES.pyx":267
 *             if kargs is None: kargs = {}
 *             context = (function, args, kargs)
 *             self.set_attr('__function__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( SNESSetFunction(self.snes, fvec, SNES_Function, <void*>context) )
 *         else:
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__function__"), __pyx_v_context); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/SNES.pyx":268
 *             context = (function, args, kargs)
 *             self.set_attr('__function__', context)
 *             CHKERR( SNESSetFunction(self.snes, fvec, SNES_Function, <void*>context) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( SNESSetFunction(self.snes, fvec, NULL, NULL) )
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetFunction(__pyx_v_self->snes, __pyx_v_fvec, __pyx_f_8petsc4py_5PETSc_SNES_Function, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(36, 268, __pyx_L1_error)

    /* "PETSc/SNES.pyx":263
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec
 *         if function is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L4;
  }

  /* "PETSc/SNES.pyx":270
 *             CHKERR( SNESSetFunction(self.snes, fvec, SNES_Function, <void*>context) )
 *         else:
 *             CHKERR( SNESSetFunction(self.snes, fvec, NULL, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def getFunction(self):
 */
  /*else*/ {
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetFunction(__pyx_v_self->snes, __pyx_v_fvec, NULL, NULL)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(36, 270, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "PETSc/SNES.pyx":260
 *         return self.get_attr('__initialguess__')
 * 
 *     def setFunction(self, function, Vec f, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":272
 *             CHKERR( SNESSetFunction(self.snes, fvec, NULL, NULL) )
 * 
 *     def getFunction(self):             # <<<<<<<<<<<<<<
 *         cdef Vec f = Vec()
 *         CHKERR( SNESGetFunction(self.snes, &f.vec, NULL, NULL) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_67getFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_66getFunction[] = "SNES.getFunction(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_67getFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFunction (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getFunction", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getFunction", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_66getFunction(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_66getFunction(struct PyPetscSNESObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_f = 0;
  PyObject *__pyx_v_function = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getFunction", 0);

  /* "PETSc/SNES.pyx":273
 * 
 *     def getFunction(self):
 *         cdef Vec f = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetFunction(self.snes, &f.vec, NULL, NULL) )
 *         PetscINCREF(f.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_f = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":274
 *     def getFunction(self):
 *         cdef Vec f = Vec()
 *         CHKERR( SNESGetFunction(self.snes, &f.vec, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(f.obj)
 *         cdef object function = self.get_attr('__function__')
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetFunction(__pyx_v_self->snes, (&__pyx_v_f->vec), NULL, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 274, __pyx_L1_error)

  /* "PETSc/SNES.pyx":275
 *         cdef Vec f = Vec()
 *         CHKERR( SNESGetFunction(self.snes, &f.vec, NULL, NULL) )
 *         PetscINCREF(f.obj)             # <<<<<<<<<<<<<<
 *         cdef object function = self.get_attr('__function__')
 *         return (f, function)
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_f->__pyx_base.obj);

  /* "PETSc/SNES.pyx":276
 *         CHKERR( SNESGetFunction(self.snes, &f.vec, NULL, NULL) )
 *         PetscINCREF(f.obj)
 *         cdef object function = self.get_attr('__function__')             # <<<<<<<<<<<<<<
 *         return (f, function)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__function__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_function = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":277
 *         PetscINCREF(f.obj)
 *         cdef object function = self.get_attr('__function__')
 *         return (f, function)             # <<<<<<<<<<<<<<
 * 
 *     def setUpdate(self, update, args=None, kargs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_f));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_f));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f));
  __Pyx_INCREF(__pyx_v_function);
  __Pyx_GIVEREF(__pyx_v_function);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_function);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":272
 *             CHKERR( SNESSetFunction(self.snes, fvec, NULL, NULL) )
 * 
 *     def getFunction(self):             # <<<<<<<<<<<<<<
 *         cdef Vec f = Vec()
 *         CHKERR( SNESGetFunction(self.snes, &f.vec, NULL, NULL) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":279
 *         return (f, function)
 * 
 *     def setUpdate(self, update, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if update is not None:
 *             if args  is None: args  = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_69setUpdate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_68setUpdate[] = "SNES.setUpdate(self, update, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_69setUpdate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_update = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUpdate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_update,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_update)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setUpdate") < 0)) __PYX_ERR(36, 279, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_update = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setUpdate", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 279, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setUpdate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_68setUpdate(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_update, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_68setUpdate(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_update, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setUpdate", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/SNES.pyx":280
 * 
 *     def setUpdate(self, update, args=None, kargs=None):
 *         if update is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_update != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/SNES.pyx":281
 *     def setUpdate(self, update, args=None, kargs=None):
 *         if update is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (update, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/SNES.pyx":282
 *         if update is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (update, args, kargs)
 *             self.set_attr('__update__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/SNES.pyx":283
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (update, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__update__', context)
 *             CHKERR( SNESSetUpdate(self.snes, SNES_Update) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_update);
    __Pyx_GIVEREF(__pyx_v_update);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_update);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/SNES.pyx":284
 *             if kargs is None: kargs = {}
 *             context = (update, args, kargs)
 *             self.set_attr('__update__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( SNESSetUpdate(self.snes, SNES_Update) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__update__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/SNES.pyx":285
 *             context = (update, args, kargs)
 *             self.set_attr('__update__', context)
 *             CHKERR( SNESSetUpdate(self.snes, SNES_Update) )             # <<<<<<<<<<<<<<
 *         else:
 *             self.set_attr('__update__', None)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetUpdate(__pyx_v_self->snes, __pyx_f_8petsc4py_5PETSc_SNES_Update)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 285, __pyx_L1_error)

    /* "PETSc/SNES.pyx":280
 * 
 *     def setUpdate(self, update, args=None, kargs=None):
 *         if update is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/SNES.pyx":287
 *             CHKERR( SNESSetUpdate(self.snes, SNES_Update) )
 *         else:
 *             self.set_attr('__update__', None)             # <<<<<<<<<<<<<<
 *             CHKERR( SNESSetUpdate(self.snes, NULL) )
 * 
 */
  /*else*/ {
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__update__"), Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/SNES.pyx":288
 *         else:
 *             self.set_attr('__update__', None)
 *             CHKERR( SNESSetUpdate(self.snes, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def getUpdate(self):
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetUpdate(__pyx_v_self->snes, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 288, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/SNES.pyx":279
 *         return (f, function)
 * 
 *     def setUpdate(self, update, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if update is not None:
 *             if args  is None: args  = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setUpdate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":290
 *             CHKERR( SNESSetUpdate(self.snes, NULL) )
 * 
 *     def getUpdate(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__update__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_71getUpdate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_70getUpdate[] = "SNES.getUpdate(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_71getUpdate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getUpdate (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getUpdate", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getUpdate", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_70getUpdate(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_70getUpdate(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getUpdate", 0);

  /* "PETSc/SNES.pyx":291
 * 
 *     def getUpdate(self):
 *         return self.get_attr('__update__')             # <<<<<<<<<<<<<<
 * 
 *     def setJacobian(self, jacobian, Mat J, Mat P=None, args=None, kargs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__update__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":290
 *             CHKERR( SNESSetUpdate(self.snes, NULL) )
 * 
 *     def getUpdate(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__update__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getUpdate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":293
 *         return self.get_attr('__update__')
 * 
 *     def setJacobian(self, jacobian, Mat J, Mat P=None, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_73setJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_72setJacobian[] = "SNES.setJacobian(self, jacobian, Mat J, Mat P=None, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_73setJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_jacobian = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setJacobian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_jacobian,&__pyx_n_s_J,&__pyx_n_s_P,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_jacobian)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setJacobian", 0, 2, 5, 1); __PYX_ERR(36, 293, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setJacobian") < 0)) __PYX_ERR(36, 293, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_jacobian = values[0];
    __pyx_v_J = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[2]);
    __pyx_v_args = values[3];
    __pyx_v_kargs = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setJacobian", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 293, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_J), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "J", 0))) __PYX_ERR(36, 293, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(36, 293, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_72setJacobian(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_jacobian, __pyx_v_J, __pyx_v_P, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_72setJacobian(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_jacobian, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  Mat __pyx_v_Jmat;
  Mat __pyx_v_Pmat;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Mat __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setJacobian", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/SNES.pyx":294
 * 
 *     def setJacobian(self, jacobian, Mat J, Mat P=None, args=None, kargs=None):
 *         cdef PetscMat Jmat=NULL             # <<<<<<<<<<<<<<
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat=Jmat
 */
  __pyx_v_Jmat = NULL;

  /* "PETSc/SNES.pyx":295
 *     def setJacobian(self, jacobian, Mat J, Mat P=None, args=None, kargs=None):
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat             # <<<<<<<<<<<<<<
 *         cdef PetscMat Pmat=Jmat
 *         if P is not None: Pmat = P.mat
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_J) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_J->mat;
    __pyx_v_Jmat = __pyx_t_3;
  }

  /* "PETSc/SNES.pyx":296
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat=Jmat             # <<<<<<<<<<<<<<
 *         if P is not None: Pmat = P.mat
 *         if jacobian is not None:
 */
  __pyx_v_Pmat = __pyx_v_Jmat;

  /* "PETSc/SNES.pyx":297
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat=Jmat
 *         if P is not None: Pmat = P.mat             # <<<<<<<<<<<<<<
 *         if jacobian is not None:
 *             if args  is None: args  = ()
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_P->mat;
    __pyx_v_Pmat = __pyx_t_3;
  }

  /* "PETSc/SNES.pyx":298
 *         cdef PetscMat Pmat=Jmat
 *         if P is not None: Pmat = P.mat
 *         if jacobian is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_jacobian != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/SNES.pyx":299
 *         if P is not None: Pmat = P.mat
 *         if jacobian is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (jacobian, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/SNES.pyx":300
 *         if jacobian is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (jacobian, args, kargs)
 *             self.set_attr('__jacobian__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_4);
      __pyx_t_4 = 0;
    }

    /* "PETSc/SNES.pyx":301
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (jacobian, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__jacobian__', context)
 *             CHKERR( SNESSetJacobian(self.snes, Jmat, Pmat, SNES_Jacobian, <void*>context) )
 */
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_jacobian);
    __Pyx_GIVEREF(__pyx_v_jacobian);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_jacobian);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/SNES.pyx":302
 *             if kargs is None: kargs = {}
 *             context = (jacobian, args, kargs)
 *             self.set_attr('__jacobian__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( SNESSetJacobian(self.snes, Jmat, Pmat, SNES_Jacobian, <void*>context) )
 *         else:
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__jacobian__"), __pyx_v_context); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/SNES.pyx":303
 *             context = (jacobian, args, kargs)
 *             self.set_attr('__jacobian__', context)
 *             CHKERR( SNESSetJacobian(self.snes, Jmat, Pmat, SNES_Jacobian, <void*>context) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( SNESSetJacobian(self.snes, Jmat, Pmat, NULL, NULL) )
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetJacobian(__pyx_v_self->snes, __pyx_v_Jmat, __pyx_v_Pmat, __pyx_f_8petsc4py_5PETSc_SNES_Jacobian, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(36, 303, __pyx_L1_error)

    /* "PETSc/SNES.pyx":298
 *         cdef PetscMat Pmat=Jmat
 *         if P is not None: Pmat = P.mat
 *         if jacobian is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L5;
  }

  /* "PETSc/SNES.pyx":305
 *             CHKERR( SNESSetJacobian(self.snes, Jmat, Pmat, SNES_Jacobian, <void*>context) )
 *         else:
 *             CHKERR( SNESSetJacobian(self.snes, Jmat, Pmat, NULL, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def getJacobian(self):
 */
  /*else*/ {
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetJacobian(__pyx_v_self->snes, __pyx_v_Jmat, __pyx_v_Pmat, NULL, NULL)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(36, 305, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "PETSc/SNES.pyx":293
 *         return self.get_attr('__update__')
 * 
 *     def setJacobian(self, jacobian, Mat J, Mat P=None, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":307
 *             CHKERR( SNESSetJacobian(self.snes, Jmat, Pmat, NULL, NULL) )
 * 
 *     def getJacobian(self):             # <<<<<<<<<<<<<<
 *         cdef Mat J = Mat()
 *         cdef Mat P = Mat()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_75getJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_74getJacobian[] = "SNES.getJacobian(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_75getJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getJacobian (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getJacobian", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getJacobian", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_74getJacobian(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_74getJacobian(struct PyPetscSNESObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_v_jacobian = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getJacobian", 0);

  /* "PETSc/SNES.pyx":308
 * 
 *     def getJacobian(self):
 *         cdef Mat J = Mat()             # <<<<<<<<<<<<<<
 *         cdef Mat P = Mat()
 *         CHKERR( SNESGetJacobian(self.snes, &J.mat, &P.mat, NULL, NULL) )
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_J = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":309
 *     def getJacobian(self):
 *         cdef Mat J = Mat()
 *         cdef Mat P = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetJacobian(self.snes, &J.mat, &P.mat, NULL, NULL) )
 *         PetscINCREF(J.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":310
 *         cdef Mat J = Mat()
 *         cdef Mat P = Mat()
 *         CHKERR( SNESGetJacobian(self.snes, &J.mat, &P.mat, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(J.obj)
 *         PetscINCREF(P.obj)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetJacobian(__pyx_v_self->snes, (&__pyx_v_J->mat), (&__pyx_v_P->mat), NULL, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 310, __pyx_L1_error)

  /* "PETSc/SNES.pyx":311
 *         cdef Mat P = Mat()
 *         CHKERR( SNESGetJacobian(self.snes, &J.mat, &P.mat, NULL, NULL) )
 *         PetscINCREF(J.obj)             # <<<<<<<<<<<<<<
 *         PetscINCREF(P.obj)
 *         cdef object jacobian = self.get_attr('__jacobian__')
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_J->__pyx_base.obj);

  /* "PETSc/SNES.pyx":312
 *         CHKERR( SNESGetJacobian(self.snes, &J.mat, &P.mat, NULL, NULL) )
 *         PetscINCREF(J.obj)
 *         PetscINCREF(P.obj)             # <<<<<<<<<<<<<<
 *         cdef object jacobian = self.get_attr('__jacobian__')
 *         return (J, P, jacobian)
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_P->__pyx_base.obj);

  /* "PETSc/SNES.pyx":313
 *         PetscINCREF(J.obj)
 *         PetscINCREF(P.obj)
 *         cdef object jacobian = self.get_attr('__jacobian__')             # <<<<<<<<<<<<<<
 *         return (J, P, jacobian)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__jacobian__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_jacobian = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":314
 *         PetscINCREF(P.obj)
 *         cdef object jacobian = self.get_attr('__jacobian__')
 *         return (J, P, jacobian)             # <<<<<<<<<<<<<<
 * 
 *     def setObjective(self, objective, args=None, kargs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_J));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_J));
  __Pyx_INCREF(((PyObject *)__pyx_v_P));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_P));
  __Pyx_INCREF(__pyx_v_jacobian);
  __Pyx_GIVEREF(__pyx_v_jacobian);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_jacobian);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":307
 *             CHKERR( SNESSetJacobian(self.snes, Jmat, Pmat, NULL, NULL) )
 * 
 *     def getJacobian(self):             # <<<<<<<<<<<<<<
 *         cdef Mat J = Mat()
 *         cdef Mat P = Mat()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_J);
  __Pyx_XDECREF((PyObject *)__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_jacobian);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":316
 *         return (J, P, jacobian)
 * 
 *     def setObjective(self, objective, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if objective is not None:
 *             if args  is None: args  = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_77setObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_76setObjective[] = "SNES.setObjective(self, objective, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_77setObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_objective = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setObjective (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_objective,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_objective)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setObjective") < 0)) __PYX_ERR(36, 316, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_objective = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setObjective", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 316, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_76setObjective(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_objective, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_76setObjective(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_objective, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setObjective", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/SNES.pyx":317
 * 
 *     def setObjective(self, objective, args=None, kargs=None):
 *         if objective is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_objective != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/SNES.pyx":318
 *     def setObjective(self, objective, args=None, kargs=None):
 *         if objective is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (objective, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/SNES.pyx":319
 *         if objective is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (objective, args, kargs)
 *             self.set_attr('__objective__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/SNES.pyx":320
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (objective, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__objective__', context)
 *             CHKERR( SNESSetObjective(self.snes, SNES_Objective, <void*>context) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_objective);
    __Pyx_GIVEREF(__pyx_v_objective);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_objective);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/SNES.pyx":321
 *             if kargs is None: kargs = {}
 *             context = (objective, args, kargs)
 *             self.set_attr('__objective__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( SNESSetObjective(self.snes, SNES_Objective, <void*>context) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__objective__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/SNES.pyx":322
 *             context = (objective, args, kargs)
 *             self.set_attr('__objective__', context)
 *             CHKERR( SNESSetObjective(self.snes, SNES_Objective, <void*>context) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( SNESSetObjective(self.snes, NULL, NULL) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetObjective(__pyx_v_self->snes, __pyx_f_8petsc4py_5PETSc_SNES_Objective, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 322, __pyx_L1_error)

    /* "PETSc/SNES.pyx":317
 * 
 *     def setObjective(self, objective, args=None, kargs=None):
 *         if objective is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/SNES.pyx":324
 *             CHKERR( SNESSetObjective(self.snes, SNES_Objective, <void*>context) )
 *         else:
 *             CHKERR( SNESSetObjective(self.snes, NULL, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def getObjective(self):
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetObjective(__pyx_v_self->snes, NULL, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 324, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/SNES.pyx":316
 *         return (J, P, jacobian)
 * 
 *     def setObjective(self, objective, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if objective is not None:
 *             if args  is None: args  = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":326
 *             CHKERR( SNESSetObjective(self.snes, NULL, NULL) )
 * 
 *     def getObjective(self):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetObjective(self.snes, NULL, NULL) )
 *         cdef object objective = self.get_attr('__objective__')
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_79getObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_78getObjective[] = "SNES.getObjective(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_79getObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getObjective (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getObjective", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getObjective", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_78getObjective(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_78getObjective(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_v_objective = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getObjective", 0);

  /* "PETSc/SNES.pyx":327
 * 
 *     def getObjective(self):
 *         CHKERR( SNESGetObjective(self.snes, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         cdef object objective = self.get_attr('__objective__')
 *         return objective
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetObjective(__pyx_v_self->snes, NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 327, __pyx_L1_error)

  /* "PETSc/SNES.pyx":328
 *     def getObjective(self):
 *         CHKERR( SNESGetObjective(self.snes, NULL, NULL) )
 *         cdef object objective = self.get_attr('__objective__')             # <<<<<<<<<<<<<<
 *         return objective
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__objective__")); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_objective = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/SNES.pyx":329
 *         CHKERR( SNESGetObjective(self.snes, NULL, NULL) )
 *         cdef object objective = self.get_attr('__objective__')
 *         return objective             # <<<<<<<<<<<<<<
 * 
 *     def computeFunction(self, Vec x not None, Vec f not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_objective);
  __pyx_r = __pyx_v_objective;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":326
 *             CHKERR( SNESSetObjective(self.snes, NULL, NULL) )
 * 
 *     def getObjective(self):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetObjective(self.snes, NULL, NULL) )
 *         cdef object objective = self.get_attr('__objective__')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_objective);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":331
 *         return objective
 * 
 *     def computeFunction(self, Vec x not None, Vec f not None):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESComputeFunction(self.snes, x.vec, f.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_81computeFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_80computeFunction[] = "SNES.computeFunction(self, Vec x, Vec f)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_81computeFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_f = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeFunction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_f,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeFunction", 1, 2, 2, 1); __PYX_ERR(36, 331, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeFunction") < 0)) __PYX_ERR(36, 331, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_f = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeFunction", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 331, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.computeFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(36, 331, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "f", 0))) __PYX_ERR(36, 331, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_80computeFunction(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_x, __pyx_v_f);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_80computeFunction(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_f) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("computeFunction", 0);

  /* "PETSc/SNES.pyx":332
 * 
 *     def computeFunction(self, Vec x not None, Vec f not None):
 *         CHKERR( SNESComputeFunction(self.snes, x.vec, f.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def computeJacobian(self, Vec x not None, Mat J not None, Mat P=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESComputeFunction(__pyx_v_self->snes, __pyx_v_x->vec, __pyx_v_f->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 332, __pyx_L1_error)

  /* "PETSc/SNES.pyx":331
 *         return objective
 * 
 *     def computeFunction(self, Vec x not None, Vec f not None):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESComputeFunction(self.snes, x.vec, f.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.computeFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":334
 *         CHKERR( SNESComputeFunction(self.snes, x.vec, f.vec) )
 * 
 *     def computeJacobian(self, Vec x not None, Mat J not None, Mat P=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_83computeJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_82computeJacobian[] = "SNES.computeJacobian(self, Vec x, Mat J, Mat P=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_83computeJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeJacobian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_J,&__pyx_n_s_P,0};
    PyObject* values[3] = {0,0,0};
    values[2] = (PyObject *)((struct PyPetscMatObject *)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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeJacobian", 0, 2, 3, 1); __PYX_ERR(36, 334, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeJacobian") < 0)) __PYX_ERR(36, 334, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_J = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeJacobian", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 334, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.computeJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(36, 334, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_J), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "J", 0))) __PYX_ERR(36, 334, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(36, 334, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_82computeJacobian(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_x, __pyx_v_J, __pyx_v_P);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_82computeJacobian(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P) {
  Mat __pyx_v_jmat;
  Mat __pyx_v_pmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Mat __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("computeJacobian", 0);

  /* "PETSc/SNES.pyx":335
 * 
 *     def computeJacobian(self, Vec x not None, Mat J not None, Mat P=None):
 *         cdef PetscMat jmat = J.mat, pmat = J.mat             # <<<<<<<<<<<<<<
 *         if P is not None: pmat = P.mat
 *         CHKERR( SNESComputeJacobian(self.snes, x.vec, jmat, pmat) )
 */
  __pyx_t_1 = __pyx_v_J->mat;
  __pyx_v_jmat = __pyx_t_1;
  __pyx_t_1 = __pyx_v_J->mat;
  __pyx_v_pmat = __pyx_t_1;

  /* "PETSc/SNES.pyx":336
 *     def computeJacobian(self, Vec x not None, Mat J not None, Mat P=None):
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat             # <<<<<<<<<<<<<<
 *         CHKERR( SNESComputeJacobian(self.snes, x.vec, jmat, pmat) )
 * 
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_1 = __pyx_v_P->mat;
    __pyx_v_pmat = __pyx_t_1;
  }

  /* "PETSc/SNES.pyx":337
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat
 *         CHKERR( SNESComputeJacobian(self.snes, x.vec, jmat, pmat) )             # <<<<<<<<<<<<<<
 * 
 *     def computeObjective(self, Vec x not None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESComputeJacobian(__pyx_v_self->snes, __pyx_v_x->vec, __pyx_v_jmat, __pyx_v_pmat)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 337, __pyx_L1_error)

  /* "PETSc/SNES.pyx":334
 *         CHKERR( SNESComputeFunction(self.snes, x.vec, f.vec) )
 * 
 *     def computeJacobian(self, Vec x not None, Mat J not None, Mat P=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.computeJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":339
 *         CHKERR( SNESComputeJacobian(self.snes, x.vec, jmat, pmat) )
 * 
 *     def computeObjective(self, Vec x not None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal o = 0
 *         CHKERR( SNESComputeObjective(self.snes, x.vec, &o) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_85computeObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_84computeObjective[] = "SNES.computeObjective(self, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_85computeObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeObjective (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,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);
        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_x)) != 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, "computeObjective") < 0)) __PYX_ERR(36, 339, __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_x = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeObjective", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 339, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.computeObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(36, 339, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_84computeObjective(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_x);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_84computeObjective(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x) {
  PetscReal __pyx_v_o;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("computeObjective", 0);

  /* "PETSc/SNES.pyx":340
 * 
 *     def computeObjective(self, Vec x not None):
 *         cdef PetscReal o = 0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESComputeObjective(self.snes, x.vec, &o) )
 *         return toReal(o)
 */
  __pyx_v_o = 0.0;

  /* "PETSc/SNES.pyx":341
 *     def computeObjective(self, Vec x not None):
 *         cdef PetscReal o = 0
 *         CHKERR( SNESComputeObjective(self.snes, x.vec, &o) )             # <<<<<<<<<<<<<<
 *         return toReal(o)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESComputeObjective(__pyx_v_self->snes, __pyx_v_x->vec, (&__pyx_v_o))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 341, __pyx_L1_error)

  /* "PETSc/SNES.pyx":342
 *         cdef PetscReal o = 0
 *         CHKERR( SNESComputeObjective(self.snes, x.vec, &o) )
 *         return toReal(o)             # <<<<<<<<<<<<<<
 * 
 *     # --- tolerances and convergence ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_o); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":339
 *         CHKERR( SNESComputeJacobian(self.snes, x.vec, jmat, pmat) )
 * 
 *     def computeObjective(self, Vec x not None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal o = 0
 *         CHKERR( SNESComputeObjective(self.snes, x.vec, &o) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.computeObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":346
 *     # --- tolerances and convergence ---
 * 
 *     def setTolerances(self, rtol=None, atol=None, stol=None, max_it=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal crtol, catol, cstol
 *         crtol = catol = cstol = PETSC_DEFAULT
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_87setTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_86setTolerances[] = "SNES.setTolerances(self, rtol=None, atol=None, stol=None, max_it=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_87setTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rtol = 0;
  PyObject *__pyx_v_atol = 0;
  PyObject *__pyx_v_stol = 0;
  PyObject *__pyx_v_max_it = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTolerances (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rtol,&__pyx_n_s_atol,&__pyx_n_s_stol,&__pyx_n_s_max_it,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rtol);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_atol);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stol);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_it);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setTolerances") < 0)) __PYX_ERR(36, 346, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rtol = values[0];
    __pyx_v_atol = values[1];
    __pyx_v_stol = values[2];
    __pyx_v_max_it = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTolerances", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 346, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_86setTolerances(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_rtol, __pyx_v_atol, __pyx_v_stol, __pyx_v_max_it);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_86setTolerances(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_rtol, PyObject *__pyx_v_atol, PyObject *__pyx_v_stol, PyObject *__pyx_v_max_it) {
  PetscReal __pyx_v_crtol;
  PetscReal __pyx_v_catol;
  PetscReal __pyx_v_cstol;
  PetscInt __pyx_v_cmaxit;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscReal __pyx_t_3;
  PetscInt __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setTolerances", 0);

  /* "PETSc/SNES.pyx":348
 *     def setTolerances(self, rtol=None, atol=None, stol=None, max_it=None):
 *         cdef PetscReal crtol, catol, cstol
 *         crtol = catol = cstol = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscInt cmaxit = PETSC_DEFAULT
 *         if rtol   is not None: crtol  = asReal(rtol)
 */
  __pyx_v_crtol = PETSC_DEFAULT;
  __pyx_v_catol = PETSC_DEFAULT;
  __pyx_v_cstol = PETSC_DEFAULT;

  /* "PETSc/SNES.pyx":349
 *         cdef PetscReal crtol, catol, cstol
 *         crtol = catol = cstol = PETSC_DEFAULT
 *         cdef PetscInt cmaxit = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         if rtol   is not None: crtol  = asReal(rtol)
 *         if atol   is not None: catol  = asReal(atol)
 */
  __pyx_v_cmaxit = PETSC_DEFAULT;

  /* "PETSc/SNES.pyx":350
 *         crtol = catol = cstol = PETSC_DEFAULT
 *         cdef PetscInt cmaxit = PETSC_DEFAULT
 *         if rtol   is not None: crtol  = asReal(rtol)             # <<<<<<<<<<<<<<
 *         if atol   is not None: catol  = asReal(atol)
 *         if stol   is not None: cstol  = asReal(stol)
 */
  __pyx_t_1 = (__pyx_v_rtol != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_rtol); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 350, __pyx_L1_error)
    __pyx_v_crtol = __pyx_t_3;
  }

  /* "PETSc/SNES.pyx":351
 *         cdef PetscInt cmaxit = PETSC_DEFAULT
 *         if rtol   is not None: crtol  = asReal(rtol)
 *         if atol   is not None: catol  = asReal(atol)             # <<<<<<<<<<<<<<
 *         if stol   is not None: cstol  = asReal(stol)
 *         if max_it is not None: cmaxit = asInt(max_it)
 */
  __pyx_t_2 = (__pyx_v_atol != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_atol); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 351, __pyx_L1_error)
    __pyx_v_catol = __pyx_t_3;
  }

  /* "PETSc/SNES.pyx":352
 *         if rtol   is not None: crtol  = asReal(rtol)
 *         if atol   is not None: catol  = asReal(atol)
 *         if stol   is not None: cstol  = asReal(stol)             # <<<<<<<<<<<<<<
 *         if max_it is not None: cmaxit = asInt(max_it)
 *         CHKERR( SNESSetTolerances(self.snes, catol, crtol, cstol,
 */
  __pyx_t_1 = (__pyx_v_stol != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_stol); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 352, __pyx_L1_error)
    __pyx_v_cstol = __pyx_t_3;
  }

  /* "PETSc/SNES.pyx":353
 *         if atol   is not None: catol  = asReal(atol)
 *         if stol   is not None: cstol  = asReal(stol)
 *         if max_it is not None: cmaxit = asInt(max_it)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetTolerances(self.snes, catol, crtol, cstol,
 *                                   cmaxit, PETSC_DEFAULT) )
 */
  __pyx_t_2 = (__pyx_v_max_it != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_max_it); if (unlikely(__pyx_t_4 == -1L && PyErr_Occurred())) __PYX_ERR(36, 353, __pyx_L1_error)
    __pyx_v_cmaxit = __pyx_t_4;
  }

  /* "PETSc/SNES.pyx":354
 *         if stol   is not None: cstol  = asReal(stol)
 *         if max_it is not None: cmaxit = asInt(max_it)
 *         CHKERR( SNESSetTolerances(self.snes, catol, crtol, cstol,             # <<<<<<<<<<<<<<
 *                                   cmaxit, PETSC_DEFAULT) )
 * 
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetTolerances(__pyx_v_self->snes, __pyx_v_catol, __pyx_v_crtol, __pyx_v_cstol, __pyx_v_cmaxit, PETSC_DEFAULT)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(36, 354, __pyx_L1_error)

  /* "PETSc/SNES.pyx":346
 *     # --- tolerances and convergence ---
 * 
 *     def setTolerances(self, rtol=None, atol=None, stol=None, max_it=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal crtol, catol, cstol
 *         crtol = catol = cstol = PETSC_DEFAULT
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":357
 *                                   cmaxit, PETSC_DEFAULT) )
 * 
 *     def getTolerances(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal crtol=0, catol=0, cstol=0
 *         cdef PetscInt cmaxit=0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_89getTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_88getTolerances[] = "SNES.getTolerances(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_89getTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTolerances (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getTolerances", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getTolerances", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_88getTolerances(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_88getTolerances(struct PyPetscSNESObject *__pyx_v_self) {
  PetscReal __pyx_v_crtol;
  PetscReal __pyx_v_catol;
  PetscReal __pyx_v_cstol;
  PetscInt __pyx_v_cmaxit;
  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;
  __Pyx_RefNannySetupContext("getTolerances", 0);

  /* "PETSc/SNES.pyx":358
 * 
 *     def getTolerances(self):
 *         cdef PetscReal crtol=0, catol=0, cstol=0             # <<<<<<<<<<<<<<
 *         cdef PetscInt cmaxit=0
 *         CHKERR( SNESGetTolerances(self.snes, &catol, &crtol, &cstol,
 */
  __pyx_v_crtol = 0.0;
  __pyx_v_catol = 0.0;
  __pyx_v_cstol = 0.0;

  /* "PETSc/SNES.pyx":359
 *     def getTolerances(self):
 *         cdef PetscReal crtol=0, catol=0, cstol=0
 *         cdef PetscInt cmaxit=0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetTolerances(self.snes, &catol, &crtol, &cstol,
 *                                   &cmaxit, NULL) )
 */
  __pyx_v_cmaxit = 0;

  /* "PETSc/SNES.pyx":360
 *         cdef PetscReal crtol=0, catol=0, cstol=0
 *         cdef PetscInt cmaxit=0
 *         CHKERR( SNESGetTolerances(self.snes, &catol, &crtol, &cstol,             # <<<<<<<<<<<<<<
 *                                   &cmaxit, NULL) )
 *         return (toReal(crtol), toReal(catol), toReal(cstol), toInt(cmaxit))
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetTolerances(__pyx_v_self->snes, (&__pyx_v_catol), (&__pyx_v_crtol), (&__pyx_v_cstol), (&__pyx_v_cmaxit), NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 360, __pyx_L1_error)

  /* "PETSc/SNES.pyx":362
 *         CHKERR( SNESGetTolerances(self.snes, &catol, &crtol, &cstol,
 *                                   &cmaxit, NULL) )
 *         return (toReal(crtol), toReal(catol), toReal(cstol), toInt(cmaxit))             # <<<<<<<<<<<<<<
 * 
 *     def setNormSchedule(self, normsched):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_crtol); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_catol); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_cstol); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_cmaxit); if (unlikely(!__pyx_t_5)) __PYX_ERR(36, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(36, 362, __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_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":357
 *                                   cmaxit, PETSC_DEFAULT) )
 * 
 *     def getTolerances(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal crtol=0, catol=0, cstol=0
 *         cdef PetscInt cmaxit=0
 */

  /* 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("petsc4py.PETSc.SNES.getTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":364
 *         return (toReal(crtol), toReal(catol), toReal(cstol), toInt(cmaxit))
 * 
 *     def setNormSchedule(self, normsched):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetNormSchedule(self.snes, normsched) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_91setNormSchedule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_90setNormSchedule[] = "SNES.setNormSchedule(self, normsched)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_91setNormSchedule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_normsched = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setNormSchedule (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_normsched,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);
        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_normsched)) != 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, "setNormSchedule") < 0)) __PYX_ERR(36, 364, __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_normsched = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setNormSchedule", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 364, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setNormSchedule", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_90setNormSchedule(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_normsched);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_90setNormSchedule(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_normsched) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  SNESNormSchedule __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setNormSchedule", 0);

  /* "PETSc/SNES.pyx":365
 * 
 *     def setNormSchedule(self, normsched):
 *         CHKERR( SNESSetNormSchedule(self.snes, normsched) )             # <<<<<<<<<<<<<<
 * 
 *     def getNormSchedule(self):
 */
  __pyx_t_1 = ((SNESNormSchedule)__Pyx_PyInt_As_SNESNormSchedule(__pyx_v_normsched)); if (unlikely(PyErr_Occurred())) __PYX_ERR(36, 365, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetNormSchedule(__pyx_v_self->snes, __pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 365, __pyx_L1_error)

  /* "PETSc/SNES.pyx":364
 *         return (toReal(crtol), toReal(catol), toReal(cstol), toInt(cmaxit))
 * 
 *     def setNormSchedule(self, normsched):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetNormSchedule(self.snes, normsched) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setNormSchedule", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":367
 *         CHKERR( SNESSetNormSchedule(self.snes, normsched) )
 * 
 *     def getNormSchedule(self):             # <<<<<<<<<<<<<<
 *         cdef PetscSNESNormSchedule normsched = SNES_NORM_NONE
 *         CHKERR( SNESGetNormSchedule(self.snes, &normsched) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_93getNormSchedule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_92getNormSchedule[] = "SNES.getNormSchedule(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_93getNormSchedule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getNormSchedule (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getNormSchedule", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getNormSchedule", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_92getNormSchedule(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_92getNormSchedule(struct PyPetscSNESObject *__pyx_v_self) {
  SNESNormSchedule __pyx_v_normsched;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getNormSchedule", 0);

  /* "PETSc/SNES.pyx":368
 * 
 *     def getNormSchedule(self):
 *         cdef PetscSNESNormSchedule normsched = SNES_NORM_NONE             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetNormSchedule(self.snes, &normsched) )
 *         return normsched
 */
  __pyx_v_normsched = SNES_NORM_NONE;

  /* "PETSc/SNES.pyx":369
 *     def getNormSchedule(self):
 *         cdef PetscSNESNormSchedule normsched = SNES_NORM_NONE
 *         CHKERR( SNESGetNormSchedule(self.snes, &normsched) )             # <<<<<<<<<<<<<<
 *         return normsched
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetNormSchedule(__pyx_v_self->snes, (&__pyx_v_normsched))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 369, __pyx_L1_error)

  /* "PETSc/SNES.pyx":370
 *         cdef PetscSNESNormSchedule normsched = SNES_NORM_NONE
 *         CHKERR( SNESGetNormSchedule(self.snes, &normsched) )
 *         return normsched             # <<<<<<<<<<<<<<
 * 
 *     def setConvergenceTest(self, converged, args=None, kargs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_SNESNormSchedule(__pyx_v_normsched); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":367
 *         CHKERR( SNESSetNormSchedule(self.snes, normsched) )
 * 
 *     def getNormSchedule(self):             # <<<<<<<<<<<<<<
 *         cdef PetscSNESNormSchedule normsched = SNES_NORM_NONE
 *         CHKERR( SNESGetNormSchedule(self.snes, &normsched) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getNormSchedule", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":372
 *         return normsched
 * 
 *     def setConvergenceTest(self, converged, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if converged is not None:
 *             if args  is None: args  = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_95setConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_94setConvergenceTest[] = "SNES.setConvergenceTest(self, converged, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_95setConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_converged = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvergenceTest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_converged,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_converged)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConvergenceTest") < 0)) __PYX_ERR(36, 372, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_converged = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvergenceTest", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 372, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_94setConvergenceTest(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_converged, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_94setConvergenceTest(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_converged, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setConvergenceTest", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/SNES.pyx":373
 * 
 *     def setConvergenceTest(self, converged, args=None, kargs=None):
 *         if converged is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_converged != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/SNES.pyx":374
 *     def setConvergenceTest(self, converged, args=None, kargs=None):
 *         if converged is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (converged, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/SNES.pyx":375
 *         if converged is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (converged, args, kargs)
 *             self.set_attr('__converged__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 375, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/SNES.pyx":376
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (converged, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__converged__', context)
 *             CHKERR( SNESSetConvergenceTest(self.snes, SNES_Converged, <void*>context, NULL) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_converged);
    __Pyx_GIVEREF(__pyx_v_converged);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_converged);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/SNES.pyx":377
 *             if kargs is None: kargs = {}
 *             context = (converged, args, kargs)
 *             self.set_attr('__converged__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( SNESSetConvergenceTest(self.snes, SNES_Converged, <void*>context, NULL) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__converged__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 377, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/SNES.pyx":378
 *             context = (converged, args, kargs)
 *             self.set_attr('__converged__', context)
 *             CHKERR( SNESSetConvergenceTest(self.snes, SNES_Converged, <void*>context, NULL) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( SNESSetConvergenceTest(self.snes, SNESConvergedDefault, NULL, NULL) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetConvergenceTest(__pyx_v_self->snes, __pyx_f_8petsc4py_5PETSc_SNES_Converged, ((void *)__pyx_v_context), NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 378, __pyx_L1_error)

    /* "PETSc/SNES.pyx":373
 * 
 *     def setConvergenceTest(self, converged, args=None, kargs=None):
 *         if converged is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/SNES.pyx":380
 *             CHKERR( SNESSetConvergenceTest(self.snes, SNES_Converged, <void*>context, NULL) )
 *         else:
 *             CHKERR( SNESSetConvergenceTest(self.snes, SNESConvergedDefault, NULL, NULL) )             # <<<<<<<<<<<<<<
 *             self.set_attr('__converged__', None)
 * 
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetConvergenceTest(__pyx_v_self->snes, SNESConvergedDefault, NULL, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 380, __pyx_L1_error)

    /* "PETSc/SNES.pyx":381
 *         else:
 *             CHKERR( SNESSetConvergenceTest(self.snes, SNESConvergedDefault, NULL, NULL) )
 *             self.set_attr('__converged__', None)             # <<<<<<<<<<<<<<
 * 
 *     def getConvergenceTest(self):
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__converged__"), Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "PETSc/SNES.pyx":372
 *         return normsched
 * 
 *     def setConvergenceTest(self, converged, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if converged is not None:
 *             if args  is None: args  = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":383
 *             self.set_attr('__converged__', None)
 * 
 *     def getConvergenceTest(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__converged__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_97getConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_96getConvergenceTest[] = "SNES.getConvergenceTest(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_97getConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvergenceTest (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getConvergenceTest", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getConvergenceTest", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_96getConvergenceTest(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_96getConvergenceTest(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getConvergenceTest", 0);

  /* "PETSc/SNES.pyx":384
 * 
 *     def getConvergenceTest(self):
 *         return self.get_attr('__converged__')             # <<<<<<<<<<<<<<
 * 
 *     def callConvergenceTest(self, its, xnorm, ynorm, fnorm):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__converged__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":383
 *             self.set_attr('__converged__', None)
 * 
 *     def getConvergenceTest(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__converged__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":386
 *         return self.get_attr('__converged__')
 * 
 *     def callConvergenceTest(self, its, xnorm, ynorm, fnorm):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival  = asInt(its)
 *         cdef PetscReal rval1 = asReal(xnorm)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_99callConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_98callConvergenceTest[] = "SNES.callConvergenceTest(self, its, xnorm, ynorm, fnorm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_99callConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_its = 0;
  PyObject *__pyx_v_xnorm = 0;
  PyObject *__pyx_v_ynorm = 0;
  PyObject *__pyx_v_fnorm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("callConvergenceTest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_its,&__pyx_n_s_xnorm,&__pyx_n_s_ynorm,&__pyx_n_s_fnorm,0};
    PyObject* values[4] = {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  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_its)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xnorm)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("callConvergenceTest", 1, 4, 4, 1); __PYX_ERR(36, 386, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ynorm)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("callConvergenceTest", 1, 4, 4, 2); __PYX_ERR(36, 386, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fnorm)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("callConvergenceTest", 1, 4, 4, 3); __PYX_ERR(36, 386, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "callConvergenceTest") < 0)) __PYX_ERR(36, 386, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      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);
    }
    __pyx_v_its = values[0];
    __pyx_v_xnorm = values[1];
    __pyx_v_ynorm = values[2];
    __pyx_v_fnorm = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("callConvergenceTest", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 386, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.callConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_98callConvergenceTest(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_its, __pyx_v_xnorm, __pyx_v_ynorm, __pyx_v_fnorm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_98callConvergenceTest(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_its, PyObject *__pyx_v_xnorm, PyObject *__pyx_v_ynorm, PyObject *__pyx_v_fnorm) {
  PetscInt __pyx_v_ival;
  PetscReal __pyx_v_rval1;
  PetscReal __pyx_v_rval2;
  PetscReal __pyx_v_rval3;
  SNESConvergedReason __pyx_v_reason;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscReal __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("callConvergenceTest", 0);

  /* "PETSc/SNES.pyx":387
 * 
 *     def callConvergenceTest(self, its, xnorm, ynorm, fnorm):
 *         cdef PetscInt  ival  = asInt(its)             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval1 = asReal(xnorm)
 *         cdef PetscReal rval2 = asReal(ynorm)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_its); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 387, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/SNES.pyx":388
 *     def callConvergenceTest(self, its, xnorm, ynorm, fnorm):
 *         cdef PetscInt  ival  = asInt(its)
 *         cdef PetscReal rval1 = asReal(xnorm)             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval2 = asReal(ynorm)
 *         cdef PetscReal rval3 = asReal(fnorm)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_xnorm); if (unlikely(__pyx_t_2 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 388, __pyx_L1_error)
  __pyx_v_rval1 = __pyx_t_2;

  /* "PETSc/SNES.pyx":389
 *         cdef PetscInt  ival  = asInt(its)
 *         cdef PetscReal rval1 = asReal(xnorm)
 *         cdef PetscReal rval2 = asReal(ynorm)             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval3 = asReal(fnorm)
 *         cdef PetscSNESConvergedReason reason = SNES_CONVERGED_ITERATING
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_ynorm); if (unlikely(__pyx_t_2 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 389, __pyx_L1_error)
  __pyx_v_rval2 = __pyx_t_2;

  /* "PETSc/SNES.pyx":390
 *         cdef PetscReal rval1 = asReal(xnorm)
 *         cdef PetscReal rval2 = asReal(ynorm)
 *         cdef PetscReal rval3 = asReal(fnorm)             # <<<<<<<<<<<<<<
 *         cdef PetscSNESConvergedReason reason = SNES_CONVERGED_ITERATING
 *         CHKERR( SNESConvergenceTestCall(self.snes, ival,
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_fnorm); if (unlikely(__pyx_t_2 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 390, __pyx_L1_error)
  __pyx_v_rval3 = __pyx_t_2;

  /* "PETSc/SNES.pyx":391
 *         cdef PetscReal rval2 = asReal(ynorm)
 *         cdef PetscReal rval3 = asReal(fnorm)
 *         cdef PetscSNESConvergedReason reason = SNES_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *         CHKERR( SNESConvergenceTestCall(self.snes, ival,
 *                                         rval1, rval2, rval3, &reason) )
 */
  __pyx_v_reason = SNES_CONVERGED_ITERATING;

  /* "PETSc/SNES.pyx":392
 *         cdef PetscReal rval3 = asReal(fnorm)
 *         cdef PetscSNESConvergedReason reason = SNES_CONVERGED_ITERATING
 *         CHKERR( SNESConvergenceTestCall(self.snes, ival,             # <<<<<<<<<<<<<<
 *                                         rval1, rval2, rval3, &reason) )
 *         return reason
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESConvergenceTestCall(__pyx_v_self->snes, __pyx_v_ival, __pyx_v_rval1, __pyx_v_rval2, __pyx_v_rval3, (&__pyx_v_reason))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(36, 392, __pyx_L1_error)

  /* "PETSc/SNES.pyx":394
 *         CHKERR( SNESConvergenceTestCall(self.snes, ival,
 *                                         rval1, rval2, rval3, &reason) )
 *         return reason             # <<<<<<<<<<<<<<
 * 
 *     def setConvergenceHistory(self, length=None, reset=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_From_SNESConvergedReason(__pyx_v_reason); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":386
 *         return self.get_attr('__converged__')
 * 
 *     def callConvergenceTest(self, its, xnorm, ynorm, fnorm):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival  = asInt(its)
 *         cdef PetscReal rval1 = asReal(xnorm)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.callConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":396
 *         return reason
 * 
 *     def setConvergenceHistory(self, length=None, reset=False):             # <<<<<<<<<<<<<<
 *         cdef PetscReal *rdata = NULL
 *         cdef PetscInt  *idata = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_101setConvergenceHistory(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_100setConvergenceHistory[] = "SNES.setConvergenceHistory(self, length=None, reset=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_101setConvergenceHistory(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_length = 0;
  PyObject *__pyx_v_reset = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvergenceHistory (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_length,&__pyx_n_s_reset,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_length);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reset);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConvergenceHistory") < 0)) __PYX_ERR(36, 396, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_length = values[0];
    __pyx_v_reset = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvergenceHistory", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 396, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setConvergenceHistory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_100setConvergenceHistory(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_length, __pyx_v_reset);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_100setConvergenceHistory(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_length, PyObject *__pyx_v_reset) {
  PetscReal *__pyx_v_rdata;
  PetscInt *__pyx_v_idata;
  PetscInt __pyx_v_size;
  PetscBool __pyx_v_flag;
  PyObject *__pyx_v_rhist = 0;
  PyObject *__pyx_v_ihist = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("setConvergenceHistory", 0);

  /* "PETSc/SNES.pyx":397
 * 
 *     def setConvergenceHistory(self, length=None, reset=False):
 *         cdef PetscReal *rdata = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt  *idata = NULL
 *         cdef PetscInt   size = 1000
 */
  __pyx_v_rdata = NULL;

  /* "PETSc/SNES.pyx":398
 *     def setConvergenceHistory(self, length=None, reset=False):
 *         cdef PetscReal *rdata = NULL
 *         cdef PetscInt  *idata = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt   size = 1000
 *         cdef PetscBool flag = PETSC_FALSE
 */
  __pyx_v_idata = NULL;

  /* "PETSc/SNES.pyx":399
 *         cdef PetscReal *rdata = NULL
 *         cdef PetscInt  *idata = NULL
 *         cdef PetscInt   size = 1000             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         if   length is True:     pass
 */
  __pyx_v_size = 0x3E8;

  /* "PETSc/SNES.pyx":400
 *         cdef PetscInt  *idata = NULL
 *         cdef PetscInt   size = 1000
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         if   length is True:     pass
 *         elif length is not None: size = asInt(length)
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/SNES.pyx":401
 *         cdef PetscInt   size = 1000
 *         cdef PetscBool flag = PETSC_FALSE
 *         if   length is True:     pass             # <<<<<<<<<<<<<<
 *         elif length is not None: size = asInt(length)
 *         if size < 0: size = 1000
 */
  __pyx_t_1 = (__pyx_v_length == Py_True);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    goto __pyx_L3;
  }

  /* "PETSc/SNES.pyx":402
 *         cdef PetscBool flag = PETSC_FALSE
 *         if   length is True:     pass
 *         elif length is not None: size = asInt(length)             # <<<<<<<<<<<<<<
 *         if size < 0: size = 1000
 *         if reset: flag = PETSC_TRUE
 */
  __pyx_t_2 = (__pyx_v_length != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_length); if (unlikely(__pyx_t_3 == -1L && PyErr_Occurred())) __PYX_ERR(36, 402, __pyx_L1_error)
    __pyx_v_size = __pyx_t_3;
  }
  __pyx_L3:;

  /* "PETSc/SNES.pyx":403
 *         if   length is True:     pass
 *         elif length is not None: size = asInt(length)
 *         if size < 0: size = 1000             # <<<<<<<<<<<<<<
 *         if reset: flag = PETSC_TRUE
 *         cdef object rhist = oarray_r(empty_r(size), NULL, &rdata)
 */
  __pyx_t_1 = ((__pyx_v_size < 0) != 0);
  if (__pyx_t_1) {
    __pyx_v_size = 0x3E8;
  }

  /* "PETSc/SNES.pyx":404
 *         elif length is not None: size = asInt(length)
 *         if size < 0: size = 1000
 *         if reset: flag = PETSC_TRUE             # <<<<<<<<<<<<<<
 *         cdef object rhist = oarray_r(empty_r(size), NULL, &rdata)
 *         cdef object ihist = oarray_i(empty_i(size), NULL, &idata)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reset); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(36, 404, __pyx_L1_error)
  if (__pyx_t_1) {
    __pyx_v_flag = PETSC_TRUE;
  }

  /* "PETSc/SNES.pyx":405
 *         if size < 0: size = 1000
 *         if reset: flag = PETSC_TRUE
 *         cdef object rhist = oarray_r(empty_r(size), NULL, &rdata)             # <<<<<<<<<<<<<<
 *         cdef object ihist = oarray_i(empty_i(size), NULL, &idata)
 *         self.set_attr('__history__', (rhist, ihist))
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_r(__pyx_v_size)); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_r(__pyx_t_4, NULL, (&__pyx_v_rdata))); if (unlikely(!__pyx_t_5)) __PYX_ERR(36, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_rhist = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "PETSc/SNES.pyx":406
 *         if reset: flag = PETSC_TRUE
 *         cdef object rhist = oarray_r(empty_r(size), NULL, &rdata)
 *         cdef object ihist = oarray_i(empty_i(size), NULL, &idata)             # <<<<<<<<<<<<<<
 *         self.set_attr('__history__', (rhist, ihist))
 *         CHKERR( SNESSetConvergenceHistory(self.snes, rdata, idata, size, flag) )
 */
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_i(__pyx_v_size)); if (unlikely(!__pyx_t_5)) __PYX_ERR(36, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_i(__pyx_t_5, NULL, (&__pyx_v_idata))); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_ihist = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/SNES.pyx":407
 *         cdef object rhist = oarray_r(empty_r(size), NULL, &rdata)
 *         cdef object ihist = oarray_i(empty_i(size), NULL, &idata)
 *         self.set_attr('__history__', (rhist, ihist))             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetConvergenceHistory(self.snes, rdata, idata, size, flag) )
 * 
 */
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_rhist);
  __Pyx_GIVEREF(__pyx_v_rhist);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_rhist);
  __Pyx_INCREF(__pyx_v_ihist);
  __Pyx_GIVEREF(__pyx_v_ihist);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_ihist);
  __pyx_t_5 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__history__"), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(36, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/SNES.pyx":408
 *         cdef object ihist = oarray_i(empty_i(size), NULL, &idata)
 *         self.set_attr('__history__', (rhist, ihist))
 *         CHKERR( SNESSetConvergenceHistory(self.snes, rdata, idata, size, flag) )             # <<<<<<<<<<<<<<
 * 
 *     def getConvergenceHistory(self):
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetConvergenceHistory(__pyx_v_self->snes, __pyx_v_rdata, __pyx_v_idata, __pyx_v_size, __pyx_v_flag)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(36, 408, __pyx_L1_error)

  /* "PETSc/SNES.pyx":396
 *         return reason
 * 
 *     def setConvergenceHistory(self, length=None, reset=False):             # <<<<<<<<<<<<<<
 *         cdef PetscReal *rdata = NULL
 *         cdef PetscInt  *idata = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setConvergenceHistory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rhist);
  __Pyx_XDECREF(__pyx_v_ihist);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":410
 *         CHKERR( SNESSetConvergenceHistory(self.snes, rdata, idata, size, flag) )
 * 
 *     def getConvergenceHistory(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal *rdata = NULL
 *         cdef PetscInt  *idata = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_103getConvergenceHistory(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_102getConvergenceHistory[] = "SNES.getConvergenceHistory(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_103getConvergenceHistory(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvergenceHistory (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getConvergenceHistory", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getConvergenceHistory", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_102getConvergenceHistory(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_102getConvergenceHistory(struct PyPetscSNESObject *__pyx_v_self) {
  PetscReal *__pyx_v_rdata;
  PetscInt *__pyx_v_idata;
  PetscInt __pyx_v_size;
  PyObject *__pyx_v_rhist = 0;
  PyObject *__pyx_v_ihist = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvergenceHistory", 0);

  /* "PETSc/SNES.pyx":411
 * 
 *     def getConvergenceHistory(self):
 *         cdef PetscReal *rdata = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt  *idata = NULL
 *         cdef PetscInt   size = 0
 */
  __pyx_v_rdata = NULL;

  /* "PETSc/SNES.pyx":412
 *     def getConvergenceHistory(self):
 *         cdef PetscReal *rdata = NULL
 *         cdef PetscInt  *idata = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt   size = 0
 *         CHKERR( SNESGetConvergenceHistory(self.snes, &rdata, &idata, &size) )
 */
  __pyx_v_idata = NULL;

  /* "PETSc/SNES.pyx":413
 *         cdef PetscReal *rdata = NULL
 *         cdef PetscInt  *idata = NULL
 *         cdef PetscInt   size = 0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetConvergenceHistory(self.snes, &rdata, &idata, &size) )
 *         cdef object rhist = array_r(size, rdata)
 */
  __pyx_v_size = 0;

  /* "PETSc/SNES.pyx":414
 *         cdef PetscInt  *idata = NULL
 *         cdef PetscInt   size = 0
 *         CHKERR( SNESGetConvergenceHistory(self.snes, &rdata, &idata, &size) )             # <<<<<<<<<<<<<<
 *         cdef object rhist = array_r(size, rdata)
 *         cdef object ihist = array_i(size, idata)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetConvergenceHistory(__pyx_v_self->snes, (&__pyx_v_rdata), (&__pyx_v_idata), (&__pyx_v_size))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 414, __pyx_L1_error)

  /* "PETSc/SNES.pyx":415
 *         cdef PetscInt   size = 0
 *         CHKERR( SNESGetConvergenceHistory(self.snes, &rdata, &idata, &size) )
 *         cdef object rhist = array_r(size, rdata)             # <<<<<<<<<<<<<<
 *         cdef object ihist = array_i(size, idata)
 *         return (rhist, ihist)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_r(__pyx_v_size, __pyx_v_rdata)); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_rhist = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/SNES.pyx":416
 *         CHKERR( SNESGetConvergenceHistory(self.snes, &rdata, &idata, &size) )
 *         cdef object rhist = array_r(size, rdata)
 *         cdef object ihist = array_i(size, idata)             # <<<<<<<<<<<<<<
 *         return (rhist, ihist)
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_size, __pyx_v_idata)); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ihist = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/SNES.pyx":417
 *         cdef object rhist = array_r(size, rdata)
 *         cdef object ihist = array_i(size, idata)
 *         return (rhist, ihist)             # <<<<<<<<<<<<<<
 * 
 *     def logConvergenceHistory(self, norm, linear_its=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_rhist);
  __Pyx_GIVEREF(__pyx_v_rhist);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_rhist);
  __Pyx_INCREF(__pyx_v_ihist);
  __Pyx_GIVEREF(__pyx_v_ihist);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_ihist);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":410
 *         CHKERR( SNESSetConvergenceHistory(self.snes, rdata, idata, size, flag) )
 * 
 *     def getConvergenceHistory(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal *rdata = NULL
 *         cdef PetscInt  *idata = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getConvergenceHistory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rhist);
  __Pyx_XDECREF(__pyx_v_ihist);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":419
 *         return (rhist, ihist)
 * 
 *     def logConvergenceHistory(self, norm, linear_its=0):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(norm)
 *         cdef PetscInt  ival = asInt(linear_its)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_105logConvergenceHistory(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_104logConvergenceHistory[] = "SNES.logConvergenceHistory(self, norm, linear_its=0)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_105logConvergenceHistory(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_norm = 0;
  PyObject *__pyx_v_linear_its = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("logConvergenceHistory (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_norm,&__pyx_n_s_linear_its,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_int_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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_norm)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_linear_its);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "logConvergenceHistory") < 0)) __PYX_ERR(36, 419, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_norm = values[0];
    __pyx_v_linear_its = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("logConvergenceHistory", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 419, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.logConvergenceHistory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_104logConvergenceHistory(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_norm, __pyx_v_linear_its);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_104logConvergenceHistory(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_norm, PyObject *__pyx_v_linear_its) {
  PetscReal __pyx_v_rval;
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  PetscInt __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("logConvergenceHistory", 0);

  /* "PETSc/SNES.pyx":420
 * 
 *     def logConvergenceHistory(self, norm, linear_its=0):
 *         cdef PetscReal rval = asReal(norm)             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = asInt(linear_its)
 *         CHKERR( SNESLogConvergenceHistory(self.snes, rval, ival) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_norm); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 420, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/SNES.pyx":421
 *     def logConvergenceHistory(self, norm, linear_its=0):
 *         cdef PetscReal rval = asReal(norm)
 *         cdef PetscInt  ival = asInt(linear_its)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESLogConvergenceHistory(self.snes, rval, ival) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_linear_its); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(36, 421, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_2;

  /* "PETSc/SNES.pyx":422
 *         cdef PetscReal rval = asReal(norm)
 *         cdef PetscInt  ival = asInt(linear_its)
 *         CHKERR( SNESLogConvergenceHistory(self.snes, rval, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def setResetCounters(self, reset=True):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESLogConvergenceHistory(__pyx_v_self->snes, __pyx_v_rval, __pyx_v_ival)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(36, 422, __pyx_L1_error)

  /* "PETSc/SNES.pyx":419
 *         return (rhist, ihist)
 * 
 *     def logConvergenceHistory(self, norm, linear_its=0):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(norm)
 *         cdef PetscInt  ival = asInt(linear_its)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.logConvergenceHistory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":424
 *         CHKERR( SNESLogConvergenceHistory(self.snes, rval, ival) )
 * 
 *     def setResetCounters(self, reset=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = reset
 *         CHKERR( SNESSetCountersReset(self.snes, flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_107setResetCounters(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_106setResetCounters[] = "SNES.setResetCounters(self, reset=True)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_107setResetCounters(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_reset = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setResetCounters (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reset,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reset);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setResetCounters") < 0)) __PYX_ERR(36, 424, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_reset = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setResetCounters", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 424, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setResetCounters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_106setResetCounters(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_reset);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_106setResetCounters(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_reset) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setResetCounters", 0);

  /* "PETSc/SNES.pyx":425
 * 
 *     def setResetCounters(self, reset=True):
 *         cdef PetscBool flag = reset             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetCountersReset(self.snes, flag) )
 * 
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_reset)); if (unlikely(PyErr_Occurred())) __PYX_ERR(36, 425, __pyx_L1_error)
  __pyx_v_flag = __pyx_t_1;

  /* "PETSc/SNES.pyx":426
 *     def setResetCounters(self, reset=True):
 *         cdef PetscBool flag = reset
 *         CHKERR( SNESSetCountersReset(self.snes, flag) )             # <<<<<<<<<<<<<<
 * 
 *     # --- monitoring ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetCountersReset(__pyx_v_self->snes, __pyx_v_flag)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 426, __pyx_L1_error)

  /* "PETSc/SNES.pyx":424
 *         CHKERR( SNESLogConvergenceHistory(self.snes, rval, ival) )
 * 
 *     def setResetCounters(self, reset=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = reset
 *         CHKERR( SNESSetCountersReset(self.snes, flag) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setResetCounters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":430
 *     # --- monitoring ---
 * 
 *     def setMonitor(self, monitor, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_109setMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_108setMonitor[] = "SNES.setMonitor(self, monitor, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_109setMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_monitor = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMonitor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_monitor,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_monitor)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMonitor") < 0)) __PYX_ERR(36, 430, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_monitor = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMonitor", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 430, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_108setMonitor(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_monitor, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_108setMonitor(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_monitor, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_monitorlist = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setMonitor", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/SNES.pyx":431
 * 
 *     def setMonitor(self, monitor, args=None, kargs=None):
 *         if monitor is None: return             # <<<<<<<<<<<<<<
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:
 */
  __pyx_t_1 = (__pyx_v_monitor == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "PETSc/SNES.pyx":432
 *     def setMonitor(self, monitor, args=None, kargs=None):
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')             # <<<<<<<<<<<<<<
 *         if monitorlist is None:
 *             monitorlist = []
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__")); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_monitorlist = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":433
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:             # <<<<<<<<<<<<<<
 *             monitorlist = []
 *             self.set_attr('__monitor__', monitorlist)
 */
  __pyx_t_2 = (__pyx_v_monitorlist == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/SNES.pyx":434
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:
 *             monitorlist = []             # <<<<<<<<<<<<<<
 *             self.set_attr('__monitor__', monitorlist)
 *             CHKERR( SNESMonitorSet(self.snes, SNES_Monitor, NULL, NULL) )
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_monitorlist, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/SNES.pyx":435
 *         if monitorlist is None:
 *             monitorlist = []
 *             self.set_attr('__monitor__', monitorlist)             # <<<<<<<<<<<<<<
 *             CHKERR( SNESMonitorSet(self.snes, SNES_Monitor, NULL, NULL) )
 *         if args  is None: args  = ()
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__"), __pyx_v_monitorlist); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 435, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/SNES.pyx":436
 *             monitorlist = []
 *             self.set_attr('__monitor__', monitorlist)
 *             CHKERR( SNESMonitorSet(self.snes, SNES_Monitor, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESMonitorSet(__pyx_v_self->snes, __pyx_f_8petsc4py_5PETSc_SNES_Monitor, NULL, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 436, __pyx_L1_error)

    /* "PETSc/SNES.pyx":433
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:             # <<<<<<<<<<<<<<
 *             monitorlist = []
 *             self.set_attr('__monitor__', monitorlist)
 */
  }

  /* "PETSc/SNES.pyx":437
 *             self.set_attr('__monitor__', monitorlist)
 *             CHKERR( SNESMonitorSet(self.snes, SNES_Monitor, NULL, NULL) )
 *         if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         context = (monitor, args, kargs)
 */
  __pyx_t_1 = (__pyx_v_args == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/SNES.pyx":438
 *             CHKERR( SNESMonitorSet(self.snes, SNES_Monitor, NULL, NULL) )
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         context = (monitor, args, kargs)
 *         monitorlist.append(context)
 */
  __pyx_t_2 = (__pyx_v_kargs == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "PETSc/SNES.pyx":439
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}
 *         context = (monitor, args, kargs)             # <<<<<<<<<<<<<<
 *         monitorlist.append(context)
 * 
 */
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_monitor);
  __Pyx_GIVEREF(__pyx_v_monitor);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_monitor);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
  __pyx_v_context = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":440
 *         if kargs is None: kargs = {}
 *         context = (monitor, args, kargs)
 *         monitorlist.append(context)             # <<<<<<<<<<<<<<
 * 
 *     def getMonitor(self):
 */
  __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_monitorlist, __pyx_v_context); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(36, 440, __pyx_L1_error)

  /* "PETSc/SNES.pyx":430
 *     # --- monitoring ---
 * 
 *     def setMonitor(self, monitor, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_monitorlist);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":442
 *         monitorlist.append(context)
 * 
 *     def getMonitor(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__monitor__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_111getMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_110getMonitor[] = "SNES.getMonitor(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_111getMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMonitor (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMonitor", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMonitor", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_110getMonitor(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_110getMonitor(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getMonitor", 0);

  /* "PETSc/SNES.pyx":443
 * 
 *     def getMonitor(self):
 *         return self.get_attr('__monitor__')             # <<<<<<<<<<<<<<
 * 
 *     def cancelMonitor(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":442
 *         monitorlist.append(context)
 * 
 *     def getMonitor(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__monitor__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":445
 *         return self.get_attr('__monitor__')
 * 
 *     def cancelMonitor(self):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESMonitorCancel(self.snes) )
 *         self.set_attr('__monitor__', None)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_113cancelMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_112cancelMonitor[] = "SNES.cancelMonitor(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_113cancelMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cancelMonitor (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("cancelMonitor", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "cancelMonitor", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_112cancelMonitor(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_112cancelMonitor(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("cancelMonitor", 0);

  /* "PETSc/SNES.pyx":446
 * 
 *     def cancelMonitor(self):
 *         CHKERR( SNESMonitorCancel(self.snes) )             # <<<<<<<<<<<<<<
 *         self.set_attr('__monitor__', None)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESMonitorCancel(__pyx_v_self->snes)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 446, __pyx_L1_error)

  /* "PETSc/SNES.pyx":447
 *     def cancelMonitor(self):
 *         CHKERR( SNESMonitorCancel(self.snes) )
 *         self.set_attr('__monitor__', None)             # <<<<<<<<<<<<<<
 * 
 *     def monitor(self, its, rnorm):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_SNES *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__"), Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/SNES.pyx":445
 *         return self.get_attr('__monitor__')
 * 
 *     def cancelMonitor(self):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESMonitorCancel(self.snes) )
 *         self.set_attr('__monitor__', None)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.cancelMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":449
 *         self.set_attr('__monitor__', None)
 * 
 *     def monitor(self, its, rnorm):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = asInt(its)
 *         cdef PetscReal rval = asReal(rnorm)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_115monitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_114monitor[] = "SNES.monitor(self, its, rnorm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_115monitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_its = 0;
  PyObject *__pyx_v_rnorm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("monitor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_its,&__pyx_n_s_rnorm,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_its)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rnorm)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("monitor", 1, 2, 2, 1); __PYX_ERR(36, 449, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "monitor") < 0)) __PYX_ERR(36, 449, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_its = values[0];
    __pyx_v_rnorm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("monitor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 449, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_114monitor(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_its, __pyx_v_rnorm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_114monitor(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_its, PyObject *__pyx_v_rnorm) {
  PetscInt __pyx_v_ival;
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscReal __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("monitor", 0);

  /* "PETSc/SNES.pyx":450
 * 
 *     def monitor(self, its, rnorm):
 *         cdef PetscInt  ival = asInt(its)             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(rnorm)
 *         CHKERR( SNESMonitor(self.snes, ival, rval) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_its); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 450, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/SNES.pyx":451
 *     def monitor(self, its, rnorm):
 *         cdef PetscInt  ival = asInt(its)
 *         cdef PetscReal rval = asReal(rnorm)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESMonitor(self.snes, ival, rval) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_rnorm); if (unlikely(__pyx_t_2 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 451, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_2;

  /* "PETSc/SNES.pyx":452
 *         cdef PetscInt  ival = asInt(its)
 *         cdef PetscReal rval = asReal(rnorm)
 *         CHKERR( SNESMonitor(self.snes, ival, rval) )             # <<<<<<<<<<<<<<
 * 
 *     # --- more tolerances ---
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESMonitor(__pyx_v_self->snes, __pyx_v_ival, __pyx_v_rval)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(36, 452, __pyx_L1_error)

  /* "PETSc/SNES.pyx":449
 *         self.set_attr('__monitor__', None)
 * 
 *     def monitor(self, its, rnorm):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = asInt(its)
 *         cdef PetscReal rval = asReal(rnorm)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":456
 *     # --- more tolerances ---
 * 
 *     def setMaxFunctionEvaluations(self, max_funcs):             # <<<<<<<<<<<<<<
 *         cdef PetscReal r = PETSC_DEFAULT
 *         cdef PetscInt  i = PETSC_DEFAULT
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_117setMaxFunctionEvaluations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_116setMaxFunctionEvaluations[] = "SNES.setMaxFunctionEvaluations(self, max_funcs)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_117setMaxFunctionEvaluations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_max_funcs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMaxFunctionEvaluations (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_funcs,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);
        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_max_funcs)) != 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, "setMaxFunctionEvaluations") < 0)) __PYX_ERR(36, 456, __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_max_funcs = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMaxFunctionEvaluations", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 456, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setMaxFunctionEvaluations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_116setMaxFunctionEvaluations(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_max_funcs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_116setMaxFunctionEvaluations(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_max_funcs) {
  PetscReal __pyx_v_r;
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMaxFunctionEvaluations", 0);

  /* "PETSc/SNES.pyx":457
 * 
 *     def setMaxFunctionEvaluations(self, max_funcs):
 *         cdef PetscReal r = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscInt  i = PETSC_DEFAULT
 *         cdef PetscInt ival = asInt(max_funcs)
 */
  __pyx_v_r = PETSC_DEFAULT;

  /* "PETSc/SNES.pyx":458
 *     def setMaxFunctionEvaluations(self, max_funcs):
 *         cdef PetscReal r = PETSC_DEFAULT
 *         cdef PetscInt  i = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(max_funcs)
 *         CHKERR( SNESSetTolerances(self.snes, r, r, r, i, ival) )
 */
  __pyx_v_i = PETSC_DEFAULT;

  /* "PETSc/SNES.pyx":459
 *         cdef PetscReal r = PETSC_DEFAULT
 *         cdef PetscInt  i = PETSC_DEFAULT
 *         cdef PetscInt ival = asInt(max_funcs)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetTolerances(self.snes, r, r, r, i, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_max_funcs); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 459, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/SNES.pyx":460
 *         cdef PetscInt  i = PETSC_DEFAULT
 *         cdef PetscInt ival = asInt(max_funcs)
 *         CHKERR( SNESSetTolerances(self.snes, r, r, r, i, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def getMaxFunctionEvaluations(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetTolerances(__pyx_v_self->snes, __pyx_v_r, __pyx_v_r, __pyx_v_r, __pyx_v_i, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 460, __pyx_L1_error)

  /* "PETSc/SNES.pyx":456
 *     # --- more tolerances ---
 * 
 *     def setMaxFunctionEvaluations(self, max_funcs):             # <<<<<<<<<<<<<<
 *         cdef PetscReal r = PETSC_DEFAULT
 *         cdef PetscInt  i = PETSC_DEFAULT
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setMaxFunctionEvaluations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":462
 *         CHKERR( SNESSetTolerances(self.snes, r, r, r, i, ival) )
 * 
 *     def getMaxFunctionEvaluations(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal *r = NULL
 *         cdef PetscInt  *i = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_119getMaxFunctionEvaluations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_118getMaxFunctionEvaluations[] = "SNES.getMaxFunctionEvaluations(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_119getMaxFunctionEvaluations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMaxFunctionEvaluations (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMaxFunctionEvaluations", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMaxFunctionEvaluations", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_118getMaxFunctionEvaluations(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_118getMaxFunctionEvaluations(struct PyPetscSNESObject *__pyx_v_self) {
  PetscReal *__pyx_v_r;
  PetscInt *__pyx_v_i;
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getMaxFunctionEvaluations", 0);

  /* "PETSc/SNES.pyx":463
 * 
 *     def getMaxFunctionEvaluations(self):
 *         cdef PetscReal *r = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt  *i = NULL
 *         cdef PetscInt ival = 0
 */
  __pyx_v_r = NULL;

  /* "PETSc/SNES.pyx":464
 *     def getMaxFunctionEvaluations(self):
 *         cdef PetscReal *r = NULL
 *         cdef PetscInt  *i = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetTolerances(self.snes, r, r, r, i, &ival) )
 */
  __pyx_v_i = NULL;

  /* "PETSc/SNES.pyx":465
 *         cdef PetscReal *r = NULL
 *         cdef PetscInt  *i = NULL
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetTolerances(self.snes, r, r, r, i, &ival) )
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/SNES.pyx":466
 *         cdef PetscInt  *i = NULL
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetTolerances(self.snes, r, r, r, i, &ival) )             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetTolerances(__pyx_v_self->snes, __pyx_v_r, __pyx_v_r, __pyx_v_r, __pyx_v_i, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 466, __pyx_L1_error)

  /* "PETSc/SNES.pyx":467
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetTolerances(self.snes, r, r, r, i, &ival) )
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def getFunctionEvaluations(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":462
 *         CHKERR( SNESSetTolerances(self.snes, r, r, r, i, ival) )
 * 
 *     def getMaxFunctionEvaluations(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal *r = NULL
 *         cdef PetscInt  *i = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getMaxFunctionEvaluations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":469
 *         return toInt(ival)
 * 
 *     def getFunctionEvaluations(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetNumberFunctionEvals(self.snes, &ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_121getFunctionEvaluations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_120getFunctionEvaluations[] = "SNES.getFunctionEvaluations(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_121getFunctionEvaluations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFunctionEvaluations (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getFunctionEvaluations", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getFunctionEvaluations", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_120getFunctionEvaluations(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_120getFunctionEvaluations(struct PyPetscSNESObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getFunctionEvaluations", 0);

  /* "PETSc/SNES.pyx":470
 * 
 *     def getFunctionEvaluations(self):
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetNumberFunctionEvals(self.snes, &ival) )
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/SNES.pyx":471
 *     def getFunctionEvaluations(self):
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetNumberFunctionEvals(self.snes, &ival) )             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetNumberFunctionEvals(__pyx_v_self->snes, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 471, __pyx_L1_error)

  /* "PETSc/SNES.pyx":472
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetNumberFunctionEvals(self.snes, &ival) )
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def setMaxStepFailures(self, max_fails):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":469
 *         return toInt(ival)
 * 
 *     def getFunctionEvaluations(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetNumberFunctionEvals(self.snes, &ival) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getFunctionEvaluations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":474
 *         return toInt(ival)
 * 
 *     def setMaxStepFailures(self, max_fails):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(max_fails)
 *         CHKERR( SNESSetMaxNonlinearStepFailures(self.snes, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_123setMaxStepFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_122setMaxStepFailures[] = "SNES.setMaxStepFailures(self, max_fails)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_123setMaxStepFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_max_fails = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMaxStepFailures (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_fails,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);
        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_max_fails)) != 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, "setMaxStepFailures") < 0)) __PYX_ERR(36, 474, __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_max_fails = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMaxStepFailures", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 474, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setMaxStepFailures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_122setMaxStepFailures(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_max_fails);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_122setMaxStepFailures(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_max_fails) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMaxStepFailures", 0);

  /* "PETSc/SNES.pyx":475
 * 
 *     def setMaxStepFailures(self, max_fails):
 *         cdef PetscInt ival = asInt(max_fails)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetMaxNonlinearStepFailures(self.snes, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_max_fails); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 475, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/SNES.pyx":476
 *     def setMaxStepFailures(self, max_fails):
 *         cdef PetscInt ival = asInt(max_fails)
 *         CHKERR( SNESSetMaxNonlinearStepFailures(self.snes, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def getMaxStepFailures(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetMaxNonlinearStepFailures(__pyx_v_self->snes, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 476, __pyx_L1_error)

  /* "PETSc/SNES.pyx":474
 *         return toInt(ival)
 * 
 *     def setMaxStepFailures(self, max_fails):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(max_fails)
 *         CHKERR( SNESSetMaxNonlinearStepFailures(self.snes, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setMaxStepFailures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":478
 *         CHKERR( SNESSetMaxNonlinearStepFailures(self.snes, ival) )
 * 
 *     def getMaxStepFailures(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetMaxNonlinearStepFailures(self.snes, &ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_125getMaxStepFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_124getMaxStepFailures[] = "SNES.getMaxStepFailures(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_125getMaxStepFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMaxStepFailures (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMaxStepFailures", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMaxStepFailures", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_124getMaxStepFailures(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_124getMaxStepFailures(struct PyPetscSNESObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getMaxStepFailures", 0);

  /* "PETSc/SNES.pyx":479
 * 
 *     def getMaxStepFailures(self):
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetMaxNonlinearStepFailures(self.snes, &ival) )
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/SNES.pyx":480
 *     def getMaxStepFailures(self):
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetMaxNonlinearStepFailures(self.snes, &ival) )             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetMaxNonlinearStepFailures(__pyx_v_self->snes, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 480, __pyx_L1_error)

  /* "PETSc/SNES.pyx":481
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetMaxNonlinearStepFailures(self.snes, &ival) )
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def getStepFailures(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":478
 *         CHKERR( SNESSetMaxNonlinearStepFailures(self.snes, ival) )
 * 
 *     def getMaxStepFailures(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetMaxNonlinearStepFailures(self.snes, &ival) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getMaxStepFailures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":483
 *         return toInt(ival)
 * 
 *     def getStepFailures(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetNonlinearStepFailures(self.snes, &ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_127getStepFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_126getStepFailures[] = "SNES.getStepFailures(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_127getStepFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getStepFailures (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getStepFailures", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getStepFailures", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_126getStepFailures(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_126getStepFailures(struct PyPetscSNESObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getStepFailures", 0);

  /* "PETSc/SNES.pyx":484
 * 
 *     def getStepFailures(self):
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetNonlinearStepFailures(self.snes, &ival) )
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/SNES.pyx":485
 *     def getStepFailures(self):
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetNonlinearStepFailures(self.snes, &ival) )             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetNonlinearStepFailures(__pyx_v_self->snes, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 485, __pyx_L1_error)

  /* "PETSc/SNES.pyx":486
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetNonlinearStepFailures(self.snes, &ival) )
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def setMaxKSPFailures(self, max_fails):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":483
 *         return toInt(ival)
 * 
 *     def getStepFailures(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetNonlinearStepFailures(self.snes, &ival) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getStepFailures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":488
 *         return toInt(ival)
 * 
 *     def setMaxKSPFailures(self, max_fails):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(max_fails)
 *         CHKERR( SNESSetMaxLinearSolveFailures(self.snes, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_129setMaxKSPFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_128setMaxKSPFailures[] = "SNES.setMaxKSPFailures(self, max_fails)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_129setMaxKSPFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_max_fails = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMaxKSPFailures (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_fails,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);
        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_max_fails)) != 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, "setMaxKSPFailures") < 0)) __PYX_ERR(36, 488, __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_max_fails = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMaxKSPFailures", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 488, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setMaxKSPFailures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_128setMaxKSPFailures(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_max_fails);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_128setMaxKSPFailures(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_max_fails) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMaxKSPFailures", 0);

  /* "PETSc/SNES.pyx":489
 * 
 *     def setMaxKSPFailures(self, max_fails):
 *         cdef PetscInt ival = asInt(max_fails)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetMaxLinearSolveFailures(self.snes, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_max_fails); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 489, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/SNES.pyx":490
 *     def setMaxKSPFailures(self, max_fails):
 *         cdef PetscInt ival = asInt(max_fails)
 *         CHKERR( SNESSetMaxLinearSolveFailures(self.snes, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def getMaxKSPFailures(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetMaxLinearSolveFailures(__pyx_v_self->snes, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 490, __pyx_L1_error)

  /* "PETSc/SNES.pyx":488
 *         return toInt(ival)
 * 
 *     def setMaxKSPFailures(self, max_fails):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(max_fails)
 *         CHKERR( SNESSetMaxLinearSolveFailures(self.snes, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setMaxKSPFailures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":492
 *         CHKERR( SNESSetMaxLinearSolveFailures(self.snes, ival) )
 * 
 *     def getMaxKSPFailures(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetMaxLinearSolveFailures(self.snes, &ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_131getMaxKSPFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_130getMaxKSPFailures[] = "SNES.getMaxKSPFailures(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_131getMaxKSPFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMaxKSPFailures (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMaxKSPFailures", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMaxKSPFailures", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_130getMaxKSPFailures(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_130getMaxKSPFailures(struct PyPetscSNESObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getMaxKSPFailures", 0);

  /* "PETSc/SNES.pyx":493
 * 
 *     def getMaxKSPFailures(self):
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetMaxLinearSolveFailures(self.snes, &ival) )
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/SNES.pyx":494
 *     def getMaxKSPFailures(self):
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetMaxLinearSolveFailures(self.snes, &ival) )             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetMaxLinearSolveFailures(__pyx_v_self->snes, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 494, __pyx_L1_error)

  /* "PETSc/SNES.pyx":495
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetMaxLinearSolveFailures(self.snes, &ival) )
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def getKSPFailures(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":492
 *         CHKERR( SNESSetMaxLinearSolveFailures(self.snes, ival) )
 * 
 *     def getMaxKSPFailures(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetMaxLinearSolveFailures(self.snes, &ival) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getMaxKSPFailures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":497
 *         return toInt(ival)
 * 
 *     def getKSPFailures(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetLinearSolveFailures(self.snes, &ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_133getKSPFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_132getKSPFailures[] = "SNES.getKSPFailures(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_133getKSPFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getKSPFailures (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getKSPFailures", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getKSPFailures", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_132getKSPFailures(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_132getKSPFailures(struct PyPetscSNESObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getKSPFailures", 0);

  /* "PETSc/SNES.pyx":498
 * 
 *     def getKSPFailures(self):
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetLinearSolveFailures(self.snes, &ival) )
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/SNES.pyx":499
 *     def getKSPFailures(self):
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetLinearSolveFailures(self.snes, &ival) )             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetLinearSolveFailures(__pyx_v_self->snes, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 499, __pyx_L1_error)

  /* "PETSc/SNES.pyx":500
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetLinearSolveFailures(self.snes, &ival) )
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     setMaxNonlinearStepFailures = setMaxStepFailures
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":497
 *         return toInt(ival)
 * 
 *     def getKSPFailures(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetLinearSolveFailures(self.snes, &ival) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getKSPFailures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":511
 *     # --- solving ---
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetUp(self.snes) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_135setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_134setUp[] = "SNES.setUp(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_135setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUp (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUp", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUp", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_134setUp(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_134setUp(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUp", 0);

  /* "PETSc/SNES.pyx":512
 * 
 *     def setUp(self):
 *         CHKERR( SNESSetUp(self.snes) )             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetUp(__pyx_v_self->snes)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 512, __pyx_L1_error)

  /* "PETSc/SNES.pyx":511
 *     # --- solving ---
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetUp(self.snes) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":514
 *         CHKERR( SNESSetUp(self.snes) )
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESReset(self.snes) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_137reset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_136reset[] = "SNES.reset(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_137reset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("reset", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "reset", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_136reset(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_136reset(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "PETSc/SNES.pyx":515
 * 
 *     def reset(self):
 *         CHKERR( SNESReset(self.snes) )             # <<<<<<<<<<<<<<
 * 
 *     def solve(self, Vec b, Vec x not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESReset(__pyx_v_self->snes)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 515, __pyx_L1_error)

  /* "PETSc/SNES.pyx":514
 *         CHKERR( SNESSetUp(self.snes) )
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESReset(self.snes) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":517
 *         CHKERR( SNESReset(self.snes) )
 * 
 *     def solve(self, Vec b, Vec x not None):             # <<<<<<<<<<<<<<
 *         cdef PetscVec rhs = NULL
 *         if b is not None: rhs = b.vec
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_139solve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_138solve[] = "SNES.solve(self, Vec b, Vec x)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_139solve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_b = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_x,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solve", 1, 2, 2, 1); __PYX_ERR(36, 517, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solve") < 0)) __PYX_ERR(36, 517, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_b = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 517, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "b", 0))) __PYX_ERR(36, 517, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(36, 517, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_138solve(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_b, __pyx_v_x);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_138solve(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_b, struct PyPetscVecObject *__pyx_v_x) {
  Vec __pyx_v_rhs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Vec __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("solve", 0);

  /* "PETSc/SNES.pyx":518
 * 
 *     def solve(self, Vec b, Vec x not None):
 *         cdef PetscVec rhs = NULL             # <<<<<<<<<<<<<<
 *         if b is not None: rhs = b.vec
 *         CHKERR( SNESSolve(self.snes, rhs, x.vec) )
 */
  __pyx_v_rhs = NULL;

  /* "PETSc/SNES.pyx":519
 *     def solve(self, Vec b, Vec x not None):
 *         cdef PetscVec rhs = NULL
 *         if b is not None: rhs = b.vec             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSolve(self.snes, rhs, x.vec) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_b) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_b->vec;
    __pyx_v_rhs = __pyx_t_3;
  }

  /* "PETSc/SNES.pyx":520
 *         cdef PetscVec rhs = NULL
 *         if b is not None: rhs = b.vec
 *         CHKERR( SNESSolve(self.snes, rhs, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def setConvergedReason(self, reason):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSolve(__pyx_v_self->snes, __pyx_v_rhs, __pyx_v_x->vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(36, 520, __pyx_L1_error)

  /* "PETSc/SNES.pyx":517
 *         CHKERR( SNESReset(self.snes) )
 * 
 *     def solve(self, Vec b, Vec x not None):             # <<<<<<<<<<<<<<
 *         cdef PetscVec rhs = NULL
 *         if b is not None: rhs = b.vec
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":522
 *         CHKERR( SNESSolve(self.snes, rhs, x.vec) )
 * 
 *     def setConvergedReason(self, reason):             # <<<<<<<<<<<<<<
 *         cdef PetscSNESConvergedReason eval = reason
 *         CHKERR( SNESSetConvergedReason(self.snes, eval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_141setConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_140setConvergedReason[] = "SNES.setConvergedReason(self, reason)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_141setConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_reason = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvergedReason (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reason,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);
        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_reason)) != 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, "setConvergedReason") < 0)) __PYX_ERR(36, 522, __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_reason = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvergedReason", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 522, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_140setConvergedReason(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_reason);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_140setConvergedReason(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_reason) {
  SNESConvergedReason __pyx_v_eval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  SNESConvergedReason __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setConvergedReason", 0);

  /* "PETSc/SNES.pyx":523
 * 
 *     def setConvergedReason(self, reason):
 *         cdef PetscSNESConvergedReason eval = reason             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetConvergedReason(self.snes, eval) )
 * 
 */
  __pyx_t_1 = ((SNESConvergedReason)__Pyx_PyInt_As_SNESConvergedReason(__pyx_v_reason)); if (unlikely(PyErr_Occurred())) __PYX_ERR(36, 523, __pyx_L1_error)
  __pyx_v_eval = __pyx_t_1;

  /* "PETSc/SNES.pyx":524
 *     def setConvergedReason(self, reason):
 *         cdef PetscSNESConvergedReason eval = reason
 *         CHKERR( SNESSetConvergedReason(self.snes, eval) )             # <<<<<<<<<<<<<<
 * 
 *     def getConvergedReason(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetConvergedReason(__pyx_v_self->snes, __pyx_v_eval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 524, __pyx_L1_error)

  /* "PETSc/SNES.pyx":522
 *         CHKERR( SNESSolve(self.snes, rhs, x.vec) )
 * 
 *     def setConvergedReason(self, reason):             # <<<<<<<<<<<<<<
 *         cdef PetscSNESConvergedReason eval = reason
 *         CHKERR( SNESSetConvergedReason(self.snes, eval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":526
 *         CHKERR( SNESSetConvergedReason(self.snes, eval) )
 * 
 *     def getConvergedReason(self):             # <<<<<<<<<<<<<<
 *         cdef PetscSNESConvergedReason reason = SNES_CONVERGED_ITERATING
 *         CHKERR( SNESGetConvergedReason(self.snes, &reason) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_143getConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_142getConvergedReason[] = "SNES.getConvergedReason(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_143getConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvergedReason (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getConvergedReason", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getConvergedReason", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_142getConvergedReason(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_142getConvergedReason(struct PyPetscSNESObject *__pyx_v_self) {
  SNESConvergedReason __pyx_v_reason;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvergedReason", 0);

  /* "PETSc/SNES.pyx":527
 * 
 *     def getConvergedReason(self):
 *         cdef PetscSNESConvergedReason reason = SNES_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetConvergedReason(self.snes, &reason) )
 *         return reason
 */
  __pyx_v_reason = SNES_CONVERGED_ITERATING;

  /* "PETSc/SNES.pyx":528
 *     def getConvergedReason(self):
 *         cdef PetscSNESConvergedReason reason = SNES_CONVERGED_ITERATING
 *         CHKERR( SNESGetConvergedReason(self.snes, &reason) )             # <<<<<<<<<<<<<<
 *         return reason
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetConvergedReason(__pyx_v_self->snes, (&__pyx_v_reason))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 528, __pyx_L1_error)

  /* "PETSc/SNES.pyx":529
 *         cdef PetscSNESConvergedReason reason = SNES_CONVERGED_ITERATING
 *         CHKERR( SNESGetConvergedReason(self.snes, &reason) )
 *         return reason             # <<<<<<<<<<<<<<
 * 
 *     def setIterationNumber(self, its):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_SNESConvergedReason(__pyx_v_reason); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":526
 *         CHKERR( SNESSetConvergedReason(self.snes, eval) )
 * 
 *     def getConvergedReason(self):             # <<<<<<<<<<<<<<
 *         cdef PetscSNESConvergedReason reason = SNES_CONVERGED_ITERATING
 *         CHKERR( SNESGetConvergedReason(self.snes, &reason) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":531
 *         return reason
 * 
 *     def setIterationNumber(self, its):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(its)
 *         CHKERR( SNESSetIterationNumber(self.snes, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_145setIterationNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_144setIterationNumber[] = "SNES.setIterationNumber(self, its)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_145setIterationNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_its = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setIterationNumber (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_its,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);
        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_its)) != 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, "setIterationNumber") < 0)) __PYX_ERR(36, 531, __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_its = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setIterationNumber", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 531, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setIterationNumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_144setIterationNumber(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_its);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_144setIterationNumber(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_its) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setIterationNumber", 0);

  /* "PETSc/SNES.pyx":532
 * 
 *     def setIterationNumber(self, its):
 *         cdef PetscInt ival = asInt(its)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetIterationNumber(self.snes, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_its); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(36, 532, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/SNES.pyx":533
 *     def setIterationNumber(self, its):
 *         cdef PetscInt ival = asInt(its)
 *         CHKERR( SNESSetIterationNumber(self.snes, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def getIterationNumber(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetIterationNumber(__pyx_v_self->snes, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 533, __pyx_L1_error)

  /* "PETSc/SNES.pyx":531
 *         return reason
 * 
 *     def setIterationNumber(self, its):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(its)
 *         CHKERR( SNESSetIterationNumber(self.snes, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setIterationNumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":535
 *         CHKERR( SNESSetIterationNumber(self.snes, ival) )
 * 
 *     def getIterationNumber(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetIterationNumber(self.snes, &ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_147getIterationNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_146getIterationNumber[] = "SNES.getIterationNumber(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_147getIterationNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getIterationNumber (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getIterationNumber", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getIterationNumber", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_146getIterationNumber(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_146getIterationNumber(struct PyPetscSNESObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getIterationNumber", 0);

  /* "PETSc/SNES.pyx":536
 * 
 *     def getIterationNumber(self):
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetIterationNumber(self.snes, &ival) )
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/SNES.pyx":537
 *     def getIterationNumber(self):
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetIterationNumber(self.snes, &ival) )             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetIterationNumber(__pyx_v_self->snes, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 537, __pyx_L1_error)

  /* "PETSc/SNES.pyx":538
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetIterationNumber(self.snes, &ival) )
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def getLinearSolveIterations(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":535
 *         CHKERR( SNESSetIterationNumber(self.snes, ival) )
 * 
 *     def getIterationNumber(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetIterationNumber(self.snes, &ival) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getIterationNumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":540
 *         return toInt(ival)
 * 
 *     def getLinearSolveIterations(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetLinearSolveIterations(self.snes, &ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_149getLinearSolveIterations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_148getLinearSolveIterations[] = "SNES.getLinearSolveIterations(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_149getLinearSolveIterations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLinearSolveIterations (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getLinearSolveIterations", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getLinearSolveIterations", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_148getLinearSolveIterations(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_148getLinearSolveIterations(struct PyPetscSNESObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getLinearSolveIterations", 0);

  /* "PETSc/SNES.pyx":541
 * 
 *     def getLinearSolveIterations(self):
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetLinearSolveIterations(self.snes, &ival) )
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/SNES.pyx":542
 *     def getLinearSolveIterations(self):
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetLinearSolveIterations(self.snes, &ival) )             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetLinearSolveIterations(__pyx_v_self->snes, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 542, __pyx_L1_error)

  /* "PETSc/SNES.pyx":543
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetLinearSolveIterations(self.snes, &ival) )
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def getRhs(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":540
 *         return toInt(ival)
 * 
 *     def getLinearSolveIterations(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( SNESGetLinearSolveIterations(self.snes, &ival) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getLinearSolveIterations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":545
 *         return toInt(ival)
 * 
 *     def getRhs(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vec = Vec()
 *         CHKERR( SNESGetRhs(self.snes, &vec.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_151getRhs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_150getRhs[] = "SNES.getRhs(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_151getRhs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRhs (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getRhs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getRhs", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_150getRhs(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_150getRhs(struct PyPetscSNESObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getRhs", 0);

  /* "PETSc/SNES.pyx":546
 * 
 *     def getRhs(self):
 *         cdef Vec vec = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetRhs(self.snes, &vec.vec) )
 *         PetscINCREF(vec.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":547
 *     def getRhs(self):
 *         cdef Vec vec = Vec()
 *         CHKERR( SNESGetRhs(self.snes, &vec.vec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(vec.obj)
 *         return vec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetRhs(__pyx_v_self->snes, (&__pyx_v_vec->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 547, __pyx_L1_error)

  /* "PETSc/SNES.pyx":548
 *         cdef Vec vec = Vec()
 *         CHKERR( SNESGetRhs(self.snes, &vec.vec) )
 *         PetscINCREF(vec.obj)             # <<<<<<<<<<<<<<
 *         return vec
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_vec->__pyx_base.obj);

  /* "PETSc/SNES.pyx":549
 *         CHKERR( SNESGetRhs(self.snes, &vec.vec) )
 *         PetscINCREF(vec.obj)
 *         return vec             # <<<<<<<<<<<<<<
 * 
 *     def getSolution(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = ((PyObject *)__pyx_v_vec);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":545
 *         return toInt(ival)
 * 
 *     def getRhs(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vec = Vec()
 *         CHKERR( SNESGetRhs(self.snes, &vec.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getRhs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":551
 *         return vec
 * 
 *     def getSolution(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vec = Vec()
 *         CHKERR( SNESGetSolution(self.snes, &vec.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_153getSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_152getSolution[] = "SNES.getSolution(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_153getSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSolution (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSolution", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSolution", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_152getSolution(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_152getSolution(struct PyPetscSNESObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getSolution", 0);

  /* "PETSc/SNES.pyx":552
 * 
 *     def getSolution(self):
 *         cdef Vec vec = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetSolution(self.snes, &vec.vec) )
 *         PetscINCREF(vec.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":553
 *     def getSolution(self):
 *         cdef Vec vec = Vec()
 *         CHKERR( SNESGetSolution(self.snes, &vec.vec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(vec.obj)
 *         return vec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetSolution(__pyx_v_self->snes, (&__pyx_v_vec->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 553, __pyx_L1_error)

  /* "PETSc/SNES.pyx":554
 *         cdef Vec vec = Vec()
 *         CHKERR( SNESGetSolution(self.snes, &vec.vec) )
 *         PetscINCREF(vec.obj)             # <<<<<<<<<<<<<<
 *         return vec
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_vec->__pyx_base.obj);

  /* "PETSc/SNES.pyx":555
 *         CHKERR( SNESGetSolution(self.snes, &vec.vec) )
 *         PetscINCREF(vec.obj)
 *         return vec             # <<<<<<<<<<<<<<
 * 
 *     def setSolution(self, Vec vec not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = ((PyObject *)__pyx_v_vec);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":551
 *         return vec
 * 
 *     def getSolution(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vec = Vec()
 *         CHKERR( SNESGetSolution(self.snes, &vec.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getSolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":557
 *         return vec
 * 
 *     def setSolution(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetSolution(self.snes, vec.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_155setSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_154setSolution[] = "SNES.setSolution(self, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_155setSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setSolution (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "setSolution") < 0)) __PYX_ERR(36, 557, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setSolution", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 557, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setSolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(36, 557, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_154setSolution(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_vec);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_154setSolution(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setSolution", 0);

  /* "PETSc/SNES.pyx":558
 * 
 *     def setSolution(self, Vec vec not None):
 *         CHKERR( SNESSetSolution(self.snes, vec.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def getSolutionUpdate(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetSolution(__pyx_v_self->snes, __pyx_v_vec->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 558, __pyx_L1_error)

  /* "PETSc/SNES.pyx":557
 *         return vec
 * 
 *     def setSolution(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetSolution(self.snes, vec.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setSolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":560
 *         CHKERR( SNESSetSolution(self.snes, vec.vec) )
 * 
 *     def getSolutionUpdate(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vec = Vec()
 *         CHKERR( SNESGetSolutionUpdate(self.snes, &vec.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_157getSolutionUpdate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_156getSolutionUpdate[] = "SNES.getSolutionUpdate(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_157getSolutionUpdate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSolutionUpdate (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSolutionUpdate", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSolutionUpdate", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_156getSolutionUpdate(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_156getSolutionUpdate(struct PyPetscSNESObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getSolutionUpdate", 0);

  /* "PETSc/SNES.pyx":561
 * 
 *     def getSolutionUpdate(self):
 *         cdef Vec vec = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetSolutionUpdate(self.snes, &vec.vec) )
 *         PetscINCREF(vec.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":562
 *     def getSolutionUpdate(self):
 *         cdef Vec vec = Vec()
 *         CHKERR( SNESGetSolutionUpdate(self.snes, &vec.vec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(vec.obj)
 *         return vec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetSolutionUpdate(__pyx_v_self->snes, (&__pyx_v_vec->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 562, __pyx_L1_error)

  /* "PETSc/SNES.pyx":563
 *         cdef Vec vec = Vec()
 *         CHKERR( SNESGetSolutionUpdate(self.snes, &vec.vec) )
 *         PetscINCREF(vec.obj)             # <<<<<<<<<<<<<<
 *         return vec
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_vec->__pyx_base.obj);

  /* "PETSc/SNES.pyx":564
 *         CHKERR( SNESGetSolutionUpdate(self.snes, &vec.vec) )
 *         PetscINCREF(vec.obj)
 *         return vec             # <<<<<<<<<<<<<<
 * 
 *     # --- linear solver ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = ((PyObject *)__pyx_v_vec);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":560
 *         CHKERR( SNESSetSolution(self.snes, vec.vec) )
 * 
 *     def getSolutionUpdate(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vec = Vec()
 *         CHKERR( SNESGetSolutionUpdate(self.snes, &vec.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getSolutionUpdate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":568
 *     # --- linear solver ---
 * 
 *     def setKSP(self, KSP ksp not None):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetKSP(self.snes, ksp.ksp) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_159setKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_158setKSP[] = "SNES.setKSP(self, KSP ksp)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_159setKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscKSPObject *__pyx_v_ksp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setKSP (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ksp,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);
        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_ksp)) != 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, "setKSP") < 0)) __PYX_ERR(36, 568, __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_ksp = ((struct PyPetscKSPObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setKSP", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 568, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setKSP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ksp), __pyx_ptype_8petsc4py_5PETSc_KSP, 0, "ksp", 0))) __PYX_ERR(36, 568, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_158setKSP(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_ksp);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_158setKSP(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscKSPObject *__pyx_v_ksp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setKSP", 0);

  /* "PETSc/SNES.pyx":569
 * 
 *     def setKSP(self, KSP ksp not None):
 *         CHKERR( SNESSetKSP(self.snes, ksp.ksp) )             # <<<<<<<<<<<<<<
 * 
 *     def getKSP(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetKSP(__pyx_v_self->snes, __pyx_v_ksp->ksp)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 569, __pyx_L1_error)

  /* "PETSc/SNES.pyx":568
 *     # --- linear solver ---
 * 
 *     def setKSP(self, KSP ksp not None):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetKSP(self.snes, ksp.ksp) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setKSP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":571
 *         CHKERR( SNESSetKSP(self.snes, ksp.ksp) )
 * 
 *     def getKSP(self):             # <<<<<<<<<<<<<<
 *         cdef KSP ksp = KSP()
 *         CHKERR( SNESGetKSP(self.snes, &ksp.ksp) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_161getKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_160getKSP[] = "SNES.getKSP(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_161getKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getKSP (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getKSP", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getKSP", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_160getKSP(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_160getKSP(struct PyPetscSNESObject *__pyx_v_self) {
  struct PyPetscKSPObject *__pyx_v_ksp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getKSP", 0);

  /* "PETSc/SNES.pyx":572
 * 
 *     def getKSP(self):
 *         cdef KSP ksp = KSP()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetKSP(self.snes, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ksp = ((struct PyPetscKSPObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":573
 *     def getKSP(self):
 *         cdef KSP ksp = KSP()
 *         CHKERR( SNESGetKSP(self.snes, &ksp.ksp) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(ksp.obj)
 *         return ksp
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetKSP(__pyx_v_self->snes, (&__pyx_v_ksp->ksp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 573, __pyx_L1_error)

  /* "PETSc/SNES.pyx":574
 *         cdef KSP ksp = KSP()
 *         CHKERR( SNESGetKSP(self.snes, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)             # <<<<<<<<<<<<<<
 *         return ksp
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ksp->__pyx_base.obj);

  /* "PETSc/SNES.pyx":575
 *         CHKERR( SNESGetKSP(self.snes, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 *         return ksp             # <<<<<<<<<<<<<<
 * 
 *     def setUseEW(self, flag=True, *targs, **kargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ksp));
  __pyx_r = ((PyObject *)__pyx_v_ksp);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":571
 *         CHKERR( SNESSetKSP(self.snes, ksp.ksp) )
 * 
 *     def getKSP(self):             # <<<<<<<<<<<<<<
 *         cdef KSP ksp = KSP()
 *         CHKERR( SNESGetKSP(self.snes, &ksp.ksp) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getKSP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ksp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":577
 *         return ksp
 * 
 *     def setUseEW(self, flag=True, *targs, **kargs):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = flag
 *         CHKERR( SNESKSPSetUseEW(self.snes, bval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_163setUseEW(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_162setUseEW[] = "SNES.setUseEW(self, flag=True, *targs, **kargs)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_163setUseEW(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_v_targs = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUseEW (wrapper)", 0);
  __pyx_v_kargs = PyDict_New(); if (unlikely(!__pyx_v_kargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_targs = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_targs)) {
      __Pyx_DECREF(__pyx_v_kargs); __pyx_v_kargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_targs);
  } else {
    __pyx_v_targs = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {0};
    values[0] = ((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) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kargs, values, used_pos_args, "setUseEW") < 0)) __PYX_ERR(36, 577, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
    }
    __pyx_v_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_targs); __pyx_v_targs = 0;
  __Pyx_DECREF(__pyx_v_kargs); __pyx_v_kargs = 0;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setUseEW", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_162setUseEW(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_flag, __pyx_v_targs, __pyx_v_kargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_targs);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_162setUseEW(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_flag, PyObject *__pyx_v_targs, PyObject *__pyx_v_kargs) {
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("setUseEW", 0);

  /* "PETSc/SNES.pyx":578
 * 
 *     def setUseEW(self, flag=True, *targs, **kargs):
 *         cdef PetscBool bval = flag             # <<<<<<<<<<<<<<
 *         CHKERR( SNESKSPSetUseEW(self.snes, bval) )
 *         if targs or kargs: self.setParamsEW(*targs, **kargs)
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_flag)); if (unlikely(PyErr_Occurred())) __PYX_ERR(36, 578, __pyx_L1_error)
  __pyx_v_bval = __pyx_t_1;

  /* "PETSc/SNES.pyx":579
 *     def setUseEW(self, flag=True, *targs, **kargs):
 *         cdef PetscBool bval = flag
 *         CHKERR( SNESKSPSetUseEW(self.snes, bval) )             # <<<<<<<<<<<<<<
 *         if targs or kargs: self.setParamsEW(*targs, **kargs)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESKSPSetUseEW(__pyx_v_self->snes, __pyx_v_bval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 579, __pyx_L1_error)

  /* "PETSc/SNES.pyx":580
 *         cdef PetscBool bval = flag
 *         CHKERR( SNESKSPSetUseEW(self.snes, bval) )
 *         if targs or kargs: self.setParamsEW(*targs, **kargs)             # <<<<<<<<<<<<<<
 * 
 *     def getUseEW(self):
 */
  __pyx_t_4 = (__pyx_v_targs != Py_None) && (PyTuple_GET_SIZE(__pyx_v_targs) != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_kargs); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(36, 580, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setParamsEW); if (unlikely(!__pyx_t_5)) __PYX_ERR(36, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_v_targs, __pyx_v_kargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(36, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }

  /* "PETSc/SNES.pyx":577
 *         return ksp
 * 
 *     def setUseEW(self, flag=True, *targs, **kargs):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = flag
 *         CHKERR( SNESKSPSetUseEW(self.snes, bval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setUseEW", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":582
 *         if targs or kargs: self.setParamsEW(*targs, **kargs)
 * 
 *     def getUseEW(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( SNESKSPGetUseEW(self.snes, &flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_165getUseEW(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_164getUseEW[] = "SNES.getUseEW(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_165getUseEW(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getUseEW (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getUseEW", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getUseEW", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_164getUseEW(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_164getUseEW(struct PyPetscSNESObject *__pyx_v_self) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getUseEW", 0);

  /* "PETSc/SNES.pyx":583
 * 
 *     def getUseEW(self):
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( SNESKSPGetUseEW(self.snes, &flag) )
 *         return <bint> flag
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/SNES.pyx":584
 *     def getUseEW(self):
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( SNESKSPGetUseEW(self.snes, &flag) )             # <<<<<<<<<<<<<<
 *         return <bint> flag
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESKSPGetUseEW(__pyx_v_self->snes, (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 584, __pyx_L1_error)

  /* "PETSc/SNES.pyx":585
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( SNESKSPGetUseEW(self.snes, &flag) )
 *         return <bint> flag             # <<<<<<<<<<<<<<
 * 
 *     def setParamsEW(self, version=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":582
 *         if targs or kargs: self.setParamsEW(*targs, **kargs)
 * 
 *     def getUseEW(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( SNESKSPGetUseEW(self.snes, &flag) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getUseEW", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":587
 *         return <bint> flag
 * 
 *     def setParamsEW(self, version=None,             # <<<<<<<<<<<<<<
 *                     rtol_0=None, rtol_max=None,
 *                     gamma=None, alpha=None, alpha2=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_167setParamsEW(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_166setParamsEW[] = "SNES.setParamsEW(self, version=None, rtol_0=None, rtol_max=None, gamma=None, alpha=None, alpha2=None, threshold=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_167setParamsEW(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_version = 0;
  PyObject *__pyx_v_rtol_0 = 0;
  PyObject *__pyx_v_rtol_max = 0;
  PyObject *__pyx_v_gamma = 0;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_v_alpha2 = 0;
  PyObject *__pyx_v_threshold = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setParamsEW (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_version,&__pyx_n_s_rtol_0,&__pyx_n_s_rtol_max,&__pyx_n_s_gamma,&__pyx_n_s_alpha,&__pyx_n_s_alpha2,&__pyx_n_s_threshold,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[0] = ((PyObject *)Py_None);

    /* "PETSc/SNES.pyx":588
 * 
 *     def setParamsEW(self, version=None,
 *                     rtol_0=None, rtol_max=None,             # <<<<<<<<<<<<<<
 *                     gamma=None, alpha=None, alpha2=None,
 *                     threshold=None):
 */
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);

    /* "PETSc/SNES.pyx":589
 *     def setParamsEW(self, version=None,
 *                     rtol_0=None, rtol_max=None,
 *                     gamma=None, alpha=None, alpha2=None,             # <<<<<<<<<<<<<<
 *                     threshold=None):
 *         cdef PetscInt  cversion   = PETSC_DEFAULT
 */
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);

    /* "PETSc/SNES.pyx":590
 *                     rtol_0=None, rtol_max=None,
 *                     gamma=None, alpha=None, alpha2=None,
 *                     threshold=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  cversion   = PETSC_DEFAULT
 *         cdef PetscReal crtol_0    = PETSC_DEFAULT
 */
    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  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_version);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rtol_0);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rtol_max);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gamma);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha2);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_threshold);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setParamsEW") < 0)) __PYX_ERR(36, 587, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_version = values[0];
    __pyx_v_rtol_0 = values[1];
    __pyx_v_rtol_max = values[2];
    __pyx_v_gamma = values[3];
    __pyx_v_alpha = values[4];
    __pyx_v_alpha2 = values[5];
    __pyx_v_threshold = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setParamsEW", 0, 0, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 587, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setParamsEW", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_166setParamsEW(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_version, __pyx_v_rtol_0, __pyx_v_rtol_max, __pyx_v_gamma, __pyx_v_alpha, __pyx_v_alpha2, __pyx_v_threshold);

  /* "PETSc/SNES.pyx":587
 *         return <bint> flag
 * 
 *     def setParamsEW(self, version=None,             # <<<<<<<<<<<<<<
 *                     rtol_0=None, rtol_max=None,
 *                     gamma=None, alpha=None, alpha2=None,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_166setParamsEW(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_version, PyObject *__pyx_v_rtol_0, PyObject *__pyx_v_rtol_max, PyObject *__pyx_v_gamma, PyObject *__pyx_v_alpha, PyObject *__pyx_v_alpha2, PyObject *__pyx_v_threshold) {
  PetscInt __pyx_v_cversion;
  PetscReal __pyx_v_crtol_0;
  PetscReal __pyx_v_crtol_max;
  PetscReal __pyx_v_cgamma;
  PetscReal __pyx_v_calpha;
  PetscReal __pyx_v_calpha2;
  PetscReal __pyx_v_cthreshold;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscInt __pyx_t_3;
  PetscReal __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setParamsEW", 0);

  /* "PETSc/SNES.pyx":591
 *                     gamma=None, alpha=None, alpha2=None,
 *                     threshold=None):
 *         cdef PetscInt  cversion   = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscReal crtol_0    = PETSC_DEFAULT
 *         cdef PetscReal crtol_max  = PETSC_DEFAULT
 */
  __pyx_v_cversion = PETSC_DEFAULT;

  /* "PETSc/SNES.pyx":592
 *                     threshold=None):
 *         cdef PetscInt  cversion   = PETSC_DEFAULT
 *         cdef PetscReal crtol_0    = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscReal crtol_max  = PETSC_DEFAULT
 *         cdef PetscReal cgamma     = PETSC_DEFAULT
 */
  __pyx_v_crtol_0 = PETSC_DEFAULT;

  /* "PETSc/SNES.pyx":593
 *         cdef PetscInt  cversion   = PETSC_DEFAULT
 *         cdef PetscReal crtol_0    = PETSC_DEFAULT
 *         cdef PetscReal crtol_max  = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscReal cgamma     = PETSC_DEFAULT
 *         cdef PetscReal calpha     = PETSC_DEFAULT
 */
  __pyx_v_crtol_max = PETSC_DEFAULT;

  /* "PETSc/SNES.pyx":594
 *         cdef PetscReal crtol_0    = PETSC_DEFAULT
 *         cdef PetscReal crtol_max  = PETSC_DEFAULT
 *         cdef PetscReal cgamma     = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscReal calpha     = PETSC_DEFAULT
 *         cdef PetscReal calpha2    = PETSC_DEFAULT
 */
  __pyx_v_cgamma = PETSC_DEFAULT;

  /* "PETSc/SNES.pyx":595
 *         cdef PetscReal crtol_max  = PETSC_DEFAULT
 *         cdef PetscReal cgamma     = PETSC_DEFAULT
 *         cdef PetscReal calpha     = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscReal calpha2    = PETSC_DEFAULT
 *         cdef PetscReal cthreshold = PETSC_DEFAULT
 */
  __pyx_v_calpha = PETSC_DEFAULT;

  /* "PETSc/SNES.pyx":596
 *         cdef PetscReal cgamma     = PETSC_DEFAULT
 *         cdef PetscReal calpha     = PETSC_DEFAULT
 *         cdef PetscReal calpha2    = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscReal cthreshold = PETSC_DEFAULT
 *         if version   is not None: cversion   = asInt(version)
 */
  __pyx_v_calpha2 = PETSC_DEFAULT;

  /* "PETSc/SNES.pyx":597
 *         cdef PetscReal calpha     = PETSC_DEFAULT
 *         cdef PetscReal calpha2    = PETSC_DEFAULT
 *         cdef PetscReal cthreshold = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         if version   is not None: cversion   = asInt(version)
 *         if rtol_0    is not None: crtol_0    = asReal(rtol_0)
 */
  __pyx_v_cthreshold = PETSC_DEFAULT;

  /* "PETSc/SNES.pyx":598
 *         cdef PetscReal calpha2    = PETSC_DEFAULT
 *         cdef PetscReal cthreshold = PETSC_DEFAULT
 *         if version   is not None: cversion   = asInt(version)             # <<<<<<<<<<<<<<
 *         if rtol_0    is not None: crtol_0    = asReal(rtol_0)
 *         if rtol_max  is not None: crtol_max  = asReal(rtol_max)
 */
  __pyx_t_1 = (__pyx_v_version != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_version); if (unlikely(__pyx_t_3 == -1L && PyErr_Occurred())) __PYX_ERR(36, 598, __pyx_L1_error)
    __pyx_v_cversion = __pyx_t_3;
  }

  /* "PETSc/SNES.pyx":599
 *         cdef PetscReal cthreshold = PETSC_DEFAULT
 *         if version   is not None: cversion   = asInt(version)
 *         if rtol_0    is not None: crtol_0    = asReal(rtol_0)             # <<<<<<<<<<<<<<
 *         if rtol_max  is not None: crtol_max  = asReal(rtol_max)
 *         if gamma     is not None: cgamma     = asReal(gamma)
 */
  __pyx_t_2 = (__pyx_v_rtol_0 != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_rtol_0); if (unlikely(__pyx_t_4 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 599, __pyx_L1_error)
    __pyx_v_crtol_0 = __pyx_t_4;
  }

  /* "PETSc/SNES.pyx":600
 *         if version   is not None: cversion   = asInt(version)
 *         if rtol_0    is not None: crtol_0    = asReal(rtol_0)
 *         if rtol_max  is not None: crtol_max  = asReal(rtol_max)             # <<<<<<<<<<<<<<
 *         if gamma     is not None: cgamma     = asReal(gamma)
 *         if alpha     is not None: calpha     = asReal(alpha)
 */
  __pyx_t_1 = (__pyx_v_rtol_max != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_rtol_max); if (unlikely(__pyx_t_4 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 600, __pyx_L1_error)
    __pyx_v_crtol_max = __pyx_t_4;
  }

  /* "PETSc/SNES.pyx":601
 *         if rtol_0    is not None: crtol_0    = asReal(rtol_0)
 *         if rtol_max  is not None: crtol_max  = asReal(rtol_max)
 *         if gamma     is not None: cgamma     = asReal(gamma)             # <<<<<<<<<<<<<<
 *         if alpha     is not None: calpha     = asReal(alpha)
 *         if alpha2    is not None: calpha2    = asReal(alpha2)
 */
  __pyx_t_2 = (__pyx_v_gamma != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_gamma); if (unlikely(__pyx_t_4 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 601, __pyx_L1_error)
    __pyx_v_cgamma = __pyx_t_4;
  }

  /* "PETSc/SNES.pyx":602
 *         if rtol_max  is not None: crtol_max  = asReal(rtol_max)
 *         if gamma     is not None: cgamma     = asReal(gamma)
 *         if alpha     is not None: calpha     = asReal(alpha)             # <<<<<<<<<<<<<<
 *         if alpha2    is not None: calpha2    = asReal(alpha2)
 *         if threshold is not None: cthreshold = asReal(threshold)
 */
  __pyx_t_1 = (__pyx_v_alpha != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_alpha); if (unlikely(__pyx_t_4 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 602, __pyx_L1_error)
    __pyx_v_calpha = __pyx_t_4;
  }

  /* "PETSc/SNES.pyx":603
 *         if gamma     is not None: cgamma     = asReal(gamma)
 *         if alpha     is not None: calpha     = asReal(alpha)
 *         if alpha2    is not None: calpha2    = asReal(alpha2)             # <<<<<<<<<<<<<<
 *         if threshold is not None: cthreshold = asReal(threshold)
 *         CHKERR( SNESKSPSetParametersEW(
 */
  __pyx_t_2 = (__pyx_v_alpha2 != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_alpha2); if (unlikely(__pyx_t_4 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 603, __pyx_L1_error)
    __pyx_v_calpha2 = __pyx_t_4;
  }

  /* "PETSc/SNES.pyx":604
 *         if alpha     is not None: calpha     = asReal(alpha)
 *         if alpha2    is not None: calpha2    = asReal(alpha2)
 *         if threshold is not None: cthreshold = asReal(threshold)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESKSPSetParametersEW(
 *             self.snes, cversion, crtol_0, crtol_max,
 */
  __pyx_t_1 = (__pyx_v_threshold != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_threshold); if (unlikely(__pyx_t_4 == -1.0 && PyErr_Occurred())) __PYX_ERR(36, 604, __pyx_L1_error)
    __pyx_v_cthreshold = __pyx_t_4;
  }

  /* "PETSc/SNES.pyx":605
 *         if alpha2    is not None: calpha2    = asReal(alpha2)
 *         if threshold is not None: cthreshold = asReal(threshold)
 *         CHKERR( SNESKSPSetParametersEW(             # <<<<<<<<<<<<<<
 *             self.snes, cversion, crtol_0, crtol_max,
 *             cgamma, calpha, calpha2, cthreshold) )
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESKSPSetParametersEW(__pyx_v_self->snes, __pyx_v_cversion, __pyx_v_crtol_0, __pyx_v_crtol_max, __pyx_v_cgamma, __pyx_v_calpha, __pyx_v_calpha2, __pyx_v_cthreshold)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(36, 605, __pyx_L1_error)

  /* "PETSc/SNES.pyx":587
 *         return <bint> flag
 * 
 *     def setParamsEW(self, version=None,             # <<<<<<<<<<<<<<
 *                     rtol_0=None, rtol_max=None,
 *                     gamma=None, alpha=None, alpha2=None,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setParamsEW", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":609
 *             cgamma, calpha, calpha2, cthreshold) )
 * 
 *     def getParamsEW(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  version=0
 *         cdef PetscReal rtol_0=0, rtol_max=0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_169getParamsEW(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_168getParamsEW[] = "SNES.getParamsEW(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_169getParamsEW(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getParamsEW (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getParamsEW", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getParamsEW", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_168getParamsEW(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_168getParamsEW(struct PyPetscSNESObject *__pyx_v_self) {
  PetscInt __pyx_v_version;
  PetscReal __pyx_v_rtol_0;
  PetscReal __pyx_v_rtol_max;
  PetscReal __pyx_v_gamma;
  PetscReal __pyx_v_alpha;
  PetscReal __pyx_v_alpha2;
  PetscReal __pyx_v_threshold;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getParamsEW", 0);

  /* "PETSc/SNES.pyx":610
 * 
 *     def getParamsEW(self):
 *         cdef PetscInt  version=0             # <<<<<<<<<<<<<<
 *         cdef PetscReal rtol_0=0, rtol_max=0
 *         cdef PetscReal gamma=0, alpha=0, alpha2=0
 */
  __pyx_v_version = 0;

  /* "PETSc/SNES.pyx":611
 *     def getParamsEW(self):
 *         cdef PetscInt  version=0
 *         cdef PetscReal rtol_0=0, rtol_max=0             # <<<<<<<<<<<<<<
 *         cdef PetscReal gamma=0, alpha=0, alpha2=0
 *         cdef PetscReal threshold=0
 */
  __pyx_v_rtol_0 = 0.0;
  __pyx_v_rtol_max = 0.0;

  /* "PETSc/SNES.pyx":612
 *         cdef PetscInt  version=0
 *         cdef PetscReal rtol_0=0, rtol_max=0
 *         cdef PetscReal gamma=0, alpha=0, alpha2=0             # <<<<<<<<<<<<<<
 *         cdef PetscReal threshold=0
 *         CHKERR( SNESKSPGetParametersEW(
 */
  __pyx_v_gamma = 0.0;
  __pyx_v_alpha = 0.0;
  __pyx_v_alpha2 = 0.0;

  /* "PETSc/SNES.pyx":613
 *         cdef PetscReal rtol_0=0, rtol_max=0
 *         cdef PetscReal gamma=0, alpha=0, alpha2=0
 *         cdef PetscReal threshold=0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESKSPGetParametersEW(
 *             self.snes, &version, &rtol_0, &rtol_max,
 */
  __pyx_v_threshold = 0.0;

  /* "PETSc/SNES.pyx":614
 *         cdef PetscReal gamma=0, alpha=0, alpha2=0
 *         cdef PetscReal threshold=0
 *         CHKERR( SNESKSPGetParametersEW(             # <<<<<<<<<<<<<<
 *             self.snes, &version, &rtol_0, &rtol_max,
 *             &gamma, &alpha, &alpha2, &threshold) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESKSPGetParametersEW(__pyx_v_self->snes, (&__pyx_v_version), (&__pyx_v_rtol_0), (&__pyx_v_rtol_max), (&__pyx_v_gamma), (&__pyx_v_alpha), (&__pyx_v_alpha2), (&__pyx_v_threshold))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 614, __pyx_L1_error)

  /* "PETSc/SNES.pyx":617
 *             self.snes, &version, &rtol_0, &rtol_max,
 *             &gamma, &alpha, &alpha2, &threshold) )
 *         return {'version'   : toInt(version),             # <<<<<<<<<<<<<<
 *                 'rtol_0'    : toReal(rtol_0),
 *                 'rtol_max'  : toReal(rtol_max),
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_version); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_version, __pyx_t_3) < 0) __PYX_ERR(36, 617, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":618
 *             &gamma, &alpha, &alpha2, &threshold) )
 *         return {'version'   : toInt(version),
 *                 'rtol_0'    : toReal(rtol_0),             # <<<<<<<<<<<<<<
 *                 'rtol_max'  : toReal(rtol_max),
 *                 'gamma'     : toReal(gamma),
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rtol_0); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_rtol_0, __pyx_t_3) < 0) __PYX_ERR(36, 617, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":619
 *         return {'version'   : toInt(version),
 *                 'rtol_0'    : toReal(rtol_0),
 *                 'rtol_max'  : toReal(rtol_max),             # <<<<<<<<<<<<<<
 *                 'gamma'     : toReal(gamma),
 *                 'alpha'     : toReal(alpha),
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rtol_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_rtol_max, __pyx_t_3) < 0) __PYX_ERR(36, 617, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":620
 *                 'rtol_0'    : toReal(rtol_0),
 *                 'rtol_max'  : toReal(rtol_max),
 *                 'gamma'     : toReal(gamma),             # <<<<<<<<<<<<<<
 *                 'alpha'     : toReal(alpha),
 *                 'alpha2'    : toReal(alpha2),
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_gamma); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_gamma, __pyx_t_3) < 0) __PYX_ERR(36, 617, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":621
 *                 'rtol_max'  : toReal(rtol_max),
 *                 'gamma'     : toReal(gamma),
 *                 'alpha'     : toReal(alpha),             # <<<<<<<<<<<<<<
 *                 'alpha2'    : toReal(alpha2),
 *                 'threshold' : toReal(threshold),}
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_alpha); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_alpha, __pyx_t_3) < 0) __PYX_ERR(36, 617, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":622
 *                 'gamma'     : toReal(gamma),
 *                 'alpha'     : toReal(alpha),
 *                 'alpha2'    : toReal(alpha2),             # <<<<<<<<<<<<<<
 *                 'threshold' : toReal(threshold),}
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_alpha2); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_alpha2, __pyx_t_3) < 0) __PYX_ERR(36, 617, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":623
 *                 'alpha'     : toReal(alpha),
 *                 'alpha2'    : toReal(alpha2),
 *                 'threshold' : toReal(threshold),}             # <<<<<<<<<<<<<<
 * 
 *     # --- matrix free / finite diferences ---
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_threshold); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_threshold, __pyx_t_3) < 0) __PYX_ERR(36, 617, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":609
 *             cgamma, calpha, calpha2, cthreshold) )
 * 
 *     def getParamsEW(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  version=0
 *         cdef PetscReal rtol_0=0, rtol_max=0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getParamsEW", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":627
 *     # --- matrix free / finite diferences ---
 * 
 *     def setUseMF(self, flag=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = flag
 *         CHKERR( SNESSetUseMFFD(self.snes, bval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_171setUseMF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_170setUseMF[] = "SNES.setUseMF(self, flag=True)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_171setUseMF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUseMF (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setUseMF") < 0)) __PYX_ERR(36, 627, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setUseMF", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 627, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setUseMF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_170setUseMF(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_170setUseMF(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_flag) {
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setUseMF", 0);

  /* "PETSc/SNES.pyx":628
 * 
 *     def setUseMF(self, flag=True):
 *         cdef PetscBool bval = flag             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetUseMFFD(self.snes, bval) )
 * 
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_flag)); if (unlikely(PyErr_Occurred())) __PYX_ERR(36, 628, __pyx_L1_error)
  __pyx_v_bval = __pyx_t_1;

  /* "PETSc/SNES.pyx":629
 *     def setUseMF(self, flag=True):
 *         cdef PetscBool bval = flag
 *         CHKERR( SNESSetUseMFFD(self.snes, bval) )             # <<<<<<<<<<<<<<
 * 
 *     def getUseMF(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetUseMFFD(__pyx_v_self->snes, __pyx_v_bval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 629, __pyx_L1_error)

  /* "PETSc/SNES.pyx":627
 *     # --- matrix free / finite diferences ---
 * 
 *     def setUseMF(self, flag=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = flag
 *         CHKERR( SNESSetUseMFFD(self.snes, bval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setUseMF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":631
 *         CHKERR( SNESSetUseMFFD(self.snes, bval) )
 * 
 *     def getUseMF(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( SNESGetUseMFFD(self.snes, &bval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_173getUseMF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_172getUseMF[] = "SNES.getUseMF(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_173getUseMF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getUseMF (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getUseMF", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getUseMF", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_172getUseMF(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_172getUseMF(struct PyPetscSNESObject *__pyx_v_self) {
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getUseMF", 0);

  /* "PETSc/SNES.pyx":632
 * 
 *     def getUseMF(self):
 *         cdef PetscBool bval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetUseMFFD(self.snes, &bval) )
 *         return <bint> bval
 */
  __pyx_v_bval = PETSC_FALSE;

  /* "PETSc/SNES.pyx":633
 *     def getUseMF(self):
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( SNESGetUseMFFD(self.snes, &bval) )             # <<<<<<<<<<<<<<
 *         return <bint> bval
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetUseMFFD(__pyx_v_self->snes, (&__pyx_v_bval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 633, __pyx_L1_error)

  /* "PETSc/SNES.pyx":634
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( SNESGetUseMFFD(self.snes, &bval) )
 *         return <bint> bval             # <<<<<<<<<<<<<<
 * 
 *     def setUseFD(self, flag=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_bval); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":631
 *         CHKERR( SNESSetUseMFFD(self.snes, bval) )
 * 
 *     def getUseMF(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( SNESGetUseMFFD(self.snes, &bval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getUseMF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":636
 *         return <bint> bval
 * 
 *     def setUseFD(self, flag=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = flag
 *         CHKERR( SNESSetUseFDColoring(self.snes, bval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_175setUseFD(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_174setUseFD[] = "SNES.setUseFD(self, flag=True)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_175setUseFD(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUseFD (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setUseFD") < 0)) __PYX_ERR(36, 636, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setUseFD", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 636, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setUseFD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_174setUseFD(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_174setUseFD(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_flag) {
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setUseFD", 0);

  /* "PETSc/SNES.pyx":637
 * 
 *     def setUseFD(self, flag=True):
 *         cdef PetscBool bval = flag             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetUseFDColoring(self.snes, bval) )
 * 
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_flag)); if (unlikely(PyErr_Occurred())) __PYX_ERR(36, 637, __pyx_L1_error)
  __pyx_v_bval = __pyx_t_1;

  /* "PETSc/SNES.pyx":638
 *     def setUseFD(self, flag=True):
 *         cdef PetscBool bval = flag
 *         CHKERR( SNESSetUseFDColoring(self.snes, bval) )             # <<<<<<<<<<<<<<
 * 
 *     def getUseFD(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetUseFDColoring(__pyx_v_self->snes, __pyx_v_bval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 638, __pyx_L1_error)

  /* "PETSc/SNES.pyx":636
 *         return <bint> bval
 * 
 *     def setUseFD(self, flag=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = flag
 *         CHKERR( SNESSetUseFDColoring(self.snes, bval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setUseFD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":640
 *         CHKERR( SNESSetUseFDColoring(self.snes, bval) )
 * 
 *     def getUseFD(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( SNESGetUseFDColoring(self.snes, &bval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_177getUseFD(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_176getUseFD[] = "SNES.getUseFD(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_177getUseFD(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getUseFD (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getUseFD", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getUseFD", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_176getUseFD(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_176getUseFD(struct PyPetscSNESObject *__pyx_v_self) {
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getUseFD", 0);

  /* "PETSc/SNES.pyx":641
 * 
 *     def getUseFD(self):
 *         cdef PetscBool bval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( SNESGetUseFDColoring(self.snes, &bval) )
 *         return <bint> bval
 */
  __pyx_v_bval = PETSC_FALSE;

  /* "PETSc/SNES.pyx":642
 *     def getUseFD(self):
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( SNESGetUseFDColoring(self.snes, &bval) )             # <<<<<<<<<<<<<<
 *         return <bint> bval
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESGetUseFDColoring(__pyx_v_self->snes, (&__pyx_v_bval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 642, __pyx_L1_error)

  /* "PETSc/SNES.pyx":643
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( SNESGetUseFDColoring(self.snes, &bval) )
 *         return <bint> bval             # <<<<<<<<<<<<<<
 * 
 *     # --- VI ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_bval); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":640
 *         CHKERR( SNESSetUseFDColoring(self.snes, bval) )
 * 
 *     def getUseFD(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( SNESGetUseFDColoring(self.snes, &bval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getUseFD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":647
 *     # --- VI ---
 * 
 *     def setVariableBounds(self, Vec xl not None, Vec xu not None):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESVISetVariableBounds(self.snes, xl.vec, xu.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_179setVariableBounds(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_178setVariableBounds[] = "SNES.setVariableBounds(self, Vec xl, Vec xu)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_179setVariableBounds(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_xl = 0;
  struct PyPetscVecObject *__pyx_v_xu = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setVariableBounds (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xl,&__pyx_n_s_xu,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_xl)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xu)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setVariableBounds", 1, 2, 2, 1); __PYX_ERR(36, 647, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setVariableBounds") < 0)) __PYX_ERR(36, 647, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_xl = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_xu = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setVariableBounds", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 647, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setVariableBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xl), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "xl", 0))) __PYX_ERR(36, 647, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xu), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "xu", 0))) __PYX_ERR(36, 647, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_178setVariableBounds(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_xl, __pyx_v_xu);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_178setVariableBounds(struct PyPetscSNESObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_xl, struct PyPetscVecObject *__pyx_v_xu) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setVariableBounds", 0);

  /* "PETSc/SNES.pyx":648
 * 
 *     def setVariableBounds(self, Vec xl not None, Vec xu not None):
 *         CHKERR( SNESVISetVariableBounds(self.snes, xl.vec, xu.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def getVIInactiveSet(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESVISetVariableBounds(__pyx_v_self->snes, __pyx_v_xl->vec, __pyx_v_xu->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 648, __pyx_L1_error)

  /* "PETSc/SNES.pyx":647
 *     # --- VI ---
 * 
 *     def setVariableBounds(self, Vec xl not None, Vec xu not None):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESVISetVariableBounds(self.snes, xl.vec, xu.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setVariableBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":650
 *         CHKERR( SNESVISetVariableBounds(self.snes, xl.vec, xu.vec) )
 * 
 *     def getVIInactiveSet(self):             # <<<<<<<<<<<<<<
 *         cdef IS inact = IS()
 *         CHKERR( SNESVIGetInactiveSet(self.snes, &inact.iset) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_181getVIInactiveSet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_180getVIInactiveSet[] = "SNES.getVIInactiveSet(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_181getVIInactiveSet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getVIInactiveSet (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getVIInactiveSet", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getVIInactiveSet", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_180getVIInactiveSet(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_180getVIInactiveSet(struct PyPetscSNESObject *__pyx_v_self) {
  struct PyPetscISObject *__pyx_v_inact = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getVIInactiveSet", 0);

  /* "PETSc/SNES.pyx":651
 * 
 *     def getVIInactiveSet(self):
 *         cdef IS inact = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( SNESVIGetInactiveSet(self.snes, &inact.iset) )
 *         PetscINCREF(inact.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_inact = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":652
 *     def getVIInactiveSet(self):
 *         cdef IS inact = IS()
 *         CHKERR( SNESVIGetInactiveSet(self.snes, &inact.iset) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(inact.obj)
 *         return inact
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESVIGetInactiveSet(__pyx_v_self->snes, (&__pyx_v_inact->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 652, __pyx_L1_error)

  /* "PETSc/SNES.pyx":653
 *         cdef IS inact = IS()
 *         CHKERR( SNESVIGetInactiveSet(self.snes, &inact.iset) )
 *         PetscINCREF(inact.obj)             # <<<<<<<<<<<<<<
 *         return inact
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_inact->__pyx_base.obj);

  /* "PETSc/SNES.pyx":654
 *         CHKERR( SNESVIGetInactiveSet(self.snes, &inact.iset) )
 *         PetscINCREF(inact.obj)
 *         return inact             # <<<<<<<<<<<<<<
 * 
 *     # --- Python ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_inact));
  __pyx_r = ((PyObject *)__pyx_v_inact);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":650
 *         CHKERR( SNESVISetVariableBounds(self.snes, xl.vec, xu.vec) )
 * 
 *     def getVIInactiveSet(self):             # <<<<<<<<<<<<<<
 *         cdef IS inact = IS()
 *         CHKERR( SNESVIGetInactiveSet(self.snes, &inact.iset) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getVIInactiveSet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_inact);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":658
 *     # --- Python ---
 * 
 *     def createPython(self, context=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSNES newsnes = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_183createPython(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_182createPython[] = "SNES.createPython(self, context=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_183createPython(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createPython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_comm,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createPython") < 0)) __PYX_ERR(36, 658, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_context = values[0];
    __pyx_v_comm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createPython", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 658, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.createPython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_182createPython(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_context, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_182createPython(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  SNES __pyx_v_newsnes;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createPython", 0);

  /* "PETSc/SNES.pyx":659
 * 
 *     def createPython(self, context=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscSNES newsnes = NULL
 *         CHKERR( SNESCreate(ccomm, &newsnes) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(36, 659, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/SNES.pyx":660
 *     def createPython(self, context=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSNES newsnes = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( SNESCreate(ccomm, &newsnes) )
 *         PetscCLEAR(self.obj); self.snes = newsnes
 */
  __pyx_v_newsnes = NULL;

  /* "PETSc/SNES.pyx":661
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSNES newsnes = NULL
 *         CHKERR( SNESCreate(ccomm, &newsnes) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.snes = newsnes
 *         CHKERR( SNESSetType(self.snes, SNESPYTHON) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESCreate(__pyx_v_ccomm, (&__pyx_v_newsnes))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 661, __pyx_L1_error)

  /* "PETSc/SNES.pyx":662
 *         cdef PetscSNES newsnes = NULL
 *         CHKERR( SNESCreate(ccomm, &newsnes) )
 *         PetscCLEAR(self.obj); self.snes = newsnes             # <<<<<<<<<<<<<<
 *         CHKERR( SNESSetType(self.snes, SNESPYTHON) )
 *         CHKERR( SNESPythonSetContext(self.snes, <void*>context) )
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->snes = __pyx_v_newsnes;

  /* "PETSc/SNES.pyx":663
 *         CHKERR( SNESCreate(ccomm, &newsnes) )
 *         PetscCLEAR(self.obj); self.snes = newsnes
 *         CHKERR( SNESSetType(self.snes, SNESPYTHON) )             # <<<<<<<<<<<<<<
 *         CHKERR( SNESPythonSetContext(self.snes, <void*>context) )
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESSetType(__pyx_v_self->snes, SNESPYTHON)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 663, __pyx_L1_error)

  /* "PETSc/SNES.pyx":664
 *         PetscCLEAR(self.obj); self.snes = newsnes
 *         CHKERR( SNESSetType(self.snes, SNESPYTHON) )
 *         CHKERR( SNESPythonSetContext(self.snes, <void*>context) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESPythonSetContext(__pyx_v_self->snes, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 664, __pyx_L1_error)

  /* "PETSc/SNES.pyx":665
 *         CHKERR( SNESSetType(self.snes, SNESPYTHON) )
 *         CHKERR( SNESPythonSetContext(self.snes, <void*>context) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setPythonContext(self, context):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":658
 *     # --- Python ---
 * 
 *     def createPython(self, context=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSNES newsnes = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.createPython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":667
 *         return self
 * 
 *     def setPythonContext(self, context):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESPythonSetContext(self.snes, <void*>context) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_185setPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_184setPythonContext[] = "SNES.setPythonContext(self, context)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_185setPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPythonContext (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,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);
        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_context)) != 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, "setPythonContext") < 0)) __PYX_ERR(36, 667, __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_context = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPythonContext", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 667, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_184setPythonContext(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_context);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_184setPythonContext(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_context) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setPythonContext", 0);

  /* "PETSc/SNES.pyx":668
 * 
 *     def setPythonContext(self, context):
 *         CHKERR( SNESPythonSetContext(self.snes, <void*>context) )             # <<<<<<<<<<<<<<
 * 
 *     def getPythonContext(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESPythonSetContext(__pyx_v_self->snes, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 668, __pyx_L1_error)

  /* "PETSc/SNES.pyx":667
 *         return self
 * 
 *     def setPythonContext(self, context):             # <<<<<<<<<<<<<<
 *         CHKERR( SNESPythonSetContext(self.snes, <void*>context) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":670
 *         CHKERR( SNESPythonSetContext(self.snes, <void*>context) )
 * 
 *     def getPythonContext(self):             # <<<<<<<<<<<<<<
 *         cdef void *context = NULL
 *         CHKERR( SNESPythonGetContext(self.snes, &context) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_187getPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_186getPythonContext[] = "SNES.getPythonContext(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_187getPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPythonContext (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getPythonContext", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getPythonContext", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_186getPythonContext(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_186getPythonContext(struct PyPetscSNESObject *__pyx_v_self) {
  void *__pyx_v_context;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getPythonContext", 0);

  /* "PETSc/SNES.pyx":671
 * 
 *     def getPythonContext(self):
 *         cdef void *context = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( SNESPythonGetContext(self.snes, &context) )
 *         if context == NULL: return None
 */
  __pyx_v_context = NULL;

  /* "PETSc/SNES.pyx":672
 *     def getPythonContext(self):
 *         cdef void *context = NULL
 *         CHKERR( SNESPythonGetContext(self.snes, &context) )             # <<<<<<<<<<<<<<
 *         if context == NULL: return None
 *         else: return <object> context
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESPythonGetContext(__pyx_v_self->snes, (&__pyx_v_context))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 672, __pyx_L1_error)

  /* "PETSc/SNES.pyx":673
 *         cdef void *context = NULL
 *         CHKERR( SNESPythonGetContext(self.snes, &context) )
 *         if context == NULL: return None             # <<<<<<<<<<<<<<
 *         else: return <object> context
 * 
 */
  __pyx_t_2 = ((__pyx_v_context == NULL) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "PETSc/SNES.pyx":674
 *         CHKERR( SNESPythonGetContext(self.snes, &context) )
 *         if context == NULL: return None
 *         else: return <object> context             # <<<<<<<<<<<<<<
 * 
 *     def setPythonType(self, py_type):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_context));
    __pyx_r = ((PyObject *)__pyx_v_context);
    goto __pyx_L0;
  }

  /* "PETSc/SNES.pyx":670
 *         CHKERR( SNESPythonSetContext(self.snes, <void*>context) )
 * 
 *     def getPythonContext(self):             # <<<<<<<<<<<<<<
 *         cdef void *context = NULL
 *         CHKERR( SNESPythonGetContext(self.snes, &context) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":676
 *         else: return <object> context
 * 
 *     def setPythonType(self, py_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_189setPythonType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_188setPythonType[] = "SNES.setPythonType(self, py_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_189setPythonType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_py_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPythonType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_py_type,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);
        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_py_type)) != 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, "setPythonType") < 0)) __PYX_ERR(36, 676, __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_py_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPythonType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 676, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setPythonType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_188setPythonType(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_py_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_188setPythonType(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_py_type) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setPythonType", 0);
  __Pyx_INCREF(__pyx_v_py_type);

  /* "PETSc/SNES.pyx":677
 * 
 *     def setPythonType(self, py_type):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         py_type = str2bytes(py_type, &cval)
 *         CHKERR( SNESPythonSetType(self.snes, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/SNES.pyx":678
 *     def setPythonType(self, py_type):
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESPythonSetType(self.snes, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_py_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_py_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":679
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 *         CHKERR( SNESPythonSetType(self.snes, cval) )             # <<<<<<<<<<<<<<
 * 
 *     # --- Composite ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESPythonSetType(__pyx_v_self->snes, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(36, 679, __pyx_L1_error)

  /* "PETSc/SNES.pyx":676
 *         else: return <object> context
 * 
 *     def setPythonType(self, py_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.setPythonType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":683
 *     # --- Composite ---
 * 
 *     def getCompositeSNES(self, n):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cn
 *         cdef SNES snes = SNES()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_191getCompositeSNES(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_190getCompositeSNES[] = "SNES.getCompositeSNES(self, n)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_191getCompositeSNES(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCompositeSNES (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,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);
        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_n)) != 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, "getCompositeSNES") < 0)) __PYX_ERR(36, 683, __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_n = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getCompositeSNES", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(36, 683, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getCompositeSNES", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_190getCompositeSNES(((struct PyPetscSNESObject *)__pyx_v_self), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_190getCompositeSNES(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PetscInt __pyx_v_cn;
  struct PyPetscSNESObject *__pyx_v_snes = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PetscInt __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getCompositeSNES", 0);

  /* "PETSc/SNES.pyx":685
 *     def getCompositeSNES(self, n):
 *         cdef PetscInt cn
 *         cdef SNES snes = SNES()             # <<<<<<<<<<<<<<
 *         cn = asInt(n)
 *         CHKERR( SNESCompositeGetSNES(self.snes, cn, &snes.snes) )
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_snes = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":686
 *         cdef PetscInt cn
 *         cdef SNES snes = SNES()
 *         cn = asInt(n)             # <<<<<<<<<<<<<<
 *         CHKERR( SNESCompositeGetSNES(self.snes, cn, &snes.snes) )
 *         PetscINCREF(snes.obj)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_n); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(36, 686, __pyx_L1_error)
  __pyx_v_cn = __pyx_t_2;

  /* "PETSc/SNES.pyx":687
 *         cdef SNES snes = SNES()
 *         cn = asInt(n)
 *         CHKERR( SNESCompositeGetSNES(self.snes, cn, &snes.snes) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(snes.obj)
 *         return snes
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESCompositeGetSNES(__pyx_v_self->snes, __pyx_v_cn, (&__pyx_v_snes->snes))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(36, 687, __pyx_L1_error)

  /* "PETSc/SNES.pyx":688
 *         cn = asInt(n)
 *         CHKERR( SNESCompositeGetSNES(self.snes, cn, &snes.snes) )
 *         PetscINCREF(snes.obj)             # <<<<<<<<<<<<<<
 *         return snes
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_snes->__pyx_base.obj);

  /* "PETSc/SNES.pyx":689
 *         CHKERR( SNESCompositeGetSNES(self.snes, cn, &snes.snes) )
 *         PetscINCREF(snes.obj)
 *         return snes             # <<<<<<<<<<<<<<
 * 
 *     def getCompositeNumber(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_snes));
  __pyx_r = ((PyObject *)__pyx_v_snes);
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":683
 *     # --- Composite ---
 * 
 *     def getCompositeSNES(self, n):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cn
 *         cdef SNES snes = SNES()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getCompositeSNES", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_snes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":691
 *         return snes
 * 
 *     def getCompositeNumber(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cn = 0
 *         CHKERR( SNESCompositeGetNumber(self.snes, &cn) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_193getCompositeNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4SNES_192getCompositeNumber[] = "SNES.getCompositeNumber(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_193getCompositeNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCompositeNumber (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getCompositeNumber", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getCompositeNumber", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_192getCompositeNumber(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_192getCompositeNumber(struct PyPetscSNESObject *__pyx_v_self) {
  PetscInt __pyx_v_cn;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getCompositeNumber", 0);

  /* "PETSc/SNES.pyx":692
 * 
 *     def getCompositeNumber(self):
 *         cdef PetscInt cn = 0             # <<<<<<<<<<<<<<
 *         CHKERR( SNESCompositeGetNumber(self.snes, &cn) )
 *         return toInt(cn)
 */
  __pyx_v_cn = 0;

  /* "PETSc/SNES.pyx":693
 *     def getCompositeNumber(self):
 *         cdef PetscInt cn = 0
 *         CHKERR( SNESCompositeGetNumber(self.snes, &cn) )             # <<<<<<<<<<<<<<
 *         return toInt(cn)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(SNESCompositeGetNumber(__pyx_v_self->snes, (&__pyx_v_cn))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(36, 693, __pyx_L1_error)

  /* "PETSc/SNES.pyx":694
 *         cdef PetscInt cn = 0
 *         CHKERR( SNESCompositeGetNumber(self.snes, &cn) )
 *         return toInt(cn)             # <<<<<<<<<<<<<<
 * 
 *     # --- application context ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_cn); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":691
 *         return snes
 * 
 *     def getCompositeNumber(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cn = 0
 *         CHKERR( SNESCompositeGetNumber(self.snes, &cn) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.getCompositeNumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":699
 * 
 *     property appctx:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getAppCtx()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_6appctx_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_6appctx_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6appctx___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6appctx___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":700
 *     property appctx:
 *         def __get__(self):
 *             return self.getAppCtx()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setAppCtx(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getAppCtx); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 700, __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(36, 700, __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;

  /* "PETSc/SNES.pyx":699
 * 
 *     property appctx:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getAppCtx()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.appctx.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":701
 *         def __get__(self):
 *             return self.getAppCtx()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setAppCtx(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_6appctx_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_6appctx_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6appctx_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_6appctx_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":702
 *             return self.getAppCtx()
 *         def __set__(self, value):
 *             self.setAppCtx(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- discretization space ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setAppCtx); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 702, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 702, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 702, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":701
 *         def __get__(self):
 *             return self.getAppCtx()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setAppCtx(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.appctx.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":707
 * 
 *     property dm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getDM()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_2dm_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_2dm_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_2dm___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_2dm___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":708
 *     property dm:
 *         def __get__(self):
 *             return self.getDM()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setDM(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getDM); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 708, __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(36, 708, __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;

  /* "PETSc/SNES.pyx":707
 * 
 *     property dm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getDM()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.dm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":709
 *         def __get__(self):
 *             return self.getDM()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setDM(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_2dm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_2dm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_2dm_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_2dm_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":710
 *             return self.getDM()
 *         def __set__(self, value):
 *             self.setDM(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- nonlinear preconditioner ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setDM); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 710, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 710, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":709
 *         def __get__(self):
 *             return self.getDM()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setDM(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.dm.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":715
 * 
 *     property npc:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getNPC()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_3npc_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_3npc_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_3npc___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_3npc___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":716
 *     property npc:
 *         def __get__(self):
 *             return self.getNPC()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setNPC(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getNPC); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 716, __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(36, 716, __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;

  /* "PETSc/SNES.pyx":715
 * 
 *     property npc:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getNPC()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.npc.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":717
 *         def __get__(self):
 *             return self.getNPC()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setNPC(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_3npc_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_3npc_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_3npc_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_3npc_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":718
 *             return self.getNPC()
 *         def __set__(self, value):
 *             self.setNPC(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- vectors ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setNPC); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 718, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 718, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 718, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":717
 *         def __get__(self):
 *             return self.getNPC()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setNPC(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.npc.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":723
 * 
 *     property vec_sol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolution()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_7vec_sol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_7vec_sol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_7vec_sol___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_7vec_sol___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":724
 *     property vec_sol:
 *         def __get__(self):
 *             return self.getSolution()             # <<<<<<<<<<<<<<
 * 
 *     property vec_upd:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSolution); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 724, __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(36, 724, __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;

  /* "PETSc/SNES.pyx":723
 * 
 *     property vec_sol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolution()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.vec_sol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":727
 * 
 *     property vec_upd:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolutionUpdate()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_7vec_upd_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_7vec_upd_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_7vec_upd___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_7vec_upd___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":728
 *     property vec_upd:
 *         def __get__(self):
 *             return self.getSolutionUpdate()             # <<<<<<<<<<<<<<
 * 
 *     property vec_rhs:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSolutionUpdate); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 728, __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(36, 728, __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;

  /* "PETSc/SNES.pyx":727
 * 
 *     property vec_upd:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolutionUpdate()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.vec_upd.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":731
 * 
 *     property vec_rhs:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getRhs()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_7vec_rhs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_7vec_rhs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_7vec_rhs___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_7vec_rhs___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":732
 *     property vec_rhs:
 *         def __get__(self):
 *             return self.getRhs()             # <<<<<<<<<<<<<<
 * 
 *     # --- linear solver ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getRhs); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 732, __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(36, 732, __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;

  /* "PETSc/SNES.pyx":731
 * 
 *     property vec_rhs:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getRhs()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.vec_rhs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":737
 * 
 *     property ksp:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getKSP()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_3ksp_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_3ksp_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_3ksp___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_3ksp___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":738
 *     property ksp:
 *         def __get__(self):
 *             return self.getKSP()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setKSP(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getKSP); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 738, __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(36, 738, __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;

  /* "PETSc/SNES.pyx":737
 * 
 *     property ksp:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getKSP()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.ksp.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":739
 *         def __get__(self):
 *             return self.getKSP()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setKSP(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_3ksp_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_3ksp_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_3ksp_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_3ksp_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":740
 *             return self.getKSP()
 *         def __set__(self, value):
 *             self.setKSP(value)             # <<<<<<<<<<<<<<
 * 
 *     property use_ew:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setKSP); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 740, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 740, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":739
 *         def __get__(self):
 *             return self.getKSP()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setKSP(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.ksp.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":743
 * 
 *     property use_ew:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getUseEW()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_6use_ew_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_6use_ew_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6use_ew___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6use_ew___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":744
 *     property use_ew:
 *         def __get__(self):
 *             return self.getUseEW()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setUseEW(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getUseEW); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 744, __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(36, 744, __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;

  /* "PETSc/SNES.pyx":743
 * 
 *     property use_ew:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getUseEW()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.use_ew.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":745
 *         def __get__(self):
 *             return self.getUseEW()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setUseEW(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_6use_ew_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_6use_ew_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6use_ew_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_6use_ew_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":746
 *             return self.getUseEW()
 *         def __set__(self, value):
 *             self.setUseEW(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- tolerances ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setUseEW); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 746, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 746, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":745
 *         def __get__(self):
 *             return self.getUseEW()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setUseEW(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.use_ew.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":751
 * 
 *     property rtol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[0]
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_4rtol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_4rtol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_4rtol___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_4rtol___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":752
 *     property rtol:
 *         def __get__(self):
 *             return self.getTolerances()[0]             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setTolerances(rtol=value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 752, __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(36, 752, __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(36, 752, __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;

  /* "PETSc/SNES.pyx":751
 * 
 *     property rtol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[0]
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.rtol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":753
 *         def __get__(self):
 *             return self.getTolerances()[0]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(rtol=value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_4rtol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_4rtol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_4rtol_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_4rtol_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":754
 *             return self.getTolerances()[0]
 *         def __set__(self, value):
 *             self.setTolerances(rtol=value)             # <<<<<<<<<<<<<<
 * 
 *     property atol:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setTolerances); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_rtol, __pyx_v_value) < 0) __PYX_ERR(36, 754, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 754, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":753
 *         def __get__(self):
 *             return self.getTolerances()[0]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(rtol=value)
 * 
 */

  /* 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("petsc4py.PETSc.SNES.rtol.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":757
 * 
 *     property atol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[1]
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_4atol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_4atol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_4atol___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_4atol___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":758
 *     property atol:
 *         def __get__(self):
 *             return self.getTolerances()[1]             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setTolerances(atol=value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 758, __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(36, 758, __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, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 758, __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;

  /* "PETSc/SNES.pyx":757
 * 
 *     property atol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[1]
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.atol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":759
 *         def __get__(self):
 *             return self.getTolerances()[1]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(atol=value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_4atol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_4atol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_4atol_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_4atol_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":760
 *             return self.getTolerances()[1]
 *         def __set__(self, value):
 *             self.setTolerances(atol=value)             # <<<<<<<<<<<<<<
 * 
 *     property stol:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setTolerances); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_atol, __pyx_v_value) < 0) __PYX_ERR(36, 760, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 760, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":759
 *         def __get__(self):
 *             return self.getTolerances()[1]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(atol=value)
 * 
 */

  /* 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("petsc4py.PETSc.SNES.atol.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":763
 * 
 *     property stol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[2]
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_4stol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_4stol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_4stol___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_4stol___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":764
 *     property stol:
 *         def __get__(self):
 *             return self.getTolerances()[2]             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setTolerances(stol=value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 764, __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(36, 764, __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, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 764, __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;

  /* "PETSc/SNES.pyx":763
 * 
 *     property stol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[2]
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.stol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":765
 *         def __get__(self):
 *             return self.getTolerances()[2]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(stol=value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_4stol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_4stol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_4stol_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_4stol_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":766
 *             return self.getTolerances()[2]
 *         def __set__(self, value):
 *             self.setTolerances(stol=value)             # <<<<<<<<<<<<<<
 * 
 *     property max_it:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setTolerances); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_stol, __pyx_v_value) < 0) __PYX_ERR(36, 766, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 766, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":765
 *         def __get__(self):
 *             return self.getTolerances()[2]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(stol=value)
 * 
 */

  /* 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("petsc4py.PETSc.SNES.stol.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":769
 * 
 *     property max_it:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[3]
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_6max_it_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_6max_it_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6max_it___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6max_it___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":770
 *     property max_it:
 *         def __get__(self):
 *             return self.getTolerances()[3]             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setTolerances(max_it=value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 770, __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(36, 770, __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, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 770, __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;

  /* "PETSc/SNES.pyx":769
 * 
 *     property max_it:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[3]
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.max_it.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":771
 *         def __get__(self):
 *             return self.getTolerances()[3]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(max_it=value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_6max_it_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_6max_it_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6max_it_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_6max_it_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":772
 *             return self.getTolerances()[3]
 *         def __set__(self, value):
 *             self.setTolerances(max_it=value)             # <<<<<<<<<<<<<<
 * 
 *     # --- more tolerances ---
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setTolerances); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_max_it, __pyx_v_value) < 0) __PYX_ERR(36, 772, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 772, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/SNES.pyx":771
 *         def __get__(self):
 *             return self.getTolerances()[3]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(max_it=value)
 * 
 */

  /* 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("petsc4py.PETSc.SNES.max_it.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":777
 * 
 *     property max_funcs:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getMaxFunctionEvaluations()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_9max_funcs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_9max_funcs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_9max_funcs___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_9max_funcs___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":778
 *     property max_funcs:
 *         def __get__(self):
 *             return self.getMaxFunctionEvaluations()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setMaxFunctionEvaluations(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getMaxFunctionEvaluations); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 778, __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(36, 778, __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;

  /* "PETSc/SNES.pyx":777
 * 
 *     property max_funcs:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getMaxFunctionEvaluations()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.max_funcs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":779
 *         def __get__(self):
 *             return self.getMaxFunctionEvaluations()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setMaxFunctionEvaluations(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_9max_funcs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_9max_funcs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_9max_funcs_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_9max_funcs_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":780
 *             return self.getMaxFunctionEvaluations()
 *         def __set__(self, value):
 *             self.setMaxFunctionEvaluations(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- iteration ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setMaxFunctionEvaluations); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 780, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 780, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":779
 *         def __get__(self):
 *             return self.getMaxFunctionEvaluations()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setMaxFunctionEvaluations(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.max_funcs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":785
 * 
 *     property its:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getIterationNumber()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_3its_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_3its_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_3its___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_3its___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":786
 *     property its:
 *         def __get__(self):
 *             return self.getIterationNumber()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setIterationNumber(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getIterationNumber); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 786, __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(36, 786, __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;

  /* "PETSc/SNES.pyx":785
 * 
 *     property its:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getIterationNumber()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.its.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":787
 *         def __get__(self):
 *             return self.getIterationNumber()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setIterationNumber(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_3its_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_3its_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_3its_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_3its_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":788
 *             return self.getIterationNumber()
 *         def __set__(self, value):
 *             self.setIterationNumber(value)             # <<<<<<<<<<<<<<
 * 
 *     property history:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setIterationNumber); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 788, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 788, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":787
 *         def __get__(self):
 *             return self.getIterationNumber()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setIterationNumber(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.its.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":791
 * 
 *     property history:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConvergenceHistory()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_7history_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_7history_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_7history___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_7history___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":792
 *     property history:
 *         def __get__(self):
 *             return self.getConvergenceHistory()             # <<<<<<<<<<<<<<
 * 
 *     # --- convergence ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getConvergenceHistory); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 792, __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(36, 792, __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;

  /* "PETSc/SNES.pyx":791
 * 
 *     property history:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConvergenceHistory()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.history.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":797
 * 
 *     property reason:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConvergedReason()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_6reason_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_6reason_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6reason___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6reason___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":798
 *     property reason:
 *         def __get__(self):
 *             return self.getConvergedReason()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setConvergedReason(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getConvergedReason); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 798, __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(36, 798, __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;

  /* "PETSc/SNES.pyx":797
 * 
 *     property reason:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConvergedReason()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.reason.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":799
 *         def __get__(self):
 *             return self.getConvergedReason()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setConvergedReason(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_6reason_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_6reason_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6reason_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_6reason_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":800
 *             return self.getConvergedReason()
 *         def __set__(self, value):
 *             self.setConvergedReason(value)             # <<<<<<<<<<<<<<
 * 
 *     property iterating:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setConvergedReason); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 800, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 800, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":799
 *         def __get__(self):
 *             return self.getConvergedReason()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setConvergedReason(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.reason.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":803
 * 
 *     property iterating:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason == 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_9iterating_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_9iterating_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_9iterating___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_9iterating___get__(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/SNES.pyx":804
 *     property iterating:
 *         def __get__(self):
 *             return self.reason == 0             # <<<<<<<<<<<<<<
 * 
 *     property converged:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reason); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 804, __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;

  /* "PETSc/SNES.pyx":803
 * 
 *     property iterating:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason == 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.iterating.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":807
 * 
 *     property converged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason > 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_9converged_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_9converged_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_9converged___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_9converged___get__(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/SNES.pyx":808
 *     property converged:
 *         def __get__(self):
 *             return self.reason > 0             # <<<<<<<<<<<<<<
 * 
 *     property diverged:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reason); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 808, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":807
 * 
 *     property converged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason > 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.converged.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":811
 * 
 *     property diverged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason < 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_8diverged_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_8diverged_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_8diverged___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_8diverged___get__(struct PyPetscSNESObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/SNES.pyx":812
 *     property diverged:
 *         def __get__(self):
 *             return self.reason < 0             # <<<<<<<<<<<<<<
 * 
 *     # --- matrix free / finite diferences ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reason); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 812, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SNES.pyx":811
 * 
 *     property diverged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason < 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.diverged.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":817
 * 
 *     property use_mf:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getUseMF()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_6use_mf_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_6use_mf_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6use_mf___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6use_mf___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":818
 *     property use_mf:
 *         def __get__(self):
 *             return self.getUseMF()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setUseMF(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getUseMF); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 818, __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(36, 818, __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;

  /* "PETSc/SNES.pyx":817
 * 
 *     property use_mf:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getUseMF()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.use_mf.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":819
 *         def __get__(self):
 *             return self.getUseMF()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setUseMF(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_6use_mf_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_6use_mf_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6use_mf_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_6use_mf_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":820
 *             return self.getUseMF()
 *         def __set__(self, value):
 *             self.setUseMF(value)             # <<<<<<<<<<<<<<
 * 
 *     property use_fd:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setUseMF); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 820, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 820, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 820, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":819
 *         def __get__(self):
 *             return self.getUseMF()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setUseMF(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.use_mf.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":823
 * 
 *     property use_fd:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getUseFD()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_6use_fd_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4SNES_6use_fd_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6use_fd___get__(((struct PyPetscSNESObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4SNES_6use_fd___get__(struct PyPetscSNESObject *__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);

  /* "PETSc/SNES.pyx":824
 *     property use_fd:
 *         def __get__(self):
 *             return self.getUseFD()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setUseFD(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getUseFD); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(36, 824, __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(36, 824, __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;

  /* "PETSc/SNES.pyx":823
 * 
 *     property use_fd:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getUseFD()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.use_fd.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SNES.pyx":825
 *         def __get__(self):
 *             return self.getUseFD()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setUseFD(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_4SNES_6use_fd_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_4SNES_6use_fd_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4SNES_6use_fd_2__set__(((struct PyPetscSNESObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_4SNES_6use_fd_2__set__(struct PyPetscSNESObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/SNES.pyx":826
 *             return self.getUseFD()
 *         def __set__(self, value):
 *             self.setUseFD(value)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setUseFD); if (unlikely(!__pyx_t_2)) __PYX_ERR(36, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 826, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 826, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 826, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/SNES.pyx":825
 *         def __get__(self):
 *             return self.getUseFD()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setUseFD(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.SNES.use_fd.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":80
 *     # --- xxx ---
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.ts
 *         self.ts = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS___cinit__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS___cinit__(struct PyPetscTSObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/TS.pyx":81
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.ts             # <<<<<<<<<<<<<<
 *         self.ts = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->ts));

  /* "PETSc/TS.pyx":82
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.ts
 *         self.ts = NULL             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __pyx_v_self->ts = NULL;

  /* "PETSc/TS.pyx":80
 *     # --- xxx ---
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.ts
 *         self.ts = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":86
 *     # --- xxx ---
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_3view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_2view[] = "TS.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_3view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(37, 86, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 86, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(37, 86, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_2view(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_viewer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_2view(struct PyPetscTSObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_cviewer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/TS.pyx":87
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer cviewer = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: cviewer = viewer.vwr
 *         CHKERR( TSView(self.ts, cviewer) )
 */
  __pyx_v_cviewer = NULL;

  /* "PETSc/TS.pyx":88
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( TSView(self.ts, cviewer) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_cviewer = __pyx_t_3;
  }

  /* "PETSc/TS.pyx":89
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 *         CHKERR( TSView(self.ts, cviewer) )             # <<<<<<<<<<<<<<
 * 
 *     def load(self, Viewer viewer not None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSView(__pyx_v_self->ts, __pyx_v_cviewer)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(37, 89, __pyx_L1_error)

  /* "PETSc/TS.pyx":86
 *     # --- xxx ---
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":91
 *         CHKERR( TSView(self.ts, cviewer) )
 * 
 *     def load(self, Viewer viewer not None):             # <<<<<<<<<<<<<<
 *         CHKERR( TSLoad(self.ts, viewer.vwr) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_5load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_4load[] = "TS.load(self, Viewer viewer)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_5load(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,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);
        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_viewer)) != 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, "load") < 0)) __PYX_ERR(37, 91, __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_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 91, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 0, "viewer", 0))) __PYX_ERR(37, 91, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_4load(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_viewer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_4load(struct PyPetscTSObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("load", 0);

  /* "PETSc/TS.pyx":92
 * 
 *     def load(self, Viewer viewer not None):
 *         CHKERR( TSLoad(self.ts, viewer.vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSLoad(__pyx_v_self->ts, __pyx_v_viewer->vwr)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 92, __pyx_L1_error)

  /* "PETSc/TS.pyx":91
 *         CHKERR( TSView(self.ts, cviewer) )
 * 
 *     def load(self, Viewer viewer not None):             # <<<<<<<<<<<<<<
 *         CHKERR( TSLoad(self.ts, viewer.vwr) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":94
 *         CHKERR( TSLoad(self.ts, viewer.vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( TSDestroy(&self.ts) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_6destroy[] = "TS.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_6destroy(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_6destroy(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/TS.pyx":95
 * 
 *     def destroy(self):
 *         CHKERR( TSDestroy(&self.ts) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSDestroy((&__pyx_v_self->ts))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 95, __pyx_L1_error)

  /* "PETSc/TS.pyx":96
 *     def destroy(self):
 *         CHKERR( TSDestroy(&self.ts) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/TS.pyx":94
 *         CHKERR( TSLoad(self.ts, viewer.vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( TSDestroy(&self.ts) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":98
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscTS newts = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_8create[] = "TS.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(37, 98, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 98, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_8create(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_8create(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  TS __pyx_v_newts;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/TS.pyx":99
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscTS newts = NULL
 *         CHKERR( TSCreate(ccomm, &newts) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(37, 99, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/TS.pyx":100
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscTS newts = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( TSCreate(ccomm, &newts) )
 *         PetscCLEAR(self.obj); self.ts = newts
 */
  __pyx_v_newts = NULL;

  /* "PETSc/TS.pyx":101
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscTS newts = NULL
 *         CHKERR( TSCreate(ccomm, &newts) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.ts = newts
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSCreate(__pyx_v_ccomm, (&__pyx_v_newts))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 101, __pyx_L1_error)

  /* "PETSc/TS.pyx":102
 *         cdef PetscTS newts = NULL
 *         CHKERR( TSCreate(ccomm, &newts) )
 *         PetscCLEAR(self.obj); self.ts = newts             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->ts = __pyx_v_newts;

  /* "PETSc/TS.pyx":103
 *         CHKERR( TSCreate(ccomm, &newts) )
 *         PetscCLEAR(self.obj); self.ts = newts
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def clone(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/TS.pyx":98
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscTS newts = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":105
 *         return self
 * 
 *     def clone(self):             # <<<<<<<<<<<<<<
 *         cdef TS ts = TS()
 *         CHKERR( TSClone(self.ts, &ts.ts) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_11clone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_10clone[] = "TS.clone(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_11clone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clone (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("clone", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clone", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_10clone(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_10clone(struct PyPetscTSObject *__pyx_v_self) {
  struct PyPetscTSObject *__pyx_v_ts = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("clone", 0);

  /* "PETSc/TS.pyx":106
 * 
 *     def clone(self):
 *         cdef TS ts = TS()             # <<<<<<<<<<<<<<
 *         CHKERR( TSClone(self.ts, &ts.ts) )
 *         return ts
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ts = ((struct PyPetscTSObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":107
 *     def clone(self):
 *         cdef TS ts = TS()
 *         CHKERR( TSClone(self.ts, &ts.ts) )             # <<<<<<<<<<<<<<
 *         return ts
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSClone(__pyx_v_self->ts, (&__pyx_v_ts->ts))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 107, __pyx_L1_error)

  /* "PETSc/TS.pyx":108
 *         cdef TS ts = TS()
 *         CHKERR( TSClone(self.ts, &ts.ts) )
 *         return ts             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, ts_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ts));
  __pyx_r = ((PyObject *)__pyx_v_ts);
  goto __pyx_L0;

  /* "PETSc/TS.pyx":105
 *         return self
 * 
 *     def clone(self):             # <<<<<<<<<<<<<<
 *         cdef TS ts = TS()
 *         CHKERR( TSClone(self.ts, &ts.ts) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ts);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":110
 *         return ts
 * 
 *     def setType(self, ts_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         ts_type = str2bytes(ts_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_13setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_12setType[] = "TS.setType(self, ts_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_13setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ts_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ts_type,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);
        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_ts_type)) != 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, "setType") < 0)) __PYX_ERR(37, 110, __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_ts_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 110, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_12setType(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_ts_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_12setType(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_ts_type) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_ts_type);

  /* "PETSc/TS.pyx":111
 * 
 *     def setType(self, ts_type):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         ts_type = str2bytes(ts_type, &cval)
 *         CHKERR( TSSetType(self.ts, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/TS.pyx":112
 *     def setType(self, ts_type):
 *         cdef const_char *cval = NULL
 *         ts_type = str2bytes(ts_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetType(self.ts, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_ts_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_ts_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":113
 *         cdef const_char *cval = NULL
 *         ts_type = str2bytes(ts_type, &cval)
 *         CHKERR( TSSetType(self.ts, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetType(__pyx_v_self->ts, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 113, __pyx_L1_error)

  /* "PETSc/TS.pyx":110
 *         return ts
 * 
 *     def setType(self, ts_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         ts_type = str2bytes(ts_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ts_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":115
 *         CHKERR( TSSetType(self.ts, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscTSType cval = NULL
 *         CHKERR( TSGetType(self.ts, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_15getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_14getType[] = "TS.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_15getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_14getType(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_14getType(struct PyPetscTSObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/TS.pyx":116
 * 
 *     def getType(self):
 *         cdef PetscTSType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetType(self.ts, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/TS.pyx":117
 *     def getType(self):
 *         cdef PetscTSType cval = NULL
 *         CHKERR( TSGetType(self.ts, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetType(__pyx_v_self->ts, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 117, __pyx_L1_error)

  /* "PETSc/TS.pyx":118
 *         cdef PetscTSType cval = NULL
 *         CHKERR( TSGetType(self.ts, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setProblemType(self, ptype):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":115
 *         CHKERR( TSSetType(self.ts, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscTSType cval = NULL
 *         CHKERR( TSGetType(self.ts, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":120
 *         return bytes2str(cval)
 * 
 *     def setProblemType(self, ptype):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetProblemType(self.ts, ptype) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_17setProblemType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_16setProblemType[] = "TS.setProblemType(self, ptype)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_17setProblemType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ptype = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setProblemType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ptype,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);
        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_ptype)) != 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, "setProblemType") < 0)) __PYX_ERR(37, 120, __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_ptype = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setProblemType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 120, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setProblemType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_16setProblemType(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_ptype);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_16setProblemType(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_ptype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  TSProblemType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setProblemType", 0);

  /* "PETSc/TS.pyx":121
 * 
 *     def setProblemType(self, ptype):
 *         CHKERR( TSSetProblemType(self.ts, ptype) )             # <<<<<<<<<<<<<<
 * 
 *     def getProblemType(self):
 */
  __pyx_t_1 = ((TSProblemType)__Pyx_PyInt_As_TSProblemType(__pyx_v_ptype)); if (unlikely(PyErr_Occurred())) __PYX_ERR(37, 121, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetProblemType(__pyx_v_self->ts, __pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 121, __pyx_L1_error)

  /* "PETSc/TS.pyx":120
 *         return bytes2str(cval)
 * 
 *     def setProblemType(self, ptype):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetProblemType(self.ts, ptype) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setProblemType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":123
 *         CHKERR( TSSetProblemType(self.ts, ptype) )
 * 
 *     def getProblemType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscTSProblemType ptype = TS_NONLINEAR
 *         CHKERR( TSGetProblemType(self.ts, &ptype) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_19getProblemType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_18getProblemType[] = "TS.getProblemType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_19getProblemType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getProblemType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getProblemType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getProblemType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_18getProblemType(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_18getProblemType(struct PyPetscTSObject *__pyx_v_self) {
  TSProblemType __pyx_v_ptype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getProblemType", 0);

  /* "PETSc/TS.pyx":124
 * 
 *     def getProblemType(self):
 *         cdef PetscTSProblemType ptype = TS_NONLINEAR             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetProblemType(self.ts, &ptype) )
 *         return ptype
 */
  __pyx_v_ptype = TS_NONLINEAR;

  /* "PETSc/TS.pyx":125
 *     def getProblemType(self):
 *         cdef PetscTSProblemType ptype = TS_NONLINEAR
 *         CHKERR( TSGetProblemType(self.ts, &ptype) )             # <<<<<<<<<<<<<<
 *         return ptype
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetProblemType(__pyx_v_self->ts, (&__pyx_v_ptype))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 125, __pyx_L1_error)

  /* "PETSc/TS.pyx":126
 *         cdef PetscTSProblemType ptype = TS_NONLINEAR
 *         CHKERR( TSGetProblemType(self.ts, &ptype) )
 *         return ptype             # <<<<<<<<<<<<<<
 * 
 *     def setEquationType(self, eqtype):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_TSProblemType(__pyx_v_ptype); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":123
 *         CHKERR( TSSetProblemType(self.ts, ptype) )
 * 
 *     def getProblemType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscTSProblemType ptype = TS_NONLINEAR
 *         CHKERR( TSGetProblemType(self.ts, &ptype) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getProblemType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":128
 *         return ptype
 * 
 *     def setEquationType(self, eqtype):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetEquationType(self.ts, eqtype) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_21setEquationType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_20setEquationType[] = "TS.setEquationType(self, eqtype)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_21setEquationType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_eqtype = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setEquationType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_eqtype,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);
        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_eqtype)) != 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, "setEquationType") < 0)) __PYX_ERR(37, 128, __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_eqtype = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setEquationType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 128, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setEquationType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_20setEquationType(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_eqtype);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_20setEquationType(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_eqtype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  TSEquationType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setEquationType", 0);

  /* "PETSc/TS.pyx":129
 * 
 *     def setEquationType(self, eqtype):
 *         CHKERR( TSSetEquationType(self.ts, eqtype) )             # <<<<<<<<<<<<<<
 * 
 *     def getEquationType(self):
 */
  __pyx_t_1 = ((TSEquationType)__Pyx_PyInt_As_TSEquationType(__pyx_v_eqtype)); if (unlikely(PyErr_Occurred())) __PYX_ERR(37, 129, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetEquationType(__pyx_v_self->ts, __pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 129, __pyx_L1_error)

  /* "PETSc/TS.pyx":128
 *         return ptype
 * 
 *     def setEquationType(self, eqtype):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetEquationType(self.ts, eqtype) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setEquationType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":131
 *         CHKERR( TSSetEquationType(self.ts, eqtype) )
 * 
 *     def getEquationType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscTSEquationType eqtype = TS_EQ_UNSPECIFIED
 *         CHKERR( TSGetEquationType(self.ts, &eqtype) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_23getEquationType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_22getEquationType[] = "TS.getEquationType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_23getEquationType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getEquationType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getEquationType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getEquationType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_22getEquationType(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_22getEquationType(struct PyPetscTSObject *__pyx_v_self) {
  TSEquationType __pyx_v_eqtype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getEquationType", 0);

  /* "PETSc/TS.pyx":132
 * 
 *     def getEquationType(self):
 *         cdef PetscTSEquationType eqtype = TS_EQ_UNSPECIFIED             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetEquationType(self.ts, &eqtype) )
 *         return eqtype
 */
  __pyx_v_eqtype = TS_EQ_UNSPECIFIED;

  /* "PETSc/TS.pyx":133
 *     def getEquationType(self):
 *         cdef PetscTSEquationType eqtype = TS_EQ_UNSPECIFIED
 *         CHKERR( TSGetEquationType(self.ts, &eqtype) )             # <<<<<<<<<<<<<<
 *         return eqtype
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetEquationType(__pyx_v_self->ts, (&__pyx_v_eqtype))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 133, __pyx_L1_error)

  /* "PETSc/TS.pyx":134
 *         cdef PetscTSEquationType eqtype = TS_EQ_UNSPECIFIED
 *         CHKERR( TSGetEquationType(self.ts, &eqtype) )
 *         return eqtype             # <<<<<<<<<<<<<<
 * 
 *     def setOptionsPrefix(self, prefix):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_TSEquationType(__pyx_v_eqtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":131
 *         CHKERR( TSSetEquationType(self.ts, eqtype) )
 * 
 *     def getEquationType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscTSEquationType eqtype = TS_EQ_UNSPECIFIED
 *         CHKERR( TSGetEquationType(self.ts, &eqtype) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getEquationType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":136
 *         return eqtype
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_25setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_24setOptionsPrefix[] = "TS.setOptionsPrefix(self, prefix)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_25setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOptionsPrefix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,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);
        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_prefix)) != 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, "setOptionsPrefix") < 0)) __PYX_ERR(37, 136, __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_prefix = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOptionsPrefix", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 136, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_24setOptionsPrefix(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_prefix);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_24setOptionsPrefix(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setOptionsPrefix", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "PETSc/TS.pyx":137
 * 
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( TSSetOptionsPrefix(self.ts, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/TS.pyx":138
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetOptionsPrefix(self.ts, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_prefix, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":139
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( TSSetOptionsPrefix(self.ts, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getOptionsPrefix(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetOptionsPrefix(__pyx_v_self->ts, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 139, __pyx_L1_error)

  /* "PETSc/TS.pyx":136
 *         return eqtype
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":141
 *         CHKERR( TSSetOptionsPrefix(self.ts, cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( TSGetOptionsPrefix(self.ts, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_27getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_26getOptionsPrefix[] = "TS.getOptionsPrefix(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_27getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOptionsPrefix (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOptionsPrefix", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOptionsPrefix", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_26getOptionsPrefix(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_26getOptionsPrefix(struct PyPetscTSObject *__pyx_v_self) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getOptionsPrefix", 0);

  /* "PETSc/TS.pyx":142
 * 
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetOptionsPrefix(self.ts, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/TS.pyx":143
 *     def getOptionsPrefix(self):
 *         cdef const_char *cval = NULL
 *         CHKERR( TSGetOptionsPrefix(self.ts, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetOptionsPrefix(__pyx_v_self->ts, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 143, __pyx_L1_error)

  /* "PETSc/TS.pyx":144
 *         cdef const_char *cval = NULL
 *         CHKERR( TSGetOptionsPrefix(self.ts, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":141
 *         CHKERR( TSSetOptionsPrefix(self.ts, cval) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( TSGetOptionsPrefix(self.ts, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":146
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetFromOptions(self.ts) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_29setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_28setFromOptions[] = "TS.setFromOptions(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_29setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_28setFromOptions(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_28setFromOptions(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/TS.pyx":147
 * 
 *     def setFromOptions(self):
 *         CHKERR( TSSetFromOptions(self.ts) )             # <<<<<<<<<<<<<<
 * 
 *     # --- application context ---
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetFromOptions(__pyx_v_self->ts)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 147, __pyx_L1_error)

  /* "PETSc/TS.pyx":146
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetFromOptions(self.ts) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":151
 *     # --- application context ---
 * 
 *     def setAppCtx(self, appctx):             # <<<<<<<<<<<<<<
 *         self.set_attr('__appctx__', appctx)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_31setAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_30setAppCtx[] = "TS.setAppCtx(self, appctx)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_31setAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_appctx = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setAppCtx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_appctx,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);
        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_appctx)) != 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, "setAppCtx") < 0)) __PYX_ERR(37, 151, __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_appctx = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setAppCtx", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 151, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_30setAppCtx(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_appctx);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_30setAppCtx(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_appctx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setAppCtx", 0);

  /* "PETSc/TS.pyx":152
 * 
 *     def setAppCtx(self, appctx):
 *         self.set_attr('__appctx__', appctx)             # <<<<<<<<<<<<<<
 * 
 *     def getAppCtx(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__appctx__"), __pyx_v_appctx); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":151
 *     # --- application context ---
 * 
 *     def setAppCtx(self, appctx):             # <<<<<<<<<<<<<<
 *         self.set_attr('__appctx__', appctx)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":154
 *         self.set_attr('__appctx__', appctx)
 * 
 *     def getAppCtx(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__appctx__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_33getAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_32getAppCtx[] = "TS.getAppCtx(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_33getAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getAppCtx (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getAppCtx", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getAppCtx", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_32getAppCtx(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_32getAppCtx(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getAppCtx", 0);

  /* "PETSc/TS.pyx":155
 * 
 *     def getAppCtx(self):
 *         return self.get_attr('__appctx__')             # <<<<<<<<<<<<<<
 * 
 *     # --- user RHS Function/Jacobian routines ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__appctx__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":154
 *         self.set_attr('__appctx__', appctx)
 * 
 *     def getAppCtx(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__appctx__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":159
 *     # --- user RHS Function/Jacobian routines ---
 * 
 *     def setRHSFunction(self, function, Vec f=None, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_35setRHSFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_34setRHSFunction[] = "TS.setRHSFunction(self, function, Vec f=None, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_35setRHSFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_function = 0;
  struct PyPetscVecObject *__pyx_v_f = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRHSFunction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_function,&__pyx_n_s_f,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = (PyObject *)((struct PyPetscVecObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_function)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setRHSFunction") < 0)) __PYX_ERR(37, 159, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_function = values[0];
    __pyx_v_f = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_args = values[2];
    __pyx_v_kargs = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRHSFunction", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 159, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setRHSFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "f", 0))) __PYX_ERR(37, 159, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_34setRHSFunction(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_function, __pyx_v_f, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_34setRHSFunction(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_function, struct PyPetscVecObject *__pyx_v_f, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  Vec __pyx_v_fvec;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Vec __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setRHSFunction", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TS.pyx":160
 * 
 *     def setRHSFunction(self, function, Vec f=None, args=None, kargs=None):
 *         cdef PetscVec fvec=NULL             # <<<<<<<<<<<<<<
 *         if f is not None: fvec = f.vec
 *         if function is not None:
 */
  __pyx_v_fvec = NULL;

  /* "PETSc/TS.pyx":161
 *     def setRHSFunction(self, function, Vec f=None, args=None, kargs=None):
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec             # <<<<<<<<<<<<<<
 *         if function is not None:
 *             if args  is None: args  = ()
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_f) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_f->vec;
    __pyx_v_fvec = __pyx_t_3;
  }

  /* "PETSc/TS.pyx":162
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec
 *         if function is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_2 = (__pyx_v_function != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/TS.pyx":163
 *         if f is not None: fvec = f.vec
 *         if function is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (function, args, kargs)
 */
    __pyx_t_1 = (__pyx_v_args == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/TS.pyx":164
 *         if function is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (function, args, kargs)
 *             self.set_attr('__rhsfunction__', context)
 */
    __pyx_t_2 = (__pyx_v_kargs == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 164, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_4);
      __pyx_t_4 = 0;
    }

    /* "PETSc/TS.pyx":165
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (function, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__rhsfunction__', context)
 *             CHKERR( TSSetRHSFunction(self.ts, fvec, TS_RHSFunction, <void*>context) )
 */
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_function);
    __Pyx_GIVEREF(__pyx_v_function);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_function);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/TS.pyx":166
 *             if kargs is None: kargs = {}
 *             context = (function, args, kargs)
 *             self.set_attr('__rhsfunction__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( TSSetRHSFunction(self.ts, fvec, TS_RHSFunction, <void*>context) )
 *         else:
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__rhsfunction__"), __pyx_v_context); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/TS.pyx":167
 *             context = (function, args, kargs)
 *             self.set_attr('__rhsfunction__', context)
 *             CHKERR( TSSetRHSFunction(self.ts, fvec, TS_RHSFunction, <void*>context) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( TSSetRHSFunction(self.ts, fvec, NULL, NULL) )
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetRHSFunction(__pyx_v_self->ts, __pyx_v_fvec, __pyx_f_8petsc4py_5PETSc_TS_RHSFunction, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(37, 167, __pyx_L1_error)

    /* "PETSc/TS.pyx":162
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec
 *         if function is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L4;
  }

  /* "PETSc/TS.pyx":169
 *             CHKERR( TSSetRHSFunction(self.ts, fvec, TS_RHSFunction, <void*>context) )
 *         else:
 *             CHKERR( TSSetRHSFunction(self.ts, fvec, NULL, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def setRHSJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None):
 */
  /*else*/ {
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetRHSFunction(__pyx_v_self->ts, __pyx_v_fvec, NULL, NULL)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(37, 169, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "PETSc/TS.pyx":159
 *     # --- user RHS Function/Jacobian routines ---
 * 
 *     def setRHSFunction(self, function, Vec f=None, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setRHSFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":171
 *             CHKERR( TSSetRHSFunction(self.ts, fvec, NULL, NULL) )
 * 
 *     def setRHSJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_37setRHSJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_36setRHSJacobian[] = "TS.setRHSJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_37setRHSJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_jacobian = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRHSJacobian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_jacobian,&__pyx_n_s_J,&__pyx_n_s_P,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[2] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_jacobian)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setRHSJacobian") < 0)) __PYX_ERR(37, 171, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_jacobian = values[0];
    __pyx_v_J = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[2]);
    __pyx_v_args = values[3];
    __pyx_v_kargs = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRHSJacobian", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 171, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setRHSJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_J), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "J", 0))) __PYX_ERR(37, 171, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(37, 171, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_36setRHSJacobian(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_jacobian, __pyx_v_J, __pyx_v_P, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_36setRHSJacobian(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_jacobian, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  Mat __pyx_v_Jmat;
  Mat __pyx_v_Pmat;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Mat __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setRHSJacobian", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TS.pyx":172
 * 
 *     def setRHSJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None):
 *         cdef PetscMat Jmat=NULL             # <<<<<<<<<<<<<<
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat=Jmat
 */
  __pyx_v_Jmat = NULL;

  /* "PETSc/TS.pyx":173
 *     def setRHSJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None):
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat             # <<<<<<<<<<<<<<
 *         cdef PetscMat Pmat=Jmat
 *         if P is not None: Pmat = P.mat
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_J) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_J->mat;
    __pyx_v_Jmat = __pyx_t_3;
  }

  /* "PETSc/TS.pyx":174
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat=Jmat             # <<<<<<<<<<<<<<
 *         if P is not None: Pmat = P.mat
 *         if jacobian is not None:
 */
  __pyx_v_Pmat = __pyx_v_Jmat;

  /* "PETSc/TS.pyx":175
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat=Jmat
 *         if P is not None: Pmat = P.mat             # <<<<<<<<<<<<<<
 *         if jacobian is not None:
 *             if args  is None: args  = ()
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_P->mat;
    __pyx_v_Pmat = __pyx_t_3;
  }

  /* "PETSc/TS.pyx":176
 *         cdef PetscMat Pmat=Jmat
 *         if P is not None: Pmat = P.mat
 *         if jacobian is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_jacobian != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/TS.pyx":177
 *         if P is not None: Pmat = P.mat
 *         if jacobian is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (jacobian, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/TS.pyx":178
 *         if jacobian is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (jacobian, args, kargs)
 *             self.set_attr('__rhsjacobian__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_4);
      __pyx_t_4 = 0;
    }

    /* "PETSc/TS.pyx":179
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (jacobian, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__rhsjacobian__', context)
 *             CHKERR( TSSetRHSJacobian(self.ts, Jmat, Pmat, TS_RHSJacobian, <void*>context) )
 */
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_jacobian);
    __Pyx_GIVEREF(__pyx_v_jacobian);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_jacobian);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/TS.pyx":180
 *             if kargs is None: kargs = {}
 *             context = (jacobian, args, kargs)
 *             self.set_attr('__rhsjacobian__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( TSSetRHSJacobian(self.ts, Jmat, Pmat, TS_RHSJacobian, <void*>context) )
 *         else:
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__rhsjacobian__"), __pyx_v_context); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/TS.pyx":181
 *             context = (jacobian, args, kargs)
 *             self.set_attr('__rhsjacobian__', context)
 *             CHKERR( TSSetRHSJacobian(self.ts, Jmat, Pmat, TS_RHSJacobian, <void*>context) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( TSSetRHSJacobian(self.ts, Jmat, Pmat, NULL, NULL) )
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetRHSJacobian(__pyx_v_self->ts, __pyx_v_Jmat, __pyx_v_Pmat, __pyx_f_8petsc4py_5PETSc_TS_RHSJacobian, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(37, 181, __pyx_L1_error)

    /* "PETSc/TS.pyx":176
 *         cdef PetscMat Pmat=Jmat
 *         if P is not None: Pmat = P.mat
 *         if jacobian is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L5;
  }

  /* "PETSc/TS.pyx":183
 *             CHKERR( TSSetRHSJacobian(self.ts, Jmat, Pmat, TS_RHSJacobian, <void*>context) )
 *         else:
 *             CHKERR( TSSetRHSJacobian(self.ts, Jmat, Pmat, NULL, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def computeRHSFunction(self, t, Vec x not None, Vec f not None):
 */
  /*else*/ {
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetRHSJacobian(__pyx_v_self->ts, __pyx_v_Jmat, __pyx_v_Pmat, NULL, NULL)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(37, 183, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "PETSc/TS.pyx":171
 *             CHKERR( TSSetRHSFunction(self.ts, fvec, NULL, NULL) )
 * 
 *     def setRHSJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setRHSJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":185
 *             CHKERR( TSSetRHSJacobian(self.ts, Jmat, Pmat, NULL, NULL) )
 * 
 *     def computeRHSFunction(self, t, Vec x not None, Vec f not None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal time = asReal(t)
 *         CHKERR( TSComputeRHSFunction(self.ts, time, x.vec, f.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_39computeRHSFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_38computeRHSFunction[] = "TS.computeRHSFunction(self, t, Vec x, Vec f)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_39computeRHSFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_f = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeRHSFunction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_f,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeRHSFunction", 1, 3, 3, 1); __PYX_ERR(37, 185, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeRHSFunction", 1, 3, 3, 2); __PYX_ERR(37, 185, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeRHSFunction") < 0)) __PYX_ERR(37, 185, __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_t = values[0];
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_f = ((struct PyPetscVecObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeRHSFunction", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 185, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.computeRHSFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(37, 185, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "f", 0))) __PYX_ERR(37, 185, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_38computeRHSFunction(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_t, __pyx_v_x, __pyx_v_f);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_38computeRHSFunction(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_f) {
  PetscReal __pyx_v_time;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("computeRHSFunction", 0);

  /* "PETSc/TS.pyx":186
 * 
 *     def computeRHSFunction(self, t, Vec x not None, Vec f not None):
 *         cdef PetscReal time = asReal(t)             # <<<<<<<<<<<<<<
 *         CHKERR( TSComputeRHSFunction(self.ts, time, x.vec, f.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_t); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 186, __pyx_L1_error)
  __pyx_v_time = __pyx_t_1;

  /* "PETSc/TS.pyx":187
 *     def computeRHSFunction(self, t, Vec x not None, Vec f not None):
 *         cdef PetscReal time = asReal(t)
 *         CHKERR( TSComputeRHSFunction(self.ts, time, x.vec, f.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def computeRHSFunctionLinear(self, t, Vec x not None, Vec f not None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSComputeRHSFunction(__pyx_v_self->ts, __pyx_v_time, __pyx_v_x->vec, __pyx_v_f->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 187, __pyx_L1_error)

  /* "PETSc/TS.pyx":185
 *             CHKERR( TSSetRHSJacobian(self.ts, Jmat, Pmat, NULL, NULL) )
 * 
 *     def computeRHSFunction(self, t, Vec x not None, Vec f not None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal time = asReal(t)
 *         CHKERR( TSComputeRHSFunction(self.ts, time, x.vec, f.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.computeRHSFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":189
 *         CHKERR( TSComputeRHSFunction(self.ts, time, x.vec, f.vec) )
 * 
 *     def computeRHSFunctionLinear(self, t, Vec x not None, Vec f not None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal time = asReal(t)
 *         CHKERR( TSComputeRHSFunctionLinear(self.ts, time, x.vec, f.vec, NULL) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_41computeRHSFunctionLinear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_40computeRHSFunctionLinear[] = "TS.computeRHSFunctionLinear(self, t, Vec x, Vec f)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_41computeRHSFunctionLinear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_f = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeRHSFunctionLinear (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_f,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeRHSFunctionLinear", 1, 3, 3, 1); __PYX_ERR(37, 189, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeRHSFunctionLinear", 1, 3, 3, 2); __PYX_ERR(37, 189, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeRHSFunctionLinear") < 0)) __PYX_ERR(37, 189, __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_t = values[0];
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_f = ((struct PyPetscVecObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeRHSFunctionLinear", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 189, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.computeRHSFunctionLinear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(37, 189, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "f", 0))) __PYX_ERR(37, 189, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_40computeRHSFunctionLinear(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_t, __pyx_v_x, __pyx_v_f);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_40computeRHSFunctionLinear(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_f) {
  PetscReal __pyx_v_time;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("computeRHSFunctionLinear", 0);

  /* "PETSc/TS.pyx":190
 * 
 *     def computeRHSFunctionLinear(self, t, Vec x not None, Vec f not None):
 *         cdef PetscReal time = asReal(t)             # <<<<<<<<<<<<<<
 *         CHKERR( TSComputeRHSFunctionLinear(self.ts, time, x.vec, f.vec, NULL) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_t); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 190, __pyx_L1_error)
  __pyx_v_time = __pyx_t_1;

  /* "PETSc/TS.pyx":191
 *     def computeRHSFunctionLinear(self, t, Vec x not None, Vec f not None):
 *         cdef PetscReal time = asReal(t)
 *         CHKERR( TSComputeRHSFunctionLinear(self.ts, time, x.vec, f.vec, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def computeRHSJacobian(self, t, Vec x not None, Mat J not None, Mat P=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSComputeRHSFunctionLinear(__pyx_v_self->ts, __pyx_v_time, __pyx_v_x->vec, __pyx_v_f->vec, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 191, __pyx_L1_error)

  /* "PETSc/TS.pyx":189
 *         CHKERR( TSComputeRHSFunction(self.ts, time, x.vec, f.vec) )
 * 
 *     def computeRHSFunctionLinear(self, t, Vec x not None, Vec f not None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal time = asReal(t)
 *         CHKERR( TSComputeRHSFunctionLinear(self.ts, time, x.vec, f.vec, NULL) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.computeRHSFunctionLinear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":193
 *         CHKERR( TSComputeRHSFunctionLinear(self.ts, time, x.vec, f.vec, NULL) )
 * 
 *     def computeRHSJacobian(self, t, Vec x not None, Mat J not None, Mat P=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal time = asReal(t)
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_43computeRHSJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_42computeRHSJacobian[] = "TS.computeRHSJacobian(self, t, Vec x, Mat J, Mat P=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_43computeRHSJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeRHSJacobian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_J,&__pyx_n_s_P,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = (PyObject *)((struct PyPetscMatObject *)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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeRHSJacobian", 0, 3, 4, 1); __PYX_ERR(37, 193, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeRHSJacobian", 0, 3, 4, 2); __PYX_ERR(37, 193, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeRHSJacobian") < 0)) __PYX_ERR(37, 193, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_t = values[0];
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_J = ((struct PyPetscMatObject *)values[2]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeRHSJacobian", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 193, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.computeRHSJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(37, 193, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_J), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "J", 0))) __PYX_ERR(37, 193, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(37, 193, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_42computeRHSJacobian(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_t, __pyx_v_x, __pyx_v_J, __pyx_v_P);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_42computeRHSJacobian(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_x, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P) {
  PetscReal __pyx_v_time;
  Mat __pyx_v_jmat;
  Mat __pyx_v_pmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  Mat __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("computeRHSJacobian", 0);

  /* "PETSc/TS.pyx":194
 * 
 *     def computeRHSJacobian(self, t, Vec x not None, Mat J not None, Mat P=None):
 *         cdef PetscReal time = asReal(t)             # <<<<<<<<<<<<<<
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_t); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 194, __pyx_L1_error)
  __pyx_v_time = __pyx_t_1;

  /* "PETSc/TS.pyx":195
 *     def computeRHSJacobian(self, t, Vec x not None, Mat J not None, Mat P=None):
 *         cdef PetscReal time = asReal(t)
 *         cdef PetscMat jmat = J.mat, pmat = J.mat             # <<<<<<<<<<<<<<
 *         if P is not None: pmat = P.mat
 *         CHKERR( TSComputeRHSJacobian(self.ts, time, x.vec, jmat, pmat) )
 */
  __pyx_t_2 = __pyx_v_J->mat;
  __pyx_v_jmat = __pyx_t_2;
  __pyx_t_2 = __pyx_v_J->mat;
  __pyx_v_pmat = __pyx_t_2;

  /* "PETSc/TS.pyx":196
 *         cdef PetscReal time = asReal(t)
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat             # <<<<<<<<<<<<<<
 *         CHKERR( TSComputeRHSJacobian(self.ts, time, x.vec, jmat, pmat) )
 * 
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
    __pyx_t_2 = __pyx_v_P->mat;
    __pyx_v_pmat = __pyx_t_2;
  }

  /* "PETSc/TS.pyx":197
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat
 *         CHKERR( TSComputeRHSJacobian(self.ts, time, x.vec, jmat, pmat) )             # <<<<<<<<<<<<<<
 * 
 *     def computeRHSJacobianConstant(self, t, Vec x not None, Mat J not None, Mat P=None):
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSComputeRHSJacobian(__pyx_v_self->ts, __pyx_v_time, __pyx_v_x->vec, __pyx_v_jmat, __pyx_v_pmat)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(37, 197, __pyx_L1_error)

  /* "PETSc/TS.pyx":193
 *         CHKERR( TSComputeRHSFunctionLinear(self.ts, time, x.vec, f.vec, NULL) )
 * 
 *     def computeRHSJacobian(self, t, Vec x not None, Mat J not None, Mat P=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal time = asReal(t)
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.computeRHSJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":199
 *         CHKERR( TSComputeRHSJacobian(self.ts, time, x.vec, jmat, pmat) )
 * 
 *     def computeRHSJacobianConstant(self, t, Vec x not None, Mat J not None, Mat P=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal time = asReal(t)
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_45computeRHSJacobianConstant(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_44computeRHSJacobianConstant[] = "TS.computeRHSJacobianConstant(self, t, Vec x, Mat J, Mat P=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_45computeRHSJacobianConstant(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeRHSJacobianConstant (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_J,&__pyx_n_s_P,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = (PyObject *)((struct PyPetscMatObject *)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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeRHSJacobianConstant", 0, 3, 4, 1); __PYX_ERR(37, 199, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeRHSJacobianConstant", 0, 3, 4, 2); __PYX_ERR(37, 199, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeRHSJacobianConstant") < 0)) __PYX_ERR(37, 199, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_t = values[0];
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_J = ((struct PyPetscMatObject *)values[2]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeRHSJacobianConstant", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 199, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.computeRHSJacobianConstant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(37, 199, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_J), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "J", 0))) __PYX_ERR(37, 199, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(37, 199, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_44computeRHSJacobianConstant(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_t, __pyx_v_x, __pyx_v_J, __pyx_v_P);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_44computeRHSJacobianConstant(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_x, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P) {
  PetscReal __pyx_v_time;
  Mat __pyx_v_jmat;
  Mat __pyx_v_pmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  Mat __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("computeRHSJacobianConstant", 0);

  /* "PETSc/TS.pyx":200
 * 
 *     def computeRHSJacobianConstant(self, t, Vec x not None, Mat J not None, Mat P=None):
 *         cdef PetscReal time = asReal(t)             # <<<<<<<<<<<<<<
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_t); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 200, __pyx_L1_error)
  __pyx_v_time = __pyx_t_1;

  /* "PETSc/TS.pyx":201
 *     def computeRHSJacobianConstant(self, t, Vec x not None, Mat J not None, Mat P=None):
 *         cdef PetscReal time = asReal(t)
 *         cdef PetscMat jmat = J.mat, pmat = J.mat             # <<<<<<<<<<<<<<
 *         if P is not None: pmat = P.mat
 *         CHKERR( TSComputeRHSJacobianConstant(self.ts, time, x.vec, jmat, pmat, NULL) )
 */
  __pyx_t_2 = __pyx_v_J->mat;
  __pyx_v_jmat = __pyx_t_2;
  __pyx_t_2 = __pyx_v_J->mat;
  __pyx_v_pmat = __pyx_t_2;

  /* "PETSc/TS.pyx":202
 *         cdef PetscReal time = asReal(t)
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat             # <<<<<<<<<<<<<<
 *         CHKERR( TSComputeRHSJacobianConstant(self.ts, time, x.vec, jmat, pmat, NULL) )
 * 
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
    __pyx_t_2 = __pyx_v_P->mat;
    __pyx_v_pmat = __pyx_t_2;
  }

  /* "PETSc/TS.pyx":203
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat
 *         CHKERR( TSComputeRHSJacobianConstant(self.ts, time, x.vec, jmat, pmat, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def getRHSFunction(self):
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSComputeRHSJacobianConstant(__pyx_v_self->ts, __pyx_v_time, __pyx_v_x->vec, __pyx_v_jmat, __pyx_v_pmat, NULL)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(37, 203, __pyx_L1_error)

  /* "PETSc/TS.pyx":199
 *         CHKERR( TSComputeRHSJacobian(self.ts, time, x.vec, jmat, pmat) )
 * 
 *     def computeRHSJacobianConstant(self, t, Vec x not None, Mat J not None, Mat P=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal time = asReal(t)
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.computeRHSJacobianConstant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":205
 *         CHKERR( TSComputeRHSJacobianConstant(self.ts, time, x.vec, jmat, pmat, NULL) )
 * 
 *     def getRHSFunction(self):             # <<<<<<<<<<<<<<
 *         cdef Vec f = Vec()
 *         CHKERR( TSGetRHSFunction(self.ts, &f.vec, NULL, NULL) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_47getRHSFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_46getRHSFunction[] = "TS.getRHSFunction(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_47getRHSFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRHSFunction (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getRHSFunction", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getRHSFunction", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_46getRHSFunction(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_46getRHSFunction(struct PyPetscTSObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_f = 0;
  PyObject *__pyx_v_function = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getRHSFunction", 0);

  /* "PETSc/TS.pyx":206
 * 
 *     def getRHSFunction(self):
 *         cdef Vec f = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetRHSFunction(self.ts, &f.vec, NULL, NULL) )
 *         PetscINCREF(f.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_f = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":207
 *     def getRHSFunction(self):
 *         cdef Vec f = Vec()
 *         CHKERR( TSGetRHSFunction(self.ts, &f.vec, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(f.obj)
 *         cdef object function = self.get_attr('__rhsfunction__')
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetRHSFunction(__pyx_v_self->ts, (&__pyx_v_f->vec), NULL, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 207, __pyx_L1_error)

  /* "PETSc/TS.pyx":208
 *         cdef Vec f = Vec()
 *         CHKERR( TSGetRHSFunction(self.ts, &f.vec, NULL, NULL) )
 *         PetscINCREF(f.obj)             # <<<<<<<<<<<<<<
 *         cdef object function = self.get_attr('__rhsfunction__')
 *         return (f, function)
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_f->__pyx_base.obj);

  /* "PETSc/TS.pyx":209
 *         CHKERR( TSGetRHSFunction(self.ts, &f.vec, NULL, NULL) )
 *         PetscINCREF(f.obj)
 *         cdef object function = self.get_attr('__rhsfunction__')             # <<<<<<<<<<<<<<
 *         return (f, function)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__rhsfunction__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_function = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":210
 *         PetscINCREF(f.obj)
 *         cdef object function = self.get_attr('__rhsfunction__')
 *         return (f, function)             # <<<<<<<<<<<<<<
 * 
 *     def getRHSJacobian(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_f));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_f));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f));
  __Pyx_INCREF(__pyx_v_function);
  __Pyx_GIVEREF(__pyx_v_function);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_function);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":205
 *         CHKERR( TSComputeRHSJacobianConstant(self.ts, time, x.vec, jmat, pmat, NULL) )
 * 
 *     def getRHSFunction(self):             # <<<<<<<<<<<<<<
 *         cdef Vec f = Vec()
 *         CHKERR( TSGetRHSFunction(self.ts, &f.vec, NULL, NULL) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getRHSFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":212
 *         return (f, function)
 * 
 *     def getRHSJacobian(self):             # <<<<<<<<<<<<<<
 *         cdef Mat J = Mat(), P = Mat()
 *         CHKERR( TSGetRHSJacobian(self.ts, &J.mat, &P.mat, NULL, NULL) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_49getRHSJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_48getRHSJacobian[] = "TS.getRHSJacobian(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_49getRHSJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRHSJacobian (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getRHSJacobian", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getRHSJacobian", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_48getRHSJacobian(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_48getRHSJacobian(struct PyPetscTSObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_v_jacobian = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getRHSJacobian", 0);

  /* "PETSc/TS.pyx":213
 * 
 *     def getRHSJacobian(self):
 *         cdef Mat J = Mat(), P = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetRHSJacobian(self.ts, &J.mat, &P.mat, NULL, NULL) )
 *         PetscINCREF(J.obj); PetscINCREF(P.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_J = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":214
 *     def getRHSJacobian(self):
 *         cdef Mat J = Mat(), P = Mat()
 *         CHKERR( TSGetRHSJacobian(self.ts, &J.mat, &P.mat, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(J.obj); PetscINCREF(P.obj)
 *         cdef object jacobian = self.get_attr('__rhsjacobian__')
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetRHSJacobian(__pyx_v_self->ts, (&__pyx_v_J->mat), (&__pyx_v_P->mat), NULL, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 214, __pyx_L1_error)

  /* "PETSc/TS.pyx":215
 *         cdef Mat J = Mat(), P = Mat()
 *         CHKERR( TSGetRHSJacobian(self.ts, &J.mat, &P.mat, NULL, NULL) )
 *         PetscINCREF(J.obj); PetscINCREF(P.obj)             # <<<<<<<<<<<<<<
 *         cdef object jacobian = self.get_attr('__rhsjacobian__')
 *         return (J, P, jacobian)
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_J->__pyx_base.obj);
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_P->__pyx_base.obj);

  /* "PETSc/TS.pyx":216
 *         CHKERR( TSGetRHSJacobian(self.ts, &J.mat, &P.mat, NULL, NULL) )
 *         PetscINCREF(J.obj); PetscINCREF(P.obj)
 *         cdef object jacobian = self.get_attr('__rhsjacobian__')             # <<<<<<<<<<<<<<
 *         return (J, P, jacobian)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__rhsjacobian__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_jacobian = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":217
 *         PetscINCREF(J.obj); PetscINCREF(P.obj)
 *         cdef object jacobian = self.get_attr('__rhsjacobian__')
 *         return (J, P, jacobian)             # <<<<<<<<<<<<<<
 * 
 *     # --- user Implicit Function/Jacobian routines ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_J));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_J));
  __Pyx_INCREF(((PyObject *)__pyx_v_P));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_P));
  __Pyx_INCREF(__pyx_v_jacobian);
  __Pyx_GIVEREF(__pyx_v_jacobian);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_jacobian);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":212
 *         return (f, function)
 * 
 *     def getRHSJacobian(self):             # <<<<<<<<<<<<<<
 *         cdef Mat J = Mat(), P = Mat()
 *         CHKERR( TSGetRHSJacobian(self.ts, &J.mat, &P.mat, NULL, NULL) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getRHSJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_J);
  __Pyx_XDECREF((PyObject *)__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_jacobian);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":221
 *     # --- user Implicit Function/Jacobian routines ---
 * 
 *     def setIFunction(self, function, Vec f=None, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_51setIFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_50setIFunction[] = "TS.setIFunction(self, function, Vec f=None, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_51setIFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_function = 0;
  struct PyPetscVecObject *__pyx_v_f = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setIFunction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_function,&__pyx_n_s_f,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = (PyObject *)((struct PyPetscVecObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_function)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setIFunction") < 0)) __PYX_ERR(37, 221, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_function = values[0];
    __pyx_v_f = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_args = values[2];
    __pyx_v_kargs = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setIFunction", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 221, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setIFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "f", 0))) __PYX_ERR(37, 221, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_50setIFunction(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_function, __pyx_v_f, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_50setIFunction(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_function, struct PyPetscVecObject *__pyx_v_f, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  Vec __pyx_v_fvec;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Vec __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setIFunction", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TS.pyx":222
 * 
 *     def setIFunction(self, function, Vec f=None, args=None, kargs=None):
 *         cdef PetscVec fvec=NULL             # <<<<<<<<<<<<<<
 *         if f is not None: fvec = f.vec
 *         if function is not None:
 */
  __pyx_v_fvec = NULL;

  /* "PETSc/TS.pyx":223
 *     def setIFunction(self, function, Vec f=None, args=None, kargs=None):
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec             # <<<<<<<<<<<<<<
 *         if function is not None:
 *             if args  is None: args  = ()
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_f) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_f->vec;
    __pyx_v_fvec = __pyx_t_3;
  }

  /* "PETSc/TS.pyx":224
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec
 *         if function is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_2 = (__pyx_v_function != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/TS.pyx":225
 *         if f is not None: fvec = f.vec
 *         if function is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (function, args, kargs)
 */
    __pyx_t_1 = (__pyx_v_args == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/TS.pyx":226
 *         if function is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (function, args, kargs)
 *             self.set_attr('__ifunction__', context)
 */
    __pyx_t_2 = (__pyx_v_kargs == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 226, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_4);
      __pyx_t_4 = 0;
    }

    /* "PETSc/TS.pyx":227
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (function, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__ifunction__', context)
 *             CHKERR( TSSetIFunction(self.ts, fvec, TS_IFunction, <void*>context) )
 */
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_function);
    __Pyx_GIVEREF(__pyx_v_function);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_function);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/TS.pyx":228
 *             if kargs is None: kargs = {}
 *             context = (function, args, kargs)
 *             self.set_attr('__ifunction__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( TSSetIFunction(self.ts, fvec, TS_IFunction, <void*>context) )
 *         else:
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__ifunction__"), __pyx_v_context); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/TS.pyx":229
 *             context = (function, args, kargs)
 *             self.set_attr('__ifunction__', context)
 *             CHKERR( TSSetIFunction(self.ts, fvec, TS_IFunction, <void*>context) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( TSSetIFunction(self.ts, fvec, NULL, NULL) )
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetIFunction(__pyx_v_self->ts, __pyx_v_fvec, __pyx_f_8petsc4py_5PETSc_TS_IFunction, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(37, 229, __pyx_L1_error)

    /* "PETSc/TS.pyx":224
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec
 *         if function is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L4;
  }

  /* "PETSc/TS.pyx":231
 *             CHKERR( TSSetIFunction(self.ts, fvec, TS_IFunction, <void*>context) )
 *         else:
 *             CHKERR( TSSetIFunction(self.ts, fvec, NULL, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def setIJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None):
 */
  /*else*/ {
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetIFunction(__pyx_v_self->ts, __pyx_v_fvec, NULL, NULL)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(37, 231, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "PETSc/TS.pyx":221
 *     # --- user Implicit Function/Jacobian routines ---
 * 
 *     def setIFunction(self, function, Vec f=None, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscVec fvec=NULL
 *         if f is not None: fvec = f.vec
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setIFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":233
 *             CHKERR( TSSetIFunction(self.ts, fvec, NULL, NULL) )
 * 
 *     def setIJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_53setIJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_52setIJacobian[] = "TS.setIJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_53setIJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_jacobian = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setIJacobian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_jacobian,&__pyx_n_s_J,&__pyx_n_s_P,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[2] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_jacobian)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setIJacobian") < 0)) __PYX_ERR(37, 233, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_jacobian = values[0];
    __pyx_v_J = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[2]);
    __pyx_v_args = values[3];
    __pyx_v_kargs = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setIJacobian", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 233, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setIJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_J), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "J", 0))) __PYX_ERR(37, 233, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(37, 233, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_52setIJacobian(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_jacobian, __pyx_v_J, __pyx_v_P, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_52setIJacobian(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_jacobian, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  Mat __pyx_v_Jmat;
  Mat __pyx_v_Pmat;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Mat __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setIJacobian", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TS.pyx":234
 * 
 *     def setIJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None):
 *         cdef PetscMat Jmat=NULL             # <<<<<<<<<<<<<<
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat=Jmat
 */
  __pyx_v_Jmat = NULL;

  /* "PETSc/TS.pyx":235
 *     def setIJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None):
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat             # <<<<<<<<<<<<<<
 *         cdef PetscMat Pmat=Jmat
 *         if P is not None: Pmat = P.mat
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_J) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_J->mat;
    __pyx_v_Jmat = __pyx_t_3;
  }

  /* "PETSc/TS.pyx":236
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat=Jmat             # <<<<<<<<<<<<<<
 *         if P is not None: Pmat = P.mat
 *         if jacobian is not None:
 */
  __pyx_v_Pmat = __pyx_v_Jmat;

  /* "PETSc/TS.pyx":237
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat=Jmat
 *         if P is not None: Pmat = P.mat             # <<<<<<<<<<<<<<
 *         if jacobian is not None:
 *             if args  is None: args  = ()
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_P->mat;
    __pyx_v_Pmat = __pyx_t_3;
  }

  /* "PETSc/TS.pyx":238
 *         cdef PetscMat Pmat=Jmat
 *         if P is not None: Pmat = P.mat
 *         if jacobian is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_jacobian != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/TS.pyx":239
 *         if P is not None: Pmat = P.mat
 *         if jacobian is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (jacobian, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/TS.pyx":240
 *         if jacobian is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (jacobian, args, kargs)
 *             self.set_attr('__ijacobian__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_4);
      __pyx_t_4 = 0;
    }

    /* "PETSc/TS.pyx":241
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (jacobian, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__ijacobian__', context)
 *             CHKERR( TSSetIJacobian(self.ts, Jmat, Pmat, TS_IJacobian, <void*>context) )
 */
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_jacobian);
    __Pyx_GIVEREF(__pyx_v_jacobian);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_jacobian);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/TS.pyx":242
 *             if kargs is None: kargs = {}
 *             context = (jacobian, args, kargs)
 *             self.set_attr('__ijacobian__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( TSSetIJacobian(self.ts, Jmat, Pmat, TS_IJacobian, <void*>context) )
 *         else:
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__ijacobian__"), __pyx_v_context); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/TS.pyx":243
 *             context = (jacobian, args, kargs)
 *             self.set_attr('__ijacobian__', context)
 *             CHKERR( TSSetIJacobian(self.ts, Jmat, Pmat, TS_IJacobian, <void*>context) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( TSSetIJacobian(self.ts, Jmat, Pmat, NULL, NULL) )
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetIJacobian(__pyx_v_self->ts, __pyx_v_Jmat, __pyx_v_Pmat, __pyx_f_8petsc4py_5PETSc_TS_IJacobian, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(37, 243, __pyx_L1_error)

    /* "PETSc/TS.pyx":238
 *         cdef PetscMat Pmat=Jmat
 *         if P is not None: Pmat = P.mat
 *         if jacobian is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L5;
  }

  /* "PETSc/TS.pyx":245
 *             CHKERR( TSSetIJacobian(self.ts, Jmat, Pmat, TS_IJacobian, <void*>context) )
 *         else:
 *             CHKERR( TSSetIJacobian(self.ts, Jmat, Pmat, NULL, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def computeIFunction(self,
 */
  /*else*/ {
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetIJacobian(__pyx_v_self->ts, __pyx_v_Jmat, __pyx_v_Pmat, NULL, NULL)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(37, 245, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "PETSc/TS.pyx":233
 *             CHKERR( TSSetIFunction(self.ts, fvec, NULL, NULL) )
 * 
 *     def setIJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setIJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":247
 *             CHKERR( TSSetIJacobian(self.ts, Jmat, Pmat, NULL, NULL) )
 * 
 *     def computeIFunction(self,             # <<<<<<<<<<<<<<
 *                          t, Vec x not None, Vec xdot not None,
 *                          Vec f not None, imex=False):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_55computeIFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_54computeIFunction[] = "TS.computeIFunction(self, t, Vec x, Vec xdot, Vec f, imex=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_55computeIFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_xdot = 0;
  struct PyPetscVecObject *__pyx_v_f = 0;
  PyObject *__pyx_v_imex = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeIFunction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_xdot,&__pyx_n_s_f,&__pyx_n_s_imex,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "PETSc/TS.pyx":249
 *     def computeIFunction(self,
 *                          t, Vec x not None, Vec xdot not None,
 *                          Vec f not None, imex=False):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(t)
 *         cdef PetscBool bval = imex
 */
    values[4] = ((PyObject *)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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeIFunction", 0, 4, 5, 1); __PYX_ERR(37, 247, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xdot)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeIFunction", 0, 4, 5, 2); __PYX_ERR(37, 247, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeIFunction", 0, 4, 5, 3); __PYX_ERR(37, 247, __pyx_L3_error)
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_imex);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeIFunction") < 0)) __PYX_ERR(37, 247, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        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_t = values[0];
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_xdot = ((struct PyPetscVecObject *)values[2]);
    __pyx_v_f = ((struct PyPetscVecObject *)values[3]);
    __pyx_v_imex = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeIFunction", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 247, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.computeIFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(37, 248, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xdot), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "xdot", 0))) __PYX_ERR(37, 248, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "f", 0))) __PYX_ERR(37, 249, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_54computeIFunction(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_t, __pyx_v_x, __pyx_v_xdot, __pyx_v_f, __pyx_v_imex);

  /* "PETSc/TS.pyx":247
 *             CHKERR( TSSetIJacobian(self.ts, Jmat, Pmat, NULL, NULL) )
 * 
 *     def computeIFunction(self,             # <<<<<<<<<<<<<<
 *                          t, Vec x not None, Vec xdot not None,
 *                          Vec f not None, imex=False):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_54computeIFunction(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_xdot, struct PyPetscVecObject *__pyx_v_f, PyObject *__pyx_v_imex) {
  PetscReal __pyx_v_rval;
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  PetscBool __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("computeIFunction", 0);

  /* "PETSc/TS.pyx":250
 *                          t, Vec x not None, Vec xdot not None,
 *                          Vec f not None, imex=False):
 *         cdef PetscReal rval = asReal(t)             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = imex
 *         CHKERR( TSComputeIFunction(self.ts, rval, x.vec, xdot.vec,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_t); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 250, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/TS.pyx":251
 *                          Vec f not None, imex=False):
 *         cdef PetscReal rval = asReal(t)
 *         cdef PetscBool bval = imex             # <<<<<<<<<<<<<<
 *         CHKERR( TSComputeIFunction(self.ts, rval, x.vec, xdot.vec,
 *                                    f.vec, bval) )
 */
  __pyx_t_2 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_imex)); if (unlikely(PyErr_Occurred())) __PYX_ERR(37, 251, __pyx_L1_error)
  __pyx_v_bval = __pyx_t_2;

  /* "PETSc/TS.pyx":252
 *         cdef PetscReal rval = asReal(t)
 *         cdef PetscBool bval = imex
 *         CHKERR( TSComputeIFunction(self.ts, rval, x.vec, xdot.vec,             # <<<<<<<<<<<<<<
 *                                    f.vec, bval) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSComputeIFunction(__pyx_v_self->ts, __pyx_v_rval, __pyx_v_x->vec, __pyx_v_xdot->vec, __pyx_v_f->vec, __pyx_v_bval)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(37, 252, __pyx_L1_error)

  /* "PETSc/TS.pyx":247
 *             CHKERR( TSSetIJacobian(self.ts, Jmat, Pmat, NULL, NULL) )
 * 
 *     def computeIFunction(self,             # <<<<<<<<<<<<<<
 *                          t, Vec x not None, Vec xdot not None,
 *                          Vec f not None, imex=False):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.computeIFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":255
 *                                    f.vec, bval) )
 * 
 *     def computeIJacobian(self,             # <<<<<<<<<<<<<<
 *                          t, Vec x not None, Vec xdot not None, a,
 *                          Mat J not None, Mat P=None, imex=False):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_57computeIJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_56computeIJacobian[] = "TS.computeIJacobian(self, t, Vec x, Vec xdot, a, Mat J, Mat P=None, imex=False)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_57computeIJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_xdot = 0;
  PyObject *__pyx_v_a = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_v_imex = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeIJacobian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_xdot,&__pyx_n_s_a,&__pyx_n_s_J,&__pyx_n_s_P,&__pyx_n_s_imex,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};

    /* "PETSc/TS.pyx":257
 *     def computeIJacobian(self,
 *                          t, Vec x not None, Vec xdot not None, a,
 *                          Mat J not None, Mat P=None, imex=False):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval1 = asReal(t)
 *         cdef PetscReal rval2 = asReal(a)
 */
    values[5] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[6] = ((PyObject *)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  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeIJacobian", 0, 5, 7, 1); __PYX_ERR(37, 255, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xdot)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeIJacobian", 0, 5, 7, 2); __PYX_ERR(37, 255, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeIJacobian", 0, 5, 7, 3); __PYX_ERR(37, 255, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeIJacobian", 0, 5, 7, 4); __PYX_ERR(37, 255, __pyx_L3_error)
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_imex);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeIJacobian") < 0)) __PYX_ERR(37, 255, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        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_t = values[0];
    __pyx_v_x = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_xdot = ((struct PyPetscVecObject *)values[2]);
    __pyx_v_a = values[3];
    __pyx_v_J = ((struct PyPetscMatObject *)values[4]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[5]);
    __pyx_v_imex = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeIJacobian", 0, 5, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 255, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.computeIJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(37, 256, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xdot), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "xdot", 0))) __PYX_ERR(37, 256, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_J), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "J", 0))) __PYX_ERR(37, 257, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(37, 257, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_56computeIJacobian(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_t, __pyx_v_x, __pyx_v_xdot, __pyx_v_a, __pyx_v_J, __pyx_v_P, __pyx_v_imex);

  /* "PETSc/TS.pyx":255
 *                                    f.vec, bval) )
 * 
 *     def computeIJacobian(self,             # <<<<<<<<<<<<<<
 *                          t, Vec x not None, Vec xdot not None, a,
 *                          Mat J not None, Mat P=None, imex=False):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_56computeIJacobian(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_xdot, PyObject *__pyx_v_a, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P, PyObject *__pyx_v_imex) {
  PetscReal __pyx_v_rval1;
  PetscReal __pyx_v_rval2;
  PetscBool __pyx_v_bval;
  Mat __pyx_v_jmat;
  Mat __pyx_v_pmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  PetscBool __pyx_t_2;
  Mat __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("computeIJacobian", 0);

  /* "PETSc/TS.pyx":258
 *                          t, Vec x not None, Vec xdot not None, a,
 *                          Mat J not None, Mat P=None, imex=False):
 *         cdef PetscReal rval1 = asReal(t)             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval2 = asReal(a)
 *         cdef PetscBool bval  = imex
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_t); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 258, __pyx_L1_error)
  __pyx_v_rval1 = __pyx_t_1;

  /* "PETSc/TS.pyx":259
 *                          Mat J not None, Mat P=None, imex=False):
 *         cdef PetscReal rval1 = asReal(t)
 *         cdef PetscReal rval2 = asReal(a)             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval  = imex
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_a); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 259, __pyx_L1_error)
  __pyx_v_rval2 = __pyx_t_1;

  /* "PETSc/TS.pyx":260
 *         cdef PetscReal rval1 = asReal(t)
 *         cdef PetscReal rval2 = asReal(a)
 *         cdef PetscBool bval  = imex             # <<<<<<<<<<<<<<
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat
 */
  __pyx_t_2 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_imex)); if (unlikely(PyErr_Occurred())) __PYX_ERR(37, 260, __pyx_L1_error)
  __pyx_v_bval = __pyx_t_2;

  /* "PETSc/TS.pyx":261
 *         cdef PetscReal rval2 = asReal(a)
 *         cdef PetscBool bval  = imex
 *         cdef PetscMat jmat = J.mat, pmat = J.mat             # <<<<<<<<<<<<<<
 *         if P is not None: pmat = P.mat
 *         CHKERR( TSComputeIJacobian(self.ts, rval1, x.vec, xdot.vec, rval2,
 */
  __pyx_t_3 = __pyx_v_J->mat;
  __pyx_v_jmat = __pyx_t_3;
  __pyx_t_3 = __pyx_v_J->mat;
  __pyx_v_pmat = __pyx_t_3;

  /* "PETSc/TS.pyx":262
 *         cdef PetscBool bval  = imex
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat             # <<<<<<<<<<<<<<
 *         CHKERR( TSComputeIJacobian(self.ts, rval1, x.vec, xdot.vec, rval2,
 *                                    jmat, pmat, bval) )
 */
  __pyx_t_4 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {
    __pyx_t_3 = __pyx_v_P->mat;
    __pyx_v_pmat = __pyx_t_3;
  }

  /* "PETSc/TS.pyx":263
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat
 *         CHKERR( TSComputeIJacobian(self.ts, rval1, x.vec, xdot.vec, rval2,             # <<<<<<<<<<<<<<
 *                                    jmat, pmat, bval) )
 * 
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSComputeIJacobian(__pyx_v_self->ts, __pyx_v_rval1, __pyx_v_x->vec, __pyx_v_xdot->vec, __pyx_v_rval2, __pyx_v_jmat, __pyx_v_pmat, __pyx_v_bval)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(37, 263, __pyx_L1_error)

  /* "PETSc/TS.pyx":255
 *                                    f.vec, bval) )
 * 
 *     def computeIJacobian(self,             # <<<<<<<<<<<<<<
 *                          t, Vec x not None, Vec xdot not None, a,
 *                          Mat J not None, Mat P=None, imex=False):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.computeIJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":266
 *                                    jmat, pmat, bval) )
 * 
 *     def getIFunction(self):             # <<<<<<<<<<<<<<
 *         cdef Vec f = Vec()
 *         CHKERR( TSGetIFunction(self.ts, &f.vec, NULL, NULL) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_59getIFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_58getIFunction[] = "TS.getIFunction(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_59getIFunction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getIFunction (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getIFunction", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getIFunction", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_58getIFunction(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_58getIFunction(struct PyPetscTSObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_f = 0;
  PyObject *__pyx_v_function = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getIFunction", 0);

  /* "PETSc/TS.pyx":267
 * 
 *     def getIFunction(self):
 *         cdef Vec f = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetIFunction(self.ts, &f.vec, NULL, NULL) )
 *         PetscINCREF(f.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_f = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":268
 *     def getIFunction(self):
 *         cdef Vec f = Vec()
 *         CHKERR( TSGetIFunction(self.ts, &f.vec, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(f.obj)
 *         cdef object function = self.get_attr('__ifunction__')
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetIFunction(__pyx_v_self->ts, (&__pyx_v_f->vec), NULL, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 268, __pyx_L1_error)

  /* "PETSc/TS.pyx":269
 *         cdef Vec f = Vec()
 *         CHKERR( TSGetIFunction(self.ts, &f.vec, NULL, NULL) )
 *         PetscINCREF(f.obj)             # <<<<<<<<<<<<<<
 *         cdef object function = self.get_attr('__ifunction__')
 *         return (f, function)
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_f->__pyx_base.obj);

  /* "PETSc/TS.pyx":270
 *         CHKERR( TSGetIFunction(self.ts, &f.vec, NULL, NULL) )
 *         PetscINCREF(f.obj)
 *         cdef object function = self.get_attr('__ifunction__')             # <<<<<<<<<<<<<<
 *         return (f, function)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__ifunction__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_function = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":271
 *         PetscINCREF(f.obj)
 *         cdef object function = self.get_attr('__ifunction__')
 *         return (f, function)             # <<<<<<<<<<<<<<
 * 
 *     def getIJacobian(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_f));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_f));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f));
  __Pyx_INCREF(__pyx_v_function);
  __Pyx_GIVEREF(__pyx_v_function);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_function);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":266
 *                                    jmat, pmat, bval) )
 * 
 *     def getIFunction(self):             # <<<<<<<<<<<<<<
 *         cdef Vec f = Vec()
 *         CHKERR( TSGetIFunction(self.ts, &f.vec, NULL, NULL) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getIFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":273
 *         return (f, function)
 * 
 *     def getIJacobian(self):             # <<<<<<<<<<<<<<
 *         cdef Mat J = Mat(), P = Mat()
 *         CHKERR( TSGetIJacobian(self.ts, &J.mat, &P.mat, NULL, NULL) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_61getIJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_60getIJacobian[] = "TS.getIJacobian(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_61getIJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getIJacobian (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getIJacobian", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getIJacobian", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_60getIJacobian(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_60getIJacobian(struct PyPetscTSObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_v_jacobian = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getIJacobian", 0);

  /* "PETSc/TS.pyx":274
 * 
 *     def getIJacobian(self):
 *         cdef Mat J = Mat(), P = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetIJacobian(self.ts, &J.mat, &P.mat, NULL, NULL) )
 *         PetscINCREF(J.obj); PetscINCREF(P.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_J = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":275
 *     def getIJacobian(self):
 *         cdef Mat J = Mat(), P = Mat()
 *         CHKERR( TSGetIJacobian(self.ts, &J.mat, &P.mat, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(J.obj); PetscINCREF(P.obj)
 *         cdef object jacobian = self.get_attr('__ijacobian__')
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetIJacobian(__pyx_v_self->ts, (&__pyx_v_J->mat), (&__pyx_v_P->mat), NULL, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 275, __pyx_L1_error)

  /* "PETSc/TS.pyx":276
 *         cdef Mat J = Mat(), P = Mat()
 *         CHKERR( TSGetIJacobian(self.ts, &J.mat, &P.mat, NULL, NULL) )
 *         PetscINCREF(J.obj); PetscINCREF(P.obj)             # <<<<<<<<<<<<<<
 *         cdef object jacobian = self.get_attr('__ijacobian__')
 *         return (J, P, jacobian)
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_J->__pyx_base.obj);
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_P->__pyx_base.obj);

  /* "PETSc/TS.pyx":277
 *         CHKERR( TSGetIJacobian(self.ts, &J.mat, &P.mat, NULL, NULL) )
 *         PetscINCREF(J.obj); PetscINCREF(P.obj)
 *         cdef object jacobian = self.get_attr('__ijacobian__')             # <<<<<<<<<<<<<<
 *         return (J, P, jacobian)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__ijacobian__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_jacobian = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":278
 *         PetscINCREF(J.obj); PetscINCREF(P.obj)
 *         cdef object jacobian = self.get_attr('__ijacobian__')
 *         return (J, P, jacobian)             # <<<<<<<<<<<<<<
 * 
 *     # --- solution vector ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_J));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_J));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_J));
  __Pyx_INCREF(((PyObject *)__pyx_v_P));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_P));
  __Pyx_INCREF(__pyx_v_jacobian);
  __Pyx_GIVEREF(__pyx_v_jacobian);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_jacobian);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":273
 *         return (f, function)
 * 
 *     def getIJacobian(self):             # <<<<<<<<<<<<<<
 *         cdef Mat J = Mat(), P = Mat()
 *         CHKERR( TSGetIJacobian(self.ts, &J.mat, &P.mat, NULL, NULL) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getIJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_J);
  __Pyx_XDECREF((PyObject *)__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_jacobian);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":282
 *     # --- solution vector ---
 * 
 *     def setSolution(self, Vec u not None):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetSolution(self.ts, u.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_63setSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_62setSolution[] = "TS.setSolution(self, Vec u)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_63setSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_u = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setSolution (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_u,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);
        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_u)) != 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, "setSolution") < 0)) __PYX_ERR(37, 282, __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_u = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setSolution", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 282, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setSolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "u", 0))) __PYX_ERR(37, 282, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_62setSolution(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_u);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_62setSolution(struct PyPetscTSObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_u) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setSolution", 0);

  /* "PETSc/TS.pyx":283
 * 
 *     def setSolution(self, Vec u not None):
 *         CHKERR( TSSetSolution(self.ts, u.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def getSolution(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetSolution(__pyx_v_self->ts, __pyx_v_u->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 283, __pyx_L1_error)

  /* "PETSc/TS.pyx":282
 *     # --- solution vector ---
 * 
 *     def setSolution(self, Vec u not None):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetSolution(self.ts, u.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setSolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":285
 *         CHKERR( TSSetSolution(self.ts, u.vec) )
 * 
 *     def getSolution(self):             # <<<<<<<<<<<<<<
 *         cdef Vec u = Vec()
 *         CHKERR( TSGetSolution(self.ts, &u.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_65getSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_64getSolution[] = "TS.getSolution(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_65getSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSolution (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSolution", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSolution", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_64getSolution(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_64getSolution(struct PyPetscTSObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_u = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getSolution", 0);

  /* "PETSc/TS.pyx":286
 * 
 *     def getSolution(self):
 *         cdef Vec u = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetSolution(self.ts, &u.vec) )
 *         PetscINCREF(u.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_u = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":287
 *     def getSolution(self):
 *         cdef Vec u = Vec()
 *         CHKERR( TSGetSolution(self.ts, &u.vec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(u.obj)
 *         return u
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetSolution(__pyx_v_self->ts, (&__pyx_v_u->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 287, __pyx_L1_error)

  /* "PETSc/TS.pyx":288
 *         cdef Vec u = Vec()
 *         CHKERR( TSGetSolution(self.ts, &u.vec) )
 *         PetscINCREF(u.obj)             # <<<<<<<<<<<<<<
 *         return u
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_u->__pyx_base.obj);

  /* "PETSc/TS.pyx":289
 *         CHKERR( TSGetSolution(self.ts, &u.vec) )
 *         PetscINCREF(u.obj)
 *         return u             # <<<<<<<<<<<<<<
 * 
 *     # --- inner solver ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_u));
  __pyx_r = ((PyObject *)__pyx_v_u);
  goto __pyx_L0;

  /* "PETSc/TS.pyx":285
 *         CHKERR( TSSetSolution(self.ts, u.vec) )
 * 
 *     def getSolution(self):             # <<<<<<<<<<<<<<
 *         cdef Vec u = Vec()
 *         CHKERR( TSGetSolution(self.ts, &u.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getSolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_u);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":293
 *     # --- inner solver ---
 * 
 *     def getSNES(self):             # <<<<<<<<<<<<<<
 *         cdef SNES snes = SNES()
 *         CHKERR( TSGetSNES(self.ts, &snes.snes) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_67getSNES(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_66getSNES[] = "TS.getSNES(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_67getSNES(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSNES (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSNES", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSNES", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_66getSNES(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_66getSNES(struct PyPetscTSObject *__pyx_v_self) {
  struct PyPetscSNESObject *__pyx_v_snes = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getSNES", 0);

  /* "PETSc/TS.pyx":294
 * 
 *     def getSNES(self):
 *         cdef SNES snes = SNES()             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetSNES(self.ts, &snes.snes) )
 *         PetscINCREF(snes.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_snes = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":295
 *     def getSNES(self):
 *         cdef SNES snes = SNES()
 *         CHKERR( TSGetSNES(self.ts, &snes.snes) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(snes.obj)
 *         return snes
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetSNES(__pyx_v_self->ts, (&__pyx_v_snes->snes))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 295, __pyx_L1_error)

  /* "PETSc/TS.pyx":296
 *         cdef SNES snes = SNES()
 *         CHKERR( TSGetSNES(self.ts, &snes.snes) )
 *         PetscINCREF(snes.obj)             # <<<<<<<<<<<<<<
 *         return snes
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_snes->__pyx_base.obj);

  /* "PETSc/TS.pyx":297
 *         CHKERR( TSGetSNES(self.ts, &snes.snes) )
 *         PetscINCREF(snes.obj)
 *         return snes             # <<<<<<<<<<<<<<
 * 
 *     def getKSP(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_snes));
  __pyx_r = ((PyObject *)__pyx_v_snes);
  goto __pyx_L0;

  /* "PETSc/TS.pyx":293
 *     # --- inner solver ---
 * 
 *     def getSNES(self):             # <<<<<<<<<<<<<<
 *         cdef SNES snes = SNES()
 *         CHKERR( TSGetSNES(self.ts, &snes.snes) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getSNES", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_snes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":299
 *         return snes
 * 
 *     def getKSP(self):             # <<<<<<<<<<<<<<
 *         cdef KSP ksp = KSP()
 *         CHKERR( TSGetKSP(self.ts, &ksp.ksp) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_69getKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_68getKSP[] = "TS.getKSP(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_69getKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getKSP (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getKSP", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getKSP", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_68getKSP(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_68getKSP(struct PyPetscTSObject *__pyx_v_self) {
  struct PyPetscKSPObject *__pyx_v_ksp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getKSP", 0);

  /* "PETSc/TS.pyx":300
 * 
 *     def getKSP(self):
 *         cdef KSP ksp = KSP()             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetKSP(self.ts, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ksp = ((struct PyPetscKSPObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":301
 *     def getKSP(self):
 *         cdef KSP ksp = KSP()
 *         CHKERR( TSGetKSP(self.ts, &ksp.ksp) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(ksp.obj)
 *         return ksp
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetKSP(__pyx_v_self->ts, (&__pyx_v_ksp->ksp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 301, __pyx_L1_error)

  /* "PETSc/TS.pyx":302
 *         cdef KSP ksp = KSP()
 *         CHKERR( TSGetKSP(self.ts, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)             # <<<<<<<<<<<<<<
 *         return ksp
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ksp->__pyx_base.obj);

  /* "PETSc/TS.pyx":303
 *         CHKERR( TSGetKSP(self.ts, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 *         return ksp             # <<<<<<<<<<<<<<
 * 
 *     # --- discretization space ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ksp));
  __pyx_r = ((PyObject *)__pyx_v_ksp);
  goto __pyx_L0;

  /* "PETSc/TS.pyx":299
 *         return snes
 * 
 *     def getKSP(self):             # <<<<<<<<<<<<<<
 *         cdef KSP ksp = KSP()
 *         CHKERR( TSGetKSP(self.ts, &ksp.ksp) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getKSP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ksp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":307
 *     # --- discretization space ---
 * 
 *     def getDM(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( TSGetDM(self.ts, &newdm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_71getDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_70getDM[] = "TS.getDM(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_71getDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDM (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDM", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDM", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_70getDM(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_70getDM(struct PyPetscTSObject *__pyx_v_self) {
  DM __pyx_v_newdm;
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getDM", 0);

  /* "PETSc/TS.pyx":308
 * 
 *     def getDM(self):
 *         cdef PetscDM newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetDM(self.ts, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/TS.pyx":309
 *     def getDM(self):
 *         cdef PetscDM newdm = NULL
 *         CHKERR( TSGetDM(self.ts, &newdm) )             # <<<<<<<<<<<<<<
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetDM(__pyx_v_self->ts, (&__pyx_v_newdm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 309, __pyx_L1_error)

  /* "PETSc/TS.pyx":310
 *         cdef PetscDM newdm = NULL
 *         CHKERR( TSGetDM(self.ts, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()             # <<<<<<<<<<<<<<
 *         dm.dm = newdm
 *         PetscINCREF(dm.obj)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_newdm)); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(37, 310, __pyx_L1_error)
  __pyx_v_dm = ((struct PyPetscDMObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/TS.pyx":311
 *         CHKERR( TSGetDM(self.ts, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm             # <<<<<<<<<<<<<<
 *         PetscINCREF(dm.obj)
 *         return dm
 */
  __pyx_v_dm->dm = __pyx_v_newdm;

  /* "PETSc/TS.pyx":312
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm
 *         PetscINCREF(dm.obj)             # <<<<<<<<<<<<<<
 *         return dm
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_dm->__pyx_base.obj);

  /* "PETSc/TS.pyx":313
 *         dm.dm = newdm
 *         PetscINCREF(dm.obj)
 *         return dm             # <<<<<<<<<<<<<<
 * 
 *     def setDM(self, DM dm not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dm));
  __pyx_r = ((PyObject *)__pyx_v_dm);
  goto __pyx_L0;

  /* "PETSc/TS.pyx":307
 *     # --- discretization space ---
 * 
 *     def getDM(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( TSGetDM(self.ts, &newdm) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":315
 *         return dm
 * 
 *     def setDM(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetDM(self.ts, dm.dm) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_73setDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_72setDM[] = "TS.setDM(self, DM dm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_73setDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDM (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dm,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);
        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_dm)) != 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, "setDM") < 0)) __PYX_ERR(37, 315, __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_dm = ((struct PyPetscDMObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDM", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 315, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_8petsc4py_5PETSc_DM, 0, "dm", 0))) __PYX_ERR(37, 315, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_72setDM(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_dm);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_72setDM(struct PyPetscTSObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setDM", 0);

  /* "PETSc/TS.pyx":316
 * 
 *     def setDM(self, DM dm not None):
 *         CHKERR( TSSetDM(self.ts, dm.dm) )             # <<<<<<<<<<<<<<
 * 
 *     # --- customization ---
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetDM(__pyx_v_self->ts, __pyx_v_dm->dm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 316, __pyx_L1_error)

  /* "PETSc/TS.pyx":315
 *         return dm
 * 
 *     def setDM(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetDM(self.ts, dm.dm) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":320
 *     # --- customization ---
 * 
 *     def setTime(self, t):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(t)
 *         CHKERR( TSSetTime(self.ts, rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_75setTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_74setTime[] = "TS.setTime(self, t)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_75setTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,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);
        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_t)) != 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, "setTime") < 0)) __PYX_ERR(37, 320, __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_t = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTime", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 320, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setTime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_74setTime(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_t);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_74setTime(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setTime", 0);

  /* "PETSc/TS.pyx":321
 * 
 *     def setTime(self, t):
 *         cdef PetscReal rval = asReal(t)             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetTime(self.ts, rval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_t); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 321, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/TS.pyx":322
 *     def setTime(self, t):
 *         cdef PetscReal rval = asReal(t)
 *         CHKERR( TSSetTime(self.ts, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def getTime(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetTime(__pyx_v_self->ts, __pyx_v_rval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 322, __pyx_L1_error)

  /* "PETSc/TS.pyx":320
 *     # --- customization ---
 * 
 *     def setTime(self, t):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(t)
 *         CHKERR( TSSetTime(self.ts, rval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setTime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":324
 *         CHKERR( TSSetTime(self.ts, rval) )
 * 
 *     def getTime(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetTime(self.ts, &rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_77getTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_76getTime[] = "TS.getTime(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_77getTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTime (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getTime", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getTime", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_76getTime(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_76getTime(struct PyPetscTSObject *__pyx_v_self) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getTime", 0);

  /* "PETSc/TS.pyx":325
 * 
 *     def getTime(self):
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetTime(self.ts, &rval) )
 *         return toReal(rval)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/TS.pyx":326
 *     def getTime(self):
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetTime(self.ts, &rval) )             # <<<<<<<<<<<<<<
 *         return toReal(rval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetTime(__pyx_v_self->ts, (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 326, __pyx_L1_error)

  /* "PETSc/TS.pyx":327
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetTime(self.ts, &rval) )
 *         return toReal(rval)             # <<<<<<<<<<<<<<
 * 
 *     def getPrevTime(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":324
 *         CHKERR( TSSetTime(self.ts, rval) )
 * 
 *     def getTime(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetTime(self.ts, &rval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getTime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":329
 *         return toReal(rval)
 * 
 *     def getPrevTime(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetPrevTime(self.ts, &rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_79getPrevTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_78getPrevTime[] = "TS.getPrevTime(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_79getPrevTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPrevTime (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getPrevTime", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getPrevTime", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_78getPrevTime(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_78getPrevTime(struct PyPetscTSObject *__pyx_v_self) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getPrevTime", 0);

  /* "PETSc/TS.pyx":330
 * 
 *     def getPrevTime(self):
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetPrevTime(self.ts, &rval) )
 *         return toReal(rval)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/TS.pyx":331
 *     def getPrevTime(self):
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetPrevTime(self.ts, &rval) )             # <<<<<<<<<<<<<<
 *         return toReal(rval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetPrevTime(__pyx_v_self->ts, (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 331, __pyx_L1_error)

  /* "PETSc/TS.pyx":332
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetPrevTime(self.ts, &rval) )
 *         return toReal(rval)             # <<<<<<<<<<<<<<
 * 
 *     def getSolveTime(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":329
 *         return toReal(rval)
 * 
 *     def getPrevTime(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetPrevTime(self.ts, &rval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getPrevTime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":334
 *         return toReal(rval)
 * 
 *     def getSolveTime(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetSolveTime(self.ts, &rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_81getSolveTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_80getSolveTime[] = "TS.getSolveTime(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_81getSolveTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSolveTime (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSolveTime", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSolveTime", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_80getSolveTime(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_80getSolveTime(struct PyPetscTSObject *__pyx_v_self) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getSolveTime", 0);

  /* "PETSc/TS.pyx":335
 * 
 *     def getSolveTime(self):
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetSolveTime(self.ts, &rval) )
 *         return toReal(rval)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/TS.pyx":336
 *     def getSolveTime(self):
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetSolveTime(self.ts, &rval) )             # <<<<<<<<<<<<<<
 *         return toReal(rval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetSolveTime(__pyx_v_self->ts, (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 336, __pyx_L1_error)

  /* "PETSc/TS.pyx":337
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetSolveTime(self.ts, &rval) )
 *         return toReal(rval)             # <<<<<<<<<<<<<<
 * 
 *     def setInitialTimeStep(self, initial_time, initial_time_step):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":334
 *         return toReal(rval)
 * 
 *     def getSolveTime(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetSolveTime(self.ts, &rval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getSolveTime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":339
 *         return toReal(rval)
 * 
 *     def setInitialTimeStep(self, initial_time, initial_time_step):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval1 = asReal(initial_time)
 *         cdef PetscReal rval2 = asReal(initial_time_step)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_83setInitialTimeStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_82setInitialTimeStep[] = "TS.setInitialTimeStep(self, initial_time, initial_time_step)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_83setInitialTimeStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_initial_time = 0;
  PyObject *__pyx_v_initial_time_step = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setInitialTimeStep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_initial_time,&__pyx_n_s_initial_time_step,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_initial_time)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_initial_time_step)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setInitialTimeStep", 1, 2, 2, 1); __PYX_ERR(37, 339, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setInitialTimeStep") < 0)) __PYX_ERR(37, 339, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_initial_time = values[0];
    __pyx_v_initial_time_step = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setInitialTimeStep", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 339, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setInitialTimeStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_82setInitialTimeStep(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_initial_time, __pyx_v_initial_time_step);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_82setInitialTimeStep(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_initial_time, PyObject *__pyx_v_initial_time_step) {
  PetscReal __pyx_v_rval1;
  PetscReal __pyx_v_rval2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setInitialTimeStep", 0);

  /* "PETSc/TS.pyx":340
 * 
 *     def setInitialTimeStep(self, initial_time, initial_time_step):
 *         cdef PetscReal rval1 = asReal(initial_time)             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval2 = asReal(initial_time_step)
 *         CHKERR( TSSetInitialTimeStep(self.ts, rval1, rval2) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_initial_time); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 340, __pyx_L1_error)
  __pyx_v_rval1 = __pyx_t_1;

  /* "PETSc/TS.pyx":341
 *     def setInitialTimeStep(self, initial_time, initial_time_step):
 *         cdef PetscReal rval1 = asReal(initial_time)
 *         cdef PetscReal rval2 = asReal(initial_time_step)             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetInitialTimeStep(self.ts, rval1, rval2) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_initial_time_step); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 341, __pyx_L1_error)
  __pyx_v_rval2 = __pyx_t_1;

  /* "PETSc/TS.pyx":342
 *         cdef PetscReal rval1 = asReal(initial_time)
 *         cdef PetscReal rval2 = asReal(initial_time_step)
 *         CHKERR( TSSetInitialTimeStep(self.ts, rval1, rval2) )             # <<<<<<<<<<<<<<
 * 
 *     def setTimeStep(self, time_step):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetInitialTimeStep(__pyx_v_self->ts, __pyx_v_rval1, __pyx_v_rval2)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 342, __pyx_L1_error)

  /* "PETSc/TS.pyx":339
 *         return toReal(rval)
 * 
 *     def setInitialTimeStep(self, initial_time, initial_time_step):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval1 = asReal(initial_time)
 *         cdef PetscReal rval2 = asReal(initial_time_step)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setInitialTimeStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":344
 *         CHKERR( TSSetInitialTimeStep(self.ts, rval1, rval2) )
 * 
 *     def setTimeStep(self, time_step):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(time_step)
 *         CHKERR( TSSetTimeStep(self.ts, rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_85setTimeStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_84setTimeStep[] = "TS.setTimeStep(self, time_step)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_85setTimeStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_time_step = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTimeStep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_time_step,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);
        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_time_step)) != 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, "setTimeStep") < 0)) __PYX_ERR(37, 344, __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_time_step = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTimeStep", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 344, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setTimeStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_84setTimeStep(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_time_step);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_84setTimeStep(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_time_step) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setTimeStep", 0);

  /* "PETSc/TS.pyx":345
 * 
 *     def setTimeStep(self, time_step):
 *         cdef PetscReal rval = asReal(time_step)             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetTimeStep(self.ts, rval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_time_step); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 345, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/TS.pyx":346
 *     def setTimeStep(self, time_step):
 *         cdef PetscReal rval = asReal(time_step)
 *         CHKERR( TSSetTimeStep(self.ts, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def getTimeStep(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetTimeStep(__pyx_v_self->ts, __pyx_v_rval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 346, __pyx_L1_error)

  /* "PETSc/TS.pyx":344
 *         CHKERR( TSSetInitialTimeStep(self.ts, rval1, rval2) )
 * 
 *     def setTimeStep(self, time_step):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(time_step)
 *         CHKERR( TSSetTimeStep(self.ts, rval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setTimeStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":348
 *         CHKERR( TSSetTimeStep(self.ts, rval) )
 * 
 *     def getTimeStep(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal tstep = 0
 *         CHKERR( TSGetTimeStep(self.ts, &tstep) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_87getTimeStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_86getTimeStep[] = "TS.getTimeStep(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_87getTimeStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTimeStep (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getTimeStep", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getTimeStep", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_86getTimeStep(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_86getTimeStep(struct PyPetscTSObject *__pyx_v_self) {
  PetscReal __pyx_v_tstep;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getTimeStep", 0);

  /* "PETSc/TS.pyx":349
 * 
 *     def getTimeStep(self):
 *         cdef PetscReal tstep = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetTimeStep(self.ts, &tstep) )
 *         return toReal(tstep)
 */
  __pyx_v_tstep = 0.0;

  /* "PETSc/TS.pyx":350
 *     def getTimeStep(self):
 *         cdef PetscReal tstep = 0
 *         CHKERR( TSGetTimeStep(self.ts, &tstep) )             # <<<<<<<<<<<<<<
 *         return toReal(tstep)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetTimeStep(__pyx_v_self->ts, (&__pyx_v_tstep))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 350, __pyx_L1_error)

  /* "PETSc/TS.pyx":351
 *         cdef PetscReal tstep = 0
 *         CHKERR( TSGetTimeStep(self.ts, &tstep) )
 *         return toReal(tstep)             # <<<<<<<<<<<<<<
 * 
 *     def setStepNumber(self, step_number):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_tstep); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":348
 *         CHKERR( TSSetTimeStep(self.ts, rval) )
 * 
 *     def getTimeStep(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal tstep = 0
 *         CHKERR( TSGetTimeStep(self.ts, &tstep) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getTimeStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":353
 *         return toReal(tstep)
 * 
 *     def setStepNumber(self, step_number):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(step_number)
 *         CHKERR( TSSetTimeStepNumber(self.ts, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_89setStepNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_88setStepNumber[] = "TS.setStepNumber(self, step_number)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_89setStepNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_step_number = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setStepNumber (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_step_number,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);
        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_step_number)) != 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, "setStepNumber") < 0)) __PYX_ERR(37, 353, __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_step_number = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setStepNumber", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 353, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setStepNumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_88setStepNumber(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_step_number);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_88setStepNumber(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_step_number) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setStepNumber", 0);

  /* "PETSc/TS.pyx":354
 * 
 *     def setStepNumber(self, step_number):
 *         cdef PetscInt ival = asInt(step_number)             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetTimeStepNumber(self.ts, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_step_number); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(37, 354, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/TS.pyx":355
 *     def setStepNumber(self, step_number):
 *         cdef PetscInt ival = asInt(step_number)
 *         CHKERR( TSSetTimeStepNumber(self.ts, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def getStepNumber(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetTimeStepNumber(__pyx_v_self->ts, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 355, __pyx_L1_error)

  /* "PETSc/TS.pyx":353
 *         return toReal(tstep)
 * 
 *     def setStepNumber(self, step_number):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(step_number)
 *         CHKERR( TSSetTimeStepNumber(self.ts, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setStepNumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":357
 *         CHKERR( TSSetTimeStepNumber(self.ts, ival) )
 * 
 *     def getStepNumber(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( TSGetTimeStepNumber(self.ts, &ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_91getStepNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_90getStepNumber[] = "TS.getStepNumber(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_91getStepNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getStepNumber (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getStepNumber", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getStepNumber", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_90getStepNumber(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_90getStepNumber(struct PyPetscTSObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getStepNumber", 0);

  /* "PETSc/TS.pyx":358
 * 
 *     def getStepNumber(self):
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetTimeStepNumber(self.ts, &ival) )
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/TS.pyx":359
 *     def getStepNumber(self):
 *         cdef PetscInt ival = 0
 *         CHKERR( TSGetTimeStepNumber(self.ts, &ival) )             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetTimeStepNumber(__pyx_v_self->ts, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 359, __pyx_L1_error)

  /* "PETSc/TS.pyx":360
 *         cdef PetscInt ival = 0
 *         CHKERR( TSGetTimeStepNumber(self.ts, &ival) )
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def setMaxTime(self, max_time):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":357
 *         CHKERR( TSSetTimeStepNumber(self.ts, ival) )
 * 
 *     def getStepNumber(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( TSGetTimeStepNumber(self.ts, &ival) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getStepNumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":362
 *         return toInt(ival)
 * 
 *     def setMaxTime(self, max_time):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = asReal(max_time)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_93setMaxTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_92setMaxTime[] = "TS.setMaxTime(self, max_time)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_93setMaxTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_max_time = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMaxTime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_time,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);
        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_max_time)) != 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, "setMaxTime") < 0)) __PYX_ERR(37, 362, __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_max_time = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMaxTime", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 362, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setMaxTime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_92setMaxTime(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_max_time);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_92setMaxTime(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_max_time) {
  PetscInt __pyx_v_ival;
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMaxTime", 0);

  /* "PETSc/TS.pyx":363
 * 
 *     def setMaxTime(self, max_time):
 *         cdef PetscInt  ival = 0             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(max_time)
 *         CHKERR( TSGetDuration(self.ts, &ival, NULL) )
 */
  __pyx_v_ival = 0;

  /* "PETSc/TS.pyx":364
 *     def setMaxTime(self, max_time):
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = asReal(max_time)             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetDuration(self.ts, &ival, NULL) )
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_max_time); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 364, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/TS.pyx":365
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = asReal(max_time)
 *         CHKERR( TSGetDuration(self.ts, &ival, NULL) )             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetDuration(__pyx_v_self->ts, (&__pyx_v_ival), NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 365, __pyx_L1_error)

  /* "PETSc/TS.pyx":366
 *         cdef PetscReal rval = asReal(max_time)
 *         CHKERR( TSGetDuration(self.ts, &ival, NULL) )
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def getMaxTime(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetDuration(__pyx_v_self->ts, __pyx_v_ival, __pyx_v_rval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 366, __pyx_L1_error)

  /* "PETSc/TS.pyx":362
 *         return toInt(ival)
 * 
 *     def setMaxTime(self, max_time):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = asReal(max_time)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setMaxTime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":368
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )
 * 
 *     def getMaxTime(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, NULL, &rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_95getMaxTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_94getMaxTime[] = "TS.getMaxTime(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_95getMaxTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMaxTime (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMaxTime", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMaxTime", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_94getMaxTime(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_94getMaxTime(struct PyPetscTSObject *__pyx_v_self) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getMaxTime", 0);

  /* "PETSc/TS.pyx":369
 * 
 *     def getMaxTime(self):
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetDuration(self.ts, NULL, &rval) )
 *         return toReal(rval)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/TS.pyx":370
 *     def getMaxTime(self):
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, NULL, &rval) )             # <<<<<<<<<<<<<<
 *         return toReal(rval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetDuration(__pyx_v_self->ts, NULL, (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 370, __pyx_L1_error)

  /* "PETSc/TS.pyx":371
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, NULL, &rval) )
 *         return toReal(rval)             # <<<<<<<<<<<<<<
 * 
 *     def setMaxSteps(self, max_steps):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":368
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )
 * 
 *     def getMaxTime(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, NULL, &rval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getMaxTime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":373
 *         return toReal(rval)
 * 
 *     def setMaxSteps(self, max_steps):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = asInt(max_steps)
 *         cdef PetscReal rval = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_97setMaxSteps(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_96setMaxSteps[] = "TS.setMaxSteps(self, max_steps)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_97setMaxSteps(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_max_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMaxSteps (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_steps,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);
        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_max_steps)) != 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, "setMaxSteps") < 0)) __PYX_ERR(37, 373, __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_max_steps = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMaxSteps", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 373, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setMaxSteps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_96setMaxSteps(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_max_steps);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_96setMaxSteps(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_max_steps) {
  PetscInt __pyx_v_ival;
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMaxSteps", 0);

  /* "PETSc/TS.pyx":374
 * 
 *     def setMaxSteps(self, max_steps):
 *         cdef PetscInt  ival = asInt(max_steps)             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, NULL, &rval) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_max_steps); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(37, 374, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/TS.pyx":375
 *     def setMaxSteps(self, max_steps):
 *         cdef PetscInt  ival = asInt(max_steps)
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetDuration(self.ts, NULL, &rval) )
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/TS.pyx":376
 *         cdef PetscInt  ival = asInt(max_steps)
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, NULL, &rval) )             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetDuration(__pyx_v_self->ts, NULL, (&__pyx_v_rval))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 376, __pyx_L1_error)

  /* "PETSc/TS.pyx":377
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, NULL, &rval) )
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def getMaxSteps(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetDuration(__pyx_v_self->ts, __pyx_v_ival, __pyx_v_rval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 377, __pyx_L1_error)

  /* "PETSc/TS.pyx":373
 *         return toReal(rval)
 * 
 *     def setMaxSteps(self, max_steps):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = asInt(max_steps)
 *         cdef PetscReal rval = 0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setMaxSteps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":379
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )
 * 
 *     def getMaxSteps(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( TSGetDuration(self.ts, &ival, NULL) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_99getMaxSteps(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_98getMaxSteps[] = "TS.getMaxSteps(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_99getMaxSteps(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMaxSteps (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMaxSteps", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMaxSteps", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_98getMaxSteps(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_98getMaxSteps(struct PyPetscTSObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getMaxSteps", 0);

  /* "PETSc/TS.pyx":380
 * 
 *     def getMaxSteps(self):
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetDuration(self.ts, &ival, NULL) )
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/TS.pyx":381
 *     def getMaxSteps(self):
 *         cdef PetscInt ival = 0
 *         CHKERR( TSGetDuration(self.ts, &ival, NULL) )             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetDuration(__pyx_v_self->ts, (&__pyx_v_ival), NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 381, __pyx_L1_error)

  /* "PETSc/TS.pyx":382
 *         cdef PetscInt ival = 0
 *         CHKERR( TSGetDuration(self.ts, &ival, NULL) )
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def setDuration(self, max_time, max_steps=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":379
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )
 * 
 *     def getMaxSteps(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( TSGetDuration(self.ts, &ival, NULL) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getMaxSteps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":384
 *         return toInt(ival)
 * 
 *     def setDuration(self, max_time, max_steps=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_101setDuration(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_100setDuration[] = "TS.setDuration(self, max_time, max_steps=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_101setDuration(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_max_time = 0;
  PyObject *__pyx_v_max_steps = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDuration (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_time,&__pyx_n_s_max_steps,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_max_time)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_steps);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setDuration") < 0)) __PYX_ERR(37, 384, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_max_time = values[0];
    __pyx_v_max_steps = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDuration", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 384, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setDuration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_100setDuration(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_max_time, __pyx_v_max_steps);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_100setDuration(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_max_time, PyObject *__pyx_v_max_steps) {
  PetscInt __pyx_v_ival;
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PetscInt __pyx_t_4;
  PetscReal __pyx_t_5;
  __Pyx_RefNannySetupContext("setDuration", 0);

  /* "PETSc/TS.pyx":385
 * 
 *     def setDuration(self, max_time, max_steps=None):
 *         cdef PetscInt  ival = 0             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, &ival, &rval) )
 */
  __pyx_v_ival = 0;

  /* "PETSc/TS.pyx":386
 *     def setDuration(self, max_time, max_steps=None):
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetDuration(self.ts, &ival, &rval) )
 *         if max_steps is not None: ival = asInt(max_steps)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/TS.pyx":387
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, &ival, &rval) )             # <<<<<<<<<<<<<<
 *         if max_steps is not None: ival = asInt(max_steps)
 *         if max_time  is not None: rval = asReal(max_time)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetDuration(__pyx_v_self->ts, (&__pyx_v_ival), (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 387, __pyx_L1_error)

  /* "PETSc/TS.pyx":388
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, &ival, &rval) )
 *         if max_steps is not None: ival = asInt(max_steps)             # <<<<<<<<<<<<<<
 *         if max_time  is not None: rval = asReal(max_time)
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )
 */
  __pyx_t_2 = (__pyx_v_max_steps != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_max_steps); if (unlikely(__pyx_t_4 == -1L && PyErr_Occurred())) __PYX_ERR(37, 388, __pyx_L1_error)
    __pyx_v_ival = __pyx_t_4;
  }

  /* "PETSc/TS.pyx":389
 *         CHKERR( TSGetDuration(self.ts, &ival, &rval) )
 *         if max_steps is not None: ival = asInt(max_steps)
 *         if max_time  is not None: rval = asReal(max_time)             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )
 * 
 */
  __pyx_t_3 = (__pyx_v_max_time != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_max_time); if (unlikely(__pyx_t_5 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 389, __pyx_L1_error)
    __pyx_v_rval = __pyx_t_5;
  }

  /* "PETSc/TS.pyx":390
 *         if max_steps is not None: ival = asInt(max_steps)
 *         if max_time  is not None: rval = asReal(max_time)
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def getDuration(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetDuration(__pyx_v_self->ts, __pyx_v_ival, __pyx_v_rval)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 390, __pyx_L1_error)

  /* "PETSc/TS.pyx":384
 *         return toInt(ival)
 * 
 *     def setDuration(self, max_time, max_steps=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setDuration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":392
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )
 * 
 *     def getDuration(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_103getDuration(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_102getDuration[] = "TS.getDuration(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_103getDuration(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDuration (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDuration", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDuration", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_102getDuration(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_102getDuration(struct PyPetscTSObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PetscReal __pyx_v_rval;
  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;
  __Pyx_RefNannySetupContext("getDuration", 0);

  /* "PETSc/TS.pyx":393
 * 
 *     def getDuration(self):
 *         cdef PetscInt  ival = 0             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, &ival, &rval) )
 */
  __pyx_v_ival = 0;

  /* "PETSc/TS.pyx":394
 *     def getDuration(self):
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetDuration(self.ts, &ival, &rval) )
 *         return (toReal(rval), toInt(ival))
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/TS.pyx":395
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, &ival, &rval) )             # <<<<<<<<<<<<<<
 *         return (toReal(rval), toInt(ival))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetDuration(__pyx_v_self->ts, (&__pyx_v_ival), (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 395, __pyx_L1_error)

  /* "PETSc/TS.pyx":396
 *         cdef PetscReal rval = 0
 *         CHKERR( TSGetDuration(self.ts, &ival, &rval) )
 *         return (toReal(rval), toInt(ival))             # <<<<<<<<<<<<<<
 * 
 *     def getTotalSteps(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 396, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":392
 *         CHKERR( TSSetDuration(self.ts, ival, rval) )
 * 
 *     def getDuration(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = 0
 *         cdef PetscReal rval = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getDuration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":398
 *         return (toReal(rval), toInt(ival))
 * 
 *     def getTotalSteps(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( TSGetTotalSteps(self.ts, &ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_105getTotalSteps(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_104getTotalSteps[] = "TS.getTotalSteps(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_105getTotalSteps(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTotalSteps (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getTotalSteps", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getTotalSteps", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_104getTotalSteps(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_104getTotalSteps(struct PyPetscTSObject *__pyx_v_self) {
  PetscInt __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getTotalSteps", 0);

  /* "PETSc/TS.pyx":399
 * 
 *     def getTotalSteps(self):
 *         cdef PetscInt ival = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetTotalSteps(self.ts, &ival) )
 *         return toInt(ival)
 */
  __pyx_v_ival = 0;

  /* "PETSc/TS.pyx":400
 *     def getTotalSteps(self):
 *         cdef PetscInt ival = 0
 *         CHKERR( TSGetTotalSteps(self.ts, &ival) )             # <<<<<<<<<<<<<<
 *         return toInt(ival)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetTotalSteps(__pyx_v_self->ts, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 400, __pyx_L1_error)

  /* "PETSc/TS.pyx":401
 *         cdef PetscInt ival = 0
 *         CHKERR( TSGetTotalSteps(self.ts, &ival) )
 *         return toInt(ival)             # <<<<<<<<<<<<<<
 * 
 *     def getSNESIterations(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ival); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":398
 *         return (toReal(rval), toInt(ival))
 * 
 *     def getTotalSteps(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = 0
 *         CHKERR( TSGetTotalSteps(self.ts, &ival) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getTotalSteps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":403
 *         return toInt(ival)
 * 
 *     def getSNESIterations(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetSNESIterations(self.ts, &n) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_107getSNESIterations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_106getSNESIterations[] = "TS.getSNESIterations(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_107getSNESIterations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSNESIterations (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSNESIterations", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSNESIterations", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_106getSNESIterations(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_106getSNESIterations(struct PyPetscTSObject *__pyx_v_self) {
  PetscInt __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getSNESIterations", 0);

  /* "PETSc/TS.pyx":404
 * 
 *     def getSNESIterations(self):
 *         cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetSNESIterations(self.ts, &n) )
 *         return toInt(n)
 */
  __pyx_v_n = 0;

  /* "PETSc/TS.pyx":405
 *     def getSNESIterations(self):
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetSNESIterations(self.ts, &n) )             # <<<<<<<<<<<<<<
 *         return toInt(n)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetSNESIterations(__pyx_v_self->ts, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 405, __pyx_L1_error)

  /* "PETSc/TS.pyx":406
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetSNESIterations(self.ts, &n) )
 *         return toInt(n)             # <<<<<<<<<<<<<<
 * 
 *     def getKSPIterations(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":403
 *         return toInt(ival)
 * 
 *     def getSNESIterations(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetSNESIterations(self.ts, &n) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getSNESIterations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":408
 *         return toInt(n)
 * 
 *     def getKSPIterations(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetKSPIterations(self.ts, &n) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_109getKSPIterations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_108getKSPIterations[] = "TS.getKSPIterations(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_109getKSPIterations(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getKSPIterations (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getKSPIterations", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getKSPIterations", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_108getKSPIterations(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_108getKSPIterations(struct PyPetscTSObject *__pyx_v_self) {
  PetscInt __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getKSPIterations", 0);

  /* "PETSc/TS.pyx":409
 * 
 *     def getKSPIterations(self):
 *         cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetKSPIterations(self.ts, &n) )
 *         return toInt(n)
 */
  __pyx_v_n = 0;

  /* "PETSc/TS.pyx":410
 *     def getKSPIterations(self):
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetKSPIterations(self.ts, &n) )             # <<<<<<<<<<<<<<
 *         return toInt(n)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetKSPIterations(__pyx_v_self->ts, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 410, __pyx_L1_error)

  /* "PETSc/TS.pyx":411
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetKSPIterations(self.ts, &n) )
 *         return toInt(n)             # <<<<<<<<<<<<<<
 * 
 *     def setMaxStepRejections(self, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":408
 *         return toInt(n)
 * 
 *     def getKSPIterations(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetKSPIterations(self.ts, &n) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getKSPIterations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":413
 *         return toInt(n)
 * 
 *     def setMaxStepRejections(self, n):             # <<<<<<<<<<<<<<
 *         cdef PetscInt rej = asInt(n)
 *         CHKERR( TSSetMaxStepRejections(self.ts, rej))
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_111setMaxStepRejections(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_110setMaxStepRejections[] = "TS.setMaxStepRejections(self, n)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_111setMaxStepRejections(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMaxStepRejections (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,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);
        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_n)) != 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, "setMaxStepRejections") < 0)) __PYX_ERR(37, 413, __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_n = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMaxStepRejections", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 413, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setMaxStepRejections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_110setMaxStepRejections(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_110setMaxStepRejections(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PetscInt __pyx_v_rej;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMaxStepRejections", 0);

  /* "PETSc/TS.pyx":414
 * 
 *     def setMaxStepRejections(self, n):
 *         cdef PetscInt rej = asInt(n)             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetMaxStepRejections(self.ts, rej))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_n); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(37, 414, __pyx_L1_error)
  __pyx_v_rej = __pyx_t_1;

  /* "PETSc/TS.pyx":415
 *     def setMaxStepRejections(self, n):
 *         cdef PetscInt rej = asInt(n)
 *         CHKERR( TSSetMaxStepRejections(self.ts, rej))             # <<<<<<<<<<<<<<
 * 
 *     #def getMaxStepRejections(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetMaxStepRejections(__pyx_v_self->ts, __pyx_v_rej)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 415, __pyx_L1_error)

  /* "PETSc/TS.pyx":413
 *         return toInt(n)
 * 
 *     def setMaxStepRejections(self, n):             # <<<<<<<<<<<<<<
 *         cdef PetscInt rej = asInt(n)
 *         CHKERR( TSSetMaxStepRejections(self.ts, rej))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setMaxStepRejections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":422
 *     #    return toInt(n)
 * 
 *     def getStepRejections(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetStepRejections(self.ts, &n) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_113getStepRejections(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_112getStepRejections[] = "TS.getStepRejections(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_113getStepRejections(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getStepRejections (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getStepRejections", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getStepRejections", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_112getStepRejections(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_112getStepRejections(struct PyPetscTSObject *__pyx_v_self) {
  PetscInt __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getStepRejections", 0);

  /* "PETSc/TS.pyx":423
 * 
 *     def getStepRejections(self):
 *         cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetStepRejections(self.ts, &n) )
 *         return toInt(n)
 */
  __pyx_v_n = 0;

  /* "PETSc/TS.pyx":424
 *     def getStepRejections(self):
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetStepRejections(self.ts, &n) )             # <<<<<<<<<<<<<<
 *         return toInt(n)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetStepRejections(__pyx_v_self->ts, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 424, __pyx_L1_error)

  /* "PETSc/TS.pyx":425
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetStepRejections(self.ts, &n) )
 *         return toInt(n)             # <<<<<<<<<<<<<<
 * 
 *     def setMaxSNESFailures(self, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":422
 *     #    return toInt(n)
 * 
 *     def getStepRejections(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetStepRejections(self.ts, &n) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getStepRejections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":427
 *         return toInt(n)
 * 
 *     def setMaxSNESFailures(self, n):             # <<<<<<<<<<<<<<
 *         cdef PetscInt fails = asInt(n)
 *         CHKERR( TSSetMaxSNESFailures(self.ts, fails))
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_115setMaxSNESFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_114setMaxSNESFailures[] = "TS.setMaxSNESFailures(self, n)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_115setMaxSNESFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMaxSNESFailures (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,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);
        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_n)) != 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, "setMaxSNESFailures") < 0)) __PYX_ERR(37, 427, __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_n = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMaxSNESFailures", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 427, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setMaxSNESFailures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_114setMaxSNESFailures(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_114setMaxSNESFailures(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PetscInt __pyx_v_fails;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMaxSNESFailures", 0);

  /* "PETSc/TS.pyx":428
 * 
 *     def setMaxSNESFailures(self, n):
 *         cdef PetscInt fails = asInt(n)             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetMaxSNESFailures(self.ts, fails))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_n); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(37, 428, __pyx_L1_error)
  __pyx_v_fails = __pyx_t_1;

  /* "PETSc/TS.pyx":429
 *     def setMaxSNESFailures(self, n):
 *         cdef PetscInt fails = asInt(n)
 *         CHKERR( TSSetMaxSNESFailures(self.ts, fails))             # <<<<<<<<<<<<<<
 * 
 *     #def getMaxSNESFailures(self, n):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetMaxSNESFailures(__pyx_v_self->ts, __pyx_v_fails)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 429, __pyx_L1_error)

  /* "PETSc/TS.pyx":427
 *         return toInt(n)
 * 
 *     def setMaxSNESFailures(self, n):             # <<<<<<<<<<<<<<
 *         cdef PetscInt fails = asInt(n)
 *         CHKERR( TSSetMaxSNESFailures(self.ts, fails))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setMaxSNESFailures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":436
 *     #    return toInt(n)
 * 
 *     def getSNESFailures(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetSNESFailures(self.ts, &n) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_117getSNESFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_116getSNESFailures[] = "TS.getSNESFailures(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_117getSNESFailures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSNESFailures (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSNESFailures", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSNESFailures", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_116getSNESFailures(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_116getSNESFailures(struct PyPetscTSObject *__pyx_v_self) {
  PetscInt __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getSNESFailures", 0);

  /* "PETSc/TS.pyx":437
 * 
 *     def getSNESFailures(self):
 *         cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetSNESFailures(self.ts, &n) )
 *         return toInt(n)
 */
  __pyx_v_n = 0;

  /* "PETSc/TS.pyx":438
 *     def getSNESFailures(self):
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetSNESFailures(self.ts, &n) )             # <<<<<<<<<<<<<<
 *         return toInt(n)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetSNESFailures(__pyx_v_self->ts, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 438, __pyx_L1_error)

  /* "PETSc/TS.pyx":439
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetSNESFailures(self.ts, &n) )
 *         return toInt(n)             # <<<<<<<<<<<<<<
 * 
 *     def setErrorIfStepFails(self, flag=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":436
 *     #    return toInt(n)
 * 
 *     def getSNESFailures(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = 0
 *         CHKERR( TSGetSNESFailures(self.ts, &n) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getSNESFailures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":441
 *         return toInt(n)
 * 
 *     def setErrorIfStepFails(self, flag=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = flag
 *         CHKERR( TSSetErrorIfStepFails(self.ts, bval))
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_119setErrorIfStepFails(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_118setErrorIfStepFails[] = "TS.setErrorIfStepFails(self, flag=True)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_119setErrorIfStepFails(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setErrorIfStepFails (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setErrorIfStepFails") < 0)) __PYX_ERR(37, 441, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setErrorIfStepFails", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 441, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setErrorIfStepFails", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_118setErrorIfStepFails(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_118setErrorIfStepFails(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_flag) {
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setErrorIfStepFails", 0);

  /* "PETSc/TS.pyx":442
 * 
 *     def setErrorIfStepFails(self, flag=True):
 *         cdef PetscBool bval = flag             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetErrorIfStepFails(self.ts, bval))
 * 
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_flag)); if (unlikely(PyErr_Occurred())) __PYX_ERR(37, 442, __pyx_L1_error)
  __pyx_v_bval = __pyx_t_1;

  /* "PETSc/TS.pyx":443
 *     def setErrorIfStepFails(self, flag=True):
 *         cdef PetscBool bval = flag
 *         CHKERR( TSSetErrorIfStepFails(self.ts, bval))             # <<<<<<<<<<<<<<
 * 
 *     def setTolerances(self, rtol=None, atol=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetErrorIfStepFails(__pyx_v_self->ts, __pyx_v_bval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 443, __pyx_L1_error)

  /* "PETSc/TS.pyx":441
 *         return toInt(n)
 * 
 *     def setErrorIfStepFails(self, flag=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = flag
 *         CHKERR( TSSetErrorIfStepFails(self.ts, bval))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setErrorIfStepFails", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":445
 *         CHKERR( TSSetErrorIfStepFails(self.ts, bval))
 * 
 *     def setTolerances(self, rtol=None, atol=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rrtol = PETSC_DEFAULT
 *         cdef PetscReal ratol = PETSC_DEFAULT
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_121setTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_120setTolerances[] = "TS.setTolerances(self, rtol=None, atol=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_121setTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rtol = 0;
  PyObject *__pyx_v_atol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTolerances (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rtol,&__pyx_n_s_atol,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rtol);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_atol);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setTolerances") < 0)) __PYX_ERR(37, 445, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rtol = values[0];
    __pyx_v_atol = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTolerances", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 445, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_120setTolerances(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_rtol, __pyx_v_atol);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_120setTolerances(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_rtol, PyObject *__pyx_v_atol) {
  PetscReal __pyx_v_rrtol;
  PetscReal __pyx_v_ratol;
  Vec __pyx_v_vrtol;
  Vec __pyx_v_vatol;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Vec __pyx_t_3;
  PetscReal __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setTolerances", 0);

  /* "PETSc/TS.pyx":446
 * 
 *     def setTolerances(self, rtol=None, atol=None):
 *         cdef PetscReal rrtol = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscReal ratol = PETSC_DEFAULT
 *         cdef PetscVec  vrtol = NULL
 */
  __pyx_v_rrtol = PETSC_DEFAULT;

  /* "PETSc/TS.pyx":447
 *     def setTolerances(self, rtol=None, atol=None):
 *         cdef PetscReal rrtol = PETSC_DEFAULT
 *         cdef PetscReal ratol = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscVec  vrtol = NULL
 *         cdef PetscVec  vatol = NULL
 */
  __pyx_v_ratol = PETSC_DEFAULT;

  /* "PETSc/TS.pyx":448
 *         cdef PetscReal rrtol = PETSC_DEFAULT
 *         cdef PetscReal ratol = PETSC_DEFAULT
 *         cdef PetscVec  vrtol = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscVec  vatol = NULL
 *         if rtol is None:
 */
  __pyx_v_vrtol = NULL;

  /* "PETSc/TS.pyx":449
 *         cdef PetscReal ratol = PETSC_DEFAULT
 *         cdef PetscVec  vrtol = NULL
 *         cdef PetscVec  vatol = NULL             # <<<<<<<<<<<<<<
 *         if rtol is None:
 *             pass
 */
  __pyx_v_vatol = NULL;

  /* "PETSc/TS.pyx":450
 *         cdef PetscVec  vrtol = NULL
 *         cdef PetscVec  vatol = NULL
 *         if rtol is None:             # <<<<<<<<<<<<<<
 *             pass
 *         elif isinstance(rtol, Vec):
 */
  __pyx_t_1 = (__pyx_v_rtol == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    goto __pyx_L3;
  }

  /* "PETSc/TS.pyx":452
 *         if rtol is None:
 *             pass
 *         elif isinstance(rtol, Vec):             # <<<<<<<<<<<<<<
 *             vrtol = (<Vec>rtol).vec
 *         else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_rtol, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/TS.pyx":453
 *             pass
 *         elif isinstance(rtol, Vec):
 *             vrtol = (<Vec>rtol).vec             # <<<<<<<<<<<<<<
 *         else:
 *             rrtol = asReal(rtol)
 */
    __pyx_t_3 = ((struct PyPetscVecObject *)__pyx_v_rtol)->vec;
    __pyx_v_vrtol = __pyx_t_3;

    /* "PETSc/TS.pyx":452
 *         if rtol is None:
 *             pass
 *         elif isinstance(rtol, Vec):             # <<<<<<<<<<<<<<
 *             vrtol = (<Vec>rtol).vec
 *         else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/TS.pyx":455
 *             vrtol = (<Vec>rtol).vec
 *         else:
 *             rrtol = asReal(rtol)             # <<<<<<<<<<<<<<
 *         if atol is None:
 *             pass
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_rtol); if (unlikely(__pyx_t_4 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 455, __pyx_L1_error)
    __pyx_v_rrtol = __pyx_t_4;
  }
  __pyx_L3:;

  /* "PETSc/TS.pyx":456
 *         else:
 *             rrtol = asReal(rtol)
 *         if atol is None:             # <<<<<<<<<<<<<<
 *             pass
 *         elif isinstance(atol, Vec):
 */
  __pyx_t_1 = (__pyx_v_atol == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    goto __pyx_L4;
  }

  /* "PETSc/TS.pyx":458
 *         if atol is None:
 *             pass
 *         elif isinstance(atol, Vec):             # <<<<<<<<<<<<<<
 *             vatol = (<Vec>atol).vec
 *         else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_atol, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/TS.pyx":459
 *             pass
 *         elif isinstance(atol, Vec):
 *             vatol = (<Vec>atol).vec             # <<<<<<<<<<<<<<
 *         else:
 *             ratol = asReal(atol)
 */
    __pyx_t_3 = ((struct PyPetscVecObject *)__pyx_v_atol)->vec;
    __pyx_v_vatol = __pyx_t_3;

    /* "PETSc/TS.pyx":458
 *         if atol is None:
 *             pass
 *         elif isinstance(atol, Vec):             # <<<<<<<<<<<<<<
 *             vatol = (<Vec>atol).vec
 *         else:
 */
    goto __pyx_L4;
  }

  /* "PETSc/TS.pyx":461
 *             vatol = (<Vec>atol).vec
 *         else:
 *             ratol = asReal(atol)             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetTolerances(self.ts, ratol, vatol, rrtol, vrtol) )
 * 
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_atol); if (unlikely(__pyx_t_4 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 461, __pyx_L1_error)
    __pyx_v_ratol = __pyx_t_4;
  }
  __pyx_L4:;

  /* "PETSc/TS.pyx":462
 *         else:
 *             ratol = asReal(atol)
 *         CHKERR( TSSetTolerances(self.ts, ratol, vatol, rrtol, vrtol) )             # <<<<<<<<<<<<<<
 * 
 *     def getTolerances(self):
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetTolerances(__pyx_v_self->ts, __pyx_v_ratol, __pyx_v_vatol, __pyx_v_rrtol, __pyx_v_vrtol)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(37, 462, __pyx_L1_error)

  /* "PETSc/TS.pyx":445
 *         CHKERR( TSSetErrorIfStepFails(self.ts, bval))
 * 
 *     def setTolerances(self, rtol=None, atol=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rrtol = PETSC_DEFAULT
 *         cdef PetscReal ratol = PETSC_DEFAULT
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":464
 *         CHKERR( TSSetTolerances(self.ts, ratol, vatol, rrtol, vrtol) )
 * 
 *     def getTolerances(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rrtol = PETSC_DEFAULT
 *         cdef PetscReal ratol = PETSC_DEFAULT
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_123getTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_122getTolerances[] = "TS.getTolerances(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_123getTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTolerances (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getTolerances", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getTolerances", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_122getTolerances(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_122getTolerances(struct PyPetscTSObject *__pyx_v_self) {
  PetscReal __pyx_v_rrtol;
  PetscReal __pyx_v_ratol;
  Vec __pyx_v_vrtol;
  Vec __pyx_v_vatol;
  PyObject *__pyx_v_rtol = 0;
  PyObject *__pyx_v_atol = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getTolerances", 0);

  /* "PETSc/TS.pyx":465
 * 
 *     def getTolerances(self):
 *         cdef PetscReal rrtol = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscReal ratol = PETSC_DEFAULT
 *         cdef PetscVec  vrtol = NULL
 */
  __pyx_v_rrtol = PETSC_DEFAULT;

  /* "PETSc/TS.pyx":466
 *     def getTolerances(self):
 *         cdef PetscReal rrtol = PETSC_DEFAULT
 *         cdef PetscReal ratol = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         cdef PetscVec  vrtol = NULL
 *         cdef PetscVec  vatol = NULL
 */
  __pyx_v_ratol = PETSC_DEFAULT;

  /* "PETSc/TS.pyx":467
 *         cdef PetscReal rrtol = PETSC_DEFAULT
 *         cdef PetscReal ratol = PETSC_DEFAULT
 *         cdef PetscVec  vrtol = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscVec  vatol = NULL
 *         CHKERR( TSGetTolerances(self.ts, &ratol, &vatol, &rrtol, &vrtol) )
 */
  __pyx_v_vrtol = NULL;

  /* "PETSc/TS.pyx":468
 *         cdef PetscReal ratol = PETSC_DEFAULT
 *         cdef PetscVec  vrtol = NULL
 *         cdef PetscVec  vatol = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetTolerances(self.ts, &ratol, &vatol, &rrtol, &vrtol) )
 *         cdef object rtol = None
 */
  __pyx_v_vatol = NULL;

  /* "PETSc/TS.pyx":469
 *         cdef PetscVec  vrtol = NULL
 *         cdef PetscVec  vatol = NULL
 *         CHKERR( TSGetTolerances(self.ts, &ratol, &vatol, &rrtol, &vrtol) )             # <<<<<<<<<<<<<<
 *         cdef object rtol = None
 *         if vrtol != NULL:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetTolerances(__pyx_v_self->ts, (&__pyx_v_ratol), (&__pyx_v_vatol), (&__pyx_v_rrtol), (&__pyx_v_vrtol))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 469, __pyx_L1_error)

  /* "PETSc/TS.pyx":470
 *         cdef PetscVec  vatol = NULL
 *         CHKERR( TSGetTolerances(self.ts, &ratol, &vatol, &rrtol, &vrtol) )
 *         cdef object rtol = None             # <<<<<<<<<<<<<<
 *         if vrtol != NULL:
 *             rtol = ref_Vec(vrtol)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_rtol = Py_None;

  /* "PETSc/TS.pyx":471
 *         CHKERR( TSGetTolerances(self.ts, &ratol, &vatol, &rrtol, &vrtol) )
 *         cdef object rtol = None
 *         if vrtol != NULL:             # <<<<<<<<<<<<<<
 *             rtol = ref_Vec(vrtol)
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_vrtol != NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/TS.pyx":472
 *         cdef object rtol = None
 *         if vrtol != NULL:
 *             rtol = ref_Vec(vrtol)             # <<<<<<<<<<<<<<
 *         else:
 *             rtol = toReal(rrtol)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_vrtol)); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_rtol, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/TS.pyx":471
 *         CHKERR( TSGetTolerances(self.ts, &ratol, &vatol, &rrtol, &vrtol) )
 *         cdef object rtol = None
 *         if vrtol != NULL:             # <<<<<<<<<<<<<<
 *             rtol = ref_Vec(vrtol)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/TS.pyx":474
 *             rtol = ref_Vec(vrtol)
 *         else:
 *             rtol = toReal(rrtol)             # <<<<<<<<<<<<<<
 *         cdef object atol = None
 *         if vatol != NULL:
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rrtol); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_rtol, __pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "PETSc/TS.pyx":475
 *         else:
 *             rtol = toReal(rrtol)
 *         cdef object atol = None             # <<<<<<<<<<<<<<
 *         if vatol != NULL:
 *             atol = ref_Vec(vatol)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_atol = Py_None;

  /* "PETSc/TS.pyx":476
 *             rtol = toReal(rrtol)
 *         cdef object atol = None
 *         if vatol != NULL:             # <<<<<<<<<<<<<<
 *             atol = ref_Vec(vatol)
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_vatol != NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/TS.pyx":477
 *         cdef object atol = None
 *         if vatol != NULL:
 *             atol = ref_Vec(vatol)             # <<<<<<<<<<<<<<
 *         else:
 *             atol = toReal(ratol)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_Vec(__pyx_v_vatol)); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 477, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_atol, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/TS.pyx":476
 *             rtol = toReal(rrtol)
 *         cdef object atol = None
 *         if vatol != NULL:             # <<<<<<<<<<<<<<
 *             atol = ref_Vec(vatol)
 *         else:
 */
    goto __pyx_L4;
  }

  /* "PETSc/TS.pyx":479
 *             atol = ref_Vec(vatol)
 *         else:
 *             atol = toReal(ratol)             # <<<<<<<<<<<<<<
 *         return (rtol, atol)
 * 
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_ratol); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_atol, __pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "PETSc/TS.pyx":480
 *         else:
 *             atol = toReal(ratol)
 *         return (rtol, atol)             # <<<<<<<<<<<<<<
 * 
 *     def setExactFinalTime(self, option):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_rtol);
  __Pyx_GIVEREF(__pyx_v_rtol);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_rtol);
  __Pyx_INCREF(__pyx_v_atol);
  __Pyx_GIVEREF(__pyx_v_atol);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_atol);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":464
 *         CHKERR( TSSetTolerances(self.ts, ratol, vatol, rrtol, vrtol) )
 * 
 *     def getTolerances(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rrtol = PETSC_DEFAULT
 *         cdef PetscReal ratol = PETSC_DEFAULT
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rtol);
  __Pyx_XDECREF(__pyx_v_atol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":482
 *         return (rtol, atol)
 * 
 *     def setExactFinalTime(self, option):             # <<<<<<<<<<<<<<
 *         cdef PetscTSExactFinalTimeOption oval = option
 *         CHKERR( TSSetExactFinalTime(self.ts, oval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_125setExactFinalTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_124setExactFinalTime[] = "TS.setExactFinalTime(self, option)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_125setExactFinalTime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_option = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setExactFinalTime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_option,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);
        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_option)) != 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, "setExactFinalTime") < 0)) __PYX_ERR(37, 482, __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_option = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setExactFinalTime", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 482, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setExactFinalTime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_124setExactFinalTime(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_option);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_124setExactFinalTime(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_option) {
  TSExactFinalTimeOption __pyx_v_oval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  TSExactFinalTimeOption __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setExactFinalTime", 0);

  /* "PETSc/TS.pyx":483
 * 
 *     def setExactFinalTime(self, option):
 *         cdef PetscTSExactFinalTimeOption oval = option             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetExactFinalTime(self.ts, oval) )
 * 
 */
  __pyx_t_1 = ((TSExactFinalTimeOption)__Pyx_PyInt_As_TSExactFinalTimeOption(__pyx_v_option)); if (unlikely(PyErr_Occurred())) __PYX_ERR(37, 483, __pyx_L1_error)
  __pyx_v_oval = __pyx_t_1;

  /* "PETSc/TS.pyx":484
 *     def setExactFinalTime(self, option):
 *         cdef PetscTSExactFinalTimeOption oval = option
 *         CHKERR( TSSetExactFinalTime(self.ts, oval) )             # <<<<<<<<<<<<<<
 * 
 *     def setConvergedReason(self, reason):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetExactFinalTime(__pyx_v_self->ts, __pyx_v_oval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 484, __pyx_L1_error)

  /* "PETSc/TS.pyx":482
 *         return (rtol, atol)
 * 
 *     def setExactFinalTime(self, option):             # <<<<<<<<<<<<<<
 *         cdef PetscTSExactFinalTimeOption oval = option
 *         CHKERR( TSSetExactFinalTime(self.ts, oval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setExactFinalTime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":486
 *         CHKERR( TSSetExactFinalTime(self.ts, oval) )
 * 
 *     def setConvergedReason(self, reason):             # <<<<<<<<<<<<<<
 *         cdef PetscTSConvergedReason cval = reason
 *         CHKERR( TSSetConvergedReason(self.ts, cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_127setConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_126setConvergedReason[] = "TS.setConvergedReason(self, reason)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_127setConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_reason = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvergedReason (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reason,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);
        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_reason)) != 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, "setConvergedReason") < 0)) __PYX_ERR(37, 486, __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_reason = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvergedReason", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 486, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_126setConvergedReason(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_reason);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_126setConvergedReason(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_reason) {
  TSConvergedReason __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  TSConvergedReason __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setConvergedReason", 0);

  /* "PETSc/TS.pyx":487
 * 
 *     def setConvergedReason(self, reason):
 *         cdef PetscTSConvergedReason cval = reason             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetConvergedReason(self.ts, cval) )
 * 
 */
  __pyx_t_1 = ((TSConvergedReason)__Pyx_PyInt_As_TSConvergedReason(__pyx_v_reason)); if (unlikely(PyErr_Occurred())) __PYX_ERR(37, 487, __pyx_L1_error)
  __pyx_v_cval = __pyx_t_1;

  /* "PETSc/TS.pyx":488
 *     def setConvergedReason(self, reason):
 *         cdef PetscTSConvergedReason cval = reason
 *         CHKERR( TSSetConvergedReason(self.ts, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getConvergedReason(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetConvergedReason(__pyx_v_self->ts, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 488, __pyx_L1_error)

  /* "PETSc/TS.pyx":486
 *         CHKERR( TSSetExactFinalTime(self.ts, oval) )
 * 
 *     def setConvergedReason(self, reason):             # <<<<<<<<<<<<<<
 *         cdef PetscTSConvergedReason cval = reason
 *         CHKERR( TSSetConvergedReason(self.ts, cval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":490
 *         CHKERR( TSSetConvergedReason(self.ts, cval) )
 * 
 *     def getConvergedReason(self):             # <<<<<<<<<<<<<<
 *         cdef PetscTSConvergedReason reason = TS_CONVERGED_ITERATING
 *         CHKERR( TSGetConvergedReason(self.ts, &reason) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_129getConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_128getConvergedReason[] = "TS.getConvergedReason(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_129getConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvergedReason (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getConvergedReason", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getConvergedReason", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_128getConvergedReason(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_128getConvergedReason(struct PyPetscTSObject *__pyx_v_self) {
  TSConvergedReason __pyx_v_reason;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvergedReason", 0);

  /* "PETSc/TS.pyx":491
 * 
 *     def getConvergedReason(self):
 *         cdef PetscTSConvergedReason reason = TS_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *         CHKERR( TSGetConvergedReason(self.ts, &reason) )
 *         return reason
 */
  __pyx_v_reason = TS_CONVERGED_ITERATING;

  /* "PETSc/TS.pyx":492
 *     def getConvergedReason(self):
 *         cdef PetscTSConvergedReason reason = TS_CONVERGED_ITERATING
 *         CHKERR( TSGetConvergedReason(self.ts, &reason) )             # <<<<<<<<<<<<<<
 *         return reason
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetConvergedReason(__pyx_v_self->ts, (&__pyx_v_reason))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 492, __pyx_L1_error)

  /* "PETSc/TS.pyx":493
 *         cdef PetscTSConvergedReason reason = TS_CONVERGED_ITERATING
 *         CHKERR( TSGetConvergedReason(self.ts, &reason) )
 *         return reason             # <<<<<<<<<<<<<<
 * 
 *     # --- monitoring ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_TSConvergedReason(__pyx_v_reason); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":490
 *         CHKERR( TSSetConvergedReason(self.ts, cval) )
 * 
 *     def getConvergedReason(self):             # <<<<<<<<<<<<<<
 *         cdef PetscTSConvergedReason reason = TS_CONVERGED_ITERATING
 *         CHKERR( TSGetConvergedReason(self.ts, &reason) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":497
 *     # --- monitoring ---
 * 
 *     def setMonitor(self, monitor, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_131setMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_130setMonitor[] = "TS.setMonitor(self, monitor, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_131setMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_monitor = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMonitor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_monitor,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_monitor)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMonitor") < 0)) __PYX_ERR(37, 497, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_monitor = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMonitor", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 497, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_130setMonitor(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_monitor, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_130setMonitor(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_monitor, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_monitorlist = 0;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("setMonitor", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TS.pyx":498
 * 
 *     def setMonitor(self, monitor, args=None, kargs=None):
 *         if monitor is None: return             # <<<<<<<<<<<<<<
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:
 */
  __pyx_t_1 = (__pyx_v_monitor == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "PETSc/TS.pyx":499
 *     def setMonitor(self, monitor, args=None, kargs=None):
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')             # <<<<<<<<<<<<<<
 *         if monitorlist is None:
 *             monitorlist = []
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__")); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_monitorlist = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/TS.pyx":500
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:             # <<<<<<<<<<<<<<
 *             monitorlist = []
 *             self.set_attr('__monitor__', monitorlist)
 */
  __pyx_t_2 = (__pyx_v_monitorlist == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/TS.pyx":501
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:
 *             monitorlist = []             # <<<<<<<<<<<<<<
 *             self.set_attr('__monitor__', monitorlist)
 *             CHKERR( TSMonitorSet(self.ts, TS_Monitor, NULL, NULL) )
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_monitorlist, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/TS.pyx":502
 *         if monitorlist is None:
 *             monitorlist = []
 *             self.set_attr('__monitor__', monitorlist)             # <<<<<<<<<<<<<<
 *             CHKERR( TSMonitorSet(self.ts, TS_Monitor, NULL, NULL) )
 *         if args  is None: args  = ()
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__"), __pyx_v_monitorlist); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/TS.pyx":503
 *             monitorlist = []
 *             self.set_attr('__monitor__', monitorlist)
 *             CHKERR( TSMonitorSet(self.ts, TS_Monitor, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSMonitorSet(__pyx_v_self->ts, __pyx_f_8petsc4py_5PETSc_TS_Monitor, NULL, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(37, 503, __pyx_L1_error)

    /* "PETSc/TS.pyx":500
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:             # <<<<<<<<<<<<<<
 *             monitorlist = []
 *             self.set_attr('__monitor__', monitorlist)
 */
  }

  /* "PETSc/TS.pyx":504
 *             self.set_attr('__monitor__', monitorlist)
 *             CHKERR( TSMonitorSet(self.ts, TS_Monitor, NULL, NULL) )
 *         if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         context = (monitor, args, kargs)
 */
  __pyx_t_1 = (__pyx_v_args == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/TS.pyx":505
 *             CHKERR( TSMonitorSet(self.ts, TS_Monitor, NULL, NULL) )
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         context = (monitor, args, kargs)
 *         monitorlist.append(context)
 */
  __pyx_t_2 = (__pyx_v_kargs == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "PETSc/TS.pyx":506
 *         if args  is None: args  = ()
 *         if kargs is None: kargs = {}
 *         context = (monitor, args, kargs)             # <<<<<<<<<<<<<<
 *         monitorlist.append(context)
 * 
 */
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_monitor);
  __Pyx_GIVEREF(__pyx_v_monitor);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_monitor);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
  __pyx_v_context = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/TS.pyx":507
 *         if kargs is None: kargs = {}
 *         context = (monitor, args, kargs)
 *         monitorlist.append(context)             # <<<<<<<<<<<<<<
 * 
 *     def getMonitor(self):
 */
  __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_monitorlist, __pyx_v_context); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(37, 507, __pyx_L1_error)

  /* "PETSc/TS.pyx":497
 *     # --- monitoring ---
 * 
 *     def setMonitor(self, monitor, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_monitorlist);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":509
 *         monitorlist.append(context)
 * 
 *     def getMonitor(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__monitor__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_133getMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_132getMonitor[] = "TS.getMonitor(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_133getMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMonitor (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMonitor", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMonitor", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_132getMonitor(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_132getMonitor(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getMonitor", 0);

  /* "PETSc/TS.pyx":510
 * 
 *     def getMonitor(self):
 *         return self.get_attr('__monitor__')             # <<<<<<<<<<<<<<
 * 
 *     def cancelMonitor(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":509
 *         monitorlist.append(context)
 * 
 *     def getMonitor(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__monitor__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":512
 *         return self.get_attr('__monitor__')
 * 
 *     def cancelMonitor(self):             # <<<<<<<<<<<<<<
 *         self.set_attr('__monitor__', None)
 *         CHKERR( TSMonitorCancel(self.ts) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_135cancelMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_134cancelMonitor[] = "TS.cancelMonitor(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_135cancelMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cancelMonitor (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("cancelMonitor", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "cancelMonitor", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_134cancelMonitor(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_134cancelMonitor(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("cancelMonitor", 0);

  /* "PETSc/TS.pyx":513
 * 
 *     def cancelMonitor(self):
 *         self.set_attr('__monitor__', None)             # <<<<<<<<<<<<<<
 *         CHKERR( TSMonitorCancel(self.ts) )
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__"), Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":514
 *     def cancelMonitor(self):
 *         self.set_attr('__monitor__', None)
 *         CHKERR( TSMonitorCancel(self.ts) )             # <<<<<<<<<<<<<<
 * 
 *     def monitor(self, step, time, Vec u=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSMonitorCancel(__pyx_v_self->ts)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 514, __pyx_L1_error)

  /* "PETSc/TS.pyx":512
 *         return self.get_attr('__monitor__')
 * 
 *     def cancelMonitor(self):             # <<<<<<<<<<<<<<
 *         self.set_attr('__monitor__', None)
 *         CHKERR( TSMonitorCancel(self.ts) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.cancelMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":516
 *         CHKERR( TSMonitorCancel(self.ts) )
 * 
 *     def monitor(self, step, time, Vec u=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = asInt(step)
 *         cdef PetscReal rval = asReal(time)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_137monitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_136monitor[] = "TS.monitor(self, step, time, Vec u=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_137monitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_step = 0;
  PyObject *__pyx_v_time = 0;
  struct PyPetscVecObject *__pyx_v_u = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("monitor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_step,&__pyx_n_s_time,&__pyx_n_s_u,0};
    PyObject* values[3] = {0,0,0};
    values[2] = (PyObject *)((struct PyPetscVecObject *)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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_step)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_time)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("monitor", 0, 2, 3, 1); __PYX_ERR(37, 516, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_u);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "monitor") < 0)) __PYX_ERR(37, 516, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_step = values[0];
    __pyx_v_time = values[1];
    __pyx_v_u = ((struct PyPetscVecObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("monitor", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 516, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "u", 0))) __PYX_ERR(37, 516, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_136monitor(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_step, __pyx_v_time, __pyx_v_u);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_136monitor(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_step, PyObject *__pyx_v_time, struct PyPetscVecObject *__pyx_v_u) {
  PetscInt __pyx_v_ival;
  PetscReal __pyx_v_rval;
  Vec __pyx_v_uvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscReal __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Vec __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("monitor", 0);

  /* "PETSc/TS.pyx":517
 * 
 *     def monitor(self, step, time, Vec u=None):
 *         cdef PetscInt  ival = asInt(step)             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(time)
 *         cdef PetscVec  uvec = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_step); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(37, 517, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/TS.pyx":518
 *     def monitor(self, step, time, Vec u=None):
 *         cdef PetscInt  ival = asInt(step)
 *         cdef PetscReal rval = asReal(time)             # <<<<<<<<<<<<<<
 *         cdef PetscVec  uvec = NULL
 *         if u is not None: uvec = u.vec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_time); if (unlikely(__pyx_t_2 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 518, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_2;

  /* "PETSc/TS.pyx":519
 *         cdef PetscInt  ival = asInt(step)
 *         cdef PetscReal rval = asReal(time)
 *         cdef PetscVec  uvec = NULL             # <<<<<<<<<<<<<<
 *         if u is not None: uvec = u.vec
 *         if uvec == NULL:
 */
  __pyx_v_uvec = NULL;

  /* "PETSc/TS.pyx":520
 *         cdef PetscReal rval = asReal(time)
 *         cdef PetscVec  uvec = NULL
 *         if u is not None: uvec = u.vec             # <<<<<<<<<<<<<<
 *         if uvec == NULL:
 *             CHKERR( TSGetSolution(self.ts, &uvec) )
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_u) != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
    __pyx_t_5 = __pyx_v_u->vec;
    __pyx_v_uvec = __pyx_t_5;
  }

  /* "PETSc/TS.pyx":521
 *         cdef PetscVec  uvec = NULL
 *         if u is not None: uvec = u.vec
 *         if uvec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( TSGetSolution(self.ts, &uvec) )
 *         CHKERR( TSMonitor(self.ts, ival, rval, uvec) )
 */
  __pyx_t_4 = ((__pyx_v_uvec == NULL) != 0);
  if (__pyx_t_4) {

    /* "PETSc/TS.pyx":522
 *         if u is not None: uvec = u.vec
 *         if uvec == NULL:
 *             CHKERR( TSGetSolution(self.ts, &uvec) )             # <<<<<<<<<<<<<<
 *         CHKERR( TSMonitor(self.ts, ival, rval, uvec) )
 * 
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSGetSolution(__pyx_v_self->ts, (&__pyx_v_uvec))); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(37, 522, __pyx_L1_error)

    /* "PETSc/TS.pyx":521
 *         cdef PetscVec  uvec = NULL
 *         if u is not None: uvec = u.vec
 *         if uvec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( TSGetSolution(self.ts, &uvec) )
 *         CHKERR( TSMonitor(self.ts, ival, rval, uvec) )
 */
  }

  /* "PETSc/TS.pyx":523
 *         if uvec == NULL:
 *             CHKERR( TSGetSolution(self.ts, &uvec) )
 *         CHKERR( TSMonitor(self.ts, ival, rval, uvec) )             # <<<<<<<<<<<<<<
 * 
 *     # --- solving ---
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSMonitor(__pyx_v_self->ts, __pyx_v_ival, __pyx_v_rval, __pyx_v_uvec)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(37, 523, __pyx_L1_error)

  /* "PETSc/TS.pyx":516
 *         CHKERR( TSMonitorCancel(self.ts) )
 * 
 *     def monitor(self, step, time, Vec u=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ival = asInt(step)
 *         cdef PetscReal rval = asReal(time)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":527
 *     # --- solving ---
 * 
 *     def setPreStep(self, prestep, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if prestep is not None:
 *             if args  is None: args  = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_139setPreStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_138setPreStep[] = "TS.setPreStep(self, prestep, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_139setPreStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prestep = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPreStep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prestep,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_prestep)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setPreStep") < 0)) __PYX_ERR(37, 527, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_prestep = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPreStep", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 527, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setPreStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_138setPreStep(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_prestep, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_138setPreStep(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_prestep, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setPreStep", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TS.pyx":528
 * 
 *     def setPreStep(self, prestep, args=None, kargs=None):
 *         if prestep is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_prestep != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/TS.pyx":529
 *     def setPreStep(self, prestep, args=None, kargs=None):
 *         if prestep is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (prestep, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/TS.pyx":530
 *         if prestep is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (prestep, args, kargs)
 *             self.set_attr('__prestep__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 530, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/TS.pyx":531
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (prestep, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__prestep__', context)
 *             CHKERR( TSSetPreStep(self.ts, TS_PreStep) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_prestep);
    __Pyx_GIVEREF(__pyx_v_prestep);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_prestep);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/TS.pyx":532
 *             if kargs is None: kargs = {}
 *             context = (prestep, args, kargs)
 *             self.set_attr('__prestep__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( TSSetPreStep(self.ts, TS_PreStep) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__prestep__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 532, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/TS.pyx":533
 *             context = (prestep, args, kargs)
 *             self.set_attr('__prestep__', context)
 *             CHKERR( TSSetPreStep(self.ts, TS_PreStep) )             # <<<<<<<<<<<<<<
 *         else:
 *             self.set_attr('__prestep__', None)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetPreStep(__pyx_v_self->ts, __pyx_f_8petsc4py_5PETSc_TS_PreStep)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(37, 533, __pyx_L1_error)

    /* "PETSc/TS.pyx":528
 * 
 *     def setPreStep(self, prestep, args=None, kargs=None):
 *         if prestep is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/TS.pyx":535
 *             CHKERR( TSSetPreStep(self.ts, TS_PreStep) )
 *         else:
 *             self.set_attr('__prestep__', None)             # <<<<<<<<<<<<<<
 *             CHKERR( TSSetPreStep(self.ts, NULL) )
 * 
 */
  /*else*/ {
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__prestep__"), Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/TS.pyx":536
 *         else:
 *             self.set_attr('__prestep__', None)
 *             CHKERR( TSSetPreStep(self.ts, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def getPreStep(self):
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetPreStep(__pyx_v_self->ts, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(37, 536, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/TS.pyx":527
 *     # --- solving ---
 * 
 *     def setPreStep(self, prestep, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if prestep is not None:
 *             if args  is None: args  = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setPreStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":538
 *             CHKERR( TSSetPreStep(self.ts, NULL) )
 * 
 *     def getPreStep(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__prestep__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_141getPreStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_140getPreStep[] = "TS.getPreStep(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_141getPreStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPreStep (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getPreStep", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getPreStep", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_140getPreStep(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_140getPreStep(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getPreStep", 0);

  /* "PETSc/TS.pyx":539
 * 
 *     def getPreStep(self):
 *         return self.get_attr('__prestep__')             # <<<<<<<<<<<<<<
 * 
 *     def setPostStep(self, poststep, args=None, kargs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__prestep__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":538
 *             CHKERR( TSSetPreStep(self.ts, NULL) )
 * 
 *     def getPreStep(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__prestep__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getPreStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":541
 *         return self.get_attr('__prestep__')
 * 
 *     def setPostStep(self, poststep, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if poststep is not None:
 *             if args  is None: args  = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_143setPostStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_142setPostStep[] = "TS.setPostStep(self, poststep, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_143setPostStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_poststep = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPostStep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_poststep,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_poststep)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setPostStep") < 0)) __PYX_ERR(37, 541, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_poststep = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPostStep", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 541, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setPostStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_142setPostStep(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_poststep, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_142setPostStep(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_poststep, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setPostStep", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TS.pyx":542
 * 
 *     def setPostStep(self, poststep, args=None, kargs=None):
 *         if poststep is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_poststep != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/TS.pyx":543
 *     def setPostStep(self, poststep, args=None, kargs=None):
 *         if poststep is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (poststep, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/TS.pyx":544
 *         if poststep is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (poststep, args, kargs)
 *             self.set_attr('__poststep__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 544, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/TS.pyx":545
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (poststep, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__poststep__', context)
 *             CHKERR( TSSetPostStep(self.ts, TS_PostStep) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 545, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_poststep);
    __Pyx_GIVEREF(__pyx_v_poststep);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_poststep);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/TS.pyx":546
 *             if kargs is None: kargs = {}
 *             context = (poststep, args, kargs)
 *             self.set_attr('__poststep__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( TSSetPostStep(self.ts, TS_PostStep) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__poststep__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/TS.pyx":547
 *             context = (poststep, args, kargs)
 *             self.set_attr('__poststep__', context)
 *             CHKERR( TSSetPostStep(self.ts, TS_PostStep) )             # <<<<<<<<<<<<<<
 *         else:
 *             self.set_attr('__poststep__', None)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetPostStep(__pyx_v_self->ts, __pyx_f_8petsc4py_5PETSc_TS_PostStep)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(37, 547, __pyx_L1_error)

    /* "PETSc/TS.pyx":542
 * 
 *     def setPostStep(self, poststep, args=None, kargs=None):
 *         if poststep is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/TS.pyx":549
 *             CHKERR( TSSetPostStep(self.ts, TS_PostStep) )
 *         else:
 *             self.set_attr('__poststep__', None)             # <<<<<<<<<<<<<<
 *             CHKERR( TSSetPostStep(self.ts, NULL) )
 * 
 */
  /*else*/ {
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__poststep__"), Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/TS.pyx":550
 *         else:
 *             self.set_attr('__poststep__', None)
 *             CHKERR( TSSetPostStep(self.ts, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def getPostStep(self):
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetPostStep(__pyx_v_self->ts, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(37, 550, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/TS.pyx":541
 *         return self.get_attr('__prestep__')
 * 
 *     def setPostStep(self, poststep, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if poststep is not None:
 *             if args  is None: args  = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setPostStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":552
 *             CHKERR( TSSetPostStep(self.ts, NULL) )
 * 
 *     def getPostStep(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__poststep__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_145getPostStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_144getPostStep[] = "TS.getPostStep(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_145getPostStep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPostStep (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getPostStep", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getPostStep", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_144getPostStep(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_144getPostStep(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getPostStep", 0);

  /* "PETSc/TS.pyx":553
 * 
 *     def getPostStep(self):
 *         return self.get_attr('__poststep__')             # <<<<<<<<<<<<<<
 * 
 *     def setUp(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__poststep__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":552
 *             CHKERR( TSSetPostStep(self.ts, NULL) )
 * 
 *     def getPostStep(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__poststep__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getPostStep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":555
 *         return self.get_attr('__poststep__')
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetUp(self.ts) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_147setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_146setUp[] = "TS.setUp(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_147setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUp (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUp", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUp", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_146setUp(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_146setUp(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUp", 0);

  /* "PETSc/TS.pyx":556
 * 
 *     def setUp(self):
 *         CHKERR( TSSetUp(self.ts) )             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetUp(__pyx_v_self->ts)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 556, __pyx_L1_error)

  /* "PETSc/TS.pyx":555
 *         return self.get_attr('__poststep__')
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetUp(self.ts) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":558
 *         CHKERR( TSSetUp(self.ts) )
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         CHKERR( TSReset(self.ts) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_149reset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_148reset[] = "TS.reset(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_149reset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("reset", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "reset", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_148reset(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_148reset(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "PETSc/TS.pyx":559
 * 
 *     def reset(self):
 *         CHKERR( TSReset(self.ts) )             # <<<<<<<<<<<<<<
 * 
 *     def step(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSReset(__pyx_v_self->ts)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 559, __pyx_L1_error)

  /* "PETSc/TS.pyx":558
 *         CHKERR( TSSetUp(self.ts) )
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         CHKERR( TSReset(self.ts) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":561
 *         CHKERR( TSReset(self.ts) )
 * 
 *     def step(self):             # <<<<<<<<<<<<<<
 *         CHKERR( TSStep(self.ts) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_151step(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_150step[] = "TS.step(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_151step(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("step (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("step", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "step", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_150step(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_150step(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("step", 0);

  /* "PETSc/TS.pyx":562
 * 
 *     def step(self):
 *         CHKERR( TSStep(self.ts) )             # <<<<<<<<<<<<<<
 * 
 *     def rollBack(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSStep(__pyx_v_self->ts)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 562, __pyx_L1_error)

  /* "PETSc/TS.pyx":561
 *         CHKERR( TSReset(self.ts) )
 * 
 *     def step(self):             # <<<<<<<<<<<<<<
 *         CHKERR( TSStep(self.ts) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.step", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":564
 *         CHKERR( TSStep(self.ts) )
 * 
 *     def rollBack(self):             # <<<<<<<<<<<<<<
 *         CHKERR( TSRollBack(self.ts) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_153rollBack(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_152rollBack[] = "TS.rollBack(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_153rollBack(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rollBack (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("rollBack", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "rollBack", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_152rollBack(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_152rollBack(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("rollBack", 0);

  /* "PETSc/TS.pyx":565
 * 
 *     def rollBack(self):
 *         CHKERR( TSRollBack(self.ts) )             # <<<<<<<<<<<<<<
 * 
 *     def solve(self, Vec u not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSRollBack(__pyx_v_self->ts)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 565, __pyx_L1_error)

  /* "PETSc/TS.pyx":564
 *         CHKERR( TSStep(self.ts) )
 * 
 *     def rollBack(self):             # <<<<<<<<<<<<<<
 *         CHKERR( TSRollBack(self.ts) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.rollBack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":567
 *         CHKERR( TSRollBack(self.ts) )
 * 
 *     def solve(self, Vec u not None):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSolve(self.ts, u.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_155solve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_154solve[] = "TS.solve(self, Vec u)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_155solve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_u = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_u,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);
        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_u)) != 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, "solve") < 0)) __PYX_ERR(37, 567, __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_u = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solve", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 567, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "u", 0))) __PYX_ERR(37, 567, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_154solve(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_u);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_154solve(struct PyPetscTSObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_u) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("solve", 0);

  /* "PETSc/TS.pyx":568
 * 
 *     def solve(self, Vec u not None):
 *         CHKERR( TSSolve(self.ts, u.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def interpolate(self, t, Vec u not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSolve(__pyx_v_self->ts, __pyx_v_u->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 568, __pyx_L1_error)

  /* "PETSc/TS.pyx":567
 *         CHKERR( TSRollBack(self.ts) )
 * 
 *     def solve(self, Vec u not None):             # <<<<<<<<<<<<<<
 *         CHKERR( TSSolve(self.ts, u.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":570
 *         CHKERR( TSSolve(self.ts, u.vec) )
 * 
 *     def interpolate(self, t, Vec u not None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(t)
 *         CHKERR( TSInterpolate(self.ts, rval, u.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_157interpolate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_156interpolate[] = "TS.interpolate(self, t, Vec u)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_157interpolate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  struct PyPetscVecObject *__pyx_v_u = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("interpolate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_u,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_u)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("interpolate", 1, 2, 2, 1); __PYX_ERR(37, 570, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "interpolate") < 0)) __PYX_ERR(37, 570, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_t = values[0];
    __pyx_v_u = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("interpolate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 570, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.interpolate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "u", 0))) __PYX_ERR(37, 570, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_156interpolate(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_t, __pyx_v_u);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_156interpolate(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_t, struct PyPetscVecObject *__pyx_v_u) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("interpolate", 0);

  /* "PETSc/TS.pyx":571
 * 
 *     def interpolate(self, t, Vec u not None):
 *         cdef PetscReal rval = asReal(t)             # <<<<<<<<<<<<<<
 *         CHKERR( TSInterpolate(self.ts, rval, u.vec) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_t); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 571, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/TS.pyx":572
 *     def interpolate(self, t, Vec u not None):
 *         cdef PetscReal rval = asReal(t)
 *         CHKERR( TSInterpolate(self.ts, rval, u.vec) )             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSInterpolate(__pyx_v_self->ts, __pyx_v_rval, __pyx_v_u->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 572, __pyx_L1_error)

  /* "PETSc/TS.pyx":570
 *         CHKERR( TSSolve(self.ts, u.vec) )
 * 
 *     def interpolate(self, t, Vec u not None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(t)
 *         CHKERR( TSInterpolate(self.ts, rval, u.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.interpolate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":577
 *     # --- Python ---
 * 
 *     def createPython(self, context=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscTS newts = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_159createPython(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_158createPython[] = "TS.createPython(self, context=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_159createPython(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createPython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_comm,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createPython") < 0)) __PYX_ERR(37, 577, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_context = values[0];
    __pyx_v_comm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createPython", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 577, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.createPython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_158createPython(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_context, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_158createPython(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  TS __pyx_v_newts;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createPython", 0);

  /* "PETSc/TS.pyx":578
 * 
 *     def createPython(self, context=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscTS newts = NULL
 *         CHKERR( TSCreate(ccomm, &newts) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(37, 578, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/TS.pyx":579
 *     def createPython(self, context=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscTS newts = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( TSCreate(ccomm, &newts) )
 *         PetscCLEAR(self.obj); self.ts = newts
 */
  __pyx_v_newts = NULL;

  /* "PETSc/TS.pyx":580
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscTS newts = NULL
 *         CHKERR( TSCreate(ccomm, &newts) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.ts = newts
 *         CHKERR( TSSetType(self.ts, TSPYTHON) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSCreate(__pyx_v_ccomm, (&__pyx_v_newts))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 580, __pyx_L1_error)

  /* "PETSc/TS.pyx":581
 *         cdef PetscTS newts = NULL
 *         CHKERR( TSCreate(ccomm, &newts) )
 *         PetscCLEAR(self.obj); self.ts = newts             # <<<<<<<<<<<<<<
 *         CHKERR( TSSetType(self.ts, TSPYTHON) )
 *         CHKERR( TSPythonSetContext(self.ts, <void*>context) )
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->ts = __pyx_v_newts;

  /* "PETSc/TS.pyx":582
 *         CHKERR( TSCreate(ccomm, &newts) )
 *         PetscCLEAR(self.obj); self.ts = newts
 *         CHKERR( TSSetType(self.ts, TSPYTHON) )             # <<<<<<<<<<<<<<
 *         CHKERR( TSPythonSetContext(self.ts, <void*>context) )
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSSetType(__pyx_v_self->ts, TSPYTHON)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 582, __pyx_L1_error)

  /* "PETSc/TS.pyx":583
 *         PetscCLEAR(self.obj); self.ts = newts
 *         CHKERR( TSSetType(self.ts, TSPYTHON) )
 *         CHKERR( TSPythonSetContext(self.ts, <void*>context) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSPythonSetContext(__pyx_v_self->ts, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 583, __pyx_L1_error)

  /* "PETSc/TS.pyx":584
 *         CHKERR( TSSetType(self.ts, TSPYTHON) )
 *         CHKERR( TSPythonSetContext(self.ts, <void*>context) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setPythonContext(self, context):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/TS.pyx":577
 *     # --- Python ---
 * 
 *     def createPython(self, context=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscTS newts = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.createPython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":586
 *         return self
 * 
 *     def setPythonContext(self, context):             # <<<<<<<<<<<<<<
 *         CHKERR( TSPythonSetContext(self.ts, <void*>context) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_161setPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_160setPythonContext[] = "TS.setPythonContext(self, context)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_161setPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPythonContext (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,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);
        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_context)) != 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, "setPythonContext") < 0)) __PYX_ERR(37, 586, __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_context = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPythonContext", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 586, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_160setPythonContext(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_context);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_160setPythonContext(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_context) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setPythonContext", 0);

  /* "PETSc/TS.pyx":587
 * 
 *     def setPythonContext(self, context):
 *         CHKERR( TSPythonSetContext(self.ts, <void*>context) )             # <<<<<<<<<<<<<<
 * 
 *     def getPythonContext(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSPythonSetContext(__pyx_v_self->ts, ((void *)__pyx_v_context))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 587, __pyx_L1_error)

  /* "PETSc/TS.pyx":586
 *         return self
 * 
 *     def setPythonContext(self, context):             # <<<<<<<<<<<<<<
 *         CHKERR( TSPythonSetContext(self.ts, <void*>context) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":589
 *         CHKERR( TSPythonSetContext(self.ts, <void*>context) )
 * 
 *     def getPythonContext(self):             # <<<<<<<<<<<<<<
 *         cdef void *context = NULL
 *         CHKERR( TSPythonGetContext(self.ts, &context) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_163getPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_162getPythonContext[] = "TS.getPythonContext(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_163getPythonContext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPythonContext (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getPythonContext", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getPythonContext", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_162getPythonContext(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_162getPythonContext(struct PyPetscTSObject *__pyx_v_self) {
  void *__pyx_v_context;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getPythonContext", 0);

  /* "PETSc/TS.pyx":590
 * 
 *     def getPythonContext(self):
 *         cdef void *context = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( TSPythonGetContext(self.ts, &context) )
 *         if context == NULL: return None
 */
  __pyx_v_context = NULL;

  /* "PETSc/TS.pyx":591
 *     def getPythonContext(self):
 *         cdef void *context = NULL
 *         CHKERR( TSPythonGetContext(self.ts, &context) )             # <<<<<<<<<<<<<<
 *         if context == NULL: return None
 *         else: return <object> context
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSPythonGetContext(__pyx_v_self->ts, (&__pyx_v_context))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 591, __pyx_L1_error)

  /* "PETSc/TS.pyx":592
 *         cdef void *context = NULL
 *         CHKERR( TSPythonGetContext(self.ts, &context) )
 *         if context == NULL: return None             # <<<<<<<<<<<<<<
 *         else: return <object> context
 * 
 */
  __pyx_t_2 = ((__pyx_v_context == NULL) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "PETSc/TS.pyx":593
 *         CHKERR( TSPythonGetContext(self.ts, &context) )
 *         if context == NULL: return None
 *         else: return <object> context             # <<<<<<<<<<<<<<
 * 
 *     def setPythonType(self, py_type):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_context));
    __pyx_r = ((PyObject *)__pyx_v_context);
    goto __pyx_L0;
  }

  /* "PETSc/TS.pyx":589
 *         CHKERR( TSPythonSetContext(self.ts, <void*>context) )
 * 
 *     def getPythonContext(self):             # <<<<<<<<<<<<<<
 *         cdef void *context = NULL
 *         CHKERR( TSPythonGetContext(self.ts, &context) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getPythonContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":595
 *         else: return <object> context
 * 
 *     def setPythonType(self, py_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_165setPythonType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_164setPythonType[] = "TS.setPythonType(self, py_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_165setPythonType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_py_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPythonType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_py_type,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);
        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_py_type)) != 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, "setPythonType") < 0)) __PYX_ERR(37, 595, __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_py_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPythonType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 595, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setPythonType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_164setPythonType(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_py_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_164setPythonType(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_py_type) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setPythonType", 0);
  __Pyx_INCREF(__pyx_v_py_type);

  /* "PETSc/TS.pyx":596
 * 
 *     def setPythonType(self, py_type):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         py_type = str2bytes(py_type, &cval)
 *         CHKERR( TSPythonSetType(self.ts, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/TS.pyx":597
 *     def setPythonType(self, py_type):
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( TSPythonSetType(self.ts, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_py_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_py_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":598
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 *         CHKERR( TSPythonSetType(self.ts, cval) )             # <<<<<<<<<<<<<<
 * 
 *     # --- Theta ---
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSPythonSetType(__pyx_v_self->ts, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 598, __pyx_L1_error)

  /* "PETSc/TS.pyx":595
 *         else: return <object> context
 * 
 *     def setPythonType(self, py_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         py_type = str2bytes(py_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setPythonType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":602
 *     # --- Theta ---
 * 
 *     def setTheta(self, theta):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(theta)
 *         CHKERR( TSThetaSetTheta(self.ts, rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_167setTheta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_166setTheta[] = "TS.setTheta(self, theta)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_167setTheta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_theta = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTheta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,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);
        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;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setTheta") < 0)) __PYX_ERR(37, 602, __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_theta = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTheta", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 602, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setTheta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_166setTheta(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_theta);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_166setTheta(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_theta) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setTheta", 0);

  /* "PETSc/TS.pyx":603
 * 
 *     def setTheta(self, theta):
 *         cdef PetscReal rval = asReal(theta)             # <<<<<<<<<<<<<<
 *         CHKERR( TSThetaSetTheta(self.ts, rval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_theta); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 603, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/TS.pyx":604
 *     def setTheta(self, theta):
 *         cdef PetscReal rval = asReal(theta)
 *         CHKERR( TSThetaSetTheta(self.ts, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def getTheta(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSThetaSetTheta(__pyx_v_self->ts, __pyx_v_rval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 604, __pyx_L1_error)

  /* "PETSc/TS.pyx":602
 *     # --- Theta ---
 * 
 *     def setTheta(self, theta):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(theta)
 *         CHKERR( TSThetaSetTheta(self.ts, rval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setTheta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":606
 *         CHKERR( TSThetaSetTheta(self.ts, rval) )
 * 
 *     def getTheta(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSThetaGetTheta(self.ts, &rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_169getTheta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_168getTheta[] = "TS.getTheta(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_169getTheta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTheta (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getTheta", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getTheta", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_168getTheta(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_168getTheta(struct PyPetscTSObject *__pyx_v_self) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getTheta", 0);

  /* "PETSc/TS.pyx":607
 * 
 *     def getTheta(self):
 *         cdef PetscReal rval = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSThetaGetTheta(self.ts, &rval) )
 *         return toReal(rval)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/TS.pyx":608
 *     def getTheta(self):
 *         cdef PetscReal rval = 0
 *         CHKERR( TSThetaGetTheta(self.ts, &rval) )             # <<<<<<<<<<<<<<
 *         return toReal(rval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSThetaGetTheta(__pyx_v_self->ts, (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 608, __pyx_L1_error)

  /* "PETSc/TS.pyx":609
 *         cdef PetscReal rval = 0
 *         CHKERR( TSThetaGetTheta(self.ts, &rval) )
 *         return toReal(rval)             # <<<<<<<<<<<<<<
 * 
 *     def setThetaEndpoint(self, flag=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":606
 *         CHKERR( TSThetaSetTheta(self.ts, rval) )
 * 
 *     def getTheta(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0
 *         CHKERR( TSThetaGetTheta(self.ts, &rval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getTheta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":611
 *         return toReal(rval)
 * 
 *     def setThetaEndpoint(self, flag=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = flag
 *         CHKERR( TSThetaSetEndpoint(self.ts, bval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_171setThetaEndpoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_170setThetaEndpoint[] = "TS.setThetaEndpoint(self, flag=True)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_171setThetaEndpoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setThetaEndpoint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setThetaEndpoint") < 0)) __PYX_ERR(37, 611, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setThetaEndpoint", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 611, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setThetaEndpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_170setThetaEndpoint(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_170setThetaEndpoint(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_flag) {
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setThetaEndpoint", 0);

  /* "PETSc/TS.pyx":612
 * 
 *     def setThetaEndpoint(self, flag=True):
 *         cdef PetscBool bval = flag             # <<<<<<<<<<<<<<
 *         CHKERR( TSThetaSetEndpoint(self.ts, bval) )
 * 
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_flag)); if (unlikely(PyErr_Occurred())) __PYX_ERR(37, 612, __pyx_L1_error)
  __pyx_v_bval = __pyx_t_1;

  /* "PETSc/TS.pyx":613
 *     def setThetaEndpoint(self, flag=True):
 *         cdef PetscBool bval = flag
 *         CHKERR( TSThetaSetEndpoint(self.ts, bval) )             # <<<<<<<<<<<<<<
 * 
 *     def getThetaEndpoint(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSThetaSetEndpoint(__pyx_v_self->ts, __pyx_v_bval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 613, __pyx_L1_error)

  /* "PETSc/TS.pyx":611
 *         return toReal(rval)
 * 
 *     def setThetaEndpoint(self, flag=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = flag
 *         CHKERR( TSThetaSetEndpoint(self.ts, bval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setThetaEndpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":615
 *         CHKERR( TSThetaSetEndpoint(self.ts, bval) )
 * 
 *     def getThetaEndpoint(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( TSThetaGetEndpoint(self.ts, &bval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_173getThetaEndpoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_172getThetaEndpoint[] = "TS.getThetaEndpoint(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_173getThetaEndpoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getThetaEndpoint (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getThetaEndpoint", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getThetaEndpoint", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_172getThetaEndpoint(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_172getThetaEndpoint(struct PyPetscTSObject *__pyx_v_self) {
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getThetaEndpoint", 0);

  /* "PETSc/TS.pyx":616
 * 
 *     def getThetaEndpoint(self):
 *         cdef PetscBool bval = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( TSThetaGetEndpoint(self.ts, &bval) )
 *         return <bint> bval
 */
  __pyx_v_bval = PETSC_FALSE;

  /* "PETSc/TS.pyx":617
 *     def getThetaEndpoint(self):
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( TSThetaGetEndpoint(self.ts, &bval) )             # <<<<<<<<<<<<<<
 *         return <bint> bval
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSThetaGetEndpoint(__pyx_v_self->ts, (&__pyx_v_bval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 617, __pyx_L1_error)

  /* "PETSc/TS.pyx":618
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( TSThetaGetEndpoint(self.ts, &bval) )
 *         return <bint> bval             # <<<<<<<<<<<<<<
 * 
 *     # --- Alpha ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_bval); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":615
 *         CHKERR( TSThetaSetEndpoint(self.ts, bval) )
 * 
 *     def getThetaEndpoint(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = PETSC_FALSE
 *         CHKERR( TSThetaGetEndpoint(self.ts, &bval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.getThetaEndpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":622
 *     # --- Alpha ---
 * 
 *     def setAlphaRadius(self, radius):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(radius)
 *         CHKERR( TSAlphaSetRadius(self.ts, rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_175setAlphaRadius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_174setAlphaRadius[] = "TS.setAlphaRadius(self, radius)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_175setAlphaRadius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_radius = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setAlphaRadius (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_radius,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);
        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_radius)) != 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, "setAlphaRadius") < 0)) __PYX_ERR(37, 622, __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_radius = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setAlphaRadius", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 622, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setAlphaRadius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_174setAlphaRadius(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_radius);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_174setAlphaRadius(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_radius) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setAlphaRadius", 0);

  /* "PETSc/TS.pyx":623
 * 
 *     def setAlphaRadius(self, radius):
 *         cdef PetscReal rval = asReal(radius)             # <<<<<<<<<<<<<<
 *         CHKERR( TSAlphaSetRadius(self.ts, rval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_radius); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 623, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/TS.pyx":624
 *     def setAlphaRadius(self, radius):
 *         cdef PetscReal rval = asReal(radius)
 *         CHKERR( TSAlphaSetRadius(self.ts, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def setAlphaParams(self, alpha_m=None,alpha_f=None, gamma=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSAlphaSetRadius(__pyx_v_self->ts, __pyx_v_rval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(37, 624, __pyx_L1_error)

  /* "PETSc/TS.pyx":622
 *     # --- Alpha ---
 * 
 *     def setAlphaRadius(self, radius):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(radius)
 *         CHKERR( TSAlphaSetRadius(self.ts, rval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setAlphaRadius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":626
 *         CHKERR( TSAlphaSetRadius(self.ts, rval) )
 * 
 *     def setAlphaParams(self, alpha_m=None,alpha_f=None, gamma=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval1 = 0, rval2 = 0, rval3 = 0
 *         try: CHKERR( TSAlphaGetParams(self.ts, &rval1, &rval2, &rval3) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_177setAlphaParams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_176setAlphaParams[] = "TS.setAlphaParams(self, alpha_m=None, alpha_f=None, gamma=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_177setAlphaParams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha_m = 0;
  PyObject *__pyx_v_alpha_f = 0;
  PyObject *__pyx_v_gamma = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setAlphaParams (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alpha_m,&__pyx_n_s_alpha_f,&__pyx_n_s_gamma,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha_m);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha_f);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gamma);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setAlphaParams") < 0)) __PYX_ERR(37, 626, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_alpha_m = values[0];
    __pyx_v_alpha_f = values[1];
    __pyx_v_gamma = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setAlphaParams", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(37, 626, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setAlphaParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_176setAlphaParams(((struct PyPetscTSObject *)__pyx_v_self), __pyx_v_alpha_m, __pyx_v_alpha_f, __pyx_v_gamma);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_176setAlphaParams(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_alpha_m, PyObject *__pyx_v_alpha_f, PyObject *__pyx_v_gamma) {
  PetscReal __pyx_v_rval1;
  PetscReal __pyx_v_rval2;
  PetscReal __pyx_v_rval3;
  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;
  int __pyx_t_5;
  int __pyx_t_6;
  PetscReal __pyx_t_7;
  __Pyx_RefNannySetupContext("setAlphaParams", 0);

  /* "PETSc/TS.pyx":627
 * 
 *     def setAlphaParams(self, alpha_m=None,alpha_f=None, gamma=None):
 *         cdef PetscReal rval1 = 0, rval2 = 0, rval3 = 0             # <<<<<<<<<<<<<<
 *         try: CHKERR( TSAlphaGetParams(self.ts, &rval1, &rval2, &rval3) )
 *         except PetscError: pass
 */
  __pyx_v_rval1 = 0.0;
  __pyx_v_rval2 = 0.0;
  __pyx_v_rval3 = 0.0;

  /* "PETSc/TS.pyx":628
 *     def setAlphaParams(self, alpha_m=None,alpha_f=None, gamma=None):
 *         cdef PetscReal rval1 = 0, rval2 = 0, rval3 = 0
 *         try: CHKERR( TSAlphaGetParams(self.ts, &rval1, &rval2, &rval3) )             # <<<<<<<<<<<<<<
 *         except PetscError: pass
 *         if alpha_m is not None: rval1 = asReal(alpha_m)
 */
  {
    __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:*/ {
      __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSAlphaGetParams(__pyx_v_self->ts, (&__pyx_v_rval1), (&__pyx_v_rval2), (&__pyx_v_rval3))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(37, 628, __pyx_L3_error)
    }
    __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_L10_try_end;
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign

    /* "PETSc/TS.pyx":629
 *         cdef PetscReal rval1 = 0, rval2 = 0, rval3 = 0
 *         try: CHKERR( TSAlphaGetParams(self.ts, &rval1, &rval2, &rval3) )
 *         except PetscError: pass             # <<<<<<<<<<<<<<
 *         if alpha_m is not None: rval1 = asReal(alpha_m)
 *         if alpha_f is not None: rval2 = asReal(alpha_f)
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_v_8petsc4py_5PETSc_PetscError);
    if (__pyx_t_4) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "PETSc/TS.pyx":628
 *     def setAlphaParams(self, alpha_m=None,alpha_f=None, gamma=None):
 *         cdef PetscReal rval1 = 0, rval2 = 0, rval3 = 0
 *         try: CHKERR( TSAlphaGetParams(self.ts, &rval1, &rval2, &rval3) )             # <<<<<<<<<<<<<<
 *         except PetscError: pass
 *         if alpha_m is not None: rval1 = asReal(alpha_m)
 */
    __Pyx_PyThreadState_assign
    __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_L4_exception_handled:;
    __Pyx_PyThreadState_assign
    __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);
    __pyx_L10_try_end:;
  }

  /* "PETSc/TS.pyx":630
 *         try: CHKERR( TSAlphaGetParams(self.ts, &rval1, &rval2, &rval3) )
 *         except PetscError: pass
 *         if alpha_m is not None: rval1 = asReal(alpha_m)             # <<<<<<<<<<<<<<
 *         if alpha_f is not None: rval2 = asReal(alpha_f)
 *         if gamma   is not None: rval3 = asReal(gamma)
 */
  __pyx_t_5 = (__pyx_v_alpha_m != Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_alpha_m); if (unlikely(__pyx_t_7 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 630, __pyx_L1_error)
    __pyx_v_rval1 = __pyx_t_7;
  }

  /* "PETSc/TS.pyx":631
 *         except PetscError: pass
 *         if alpha_m is not None: rval1 = asReal(alpha_m)
 *         if alpha_f is not None: rval2 = asReal(alpha_f)             # <<<<<<<<<<<<<<
 *         if gamma   is not None: rval3 = asReal(gamma)
 *         CHKERR( TSAlphaSetParams(self.ts,  rval1,  rval2,  rval3) )
 */
  __pyx_t_6 = (__pyx_v_alpha_f != Py_None);
  __pyx_t_5 = (__pyx_t_6 != 0);
  if (__pyx_t_5) {
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_alpha_f); if (unlikely(__pyx_t_7 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 631, __pyx_L1_error)
    __pyx_v_rval2 = __pyx_t_7;
  }

  /* "PETSc/TS.pyx":632
 *         if alpha_m is not None: rval1 = asReal(alpha_m)
 *         if alpha_f is not None: rval2 = asReal(alpha_f)
 *         if gamma   is not None: rval3 = asReal(gamma)             # <<<<<<<<<<<<<<
 *         CHKERR( TSAlphaSetParams(self.ts,  rval1,  rval2,  rval3) )
 * 
 */
  __pyx_t_5 = (__pyx_v_gamma != Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_gamma); if (unlikely(__pyx_t_7 == -1.0 && PyErr_Occurred())) __PYX_ERR(37, 632, __pyx_L1_error)
    __pyx_v_rval3 = __pyx_t_7;
  }

  /* "PETSc/TS.pyx":633
 *         if alpha_f is not None: rval2 = asReal(alpha_f)
 *         if gamma   is not None: rval3 = asReal(gamma)
 *         CHKERR( TSAlphaSetParams(self.ts,  rval1,  rval2,  rval3) )             # <<<<<<<<<<<<<<
 * 
 *     def getAlphaParams(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSAlphaSetParams(__pyx_v_self->ts, __pyx_v_rval1, __pyx_v_rval2, __pyx_v_rval3)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(37, 633, __pyx_L1_error)

  /* "PETSc/TS.pyx":626
 *         CHKERR( TSAlphaSetRadius(self.ts, rval) )
 * 
 *     def setAlphaParams(self, alpha_m=None,alpha_f=None, gamma=None):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval1 = 0, rval2 = 0, rval3 = 0
 *         try: CHKERR( TSAlphaGetParams(self.ts, &rval1, &rval2, &rval3) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TS.setAlphaParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":635
 *         CHKERR( TSAlphaSetParams(self.ts,  rval1,  rval2,  rval3) )
 * 
 *     def getAlphaParams(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval1 = 0, rval2 = 0, rval3 = 0
 *         CHKERR( TSAlphaGetParams(self.ts, &rval1, &rval2, &rval3) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_179getAlphaParams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2TS_178getAlphaParams[] = "TS.getAlphaParams(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_179getAlphaParams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getAlphaParams (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getAlphaParams", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getAlphaParams", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_178getAlphaParams(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_178getAlphaParams(struct PyPetscTSObject *__pyx_v_self) {
  PetscReal __pyx_v_rval1;
  PetscReal __pyx_v_rval2;
  PetscReal __pyx_v_rval3;
  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;
  __Pyx_RefNannySetupContext("getAlphaParams", 0);

  /* "PETSc/TS.pyx":636
 * 
 *     def getAlphaParams(self):
 *         cdef PetscReal rval1 = 0, rval2 = 0, rval3 = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TSAlphaGetParams(self.ts, &rval1, &rval2, &rval3) )
 *         return (toReal(rval1), toReal(rval2), toReal(rval3))
 */
  __pyx_v_rval1 = 0.0;
  __pyx_v_rval2 = 0.0;
  __pyx_v_rval3 = 0.0;

  /* "PETSc/TS.pyx":637
 *     def getAlphaParams(self):
 *         cdef PetscReal rval1 = 0, rval2 = 0, rval3 = 0
 *         CHKERR( TSAlphaGetParams(self.ts, &rval1, &rval2, &rval3) )             # <<<<<<<<<<<<<<
 *         return (toReal(rval1), toReal(rval2), toReal(rval3))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TSAlphaGetParams(__pyx_v_self->ts, (&__pyx_v_rval1), (&__pyx_v_rval2), (&__pyx_v_rval3))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(37, 637, __pyx_L1_error)

  /* "PETSc/TS.pyx":638
 *         cdef PetscReal rval1 = 0, rval2 = 0, rval3 = 0
 *         CHKERR( TSAlphaGetParams(self.ts, &rval1, &rval2, &rval3) )
 *         return (toReal(rval1), toReal(rval2), toReal(rval3))             # <<<<<<<<<<<<<<
 * 
 *     # --- application context ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval1); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval2); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval3); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(37, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":635
 *         CHKERR( TSAlphaSetParams(self.ts,  rval1,  rval2,  rval3) )
 * 
 *     def getAlphaParams(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval1 = 0, rval2 = 0, rval3 = 0
 *         CHKERR( TSAlphaGetParams(self.ts, &rval1, &rval2, &rval3) )
 */

  /* 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("petsc4py.PETSc.TS.getAlphaParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":643
 * 
 *     property appctx:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getAppCtx()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_6appctx_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_6appctx_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_6appctx___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_6appctx___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":644
 *     property appctx:
 *         def __get__(self):
 *             return self.getAppCtx()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setAppCtx(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getAppCtx); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 644, __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(37, 644, __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;

  /* "PETSc/TS.pyx":643
 * 
 *     property appctx:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getAppCtx()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.appctx.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":645
 *         def __get__(self):
 *             return self.getAppCtx()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setAppCtx(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_6appctx_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_6appctx_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_6appctx_2__set__(((struct PyPetscTSObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS_6appctx_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TS.pyx":646
 *             return self.getAppCtx()
 *         def __set__(self, value):
 *             self.setAppCtx(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- discretization space ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setAppCtx); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 646, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 646, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":645
 *         def __get__(self):
 *             return self.getAppCtx()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setAppCtx(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.appctx.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":651
 * 
 *     property dm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getDM()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_2dm_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_2dm_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_2dm___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_2dm___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":652
 *     property dm:
 *         def __get__(self):
 *             return self.getDM()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setDM(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getDM); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 652, __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(37, 652, __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;

  /* "PETSc/TS.pyx":651
 * 
 *     property dm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getDM()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.dm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":653
 *         def __get__(self):
 *             return self.getDM()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setDM(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_2dm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_2dm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_2dm_2__set__(((struct PyPetscTSObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS_2dm_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TS.pyx":654
 *             return self.getDM()
 *         def __set__(self, value):
 *             self.setDM(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setDM); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 654, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 654, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":653
 *         def __get__(self):
 *             return self.getDM()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setDM(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.dm.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":659
 * 
 *     property problem_type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getProblemType()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_12problem_type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_12problem_type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_12problem_type___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_12problem_type___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":660
 *     property problem_type:
 *         def __get__(self):
 *             return self.getProblemType()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setProblemType(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getProblemType); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 660, __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(37, 660, __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;

  /* "PETSc/TS.pyx":659
 * 
 *     property problem_type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getProblemType()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.problem_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":661
 *         def __get__(self):
 *             return self.getProblemType()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setProblemType(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_12problem_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_12problem_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_12problem_type_2__set__(((struct PyPetscTSObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS_12problem_type_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TS.pyx":662
 *             return self.getProblemType()
 *         def __set__(self, value):
 *             self.setProblemType(value)             # <<<<<<<<<<<<<<
 * 
 *     property equation_type:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setProblemType); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 662, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 662, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 662, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":661
 *         def __get__(self):
 *             return self.getProblemType()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setProblemType(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.problem_type.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":665
 * 
 *     property equation_type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getEquationType()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_13equation_type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_13equation_type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_13equation_type___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_13equation_type___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":666
 *     property equation_type:
 *         def __get__(self):
 *             return self.getEquationType()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setEquationType(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getEquationType); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 666, __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(37, 666, __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;

  /* "PETSc/TS.pyx":665
 * 
 *     property equation_type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getEquationType()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.equation_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":667
 *         def __get__(self):
 *             return self.getEquationType()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setEquationType(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_13equation_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_13equation_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_13equation_type_2__set__(((struct PyPetscTSObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS_13equation_type_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TS.pyx":668
 *             return self.getEquationType()
 *         def __set__(self, value):
 *             self.setEquationType(value)             # <<<<<<<<<<<<<<
 * 
 *     property snes:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setEquationType); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 668, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 668, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":667
 *         def __get__(self):
 *             return self.getEquationType()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setEquationType(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.equation_type.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":671
 * 
 *     property snes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSNES()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_4snes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_4snes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_4snes___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_4snes___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":672
 *     property snes:
 *         def __get__(self):
 *             return self.getSNES()             # <<<<<<<<<<<<<<
 * 
 *     property ksp:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSNES); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 672, __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(37, 672, __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;

  /* "PETSc/TS.pyx":671
 * 
 *     property snes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSNES()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.snes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":675
 * 
 *     property ksp:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getKSP()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_3ksp_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_3ksp_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_3ksp___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_3ksp___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":676
 *     property ksp:
 *         def __get__(self):
 *             return self.getKSP()             # <<<<<<<<<<<<<<
 * 
 *     property vec_sol:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getKSP); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 676, __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(37, 676, __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;

  /* "PETSc/TS.pyx":675
 * 
 *     property ksp:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getKSP()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.ksp.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":679
 * 
 *     property vec_sol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolution()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_7vec_sol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_7vec_sol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_7vec_sol___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_7vec_sol___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":680
 *     property vec_sol:
 *         def __get__(self):
 *             return self.getSolution()             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSolution); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 680, __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(37, 680, __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;

  /* "PETSc/TS.pyx":679
 * 
 *     property vec_sol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolution()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.vec_sol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":685
 * 
 *     property time:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTime()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_4time_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_4time_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_4time___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_4time___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":686
 *     property time:
 *         def __get__(self):
 *             return self.getTime()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setTime(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getTime); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 686, __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(37, 686, __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;

  /* "PETSc/TS.pyx":685
 * 
 *     property time:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTime()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.time.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":687
 *         def __get__(self):
 *             return self.getTime()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTime(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_4time_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_4time_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_4time_2__set__(((struct PyPetscTSObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS_4time_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TS.pyx":688
 *             return self.getTime()
 *         def __set__(self, value):
 *             self.setTime(value)             # <<<<<<<<<<<<<<
 * 
 *     property time_step:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setTime); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 688, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 688, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":687
 *         def __get__(self):
 *             return self.getTime()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTime(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.time.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":691
 * 
 *     property time_step:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTimeStep()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_9time_step_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_9time_step_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_9time_step___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_9time_step___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":692
 *     property time_step:
 *         def __get__(self):
 *             return self.getTimeStep()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setTimeStep(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getTimeStep); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 692, __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(37, 692, __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;

  /* "PETSc/TS.pyx":691
 * 
 *     property time_step:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTimeStep()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.time_step.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":693
 *         def __get__(self):
 *             return self.getTimeStep()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTimeStep(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_9time_step_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_9time_step_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_9time_step_2__set__(((struct PyPetscTSObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS_9time_step_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TS.pyx":694
 *             return self.getTimeStep()
 *         def __set__(self, value):
 *             self.setTimeStep(value)             # <<<<<<<<<<<<<<
 * 
 *     property step_number:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setTimeStep); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 694, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 694, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":693
 *         def __get__(self):
 *             return self.getTimeStep()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTimeStep(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.time_step.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":697
 * 
 *     property step_number:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getStepNumber()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_11step_number_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_11step_number_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_11step_number___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_11step_number___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":698
 *     property step_number:
 *         def __get__(self):
 *             return self.getStepNumber()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setStepNumber(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getStepNumber); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 698, __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(37, 698, __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;

  /* "PETSc/TS.pyx":697
 * 
 *     property step_number:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getStepNumber()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.step_number.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":699
 *         def __get__(self):
 *             return self.getStepNumber()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setStepNumber(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_11step_number_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_11step_number_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_11step_number_2__set__(((struct PyPetscTSObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS_11step_number_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TS.pyx":700
 *             return self.getStepNumber()
 *         def __set__(self, value):
 *             self.setStepNumber(value)             # <<<<<<<<<<<<<<
 * 
 *     property max_time:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setStepNumber); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 700, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 700, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":699
 *         def __get__(self):
 *             return self.getStepNumber()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setStepNumber(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.step_number.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":703
 * 
 *     property max_time:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getMaxTime()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_8max_time_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_8max_time_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_8max_time___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_8max_time___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":704
 *     property max_time:
 *         def __get__(self):
 *             return self.getMaxTime()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setMaxTime(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getMaxTime); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 704, __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(37, 704, __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;

  /* "PETSc/TS.pyx":703
 * 
 *     property max_time:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getMaxTime()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.max_time.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":705
 *         def __get__(self):
 *             return self.getMaxTime()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setMaxTime(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_8max_time_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_8max_time_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_8max_time_2__set__(((struct PyPetscTSObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS_8max_time_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TS.pyx":706
 *             return self.getMaxTime()
 *         def __set__(self, value):
 *             self.setMaxTime(value)             # <<<<<<<<<<<<<<
 * 
 *     property max_steps:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setMaxTime); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 706, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 706, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":705
 *         def __get__(self):
 *             return self.getMaxTime()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setMaxTime(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.max_time.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":709
 * 
 *     property max_steps:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getMaxSteps()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_9max_steps_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_9max_steps_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_9max_steps___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_9max_steps___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":710
 *     property max_steps:
 *         def __get__(self):
 *             return self.getMaxSteps()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setMaxSteps(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getMaxSteps); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 710, __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(37, 710, __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;

  /* "PETSc/TS.pyx":709
 * 
 *     property max_steps:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getMaxSteps()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.max_steps.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":711
 *         def __get__(self):
 *             return self.getMaxSteps()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setMaxSteps(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_9max_steps_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_9max_steps_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_9max_steps_2__set__(((struct PyPetscTSObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS_9max_steps_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TS.pyx":712
 *             return self.getMaxSteps()
 *         def __set__(self, value):
 *             self.setMaxSteps(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- convergence ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setMaxSteps); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 712, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 712, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 712, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":711
 *         def __get__(self):
 *             return self.getMaxSteps()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setMaxSteps(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.max_steps.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":717
 * 
 *     property rtol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[0]
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_4rtol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_4rtol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_4rtol___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_4rtol___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":718
 *     property rtol:
 *         def __get__(self):
 *             return self.getTolerances()[0]             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setTolerances(rtol=value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 718, __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(37, 718, __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(37, 718, __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;

  /* "PETSc/TS.pyx":717
 * 
 *     property rtol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[0]
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.rtol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":719
 *         def __get__(self):
 *             return self.getTolerances()[0]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(rtol=value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_4rtol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_4rtol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_4rtol_2__set__(((struct PyPetscTSObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS_4rtol_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TS.pyx":720
 *             return self.getTolerances()[0]
 *         def __set__(self, value):
 *             self.setTolerances(rtol=value)             # <<<<<<<<<<<<<<
 * 
 *     property atol:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setTolerances); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_rtol, __pyx_v_value) < 0) __PYX_ERR(37, 720, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 720, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/TS.pyx":719
 *         def __get__(self):
 *             return self.getTolerances()[0]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(rtol=value)
 * 
 */

  /* 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("petsc4py.PETSc.TS.rtol.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":723
 * 
 *     property atol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[1]
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_4atol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_4atol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_4atol___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_4atol___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":724
 *     property atol:
 *         def __get__(self):
 *             return self.getTolerances()[1]             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setTolerances(atol=value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 724, __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(37, 724, __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, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 724, __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;

  /* "PETSc/TS.pyx":723
 * 
 *     property atol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getTolerances()[1]
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.atol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":725
 *         def __get__(self):
 *             return self.getTolerances()[1]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(atol=value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_4atol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_4atol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_4atol_2__set__(((struct PyPetscTSObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS_4atol_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TS.pyx":726
 *             return self.getTolerances()[1]
 *         def __set__(self, value):
 *             self.setTolerances(atol=value)             # <<<<<<<<<<<<<<
 * 
 *     property reason:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setTolerances); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_atol, __pyx_v_value) < 0) __PYX_ERR(37, 726, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 726, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/TS.pyx":725
 *         def __get__(self):
 *             return self.getTolerances()[1]
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setTolerances(atol=value)
 * 
 */

  /* 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("petsc4py.PETSc.TS.atol.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":729
 * 
 *     property reason:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConvergedReason()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_6reason_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_6reason_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_6reason___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_6reason___get__(struct PyPetscTSObject *__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);

  /* "PETSc/TS.pyx":730
 *     property reason:
 *         def __get__(self):
 *             return self.getConvergedReason()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setConvergedReason(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getConvergedReason); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(37, 730, __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(37, 730, __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;

  /* "PETSc/TS.pyx":729
 * 
 *     property reason:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConvergedReason()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.reason.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":731
 *         def __get__(self):
 *             return self.getConvergedReason()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setConvergedReason(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2TS_6reason_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2TS_6reason_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_6reason_2__set__(((struct PyPetscTSObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2TS_6reason_2__set__(struct PyPetscTSObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TS.pyx":732
 *             return self.getConvergedReason()
 *         def __set__(self, value):
 *             self.setConvergedReason(value)             # <<<<<<<<<<<<<<
 * 
 *     property iterating:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setConvergedReason); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 732, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 732, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TS.pyx":731
 *         def __get__(self):
 *             return self.getConvergedReason()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setConvergedReason(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.reason.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":735
 * 
 *     property iterating:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason == 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_9iterating_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_9iterating_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_9iterating___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_9iterating___get__(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/TS.pyx":736
 *     property iterating:
 *         def __get__(self):
 *             return self.reason == 0             # <<<<<<<<<<<<<<
 * 
 *     property converged:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reason); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 736, __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;

  /* "PETSc/TS.pyx":735
 * 
 *     property iterating:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason == 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.iterating.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":739
 * 
 *     property converged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason > 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_9converged_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_9converged_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_9converged___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_9converged___get__(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/TS.pyx":740
 *     property converged:
 *         def __get__(self):
 *             return self.reason > 0             # <<<<<<<<<<<<<<
 * 
 *     property diverged:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reason); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 740, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":739
 * 
 *     property converged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason > 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.converged.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TS.pyx":743
 * 
 *     property diverged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason < 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_8diverged_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_2TS_8diverged_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2TS_8diverged___get__(((struct PyPetscTSObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2TS_8diverged___get__(struct PyPetscTSObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/TS.pyx":744
 *     property diverged:
 *         def __get__(self):
 *             return self.reason < 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reason); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(37, 744, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TS.pyx":743
 * 
 *     property diverged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason < 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TS.diverged.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":62
 *     Reason = TAOConvergedReason
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.tao
 *         self.tao = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3TAO_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3TAO_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO___cinit__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3TAO___cinit__(struct PyPetscTAOObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/TAO.pyx":63
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.tao             # <<<<<<<<<<<<<<
 *         self.tao = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->tao));

  /* "PETSc/TAO.pyx":64
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.tao
 *         self.tao = NULL             # <<<<<<<<<<<<<<
 * 
 *     def view(self, Viewer viewer=None):
 */
  __pyx_v_self->tao = NULL;

  /* "PETSc/TAO.pyx":62
 *     Reason = TAOConvergedReason
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.tao
 *         self.tao = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":66
 *         self.tao = NULL
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_3view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_2view[] = "TAO.view(self, Viewer viewer=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_3view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(38, 66, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 66, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(38, 66, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_2view(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_viewer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_2view(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/TAO.pyx":69
 *         """
 *         """
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( TaoView(self.tao, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/TAO.pyx":70
 *         """
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( TaoView(self.tao, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":71
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( TaoView(self.tao, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoView(__pyx_v_self->tao, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 71, __pyx_L1_error)

  /* "PETSc/TAO.pyx":66
 *         self.tao = NULL
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":73
 *         CHKERR( TaoView(self.tao, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_5destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_4destroy[] = "TAO.destroy(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_5destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_4destroy(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_4destroy(struct PyPetscTAOObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/TAO.pyx":76
 *         """
 *         """
 *         CHKERR( TaoDestroy(&self.tao) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoDestroy((&__pyx_v_self->tao))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 76, __pyx_L1_error)

  /* "PETSc/TAO.pyx":77
 *         """
 *         CHKERR( TaoDestroy(&self.tao) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":73
 *         CHKERR( TaoView(self.tao, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":79
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_7create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_6create[] = "TAO.create(self, comm=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_7create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(38, 79, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 79, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_6create(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_6create(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  Tao __pyx_v_newtao;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/TAO.pyx":82
 *         """
 *         """
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscTAO newtao = NULL
 *         CHKERR( TaoCreate(ccomm, &newtao) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(38, 82, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/TAO.pyx":83
 *         """
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscTAO newtao = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( TaoCreate(ccomm, &newtao) )
 *         PetscCLEAR(self.obj); self.tao = newtao
 */
  __pyx_v_newtao = NULL;

  /* "PETSc/TAO.pyx":84
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscTAO newtao = NULL
 *         CHKERR( TaoCreate(ccomm, &newtao) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.tao = newtao
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoCreate(__pyx_v_ccomm, (&__pyx_v_newtao))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(38, 84, __pyx_L1_error)

  /* "PETSc/TAO.pyx":85
 *         cdef PetscTAO newtao = NULL
 *         CHKERR( TaoCreate(ccomm, &newtao) )
 *         PetscCLEAR(self.obj); self.tao = newtao             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->tao = __pyx_v_newtao;

  /* "PETSc/TAO.pyx":86
 *         CHKERR( TaoCreate(ccomm, &newtao) )
 *         PetscCLEAR(self.obj); self.tao = newtao
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, tao_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":79
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":88
 *         return self
 * 
 *     def setType(self, tao_type):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_9setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_8setType[] = "TAO.setType(self, tao_type)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_9setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tao_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tao_type,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);
        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_tao_type)) != 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, "setType") < 0)) __PYX_ERR(38, 88, __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_tao_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 88, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_8setType(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_tao_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_8setType(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_tao_type) {
  const char* __pyx_v_ctype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_tao_type);

  /* "PETSc/TAO.pyx":91
 *         """
 *         """
 *         cdef PetscTAOType ctype = NULL             # <<<<<<<<<<<<<<
 *         tao_type = str2bytes(tao_type, &ctype)
 *         CHKERR( TaoSetType(self.tao, ctype) )
 */
  __pyx_v_ctype = NULL;

  /* "PETSc/TAO.pyx":92
 *         """
 *         cdef PetscTAOType ctype = NULL
 *         tao_type = str2bytes(tao_type, &ctype)             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetType(self.tao, ctype) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_tao_type, (&__pyx_v_ctype)); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_tao_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":93
 *         cdef PetscTAOType ctype = NULL
 *         tao_type = str2bytes(tao_type, &ctype)
 *         CHKERR( TaoSetType(self.tao, ctype) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetType(__pyx_v_self->tao, __pyx_v_ctype)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(38, 93, __pyx_L1_error)

  /* "PETSc/TAO.pyx":88
 *         return self
 * 
 *     def setType(self, tao_type):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tao_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":95
 *         CHKERR( TaoSetType(self.tao, ctype) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_11getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_10getType[] = "TAO.getType(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_11getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_10getType(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_10getType(struct PyPetscTAOObject *__pyx_v_self) {
  const char* __pyx_v_ctype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/TAO.pyx":98
 *         """
 *         """
 *         cdef PetscTAOType ctype = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetType(self.tao, &ctype) )
 *         return bytes2str(ctype)
 */
  __pyx_v_ctype = NULL;

  /* "PETSc/TAO.pyx":99
 *         """
 *         cdef PetscTAOType ctype = NULL
 *         CHKERR( TaoGetType(self.tao, &ctype) )             # <<<<<<<<<<<<<<
 *         return bytes2str(ctype)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetType(__pyx_v_self->tao, (&__pyx_v_ctype))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 99, __pyx_L1_error)

  /* "PETSc/TAO.pyx":100
 *         cdef PetscTAOType ctype = NULL
 *         CHKERR( TaoGetType(self.tao, &ctype) )
 *         return bytes2str(ctype)             # <<<<<<<<<<<<<<
 * 
 *     def setOptionsPrefix(self, prefix):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_ctype); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":95
 *         CHKERR( TaoSetType(self.tao, ctype) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":102
 *         return bytes2str(ctype)
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_13setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_12setOptionsPrefix[] = "TAO.setOptionsPrefix(self, prefix)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_13setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOptionsPrefix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,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);
        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_prefix)) != 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, "setOptionsPrefix") < 0)) __PYX_ERR(38, 102, __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_prefix = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOptionsPrefix", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 102, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_12setOptionsPrefix(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_prefix);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_12setOptionsPrefix(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  const char *__pyx_v_cprefix;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setOptionsPrefix", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "PETSc/TAO.pyx":105
 *         """
 *         """
 *         cdef const_char *cprefix = NULL             # <<<<<<<<<<<<<<
 *         prefix = str2bytes(prefix, &cprefix)
 *         CHKERR( TaoSetOptionsPrefix(self.tao, cprefix) )
 */
  __pyx_v_cprefix = NULL;

  /* "PETSc/TAO.pyx":106
 *         """
 *         cdef const_char *cprefix = NULL
 *         prefix = str2bytes(prefix, &cprefix)             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetOptionsPrefix(self.tao, cprefix) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_prefix, (&__pyx_v_cprefix)); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":107
 *         cdef const_char *cprefix = NULL
 *         prefix = str2bytes(prefix, &cprefix)
 *         CHKERR( TaoSetOptionsPrefix(self.tao, cprefix) )             # <<<<<<<<<<<<<<
 * 
 *     def getOptionsPrefix(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetOptionsPrefix(__pyx_v_self->tao, __pyx_v_cprefix)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(38, 107, __pyx_L1_error)

  /* "PETSc/TAO.pyx":102
 *         return bytes2str(ctype)
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":109
 *         CHKERR( TaoSetOptionsPrefix(self.tao, cprefix) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_15getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_14getOptionsPrefix[] = "TAO.getOptionsPrefix(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_15getOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOptionsPrefix (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOptionsPrefix", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOptionsPrefix", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_14getOptionsPrefix(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_14getOptionsPrefix(struct PyPetscTAOObject *__pyx_v_self) {
  const char *__pyx_v_prefix;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getOptionsPrefix", 0);

  /* "PETSc/TAO.pyx":112
 *         """
 *         """
 *         cdef const_char *prefix = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetOptionsPrefix(self.tao, &prefix) )
 *         return bytes2str(prefix)
 */
  __pyx_v_prefix = NULL;

  /* "PETSc/TAO.pyx":113
 *         """
 *         cdef const_char *prefix = NULL
 *         CHKERR( TaoGetOptionsPrefix(self.tao, &prefix) )             # <<<<<<<<<<<<<<
 *         return bytes2str(prefix)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetOptionsPrefix(__pyx_v_self->tao, (&__pyx_v_prefix))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 113, __pyx_L1_error)

  /* "PETSc/TAO.pyx":114
 *         cdef const_char *prefix = NULL
 *         CHKERR( TaoGetOptionsPrefix(self.tao, &prefix) )
 *         return bytes2str(prefix)             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":109
 *         CHKERR( TaoSetOptionsPrefix(self.tao, cprefix) )
 * 
 *     def getOptionsPrefix(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":116
 *         return bytes2str(prefix)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_17setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_16setFromOptions[] = "TAO.setFromOptions(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_17setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_16setFromOptions(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_16setFromOptions(struct PyPetscTAOObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/TAO.pyx":119
 *         """
 *         """
 *         CHKERR( TaoSetFromOptions(self.tao) )             # <<<<<<<<<<<<<<
 * 
 *     def setUp(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetFromOptions(__pyx_v_self->tao)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 119, __pyx_L1_error)

  /* "PETSc/TAO.pyx":116
 *         return bytes2str(prefix)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":121
 *         CHKERR( TaoSetFromOptions(self.tao) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_19setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_18setUp[] = "TAO.setUp(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_19setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUp (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUp", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUp", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_18setUp(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_18setUp(struct PyPetscTAOObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUp", 0);

  /* "PETSc/TAO.pyx":124
 *         """
 *         """
 *         CHKERR( TaoSetUp(self.tao) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetUp(__pyx_v_self->tao)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 124, __pyx_L1_error)

  /* "PETSc/TAO.pyx":121
 *         CHKERR( TaoSetFromOptions(self.tao) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":128
 *     #
 * 
 *     def setInitialTrustRegionRadius(self, radius):             # <<<<<<<<<<<<<<
 *         cdef PetscReal cradius = asReal(radius)
 *         CHKERR( TaoSetInitialTrustRegionRadius(self.tao, cradius) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_21setInitialTrustRegionRadius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_20setInitialTrustRegionRadius[] = "TAO.setInitialTrustRegionRadius(self, radius)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_21setInitialTrustRegionRadius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_radius = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setInitialTrustRegionRadius (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_radius,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);
        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_radius)) != 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, "setInitialTrustRegionRadius") < 0)) __PYX_ERR(38, 128, __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_radius = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setInitialTrustRegionRadius", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 128, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setInitialTrustRegionRadius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_20setInitialTrustRegionRadius(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_radius);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_20setInitialTrustRegionRadius(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_radius) {
  PetscReal __pyx_v_cradius;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setInitialTrustRegionRadius", 0);

  /* "PETSc/TAO.pyx":129
 * 
 *     def setInitialTrustRegionRadius(self, radius):
 *         cdef PetscReal cradius = asReal(radius)             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetInitialTrustRegionRadius(self.tao, cradius) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_radius); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(38, 129, __pyx_L1_error)
  __pyx_v_cradius = __pyx_t_1;

  /* "PETSc/TAO.pyx":130
 *     def setInitialTrustRegionRadius(self, radius):
 *         cdef PetscReal cradius = asReal(radius)
 *         CHKERR( TaoSetInitialTrustRegionRadius(self.tao, cradius) )             # <<<<<<<<<<<<<<
 * 
 *     # --------------
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetInitialTrustRegionRadius(__pyx_v_self->tao, __pyx_v_cradius)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(38, 130, __pyx_L1_error)

  /* "PETSc/TAO.pyx":128
 *     #
 * 
 *     def setInitialTrustRegionRadius(self, radius):             # <<<<<<<<<<<<<<
 *         cdef PetscReal cradius = asReal(radius)
 *         CHKERR( TaoSetInitialTrustRegionRadius(self.tao, cradius) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setInitialTrustRegionRadius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":134
 *     # --------------
 * 
 *     def setAppCtx(self, appctx):             # <<<<<<<<<<<<<<
 *         self.set_attr("__appctx__", appctx)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_23setAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_22setAppCtx[] = "TAO.setAppCtx(self, appctx)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_23setAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_appctx = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setAppCtx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_appctx,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);
        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_appctx)) != 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, "setAppCtx") < 0)) __PYX_ERR(38, 134, __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_appctx = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setAppCtx", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 134, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_22setAppCtx(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_appctx);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_22setAppCtx(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_appctx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setAppCtx", 0);

  /* "PETSc/TAO.pyx":135
 * 
 *     def setAppCtx(self, appctx):
 *         self.set_attr("__appctx__", appctx)             # <<<<<<<<<<<<<<
 * 
 *     def getAppCtx(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__appctx__"), __pyx_v_appctx); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":134
 *     # --------------
 * 
 *     def setAppCtx(self, appctx):             # <<<<<<<<<<<<<<
 *         self.set_attr("__appctx__", appctx)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":137
 *         self.set_attr("__appctx__", appctx)
 * 
 *     def getAppCtx(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr("__appctx__")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_25getAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_24getAppCtx[] = "TAO.getAppCtx(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_25getAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getAppCtx (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getAppCtx", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getAppCtx", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_24getAppCtx(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_24getAppCtx(struct PyPetscTAOObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getAppCtx", 0);

  /* "PETSc/TAO.pyx":138
 * 
 *     def getAppCtx(self):
 *         return self.get_attr("__appctx__")             # <<<<<<<<<<<<<<
 * 
 *     def setInitial(self, Vec x not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__appctx__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":137
 *         self.set_attr("__appctx__", appctx)
 * 
 *     def getAppCtx(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr("__appctx__")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":140
 *         return self.get_attr("__appctx__")
 * 
 *     def setInitial(self, Vec x not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_27setInitial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_26setInitial[] = "TAO.setInitial(self, Vec x)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_27setInitial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setInitial (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,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);
        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_x)) != 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, "setInitial") < 0)) __PYX_ERR(38, 140, __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_x = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setInitial", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 140, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setInitial", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(38, 140, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_26setInitial(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_x);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_26setInitial(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setInitial", 0);

  /* "PETSc/TAO.pyx":143
 *         """
 *         """
 *         CHKERR( TaoSetInitialVector(self.tao, x.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def setObjective(self, objective, args=None, kargs=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetInitialVector(__pyx_v_self->tao, __pyx_v_x->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 143, __pyx_L1_error)

  /* "PETSc/TAO.pyx":140
 *         return self.get_attr("__appctx__")
 * 
 *     def setInitial(self, Vec x not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setInitial", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":145
 *         CHKERR( TaoSetInitialVector(self.tao, x.vec) )
 * 
 *     def setObjective(self, objective, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_29setObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_28setObjective[] = "TAO.setObjective(self, objective, args=None, kargs=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_29setObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_objective = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setObjective (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_objective,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_objective)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setObjective") < 0)) __PYX_ERR(38, 145, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_objective = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setObjective", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 145, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_28setObjective(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_objective, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_28setObjective(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_objective, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("setObjective", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TAO.pyx":148
 *         """
 *         """
 *         CHKERR( TaoSetObjectiveRoutine(self.tao, TAO_Objective, NULL) )             # <<<<<<<<<<<<<<
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetObjectiveRoutine(__pyx_v_self->tao, __pyx_f_8petsc4py_5PETSc_TAO_Objective, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 148, __pyx_L1_error)

  /* "PETSc/TAO.pyx":149
 *         """
 *         CHKERR( TaoSetObjectiveRoutine(self.tao, TAO_Objective, NULL) )
 *         if args is None: args = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         self.set_attr("__objective__", (objective, args, kargs))
 */
  __pyx_t_2 = (__pyx_v_args == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/TAO.pyx":150
 *         CHKERR( TaoSetObjectiveRoutine(self.tao, TAO_Objective, NULL) )
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         self.set_attr("__objective__", (objective, args, kargs))
 * 
 */
  __pyx_t_3 = (__pyx_v_kargs == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_4);
    __pyx_t_4 = 0;
  }

  /* "PETSc/TAO.pyx":151
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 *         self.set_attr("__objective__", (objective, args, kargs))             # <<<<<<<<<<<<<<
 * 
 *     def setSeparableObjective(self, separable, Vec O=None,
 */
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_objective);
  __Pyx_GIVEREF(__pyx_v_objective);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_objective);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_kargs);
  __pyx_t_5 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__objective__"), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/TAO.pyx":145
 *         CHKERR( TaoSetInitialVector(self.tao, x.vec) )
 * 
 *     def setObjective(self, objective, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":153
 *         self.set_attr("__objective__", (objective, args, kargs))
 * 
 *     def setSeparableObjective(self, separable, Vec O=None,             # <<<<<<<<<<<<<<
 *                               args=None, kargs=None):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_31setSeparableObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_30setSeparableObjective[] = "TAO.setSeparableObjective(self, separable, Vec O=None, args=None, kargs=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_31setSeparableObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_separable = 0;
  struct PyPetscVecObject *__pyx_v_O = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setSeparableObjective (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_separable,&__pyx_n_s_O,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = (PyObject *)((struct PyPetscVecObject *)Py_None);

    /* "PETSc/TAO.pyx":154
 * 
 *     def setSeparableObjective(self, separable, Vec O=None,
 *                               args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_separable)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_O);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSeparableObjective") < 0)) __PYX_ERR(38, 153, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_separable = values[0];
    __pyx_v_O = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_args = values[2];
    __pyx_v_kargs = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setSeparableObjective", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 153, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setSeparableObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_O), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "O", 0))) __PYX_ERR(38, 153, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_30setSeparableObjective(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_separable, __pyx_v_O, __pyx_v_args, __pyx_v_kargs);

  /* "PETSc/TAO.pyx":153
 *         self.set_attr("__objective__", (objective, args, kargs))
 * 
 *     def setSeparableObjective(self, separable, Vec O=None,             # <<<<<<<<<<<<<<
 *                               args=None, kargs=None):
 *         """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_30setSeparableObjective(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_separable, struct PyPetscVecObject *__pyx_v_O, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  Vec __pyx_v_Ovec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Vec __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("setSeparableObjective", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TAO.pyx":157
 *         """
 *         """
 *         cdef PetscVec Ovec = NULL             # <<<<<<<<<<<<<<
 *         if O is not None: Ovec = O.vec
 *         CHKERR( TaoSetSeparableObjectiveRoutine(self.tao, Ovec,
 */
  __pyx_v_Ovec = NULL;

  /* "PETSc/TAO.pyx":158
 *         """
 *         cdef PetscVec Ovec = NULL
 *         if O is not None: Ovec = O.vec             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetSeparableObjectiveRoutine(self.tao, Ovec,
 *                                                 TAO_SeparableObjective, NULL) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_O) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_O->vec;
    __pyx_v_Ovec = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":159
 *         cdef PetscVec Ovec = NULL
 *         if O is not None: Ovec = O.vec
 *         CHKERR( TaoSetSeparableObjectiveRoutine(self.tao, Ovec,             # <<<<<<<<<<<<<<
 *                                                 TAO_SeparableObjective, NULL) )
 *         CHKERR( PetscObjectCompose(self.obj[0], "@sepobjvec", <PetscObject>Ovec) )
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetSeparableObjectiveRoutine(__pyx_v_self->tao, __pyx_v_Ovec, __pyx_f_8petsc4py_5PETSc_TAO_SeparableObjective, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 159, __pyx_L1_error)

  /* "PETSc/TAO.pyx":161
 *         CHKERR( TaoSetSeparableObjectiveRoutine(self.tao, Ovec,
 *                                                 TAO_SeparableObjective, NULL) )
 *         CHKERR( PetscObjectCompose(self.obj[0], "@sepobjvec", <PetscObject>Ovec) )             # <<<<<<<<<<<<<<
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectCompose((__pyx_v_self->__pyx_base.obj[0]), ((char *)"@sepobjvec"), ((PetscObject)__pyx_v_Ovec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 161, __pyx_L1_error)

  /* "PETSc/TAO.pyx":162
 *                                                 TAO_SeparableObjective, NULL) )
 *         CHKERR( PetscObjectCompose(self.obj[0], "@sepobjvec", <PetscObject>Ovec) )
 *         if args is None: args = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         self.set_attr("__separable__", (separable, args, kargs))
 */
  __pyx_t_2 = (__pyx_v_args == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/TAO.pyx":163
 *         CHKERR( PetscObjectCompose(self.obj[0], "@sepobjvec", <PetscObject>Ovec) )
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         self.set_attr("__separable__", (separable, args, kargs))
 * 
 */
  __pyx_t_1 = (__pyx_v_kargs == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_5);
    __pyx_t_5 = 0;
  }

  /* "PETSc/TAO.pyx":164
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 *         self.set_attr("__separable__", (separable, args, kargs))             # <<<<<<<<<<<<<<
 * 
 *     def setGradient(self, gradient, args=None, kargs=None):
 */
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_separable);
  __Pyx_GIVEREF(__pyx_v_separable);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_separable);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_kargs);
  __pyx_t_6 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__separable__"), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PETSc/TAO.pyx":153
 *         self.set_attr("__objective__", (objective, args, kargs))
 * 
 *     def setSeparableObjective(self, separable, Vec O=None,             # <<<<<<<<<<<<<<
 *                               args=None, kargs=None):
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setSeparableObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":166
 *         self.set_attr("__separable__", (separable, args, kargs))
 * 
 *     def setGradient(self, gradient, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_33setGradient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_32setGradient[] = "TAO.setGradient(self, gradient, args=None, kargs=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_33setGradient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gradient = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setGradient (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gradient,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_gradient)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setGradient") < 0)) __PYX_ERR(38, 166, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_gradient = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setGradient", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 166, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setGradient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_32setGradient(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_gradient, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_32setGradient(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_gradient, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("setGradient", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TAO.pyx":169
 *         """
 *         """
 *         CHKERR( TaoSetGradientRoutine(self.tao, TAO_Gradient, NULL) )             # <<<<<<<<<<<<<<
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetGradientRoutine(__pyx_v_self->tao, __pyx_f_8petsc4py_5PETSc_TAO_Gradient, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 169, __pyx_L1_error)

  /* "PETSc/TAO.pyx":170
 *         """
 *         CHKERR( TaoSetGradientRoutine(self.tao, TAO_Gradient, NULL) )
 *         if args is None: args = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         self.set_attr("__gradient__", (gradient, args, kargs))
 */
  __pyx_t_2 = (__pyx_v_args == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/TAO.pyx":171
 *         CHKERR( TaoSetGradientRoutine(self.tao, TAO_Gradient, NULL) )
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         self.set_attr("__gradient__", (gradient, args, kargs))
 * 
 */
  __pyx_t_3 = (__pyx_v_kargs == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_4);
    __pyx_t_4 = 0;
  }

  /* "PETSc/TAO.pyx":172
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 *         self.set_attr("__gradient__", (gradient, args, kargs))             # <<<<<<<<<<<<<<
 * 
 *     def setObjectiveGradient(self, objgrad, args=None, kargs=None):
 */
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_gradient);
  __Pyx_GIVEREF(__pyx_v_gradient);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_gradient);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_kargs);
  __pyx_t_5 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__gradient__"), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/TAO.pyx":166
 *         self.set_attr("__separable__", (separable, args, kargs))
 * 
 *     def setGradient(self, gradient, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setGradient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":174
 *         self.set_attr("__gradient__", (gradient, args, kargs))
 * 
 *     def setObjectiveGradient(self, objgrad, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_35setObjectiveGradient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_34setObjectiveGradient[] = "TAO.setObjectiveGradient(self, objgrad, args=None, kargs=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_35setObjectiveGradient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_objgrad = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setObjectiveGradient (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_objgrad,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_objgrad)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setObjectiveGradient") < 0)) __PYX_ERR(38, 174, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_objgrad = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setObjectiveGradient", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 174, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setObjectiveGradient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_34setObjectiveGradient(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_objgrad, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_34setObjectiveGradient(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_objgrad, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("setObjectiveGradient", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TAO.pyx":177
 *         """
 *         """
 *         CHKERR( TaoSetObjectiveAndGradientRoutine(self.tao, TAO_ObjGrad, NULL) )             # <<<<<<<<<<<<<<
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetObjectiveAndGradientRoutine(__pyx_v_self->tao, __pyx_f_8petsc4py_5PETSc_TAO_ObjGrad, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 177, __pyx_L1_error)

  /* "PETSc/TAO.pyx":178
 *         """
 *         CHKERR( TaoSetObjectiveAndGradientRoutine(self.tao, TAO_ObjGrad, NULL) )
 *         if args is None: args = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         self.set_attr("__objgrad__", (objgrad, args, kargs))
 */
  __pyx_t_2 = (__pyx_v_args == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/TAO.pyx":179
 *         CHKERR( TaoSetObjectiveAndGradientRoutine(self.tao, TAO_ObjGrad, NULL) )
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         self.set_attr("__objgrad__", (objgrad, args, kargs))
 * 
 */
  __pyx_t_3 = (__pyx_v_kargs == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_4);
    __pyx_t_4 = 0;
  }

  /* "PETSc/TAO.pyx":180
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 *         self.set_attr("__objgrad__", (objgrad, args, kargs))             # <<<<<<<<<<<<<<
 * 
 *     def setVariableBounds(self, varbounds, args=None, kargs=None):
 */
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_objgrad);
  __Pyx_GIVEREF(__pyx_v_objgrad);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_objgrad);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_kargs);
  __pyx_t_5 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__objgrad__"), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/TAO.pyx":174
 *         self.set_attr("__gradient__", (gradient, args, kargs))
 * 
 *     def setObjectiveGradient(self, objgrad, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setObjectiveGradient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":182
 *         self.set_attr("__objgrad__", (objgrad, args, kargs))
 * 
 *     def setVariableBounds(self, varbounds, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_37setVariableBounds(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_36setVariableBounds[] = "TAO.setVariableBounds(self, varbounds, args=None, kargs=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_37setVariableBounds(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_varbounds = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setVariableBounds (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_varbounds,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_varbounds)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setVariableBounds") < 0)) __PYX_ERR(38, 182, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_varbounds = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setVariableBounds", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 182, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setVariableBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_36setVariableBounds(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_varbounds, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_36setVariableBounds(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_varbounds, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  struct PyPetscVecObject *__pyx_v_xl = 0;
  struct PyPetscVecObject *__pyx_v_xu = 0;
  PyObject *__pyx_v_ol = NULL;
  PyObject *__pyx_v_ou = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("setVariableBounds", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TAO.pyx":185
 *         """
 *         """
 *         cdef Vec xl=None, xu=None             # <<<<<<<<<<<<<<
 *         if (isinstance(varbounds, list) or isinstance(varbounds, tuple)):
 *             ol, ou = varbounds
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_xl = ((struct PyPetscVecObject *)Py_None);
  __Pyx_INCREF(Py_None);
  __pyx_v_xu = ((struct PyPetscVecObject *)Py_None);

  /* "PETSc/TAO.pyx":186
 *         """
 *         cdef Vec xl=None, xu=None
 *         if (isinstance(varbounds, list) or isinstance(varbounds, tuple)):             # <<<<<<<<<<<<<<
 *             ol, ou = varbounds
 *             xl = <Vec?> ol; xu = <Vec?> ou
 */
  __pyx_t_2 = PyList_Check(__pyx_v_varbounds); 
  __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 = PyTuple_Check(__pyx_v_varbounds); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PETSc/TAO.pyx":187
 *         cdef Vec xl=None, xu=None
 *         if (isinstance(varbounds, list) or isinstance(varbounds, tuple)):
 *             ol, ou = varbounds             # <<<<<<<<<<<<<<
 *             xl = <Vec?> ol; xu = <Vec?> ou
 *             CHKERR( TaoSetVariableBounds(self.tao, xl.vec, xu.vec) )
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_varbounds))) || (PyList_CheckExact(__pyx_v_varbounds))) {
      PyObject* sequence = __pyx_v_varbounds;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(38, 187, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_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(38, 187, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 187, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_v_varbounds); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 187, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(38, 187, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(38, 187, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_ol = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_ou = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PETSc/TAO.pyx":188
 *         if (isinstance(varbounds, list) or isinstance(varbounds, tuple)):
 *             ol, ou = varbounds
 *             xl = <Vec?> ol; xu = <Vec?> ou             # <<<<<<<<<<<<<<
 *             CHKERR( TaoSetVariableBounds(self.tao, xl.vec, xu.vec) )
 *             return
 */
    if (!(likely(__Pyx_TypeTest(__pyx_v_ol, __pyx_ptype_8petsc4py_5PETSc_Vec)))) __PYX_ERR(38, 188, __pyx_L1_error)
    __pyx_t_5 = __pyx_v_ol;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_xl, ((struct PyPetscVecObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    if (!(likely(__Pyx_TypeTest(__pyx_v_ou, __pyx_ptype_8petsc4py_5PETSc_Vec)))) __PYX_ERR(38, 188, __pyx_L1_error)
    __pyx_t_5 = __pyx_v_ou;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_xu, ((struct PyPetscVecObject *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "PETSc/TAO.pyx":189
 *             ol, ou = varbounds
 *             xl = <Vec?> ol; xu = <Vec?> ou
 *             CHKERR( TaoSetVariableBounds(self.tao, xl.vec, xu.vec) )             # <<<<<<<<<<<<<<
 *             return
 *         if isinstance(varbounds, Vec):
 */
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetVariableBounds(__pyx_v_self->tao, __pyx_v_xl->vec, __pyx_v_xu->vec)); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(38, 189, __pyx_L1_error)

    /* "PETSc/TAO.pyx":190
 *             xl = <Vec?> ol; xu = <Vec?> ou
 *             CHKERR( TaoSetVariableBounds(self.tao, xl.vec, xu.vec) )
 *             return             # <<<<<<<<<<<<<<
 *         if isinstance(varbounds, Vec):
 *             ol = varbounds; ou = args
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "PETSc/TAO.pyx":186
 *         """
 *         cdef Vec xl=None, xu=None
 *         if (isinstance(varbounds, list) or isinstance(varbounds, tuple)):             # <<<<<<<<<<<<<<
 *             ol, ou = varbounds
 *             xl = <Vec?> ol; xu = <Vec?> ou
 */
  }

  /* "PETSc/TAO.pyx":191
 *             CHKERR( TaoSetVariableBounds(self.tao, xl.vec, xu.vec) )
 *             return
 *         if isinstance(varbounds, Vec):             # <<<<<<<<<<<<<<
 *             ol = varbounds; ou = args
 *             xl = <Vec?> ol; xu = <Vec?> ou
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_varbounds, __pyx_ptype_8petsc4py_5PETSc_Vec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/TAO.pyx":192
 *             return
 *         if isinstance(varbounds, Vec):
 *             ol = varbounds; ou = args             # <<<<<<<<<<<<<<
 *             xl = <Vec?> ol; xu = <Vec?> ou
 *             CHKERR( TaoSetVariableBounds(self.tao, xl.vec, xu.vec) )
 */
    __Pyx_INCREF(__pyx_v_varbounds);
    __pyx_v_ol = __pyx_v_varbounds;
    __Pyx_INCREF(__pyx_v_args);
    __pyx_v_ou = __pyx_v_args;

    /* "PETSc/TAO.pyx":193
 *         if isinstance(varbounds, Vec):
 *             ol = varbounds; ou = args
 *             xl = <Vec?> ol; xu = <Vec?> ou             # <<<<<<<<<<<<<<
 *             CHKERR( TaoSetVariableBounds(self.tao, xl.vec, xu.vec) )
 *             return
 */
    if (!(likely(__Pyx_TypeTest(__pyx_v_ol, __pyx_ptype_8petsc4py_5PETSc_Vec)))) __PYX_ERR(38, 193, __pyx_L1_error)
    __pyx_t_5 = __pyx_v_ol;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_xl, ((struct PyPetscVecObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    if (!(likely(__Pyx_TypeTest(__pyx_v_ou, __pyx_ptype_8petsc4py_5PETSc_Vec)))) __PYX_ERR(38, 193, __pyx_L1_error)
    __pyx_t_5 = __pyx_v_ou;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_xu, ((struct PyPetscVecObject *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "PETSc/TAO.pyx":194
 *             ol = varbounds; ou = args
 *             xl = <Vec?> ol; xu = <Vec?> ou
 *             CHKERR( TaoSetVariableBounds(self.tao, xl.vec, xu.vec) )             # <<<<<<<<<<<<<<
 *             return
 *         CHKERR( TaoSetVariableBoundsRoutine(self.tao, TAO_VarBounds, NULL) )
 */
    __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetVariableBounds(__pyx_v_self->tao, __pyx_v_xl->vec, __pyx_v_xu->vec)); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(38, 194, __pyx_L1_error)

    /* "PETSc/TAO.pyx":195
 *             xl = <Vec?> ol; xu = <Vec?> ou
 *             CHKERR( TaoSetVariableBounds(self.tao, xl.vec, xu.vec) )
 *             return             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetVariableBoundsRoutine(self.tao, TAO_VarBounds, NULL) )
 *         if args is None: args = ()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "PETSc/TAO.pyx":191
 *             CHKERR( TaoSetVariableBounds(self.tao, xl.vec, xu.vec) )
 *             return
 *         if isinstance(varbounds, Vec):             # <<<<<<<<<<<<<<
 *             ol = varbounds; ou = args
 *             xl = <Vec?> ol; xu = <Vec?> ou
 */
  }

  /* "PETSc/TAO.pyx":196
 *             CHKERR( TaoSetVariableBounds(self.tao, xl.vec, xu.vec) )
 *             return
 *         CHKERR( TaoSetVariableBoundsRoutine(self.tao, TAO_VarBounds, NULL) )             # <<<<<<<<<<<<<<
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetVariableBoundsRoutine(__pyx_v_self->tao, __pyx_f_8petsc4py_5PETSc_TAO_VarBounds, NULL)); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(38, 196, __pyx_L1_error)

  /* "PETSc/TAO.pyx":197
 *             return
 *         CHKERR( TaoSetVariableBoundsRoutine(self.tao, TAO_VarBounds, NULL) )
 *         if args is None: args = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         self.set_attr("__varbounds__", (varbounds, args, kargs))
 */
  __pyx_t_2 = (__pyx_v_args == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/TAO.pyx":198
 *         CHKERR( TaoSetVariableBoundsRoutine(self.tao, TAO_VarBounds, NULL) )
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         self.set_attr("__varbounds__", (varbounds, args, kargs))
 * 
 */
  __pyx_t_1 = (__pyx_v_kargs == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_5);
    __pyx_t_5 = 0;
  }

  /* "PETSc/TAO.pyx":199
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 *         self.set_attr("__varbounds__", (varbounds, args, kargs))             # <<<<<<<<<<<<<<
 * 
 *     def setConstraints(self, constraints, Vec C=None,
 */
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_varbounds);
  __Pyx_GIVEREF(__pyx_v_varbounds);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_varbounds);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_kargs);
  __pyx_t_4 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__varbounds__"), __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "PETSc/TAO.pyx":182
 *         self.set_attr("__objgrad__", (objgrad, args, kargs))
 * 
 *     def setVariableBounds(self, varbounds, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setVariableBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_xl);
  __Pyx_XDECREF((PyObject *)__pyx_v_xu);
  __Pyx_XDECREF(__pyx_v_ol);
  __Pyx_XDECREF(__pyx_v_ou);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":201
 *         self.set_attr("__varbounds__", (varbounds, args, kargs))
 * 
 *     def setConstraints(self, constraints, Vec C=None,             # <<<<<<<<<<<<<<
 *                        args=None, kargs=None):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_39setConstraints(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_38setConstraints[] = "TAO.setConstraints(self, constraints, Vec C=None, args=None, kargs=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_39setConstraints(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_constraints = 0;
  struct PyPetscVecObject *__pyx_v_C = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConstraints (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_constraints,&__pyx_n_s_C,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = (PyObject *)((struct PyPetscVecObject *)Py_None);

    /* "PETSc/TAO.pyx":202
 * 
 *     def setConstraints(self, constraints, Vec C=None,
 *                        args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_constraints)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_C);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConstraints") < 0)) __PYX_ERR(38, 201, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_constraints = values[0];
    __pyx_v_C = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_args = values[2];
    __pyx_v_kargs = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConstraints", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 201, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setConstraints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_C), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "C", 0))) __PYX_ERR(38, 201, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_38setConstraints(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_constraints, __pyx_v_C, __pyx_v_args, __pyx_v_kargs);

  /* "PETSc/TAO.pyx":201
 *         self.set_attr("__varbounds__", (varbounds, args, kargs))
 * 
 *     def setConstraints(self, constraints, Vec C=None,             # <<<<<<<<<<<<<<
 *                        args=None, kargs=None):
 *         """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_38setConstraints(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_constraints, struct PyPetscVecObject *__pyx_v_C, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  Vec __pyx_v_Cvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Vec __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("setConstraints", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TAO.pyx":205
 *         """
 *         """
 *         cdef PetscVec Cvec=NULL             # <<<<<<<<<<<<<<
 *         if C is not None: Cvec = C.vec
 *         CHKERR( TaoSetConstraintsRoutine(self.tao, Cvec, TAO_Constraints, NULL) )
 */
  __pyx_v_Cvec = NULL;

  /* "PETSc/TAO.pyx":206
 *         """
 *         cdef PetscVec Cvec=NULL
 *         if C is not None: Cvec = C.vec             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetConstraintsRoutine(self.tao, Cvec, TAO_Constraints, NULL) )
 *         if args is None: args = ()
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_C) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_C->vec;
    __pyx_v_Cvec = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":207
 *         cdef PetscVec Cvec=NULL
 *         if C is not None: Cvec = C.vec
 *         CHKERR( TaoSetConstraintsRoutine(self.tao, Cvec, TAO_Constraints, NULL) )             # <<<<<<<<<<<<<<
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetConstraintsRoutine(__pyx_v_self->tao, __pyx_v_Cvec, __pyx_f_8petsc4py_5PETSc_TAO_Constraints, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 207, __pyx_L1_error)

  /* "PETSc/TAO.pyx":208
 *         if C is not None: Cvec = C.vec
 *         CHKERR( TaoSetConstraintsRoutine(self.tao, Cvec, TAO_Constraints, NULL) )
 *         if args is None: args = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         self.set_attr("__constraints__", (constraints, args, kargs))
 */
  __pyx_t_2 = (__pyx_v_args == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/TAO.pyx":209
 *         CHKERR( TaoSetConstraintsRoutine(self.tao, Cvec, TAO_Constraints, NULL) )
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         self.set_attr("__constraints__", (constraints, args, kargs))
 * 
 */
  __pyx_t_1 = (__pyx_v_kargs == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_5);
    __pyx_t_5 = 0;
  }

  /* "PETSc/TAO.pyx":210
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 *         self.set_attr("__constraints__", (constraints, args, kargs))             # <<<<<<<<<<<<<<
 * 
 *     def setHessian(self, hessian, Mat H=None, Mat P=None,
 */
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_constraints);
  __Pyx_GIVEREF(__pyx_v_constraints);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_constraints);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_kargs);
  __pyx_t_6 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__constraints__"), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PETSc/TAO.pyx":201
 *         self.set_attr("__varbounds__", (varbounds, args, kargs))
 * 
 *     def setConstraints(self, constraints, Vec C=None,             # <<<<<<<<<<<<<<
 *                        args=None, kargs=None):
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setConstraints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":212
 *         self.set_attr("__constraints__", (constraints, args, kargs))
 * 
 *     def setHessian(self, hessian, Mat H=None, Mat P=None,             # <<<<<<<<<<<<<<
 *                    args=None, kargs=None):
 *         cdef PetscMat Hmat=NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_41setHessian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_40setHessian[] = "TAO.setHessian(self, hessian, Mat H=None, Mat P=None, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_41setHessian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_hessian = 0;
  struct PyPetscMatObject *__pyx_v_H = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setHessian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hessian,&__pyx_n_s_H,&__pyx_n_s_P,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[2] = (PyObject *)((struct PyPetscMatObject *)Py_None);

    /* "PETSc/TAO.pyx":213
 * 
 *     def setHessian(self, hessian, Mat H=None, Mat P=None,
 *                    args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscMat Hmat=NULL
 *         if H is not None: Hmat = H.mat
 */
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_hessian)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setHessian") < 0)) __PYX_ERR(38, 212, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_hessian = values[0];
    __pyx_v_H = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[2]);
    __pyx_v_args = values[3];
    __pyx_v_kargs = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setHessian", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 212, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setHessian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_H), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "H", 0))) __PYX_ERR(38, 212, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(38, 212, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_40setHessian(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_hessian, __pyx_v_H, __pyx_v_P, __pyx_v_args, __pyx_v_kargs);

  /* "PETSc/TAO.pyx":212
 *         self.set_attr("__constraints__", (constraints, args, kargs))
 * 
 *     def setHessian(self, hessian, Mat H=None, Mat P=None,             # <<<<<<<<<<<<<<
 *                    args=None, kargs=None):
 *         cdef PetscMat Hmat=NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_40setHessian(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_hessian, struct PyPetscMatObject *__pyx_v_H, struct PyPetscMatObject *__pyx_v_P, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  Mat __pyx_v_Hmat;
  Mat __pyx_v_Pmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Mat __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("setHessian", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TAO.pyx":214
 *     def setHessian(self, hessian, Mat H=None, Mat P=None,
 *                    args=None, kargs=None):
 *         cdef PetscMat Hmat=NULL             # <<<<<<<<<<<<<<
 *         if H is not None: Hmat = H.mat
 *         cdef PetscMat Pmat = Hmat
 */
  __pyx_v_Hmat = NULL;

  /* "PETSc/TAO.pyx":215
 *                    args=None, kargs=None):
 *         cdef PetscMat Hmat=NULL
 *         if H is not None: Hmat = H.mat             # <<<<<<<<<<<<<<
 *         cdef PetscMat Pmat = Hmat
 *         if P is not None: Pmat = P.mat
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_H) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_H->mat;
    __pyx_v_Hmat = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":216
 *         cdef PetscMat Hmat=NULL
 *         if H is not None: Hmat = H.mat
 *         cdef PetscMat Pmat = Hmat             # <<<<<<<<<<<<<<
 *         if P is not None: Pmat = P.mat
 *         CHKERR( TaoSetHessianRoutine(self.tao, Hmat, Pmat, TAO_Hessian, NULL) )
 */
  __pyx_v_Pmat = __pyx_v_Hmat;

  /* "PETSc/TAO.pyx":217
 *         if H is not None: Hmat = H.mat
 *         cdef PetscMat Pmat = Hmat
 *         if P is not None: Pmat = P.mat             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetHessianRoutine(self.tao, Hmat, Pmat, TAO_Hessian, NULL) )
 *         if args is None: args = ()
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_P->mat;
    __pyx_v_Pmat = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":218
 *         cdef PetscMat Pmat = Hmat
 *         if P is not None: Pmat = P.mat
 *         CHKERR( TaoSetHessianRoutine(self.tao, Hmat, Pmat, TAO_Hessian, NULL) )             # <<<<<<<<<<<<<<
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetHessianRoutine(__pyx_v_self->tao, __pyx_v_Hmat, __pyx_v_Pmat, __pyx_f_8petsc4py_5PETSc_TAO_Hessian, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 218, __pyx_L1_error)

  /* "PETSc/TAO.pyx":219
 *         if P is not None: Pmat = P.mat
 *         CHKERR( TaoSetHessianRoutine(self.tao, Hmat, Pmat, TAO_Hessian, NULL) )
 *         if args is None: args = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         self.set_attr("__hessian__", (hessian, args, kargs))
 */
  __pyx_t_1 = (__pyx_v_args == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/TAO.pyx":220
 *         CHKERR( TaoSetHessianRoutine(self.tao, Hmat, Pmat, TAO_Hessian, NULL) )
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         self.set_attr("__hessian__", (hessian, args, kargs))
 * 
 */
  __pyx_t_2 = (__pyx_v_kargs == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_5);
    __pyx_t_5 = 0;
  }

  /* "PETSc/TAO.pyx":221
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 *         self.set_attr("__hessian__", (hessian, args, kargs))             # <<<<<<<<<<<<<<
 * 
 *     def setJacobian(self, jacobian, Mat J=None, Mat P=None,
 */
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_hessian);
  __Pyx_GIVEREF(__pyx_v_hessian);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_hessian);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_kargs);
  __pyx_t_6 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__hessian__"), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PETSc/TAO.pyx":212
 *         self.set_attr("__constraints__", (constraints, args, kargs))
 * 
 *     def setHessian(self, hessian, Mat H=None, Mat P=None,             # <<<<<<<<<<<<<<
 *                    args=None, kargs=None):
 *         cdef PetscMat Hmat=NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setHessian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":223
 *         self.set_attr("__hessian__", (hessian, args, kargs))
 * 
 *     def setJacobian(self, jacobian, Mat J=None, Mat P=None,             # <<<<<<<<<<<<<<
 *                     args=None, kargs=None):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_43setJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_42setJacobian[] = "TAO.setJacobian(self, jacobian, Mat J=None, Mat P=None, args=None, kargs=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_43setJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_jacobian = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setJacobian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_jacobian,&__pyx_n_s_J,&__pyx_n_s_P,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[2] = (PyObject *)((struct PyPetscMatObject *)Py_None);

    /* "PETSc/TAO.pyx":224
 * 
 *     def setJacobian(self, jacobian, Mat J=None, Mat P=None,
 *                     args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_jacobian)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setJacobian") < 0)) __PYX_ERR(38, 223, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_jacobian = values[0];
    __pyx_v_J = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[2]);
    __pyx_v_args = values[3];
    __pyx_v_kargs = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setJacobian", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 223, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_J), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "J", 0))) __PYX_ERR(38, 223, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(38, 223, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_42setJacobian(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_jacobian, __pyx_v_J, __pyx_v_P, __pyx_v_args, __pyx_v_kargs);

  /* "PETSc/TAO.pyx":223
 *         self.set_attr("__hessian__", (hessian, args, kargs))
 * 
 *     def setJacobian(self, jacobian, Mat J=None, Mat P=None,             # <<<<<<<<<<<<<<
 *                     args=None, kargs=None):
 *         """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_42setJacobian(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_jacobian, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  Mat __pyx_v_Jmat;
  Mat __pyx_v_Pmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Mat __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("setJacobian", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TAO.pyx":227
 *         """
 *         """
 *         cdef PetscMat Jmat=NULL             # <<<<<<<<<<<<<<
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat = Jmat
 */
  __pyx_v_Jmat = NULL;

  /* "PETSc/TAO.pyx":228
 *         """
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat             # <<<<<<<<<<<<<<
 *         cdef PetscMat Pmat = Jmat
 *         if P is not None: Pmat = P.mat
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_J) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_J->mat;
    __pyx_v_Jmat = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":229
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat = Jmat             # <<<<<<<<<<<<<<
 *         if P is not None: Pmat = P.mat
 *         CHKERR( TaoSetJacobianRoutine(self.tao, Jmat, Pmat, TAO_Jacobian, NULL) )
 */
  __pyx_v_Pmat = __pyx_v_Jmat;

  /* "PETSc/TAO.pyx":230
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat = Jmat
 *         if P is not None: Pmat = P.mat             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetJacobianRoutine(self.tao, Jmat, Pmat, TAO_Jacobian, NULL) )
 *         if args is None: args = ()
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_P->mat;
    __pyx_v_Pmat = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":231
 *         cdef PetscMat Pmat = Jmat
 *         if P is not None: Pmat = P.mat
 *         CHKERR( TaoSetJacobianRoutine(self.tao, Jmat, Pmat, TAO_Jacobian, NULL) )             # <<<<<<<<<<<<<<
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetJacobianRoutine(__pyx_v_self->tao, __pyx_v_Jmat, __pyx_v_Pmat, __pyx_f_8petsc4py_5PETSc_TAO_Jacobian, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 231, __pyx_L1_error)

  /* "PETSc/TAO.pyx":232
 *         if P is not None: Pmat = P.mat
 *         CHKERR( TaoSetJacobianRoutine(self.tao, Jmat, Pmat, TAO_Jacobian, NULL) )
 *         if args is None: args = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         self.set_attr("__jacobian__", (jacobian, args, kargs))
 */
  __pyx_t_1 = (__pyx_v_args == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/TAO.pyx":233
 *         CHKERR( TaoSetJacobianRoutine(self.tao, Jmat, Pmat, TAO_Jacobian, NULL) )
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         self.set_attr("__jacobian__", (jacobian, args, kargs))
 * 
 */
  __pyx_t_2 = (__pyx_v_kargs == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_5);
    __pyx_t_5 = 0;
  }

  /* "PETSc/TAO.pyx":234
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 *         self.set_attr("__jacobian__", (jacobian, args, kargs))             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_jacobian);
  __Pyx_GIVEREF(__pyx_v_jacobian);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_jacobian);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_kargs);
  __pyx_t_6 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__jacobian__"), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PETSc/TAO.pyx":223
 *         self.set_attr("__hessian__", (hessian, args, kargs))
 * 
 *     def setJacobian(self, jacobian, Mat J=None, Mat P=None,             # <<<<<<<<<<<<<<
 *                     args=None, kargs=None):
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":238
 *     #
 * 
 *     def setStateDesignIS(self, IS state, IS design):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_45setStateDesignIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_44setStateDesignIS[] = "TAO.setStateDesignIS(self, IS state, IS design)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_45setStateDesignIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_state = 0;
  struct PyPetscISObject *__pyx_v_design = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setStateDesignIS (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_state,&__pyx_n_s_design,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_state)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_design)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setStateDesignIS", 1, 2, 2, 1); __PYX_ERR(38, 238, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setStateDesignIS") < 0)) __PYX_ERR(38, 238, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_state = ((struct PyPetscISObject *)values[0]);
    __pyx_v_design = ((struct PyPetscISObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setStateDesignIS", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 238, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setStateDesignIS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_8petsc4py_5PETSc_IS, 1, "state", 0))) __PYX_ERR(38, 238, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_design), __pyx_ptype_8petsc4py_5PETSc_IS, 1, "design", 0))) __PYX_ERR(38, 238, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_44setStateDesignIS(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_state, __pyx_v_design);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_44setStateDesignIS(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscISObject *__pyx_v_state, struct PyPetscISObject *__pyx_v_design) {
  IS __pyx_v_s_is;
  IS __pyx_v_d_is;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  IS __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setStateDesignIS", 0);

  /* "PETSc/TAO.pyx":241
 *         """
 *         """
 *         cdef PetscIS s_is = NULL, d_is = NULL             # <<<<<<<<<<<<<<
 *         if state  is not None: s_is = state.iset
 *         if design is not None: d_is = design.iset
 */
  __pyx_v_s_is = NULL;
  __pyx_v_d_is = NULL;

  /* "PETSc/TAO.pyx":242
 *         """
 *         cdef PetscIS s_is = NULL, d_is = NULL
 *         if state  is not None: s_is = state.iset             # <<<<<<<<<<<<<<
 *         if design is not None: d_is = design.iset
 *         CHKERR( TaoSetStateDesignIS(self.tao, s_is, d_is) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_state) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_state->iset;
    __pyx_v_s_is = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":243
 *         cdef PetscIS s_is = NULL, d_is = NULL
 *         if state  is not None: s_is = state.iset
 *         if design is not None: d_is = design.iset             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetStateDesignIS(self.tao, s_is, d_is) )
 * 
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_design) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_design->iset;
    __pyx_v_d_is = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":244
 *         if state  is not None: s_is = state.iset
 *         if design is not None: d_is = design.iset
 *         CHKERR( TaoSetStateDesignIS(self.tao, s_is, d_is) )             # <<<<<<<<<<<<<<
 * 
 *     def setJacobianState(self, jacobian_state, Mat J=None, Mat P=None, Mat I=None,
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetStateDesignIS(__pyx_v_self->tao, __pyx_v_s_is, __pyx_v_d_is)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 244, __pyx_L1_error)

  /* "PETSc/TAO.pyx":238
 *     #
 * 
 *     def setStateDesignIS(self, IS state, IS design):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setStateDesignIS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":246
 *         CHKERR( TaoSetStateDesignIS(self.tao, s_is, d_is) )
 * 
 *     def setJacobianState(self, jacobian_state, Mat J=None, Mat P=None, Mat I=None,             # <<<<<<<<<<<<<<
 *                          args=None, kargs=None):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_47setJacobianState(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_46setJacobianState[] = "TAO.setJacobianState(self, jacobian_state, Mat J=None, Mat P=None, Mat I=None, args=None, kargs=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_47setJacobianState(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_jacobian_state = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  struct PyPetscMatObject *__pyx_v_I = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setJacobianState (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_jacobian_state,&__pyx_n_s_J,&__pyx_n_s_P,&__pyx_n_s_I,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[1] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[2] = (PyObject *)((struct PyPetscMatObject *)Py_None);
    values[3] = (PyObject *)((struct PyPetscMatObject *)Py_None);

    /* "PETSc/TAO.pyx":247
 * 
 *     def setJacobianState(self, jacobian_state, Mat J=None, Mat P=None, Mat I=None,
 *                          args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */
    values[4] = ((PyObject *)Py_None);
    values[5] = ((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  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_jacobian_state)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_I);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setJacobianState") < 0)) __PYX_ERR(38, 246, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_jacobian_state = values[0];
    __pyx_v_J = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[2]);
    __pyx_v_I = ((struct PyPetscMatObject *)values[3]);
    __pyx_v_args = values[4];
    __pyx_v_kargs = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setJacobianState", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 246, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setJacobianState", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_J), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "J", 0))) __PYX_ERR(38, 246, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(38, 246, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_I), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "I", 0))) __PYX_ERR(38, 246, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_46setJacobianState(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_jacobian_state, __pyx_v_J, __pyx_v_P, __pyx_v_I, __pyx_v_args, __pyx_v_kargs);

  /* "PETSc/TAO.pyx":246
 *         CHKERR( TaoSetStateDesignIS(self.tao, s_is, d_is) )
 * 
 *     def setJacobianState(self, jacobian_state, Mat J=None, Mat P=None, Mat I=None,             # <<<<<<<<<<<<<<
 *                          args=None, kargs=None):
 *         """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_46setJacobianState(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_jacobian_state, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P, struct PyPetscMatObject *__pyx_v_I, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  Mat __pyx_v_Jmat;
  Mat __pyx_v_Pmat;
  Mat __pyx_v_Imat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Mat __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("setJacobianState", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TAO.pyx":250
 *         """
 *         """
 *         cdef PetscMat Jmat=NULL             # <<<<<<<<<<<<<<
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat = Jmat
 */
  __pyx_v_Jmat = NULL;

  /* "PETSc/TAO.pyx":251
 *         """
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat             # <<<<<<<<<<<<<<
 *         cdef PetscMat Pmat = Jmat
 *         if P is not None: Pmat = P.mat
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_J) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_J->mat;
    __pyx_v_Jmat = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":252
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat = Jmat             # <<<<<<<<<<<<<<
 *         if P is not None: Pmat = P.mat
 *         cdef PetscMat Imat = NULL
 */
  __pyx_v_Pmat = __pyx_v_Jmat;

  /* "PETSc/TAO.pyx":253
 *         if J is not None: Jmat = J.mat
 *         cdef PetscMat Pmat = Jmat
 *         if P is not None: Pmat = P.mat             # <<<<<<<<<<<<<<
 *         cdef PetscMat Imat = NULL
 *         if I is not None: Imat = I.mat
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_P->mat;
    __pyx_v_Pmat = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":254
 *         cdef PetscMat Pmat = Jmat
 *         if P is not None: Pmat = P.mat
 *         cdef PetscMat Imat = NULL             # <<<<<<<<<<<<<<
 *         if I is not None: Imat = I.mat
 *         CHKERR( TaoSetJacobianStateRoutine(self.tao, Jmat, Pmat, Imat,
 */
  __pyx_v_Imat = NULL;

  /* "PETSc/TAO.pyx":255
 *         if P is not None: Pmat = P.mat
 *         cdef PetscMat Imat = NULL
 *         if I is not None: Imat = I.mat             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetJacobianStateRoutine(self.tao, Jmat, Pmat, Imat,
 *                                            TAO_JacobianState, NULL) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_I) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_I->mat;
    __pyx_v_Imat = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":256
 *         cdef PetscMat Imat = NULL
 *         if I is not None: Imat = I.mat
 *         CHKERR( TaoSetJacobianStateRoutine(self.tao, Jmat, Pmat, Imat,             # <<<<<<<<<<<<<<
 *                                            TAO_JacobianState, NULL) )
 *         if args is None: args = ()
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetJacobianStateRoutine(__pyx_v_self->tao, __pyx_v_Jmat, __pyx_v_Pmat, __pyx_v_Imat, __pyx_f_8petsc4py_5PETSc_TAO_JacobianState, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 256, __pyx_L1_error)

  /* "PETSc/TAO.pyx":258
 *         CHKERR( TaoSetJacobianStateRoutine(self.tao, Jmat, Pmat, Imat,
 *                                            TAO_JacobianState, NULL) )
 *         if args is None: args = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         self.set_attr("__jacobian_state__", (jacobian_state, args, kargs))
 */
  __pyx_t_2 = (__pyx_v_args == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/TAO.pyx":259
 *                                            TAO_JacobianState, NULL) )
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         self.set_attr("__jacobian_state__", (jacobian_state, args, kargs))
 * 
 */
  __pyx_t_1 = (__pyx_v_kargs == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_5);
    __pyx_t_5 = 0;
  }

  /* "PETSc/TAO.pyx":260
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 *         self.set_attr("__jacobian_state__", (jacobian_state, args, kargs))             # <<<<<<<<<<<<<<
 * 
 *     def setJacobianDesign(self, jacobian_design, Mat J=None,
 */
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_jacobian_state);
  __Pyx_GIVEREF(__pyx_v_jacobian_state);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_jacobian_state);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_kargs);
  __pyx_t_6 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__jacobian_state__"), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PETSc/TAO.pyx":246
 *         CHKERR( TaoSetStateDesignIS(self.tao, s_is, d_is) )
 * 
 *     def setJacobianState(self, jacobian_state, Mat J=None, Mat P=None, Mat I=None,             # <<<<<<<<<<<<<<
 *                          args=None, kargs=None):
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setJacobianState", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":262
 *         self.set_attr("__jacobian_state__", (jacobian_state, args, kargs))
 * 
 *     def setJacobianDesign(self, jacobian_design, Mat J=None,             # <<<<<<<<<<<<<<
 *                           args=None, kargs=None):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_49setJacobianDesign(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_48setJacobianDesign[] = "TAO.setJacobianDesign(self, jacobian_design, Mat J=None, args=None, kargs=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_49setJacobianDesign(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_jacobian_design = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setJacobianDesign (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_jacobian_design,&__pyx_n_s_J,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = (PyObject *)((struct PyPetscMatObject *)Py_None);

    /* "PETSc/TAO.pyx":263
 * 
 *     def setJacobianDesign(self, jacobian_design, Mat J=None,
 *                           args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_jacobian_design)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setJacobianDesign") < 0)) __PYX_ERR(38, 262, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_jacobian_design = values[0];
    __pyx_v_J = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_args = values[2];
    __pyx_v_kargs = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setJacobianDesign", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 262, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setJacobianDesign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_J), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "J", 0))) __PYX_ERR(38, 262, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_48setJacobianDesign(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_jacobian_design, __pyx_v_J, __pyx_v_args, __pyx_v_kargs);

  /* "PETSc/TAO.pyx":262
 *         self.set_attr("__jacobian_state__", (jacobian_state, args, kargs))
 * 
 *     def setJacobianDesign(self, jacobian_design, Mat J=None,             # <<<<<<<<<<<<<<
 *                           args=None, kargs=None):
 *         """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_48setJacobianDesign(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_jacobian_design, struct PyPetscMatObject *__pyx_v_J, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  Mat __pyx_v_Jmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Mat __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("setJacobianDesign", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TAO.pyx":266
 *         """
 *         """
 *         cdef PetscMat Jmat=NULL             # <<<<<<<<<<<<<<
 *         if J is not None: Jmat = J.mat
 *         CHKERR( TaoSetJacobianDesignRoutine(self.tao, Jmat,
 */
  __pyx_v_Jmat = NULL;

  /* "PETSc/TAO.pyx":267
 *         """
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetJacobianDesignRoutine(self.tao, Jmat,
 *                                             TAO_JacobianDesign, NULL) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_J) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_J->mat;
    __pyx_v_Jmat = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":268
 *         cdef PetscMat Jmat=NULL
 *         if J is not None: Jmat = J.mat
 *         CHKERR( TaoSetJacobianDesignRoutine(self.tao, Jmat,             # <<<<<<<<<<<<<<
 *                                             TAO_JacobianDesign, NULL) )
 *         if args is None: args = ()
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetJacobianDesignRoutine(__pyx_v_self->tao, __pyx_v_Jmat, __pyx_f_8petsc4py_5PETSc_TAO_JacobianDesign, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 268, __pyx_L1_error)

  /* "PETSc/TAO.pyx":270
 *         CHKERR( TaoSetJacobianDesignRoutine(self.tao, Jmat,
 *                                             TAO_JacobianDesign, NULL) )
 *         if args is None: args = ()             # <<<<<<<<<<<<<<
 *         if kargs is None: kargs = {}
 *         self.set_attr("__jacobian_design__", (jacobian_design, args, kargs))
 */
  __pyx_t_2 = (__pyx_v_args == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
  }

  /* "PETSc/TAO.pyx":271
 *                                             TAO_JacobianDesign, NULL) )
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *         self.set_attr("__jacobian_design__", (jacobian_design, args, kargs))
 * 
 */
  __pyx_t_1 = (__pyx_v_kargs == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_5);
    __pyx_t_5 = 0;
  }

  /* "PETSc/TAO.pyx":272
 *         if args is None: args = ()
 *         if kargs is None: kargs = {}
 *         self.set_attr("__jacobian_design__", (jacobian_design, args, kargs))             # <<<<<<<<<<<<<<
 * 
 *     # --------------
 */
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_jacobian_design);
  __Pyx_GIVEREF(__pyx_v_jacobian_design);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_jacobian_design);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);
  __Pyx_GIVEREF(__pyx_v_kargs);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_kargs);
  __pyx_t_6 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__jacobian_design__"), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PETSc/TAO.pyx":262
 *         self.set_attr("__jacobian_state__", (jacobian_state, args, kargs))
 * 
 *     def setJacobianDesign(self, jacobian_design, Mat J=None,             # <<<<<<<<<<<<<<
 *                           args=None, kargs=None):
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setJacobianDesign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":276
 *     # --------------
 * 
 *     def computeObjective(self, Vec x not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_51computeObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_50computeObjective[] = "TAO.computeObjective(self, Vec x)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_51computeObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeObjective (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,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);
        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_x)) != 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, "computeObjective") < 0)) __PYX_ERR(38, 276, __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_x = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeObjective", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 276, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(38, 276, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_50computeObjective(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_x);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_50computeObjective(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x) {
  PetscReal __pyx_v_f;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("computeObjective", 0);

  /* "PETSc/TAO.pyx":279
 *         """
 *         """
 *         cdef PetscReal f = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TaoComputeObjective(self.tao, x.vec, &f) )
 *         return toReal(f)
 */
  __pyx_v_f = 0.0;

  /* "PETSc/TAO.pyx":280
 *         """
 *         cdef PetscReal f = 0
 *         CHKERR( TaoComputeObjective(self.tao, x.vec, &f) )             # <<<<<<<<<<<<<<
 *         return toReal(f)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoComputeObjective(__pyx_v_self->tao, __pyx_v_x->vec, (&__pyx_v_f))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 280, __pyx_L1_error)

  /* "PETSc/TAO.pyx":281
 *         cdef PetscReal f = 0
 *         CHKERR( TaoComputeObjective(self.tao, x.vec, &f) )
 *         return toReal(f)             # <<<<<<<<<<<<<<
 * 
 *     def computeSeparableObjective(self, Vec x not None, Vec f not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_f); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":276
 *     # --------------
 * 
 *     def computeObjective(self, Vec x not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":283
 *         return toReal(f)
 * 
 *     def computeSeparableObjective(self, Vec x not None, Vec f not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_53computeSeparableObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_52computeSeparableObjective[] = "TAO.computeSeparableObjective(self, Vec x, Vec f)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_53computeSeparableObjective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_f = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeSeparableObjective (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_f,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeSeparableObjective", 1, 2, 2, 1); __PYX_ERR(38, 283, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSeparableObjective") < 0)) __PYX_ERR(38, 283, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_f = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeSeparableObjective", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 283, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeSeparableObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(38, 283, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "f", 0))) __PYX_ERR(38, 283, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_52computeSeparableObjective(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_x, __pyx_v_f);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_52computeSeparableObjective(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_f) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("computeSeparableObjective", 0);

  /* "PETSc/TAO.pyx":286
 *         """
 *         """
 *         CHKERR( TaoComputeSeparableObjective(self.tao, x.vec, f.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def computeGradient(self, Vec x not None, Vec g not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoComputeSeparableObjective(__pyx_v_self->tao, __pyx_v_x->vec, __pyx_v_f->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 286, __pyx_L1_error)

  /* "PETSc/TAO.pyx":283
 *         return toReal(f)
 * 
 *     def computeSeparableObjective(self, Vec x not None, Vec f not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeSeparableObjective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":288
 *         CHKERR( TaoComputeSeparableObjective(self.tao, x.vec, f.vec) )
 * 
 *     def computeGradient(self, Vec x not None, Vec g not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_55computeGradient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_54computeGradient[] = "TAO.computeGradient(self, Vec x, Vec g)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_55computeGradient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_g = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeGradient (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_g,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_g)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeGradient", 1, 2, 2, 1); __PYX_ERR(38, 288, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeGradient") < 0)) __PYX_ERR(38, 288, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_g = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeGradient", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 288, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeGradient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(38, 288, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "g", 0))) __PYX_ERR(38, 288, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_54computeGradient(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_x, __pyx_v_g);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_54computeGradient(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_g) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("computeGradient", 0);

  /* "PETSc/TAO.pyx":291
 *         """
 *         """
 *         CHKERR( TaoComputeGradient(self.tao, x.vec, g.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def computeObjectiveGradient(self, Vec x not None, Vec g not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoComputeGradient(__pyx_v_self->tao, __pyx_v_x->vec, __pyx_v_g->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 291, __pyx_L1_error)

  /* "PETSc/TAO.pyx":288
 *         CHKERR( TaoComputeSeparableObjective(self.tao, x.vec, f.vec) )
 * 
 *     def computeGradient(self, Vec x not None, Vec g not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeGradient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":293
 *         CHKERR( TaoComputeGradient(self.tao, x.vec, g.vec) )
 * 
 *     def computeObjectiveGradient(self, Vec x not None, Vec g not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_57computeObjectiveGradient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_56computeObjectiveGradient[] = "TAO.computeObjectiveGradient(self, Vec x, Vec g)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_57computeObjectiveGradient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_g = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeObjectiveGradient (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_g,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_g)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeObjectiveGradient", 1, 2, 2, 1); __PYX_ERR(38, 293, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeObjectiveGradient") < 0)) __PYX_ERR(38, 293, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_g = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeObjectiveGradient", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 293, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeObjectiveGradient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(38, 293, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "g", 0))) __PYX_ERR(38, 293, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_56computeObjectiveGradient(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_x, __pyx_v_g);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_56computeObjectiveGradient(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_g) {
  PetscReal __pyx_v_f;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("computeObjectiveGradient", 0);

  /* "PETSc/TAO.pyx":296
 *         """
 *         """
 *         cdef PetscReal f = 0             # <<<<<<<<<<<<<<
 *         CHKERR( TaoComputeObjectiveAndGradient(self.tao, x.vec, &f, g.vec) )
 *         return toReal(f)
 */
  __pyx_v_f = 0.0;

  /* "PETSc/TAO.pyx":297
 *         """
 *         cdef PetscReal f = 0
 *         CHKERR( TaoComputeObjectiveAndGradient(self.tao, x.vec, &f, g.vec) )             # <<<<<<<<<<<<<<
 *         return toReal(f)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoComputeObjectiveAndGradient(__pyx_v_self->tao, __pyx_v_x->vec, (&__pyx_v_f), __pyx_v_g->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 297, __pyx_L1_error)

  /* "PETSc/TAO.pyx":298
 *         cdef PetscReal f = 0
 *         CHKERR( TaoComputeObjectiveAndGradient(self.tao, x.vec, &f, g.vec) )
 *         return toReal(f)             # <<<<<<<<<<<<<<
 * 
 *     def computeDualVariables(self, Vec xl not None, Vec xu not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_f); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":293
 *         CHKERR( TaoComputeGradient(self.tao, x.vec, g.vec) )
 * 
 *     def computeObjectiveGradient(self, Vec x not None, Vec g not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeObjectiveGradient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":300
 *         return toReal(f)
 * 
 *     def computeDualVariables(self, Vec xl not None, Vec xu not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_59computeDualVariables(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_58computeDualVariables[] = "TAO.computeDualVariables(self, Vec xl, Vec xu)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_59computeDualVariables(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_xl = 0;
  struct PyPetscVecObject *__pyx_v_xu = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeDualVariables (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xl,&__pyx_n_s_xu,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_xl)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xu)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeDualVariables", 1, 2, 2, 1); __PYX_ERR(38, 300, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeDualVariables") < 0)) __PYX_ERR(38, 300, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_xl = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_xu = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeDualVariables", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 300, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeDualVariables", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xl), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "xl", 0))) __PYX_ERR(38, 300, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xu), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "xu", 0))) __PYX_ERR(38, 300, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_58computeDualVariables(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_xl, __pyx_v_xu);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_58computeDualVariables(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_xl, struct PyPetscVecObject *__pyx_v_xu) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("computeDualVariables", 0);

  /* "PETSc/TAO.pyx":303
 *         """
 *         """
 *         CHKERR( TaoComputeDualVariables(self.tao, xl.vec, xu.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def computeVariableBounds(self, Vec xl not None, Vec xu not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoComputeDualVariables(__pyx_v_self->tao, __pyx_v_xl->vec, __pyx_v_xu->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 303, __pyx_L1_error)

  /* "PETSc/TAO.pyx":300
 *         return toReal(f)
 * 
 *     def computeDualVariables(self, Vec xl not None, Vec xu not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeDualVariables", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":305
 *         CHKERR( TaoComputeDualVariables(self.tao, xl.vec, xu.vec) )
 * 
 *     def computeVariableBounds(self, Vec xl not None, Vec xu not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_61computeVariableBounds(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_60computeVariableBounds[] = "TAO.computeVariableBounds(self, Vec xl, Vec xu)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_61computeVariableBounds(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_xl = 0;
  struct PyPetscVecObject *__pyx_v_xu = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeVariableBounds (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xl,&__pyx_n_s_xu,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_xl)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xu)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeVariableBounds", 1, 2, 2, 1); __PYX_ERR(38, 305, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeVariableBounds") < 0)) __PYX_ERR(38, 305, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_xl = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_xu = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeVariableBounds", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 305, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeVariableBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xl), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "xl", 0))) __PYX_ERR(38, 305, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xu), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "xu", 0))) __PYX_ERR(38, 305, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_60computeVariableBounds(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_xl, __pyx_v_xu);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_60computeVariableBounds(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_xl, struct PyPetscVecObject *__pyx_v_xu) {
  Vec __pyx_v_Lvec;
  Vec __pyx_v_Uvec;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("computeVariableBounds", 0);

  /* "PETSc/TAO.pyx":308
 *         """
 *         """
 *         CHKERR( TaoComputeVariableBounds(self.tao) )             # <<<<<<<<<<<<<<
 *         cdef PetscVec Lvec = NULL, Uvec = NULL
 *         CHKERR( TaoGetVariableBounds(self.tao, &Lvec, &Uvec) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoComputeVariableBounds(__pyx_v_self->tao)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 308, __pyx_L1_error)

  /* "PETSc/TAO.pyx":309
 *         """
 *         CHKERR( TaoComputeVariableBounds(self.tao) )
 *         cdef PetscVec Lvec = NULL, Uvec = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetVariableBounds(self.tao, &Lvec, &Uvec) )
 *         if xl.vec != NULL:
 */
  __pyx_v_Lvec = NULL;
  __pyx_v_Uvec = NULL;

  /* "PETSc/TAO.pyx":310
 *         CHKERR( TaoComputeVariableBounds(self.tao) )
 *         cdef PetscVec Lvec = NULL, Uvec = NULL
 *         CHKERR( TaoGetVariableBounds(self.tao, &Lvec, &Uvec) )             # <<<<<<<<<<<<<<
 *         if xl.vec != NULL:
 *             if Lvec != NULL:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetVariableBounds(__pyx_v_self->tao, (&__pyx_v_Lvec), (&__pyx_v_Uvec))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 310, __pyx_L1_error)

  /* "PETSc/TAO.pyx":311
 *         cdef PetscVec Lvec = NULL, Uvec = NULL
 *         CHKERR( TaoGetVariableBounds(self.tao, &Lvec, &Uvec) )
 *         if xl.vec != NULL:             # <<<<<<<<<<<<<<
 *             if Lvec != NULL:
 *                 CHKERR( VecCopy(Lvec, xl.vec) )
 */
  __pyx_t_2 = ((__pyx_v_xl->vec != NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/TAO.pyx":312
 *         CHKERR( TaoGetVariableBounds(self.tao, &Lvec, &Uvec) )
 *         if xl.vec != NULL:
 *             if Lvec != NULL:             # <<<<<<<<<<<<<<
 *                 CHKERR( VecCopy(Lvec, xl.vec) )
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_Lvec != NULL) != 0);
    if (__pyx_t_2) {

      /* "PETSc/TAO.pyx":313
 *         if xl.vec != NULL:
 *             if Lvec != NULL:
 *                 CHKERR( VecCopy(Lvec, xl.vec) )             # <<<<<<<<<<<<<<
 *             else:
 *                 CHKERR( VecSet(xl.vec, <PetscScalar>PETSC_NINFINITY) )
 */
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCopy(__pyx_v_Lvec, __pyx_v_xl->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 313, __pyx_L1_error)

      /* "PETSc/TAO.pyx":312
 *         CHKERR( TaoGetVariableBounds(self.tao, &Lvec, &Uvec) )
 *         if xl.vec != NULL:
 *             if Lvec != NULL:             # <<<<<<<<<<<<<<
 *                 CHKERR( VecCopy(Lvec, xl.vec) )
 *             else:
 */
      goto __pyx_L4;
    }

    /* "PETSc/TAO.pyx":315
 *                 CHKERR( VecCopy(Lvec, xl.vec) )
 *             else:
 *                 CHKERR( VecSet(xl.vec, <PetscScalar>PETSC_NINFINITY) )             # <<<<<<<<<<<<<<
 *         if xu.vec != NULL:
 *             if Uvec != NULL:
 */
    /*else*/ {
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSet(__pyx_v_xl->vec, ((PetscScalar)PETSC_NINFINITY))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 315, __pyx_L1_error)
    }
    __pyx_L4:;

    /* "PETSc/TAO.pyx":311
 *         cdef PetscVec Lvec = NULL, Uvec = NULL
 *         CHKERR( TaoGetVariableBounds(self.tao, &Lvec, &Uvec) )
 *         if xl.vec != NULL:             # <<<<<<<<<<<<<<
 *             if Lvec != NULL:
 *                 CHKERR( VecCopy(Lvec, xl.vec) )
 */
  }

  /* "PETSc/TAO.pyx":316
 *             else:
 *                 CHKERR( VecSet(xl.vec, <PetscScalar>PETSC_NINFINITY) )
 *         if xu.vec != NULL:             # <<<<<<<<<<<<<<
 *             if Uvec != NULL:
 *                 CHKERR( VecCopy(Uvec, xu.vec) )
 */
  __pyx_t_2 = ((__pyx_v_xu->vec != NULL) != 0);
  if (__pyx_t_2) {

    /* "PETSc/TAO.pyx":317
 *                 CHKERR( VecSet(xl.vec, <PetscScalar>PETSC_NINFINITY) )
 *         if xu.vec != NULL:
 *             if Uvec != NULL:             # <<<<<<<<<<<<<<
 *                 CHKERR( VecCopy(Uvec, xu.vec) )
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_Uvec != NULL) != 0);
    if (__pyx_t_2) {

      /* "PETSc/TAO.pyx":318
 *         if xu.vec != NULL:
 *             if Uvec != NULL:
 *                 CHKERR( VecCopy(Uvec, xu.vec) )             # <<<<<<<<<<<<<<
 *             else:
 *                 CHKERR( VecSet(xu.vec, <PetscScalar>PETSC_INFINITY) )
 */
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCopy(__pyx_v_Uvec, __pyx_v_xu->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 318, __pyx_L1_error)

      /* "PETSc/TAO.pyx":317
 *                 CHKERR( VecSet(xl.vec, <PetscScalar>PETSC_NINFINITY) )
 *         if xu.vec != NULL:
 *             if Uvec != NULL:             # <<<<<<<<<<<<<<
 *                 CHKERR( VecCopy(Uvec, xu.vec) )
 *             else:
 */
      goto __pyx_L6;
    }

    /* "PETSc/TAO.pyx":320
 *                 CHKERR( VecCopy(Uvec, xu.vec) )
 *             else:
 *                 CHKERR( VecSet(xu.vec, <PetscScalar>PETSC_INFINITY) )             # <<<<<<<<<<<<<<
 * 
 *     def computeConstraints(self, Vec x not None, Vec c not None):
 */
    /*else*/ {
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecSet(__pyx_v_xu->vec, ((PetscScalar)PETSC_INFINITY))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 320, __pyx_L1_error)
    }
    __pyx_L6:;

    /* "PETSc/TAO.pyx":316
 *             else:
 *                 CHKERR( VecSet(xl.vec, <PetscScalar>PETSC_NINFINITY) )
 *         if xu.vec != NULL:             # <<<<<<<<<<<<<<
 *             if Uvec != NULL:
 *                 CHKERR( VecCopy(Uvec, xu.vec) )
 */
  }

  /* "PETSc/TAO.pyx":305
 *         CHKERR( TaoComputeDualVariables(self.tao, xl.vec, xu.vec) )
 * 
 *     def computeVariableBounds(self, Vec xl not None, Vec xu not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeVariableBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":322
 *                 CHKERR( VecSet(xu.vec, <PetscScalar>PETSC_INFINITY) )
 * 
 *     def computeConstraints(self, Vec x not None, Vec c not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_63computeConstraints(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_62computeConstraints[] = "TAO.computeConstraints(self, Vec x, Vec c)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_63computeConstraints(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscVecObject *__pyx_v_c = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeConstraints (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_c,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeConstraints", 1, 2, 2, 1); __PYX_ERR(38, 322, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeConstraints") < 0)) __PYX_ERR(38, 322, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_c = ((struct PyPetscVecObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeConstraints", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 322, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeConstraints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(38, 322, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_c), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "c", 0))) __PYX_ERR(38, 322, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_62computeConstraints(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_x, __pyx_v_c);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_62computeConstraints(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscVecObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("computeConstraints", 0);

  /* "PETSc/TAO.pyx":325
 *         """
 *         """
 *         CHKERR( TaoComputeConstraints(self.tao, x.vec, c.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def computeHessian(self, Vec x not None, Mat H not None, Mat P=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoComputeConstraints(__pyx_v_self->tao, __pyx_v_x->vec, __pyx_v_c->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 325, __pyx_L1_error)

  /* "PETSc/TAO.pyx":322
 *                 CHKERR( VecSet(xu.vec, <PetscScalar>PETSC_INFINITY) )
 * 
 *     def computeConstraints(self, Vec x not None, Vec c not None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeConstraints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":327
 *         CHKERR( TaoComputeConstraints(self.tao, x.vec, c.vec) )
 * 
 *     def computeHessian(self, Vec x not None, Mat H not None, Mat P=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_65computeHessian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_64computeHessian[] = "TAO.computeHessian(self, Vec x, Mat H, Mat P=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_65computeHessian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscMatObject *__pyx_v_H = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeHessian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_H,&__pyx_n_s_P,0};
    PyObject* values[3] = {0,0,0};
    values[2] = (PyObject *)((struct PyPetscMatObject *)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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_H)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeHessian", 0, 2, 3, 1); __PYX_ERR(38, 327, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeHessian") < 0)) __PYX_ERR(38, 327, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_H = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeHessian", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 327, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeHessian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(38, 327, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_H), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "H", 0))) __PYX_ERR(38, 327, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(38, 327, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_64computeHessian(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_x, __pyx_v_H, __pyx_v_P);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_64computeHessian(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscMatObject *__pyx_v_H, struct PyPetscMatObject *__pyx_v_P) {
  Mat __pyx_v_hmat;
  Mat __pyx_v_pmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Mat __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("computeHessian", 0);

  /* "PETSc/TAO.pyx":330
 *         """
 *         """
 *         cdef PetscMat hmat = H.mat, pmat = H.mat             # <<<<<<<<<<<<<<
 *         if P is not None: pmat = P.mat
 *         CHKERR( TaoComputeHessian(self.tao, x.vec, hmat, pmat) )
 */
  __pyx_t_1 = __pyx_v_H->mat;
  __pyx_v_hmat = __pyx_t_1;
  __pyx_t_1 = __pyx_v_H->mat;
  __pyx_v_pmat = __pyx_t_1;

  /* "PETSc/TAO.pyx":331
 *         """
 *         cdef PetscMat hmat = H.mat, pmat = H.mat
 *         if P is not None: pmat = P.mat             # <<<<<<<<<<<<<<
 *         CHKERR( TaoComputeHessian(self.tao, x.vec, hmat, pmat) )
 * 
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_1 = __pyx_v_P->mat;
    __pyx_v_pmat = __pyx_t_1;
  }

  /* "PETSc/TAO.pyx":332
 *         cdef PetscMat hmat = H.mat, pmat = H.mat
 *         if P is not None: pmat = P.mat
 *         CHKERR( TaoComputeHessian(self.tao, x.vec, hmat, pmat) )             # <<<<<<<<<<<<<<
 * 
 *     def computeJacobian(self, Vec x not None, Mat J not None, Mat P=None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoComputeHessian(__pyx_v_self->tao, __pyx_v_x->vec, __pyx_v_hmat, __pyx_v_pmat)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 332, __pyx_L1_error)

  /* "PETSc/TAO.pyx":327
 *         CHKERR( TaoComputeConstraints(self.tao, x.vec, c.vec) )
 * 
 *     def computeHessian(self, Vec x not None, Mat H not None, Mat P=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeHessian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":334
 *         CHKERR( TaoComputeHessian(self.tao, x.vec, hmat, pmat) )
 * 
 *     def computeJacobian(self, Vec x not None, Mat J not None, Mat P=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_67computeJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_66computeJacobian[] = "TAO.computeJacobian(self, Vec x, Mat J, Mat P=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_67computeJacobian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  struct PyPetscMatObject *__pyx_v_J = 0;
  struct PyPetscMatObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeJacobian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_J,&__pyx_n_s_P,0};
    PyObject* values[3] = {0,0,0};
    values[2] = (PyObject *)((struct PyPetscMatObject *)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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_J)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("computeJacobian", 0, 2, 3, 1); __PYX_ERR(38, 334, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeJacobian") < 0)) __PYX_ERR(38, 334, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_x = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_J = ((struct PyPetscMatObject *)values[1]);
    __pyx_v_P = ((struct PyPetscMatObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeJacobian", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 334, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "x", 0))) __PYX_ERR(38, 334, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_J), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "J", 0))) __PYX_ERR(38, 334, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "P", 0))) __PYX_ERR(38, 334, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_66computeJacobian(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_x, __pyx_v_J, __pyx_v_P);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_66computeJacobian(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x, struct PyPetscMatObject *__pyx_v_J, struct PyPetscMatObject *__pyx_v_P) {
  Mat __pyx_v_jmat;
  Mat __pyx_v_pmat;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Mat __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("computeJacobian", 0);

  /* "PETSc/TAO.pyx":337
 *         """
 *         """
 *         cdef PetscMat jmat = J.mat, pmat = J.mat             # <<<<<<<<<<<<<<
 *         if P is not None: pmat = P.mat
 *         CHKERR( TaoComputeJacobian(self.tao, x.vec, jmat, pmat) )
 */
  __pyx_t_1 = __pyx_v_J->mat;
  __pyx_v_jmat = __pyx_t_1;
  __pyx_t_1 = __pyx_v_J->mat;
  __pyx_v_pmat = __pyx_t_1;

  /* "PETSc/TAO.pyx":338
 *         """
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat             # <<<<<<<<<<<<<<
 *         CHKERR( TaoComputeJacobian(self.tao, x.vec, jmat, pmat) )
 * 
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_P) != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
    __pyx_t_1 = __pyx_v_P->mat;
    __pyx_v_pmat = __pyx_t_1;
  }

  /* "PETSc/TAO.pyx":339
 *         cdef PetscMat jmat = J.mat, pmat = J.mat
 *         if P is not None: pmat = P.mat
 *         CHKERR( TaoComputeJacobian(self.tao, x.vec, jmat, pmat) )             # <<<<<<<<<<<<<<
 * 
 *     # --------------
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoComputeJacobian(__pyx_v_self->tao, __pyx_v_x->vec, __pyx_v_jmat, __pyx_v_pmat)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 339, __pyx_L1_error)

  /* "PETSc/TAO.pyx":334
 *         CHKERR( TaoComputeHessian(self.tao, x.vec, hmat, pmat) )
 * 
 *     def computeJacobian(self, Vec x not None, Mat J not None, Mat P=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.computeJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":345
 *     #
 * 
 *     def setTolerances(self, gatol=None, grtol=None, gttol=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_69setTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_68setTolerances[] = "TAO.setTolerances(self, gatol=None, grtol=None, gttol=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_69setTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gatol = 0;
  PyObject *__pyx_v_grtol = 0;
  PyObject *__pyx_v_gttol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTolerances (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gatol,&__pyx_n_s_grtol,&__pyx_n_s_gttol,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gatol);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_grtol);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gttol);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setTolerances") < 0)) __PYX_ERR(38, 345, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_gatol = values[0];
    __pyx_v_grtol = values[1];
    __pyx_v_gttol = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTolerances", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 345, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_68setTolerances(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_gatol, __pyx_v_grtol, __pyx_v_gttol);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_68setTolerances(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_gatol, PyObject *__pyx_v_grtol, PyObject *__pyx_v_gttol) {
  PetscReal __pyx_v__gatol;
  PetscReal __pyx_v__grtol;
  PetscReal __pyx_v__gttol;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscReal __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setTolerances", 0);

  /* "PETSc/TAO.pyx":348
 *         """
 *         """
 *         cdef PetscReal _gatol=PETSC_DEFAULT, _grtol=PETSC_DEFAULT, _gttol=PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         if gatol is not None: _gatol = asReal(gatol)
 *         if grtol is not None: _grtol = asReal(grtol)
 */
  __pyx_v__gatol = PETSC_DEFAULT;
  __pyx_v__grtol = PETSC_DEFAULT;
  __pyx_v__gttol = PETSC_DEFAULT;

  /* "PETSc/TAO.pyx":349
 *         """
 *         cdef PetscReal _gatol=PETSC_DEFAULT, _grtol=PETSC_DEFAULT, _gttol=PETSC_DEFAULT
 *         if gatol is not None: _gatol = asReal(gatol)             # <<<<<<<<<<<<<<
 *         if grtol is not None: _grtol = asReal(grtol)
 *         if gttol is not None: _gttol = asReal(gttol)
 */
  __pyx_t_1 = (__pyx_v_gatol != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_gatol); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(38, 349, __pyx_L1_error)
    __pyx_v__gatol = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":350
 *         cdef PetscReal _gatol=PETSC_DEFAULT, _grtol=PETSC_DEFAULT, _gttol=PETSC_DEFAULT
 *         if gatol is not None: _gatol = asReal(gatol)
 *         if grtol is not None: _grtol = asReal(grtol)             # <<<<<<<<<<<<<<
 *         if gttol is not None: _gttol = asReal(gttol)
 *         CHKERR( TaoSetTolerances(self.tao, _gatol, _grtol, _gttol) )
 */
  __pyx_t_2 = (__pyx_v_grtol != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_grtol); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(38, 350, __pyx_L1_error)
    __pyx_v__grtol = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":351
 *         if gatol is not None: _gatol = asReal(gatol)
 *         if grtol is not None: _grtol = asReal(grtol)
 *         if gttol is not None: _gttol = asReal(gttol)             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetTolerances(self.tao, _gatol, _grtol, _gttol) )
 * 
 */
  __pyx_t_1 = (__pyx_v_gttol != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_gttol); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(38, 351, __pyx_L1_error)
    __pyx_v__gttol = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":352
 *         if grtol is not None: _grtol = asReal(grtol)
 *         if gttol is not None: _gttol = asReal(gttol)
 *         CHKERR( TaoSetTolerances(self.tao, _gatol, _grtol, _gttol) )             # <<<<<<<<<<<<<<
 * 
 *     def getTolerances(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetTolerances(__pyx_v_self->tao, __pyx_v__gatol, __pyx_v__grtol, __pyx_v__gttol)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 352, __pyx_L1_error)

  /* "PETSc/TAO.pyx":345
 *     #
 * 
 *     def setTolerances(self, gatol=None, grtol=None, gttol=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":354
 *         CHKERR( TaoSetTolerances(self.tao, _gatol, _grtol, _gttol) )
 * 
 *     def getTolerances(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_71getTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_70getTolerances[] = "TAO.getTolerances(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_71getTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTolerances (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getTolerances", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getTolerances", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_70getTolerances(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_70getTolerances(struct PyPetscTAOObject *__pyx_v_self) {
  PetscReal __pyx_v__gatol;
  PetscReal __pyx_v__grtol;
  PetscReal __pyx_v__gttol;
  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;
  __Pyx_RefNannySetupContext("getTolerances", 0);

  /* "PETSc/TAO.pyx":357
 *         """
 *         """
 *         cdef PetscReal _gatol=PETSC_DEFAULT, _grtol=PETSC_DEFAULT, _gttol=PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetTolerances(self.tao, &_gatol, &_grtol, &_gttol) )
 *         return (toReal(_gatol), toReal(_grtol), toReal(_gttol))
 */
  __pyx_v__gatol = PETSC_DEFAULT;
  __pyx_v__grtol = PETSC_DEFAULT;
  __pyx_v__gttol = PETSC_DEFAULT;

  /* "PETSc/TAO.pyx":358
 *         """
 *         cdef PetscReal _gatol=PETSC_DEFAULT, _grtol=PETSC_DEFAULT, _gttol=PETSC_DEFAULT
 *         CHKERR( TaoGetTolerances(self.tao, &_gatol, &_grtol, &_gttol) )             # <<<<<<<<<<<<<<
 *         return (toReal(_gatol), toReal(_grtol), toReal(_gttol))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetTolerances(__pyx_v_self->tao, (&__pyx_v__gatol), (&__pyx_v__grtol), (&__pyx_v__gttol))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 358, __pyx_L1_error)

  /* "PETSc/TAO.pyx":359
 *         cdef PetscReal _gatol=PETSC_DEFAULT, _grtol=PETSC_DEFAULT, _gttol=PETSC_DEFAULT
 *         CHKERR( TaoGetTolerances(self.tao, &_gatol, &_grtol, &_gttol) )
 *         return (toReal(_gatol), toReal(_grtol), toReal(_gttol))             # <<<<<<<<<<<<<<
 * 
 *     def setConstraintTolerances(self, catol=None, crtol=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v__gatol); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v__grtol); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v__gttol); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":354
 *         CHKERR( TaoSetTolerances(self.tao, _gatol, _grtol, _gttol) )
 * 
 *     def getTolerances(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* 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("petsc4py.PETSc.TAO.getTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":361
 *         return (toReal(_gatol), toReal(_grtol), toReal(_gttol))
 * 
 *     def setConstraintTolerances(self, catol=None, crtol=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_73setConstraintTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_72setConstraintTolerances[] = "TAO.setConstraintTolerances(self, catol=None, crtol=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_73setConstraintTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_catol = 0;
  PyObject *__pyx_v_crtol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConstraintTolerances (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_catol,&__pyx_n_s_crtol,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_catol);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_crtol);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConstraintTolerances") < 0)) __PYX_ERR(38, 361, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_catol = values[0];
    __pyx_v_crtol = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConstraintTolerances", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 361, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setConstraintTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_72setConstraintTolerances(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_catol, __pyx_v_crtol);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_72setConstraintTolerances(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_catol, PyObject *__pyx_v_crtol) {
  PetscReal __pyx_v__catol;
  PetscReal __pyx_v__crtol;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscReal __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setConstraintTolerances", 0);

  /* "PETSc/TAO.pyx":364
 *         """
 *         """
 *         cdef PetscReal _catol=PETSC_DEFAULT, _crtol=PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         if catol is not None: _catol = asReal(catol)
 *         if crtol is not None: _crtol = asReal(crtol)
 */
  __pyx_v__catol = PETSC_DEFAULT;
  __pyx_v__crtol = PETSC_DEFAULT;

  /* "PETSc/TAO.pyx":365
 *         """
 *         cdef PetscReal _catol=PETSC_DEFAULT, _crtol=PETSC_DEFAULT
 *         if catol is not None: _catol = asReal(catol)             # <<<<<<<<<<<<<<
 *         if crtol is not None: _crtol = asReal(crtol)
 *         CHKERR( TaoSetConstraintTolerances(self.tao, _catol, _crtol) )
 */
  __pyx_t_1 = (__pyx_v_catol != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_catol); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(38, 365, __pyx_L1_error)
    __pyx_v__catol = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":366
 *         cdef PetscReal _catol=PETSC_DEFAULT, _crtol=PETSC_DEFAULT
 *         if catol is not None: _catol = asReal(catol)
 *         if crtol is not None: _crtol = asReal(crtol)             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetConstraintTolerances(self.tao, _catol, _crtol) )
 * 
 */
  __pyx_t_2 = (__pyx_v_crtol != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_crtol); if (unlikely(__pyx_t_3 == -1.0 && PyErr_Occurred())) __PYX_ERR(38, 366, __pyx_L1_error)
    __pyx_v__crtol = __pyx_t_3;
  }

  /* "PETSc/TAO.pyx":367
 *         if catol is not None: _catol = asReal(catol)
 *         if crtol is not None: _crtol = asReal(crtol)
 *         CHKERR( TaoSetConstraintTolerances(self.tao, _catol, _crtol) )             # <<<<<<<<<<<<<<
 * 
 *     def getConstraintTolerances(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetConstraintTolerances(__pyx_v_self->tao, __pyx_v__catol, __pyx_v__crtol)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 367, __pyx_L1_error)

  /* "PETSc/TAO.pyx":361
 *         return (toReal(_gatol), toReal(_grtol), toReal(_gttol))
 * 
 *     def setConstraintTolerances(self, catol=None, crtol=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setConstraintTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":369
 *         CHKERR( TaoSetConstraintTolerances(self.tao, _catol, _crtol) )
 * 
 *     def getConstraintTolerances(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_75getConstraintTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_74getConstraintTolerances[] = "TAO.getConstraintTolerances(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_75getConstraintTolerances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConstraintTolerances (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getConstraintTolerances", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getConstraintTolerances", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_74getConstraintTolerances(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_74getConstraintTolerances(struct PyPetscTAOObject *__pyx_v_self) {
  PetscReal __pyx_v__catol;
  PetscReal __pyx_v__crtol;
  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;
  __Pyx_RefNannySetupContext("getConstraintTolerances", 0);

  /* "PETSc/TAO.pyx":372
 *         """
 *         """
 *         cdef PetscReal _catol=PETSC_DEFAULT, _crtol=PETSC_DEFAULT             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetConstraintTolerances(self.tao, &_catol, &_crtol) )
 *         return (toReal(_catol), toReal(_crtol))
 */
  __pyx_v__catol = PETSC_DEFAULT;
  __pyx_v__crtol = PETSC_DEFAULT;

  /* "PETSc/TAO.pyx":373
 *         """
 *         cdef PetscReal _catol=PETSC_DEFAULT, _crtol=PETSC_DEFAULT
 *         CHKERR( TaoGetConstraintTolerances(self.tao, &_catol, &_crtol) )             # <<<<<<<<<<<<<<
 *         return (toReal(_catol), toReal(_crtol))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetConstraintTolerances(__pyx_v_self->tao, (&__pyx_v__catol), (&__pyx_v__crtol))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 373, __pyx_L1_error)

  /* "PETSc/TAO.pyx":374
 *         cdef PetscReal _catol=PETSC_DEFAULT, _crtol=PETSC_DEFAULT
 *         CHKERR( TaoGetConstraintTolerances(self.tao, &_catol, &_crtol) )
 *         return (toReal(_catol), toReal(_crtol))             # <<<<<<<<<<<<<<
 * 
 *     def setConvergenceTest(self, converged, args=None, kargs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v__catol); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v__crtol); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 374, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":369
 *         CHKERR( TaoSetConstraintTolerances(self.tao, _catol, _crtol) )
 * 
 *     def getConstraintTolerances(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getConstraintTolerances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":376
 *         return (toReal(_catol), toReal(_crtol))
 * 
 *     def setConvergenceTest(self, converged, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_77setConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_76setConvergenceTest[] = "TAO.setConvergenceTest(self, converged, args=None, kargs=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_77setConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_converged = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvergenceTest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_converged,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_converged)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConvergenceTest") < 0)) __PYX_ERR(38, 376, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_converged = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvergenceTest", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 376, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_76setConvergenceTest(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_converged, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_76setConvergenceTest(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_converged, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("setConvergenceTest", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TAO.pyx":379
 *         """
 *         """
 *         if converged is None:             # <<<<<<<<<<<<<<
 *             CHKERR( TaoSetConvergenceTest(self.tao, TaoDefaultConvergenceTest, NULL) )
 *             self.set_attr('__converged__', None)
 */
  __pyx_t_1 = (__pyx_v_converged == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/TAO.pyx":380
 *         """
 *         if converged is None:
 *             CHKERR( TaoSetConvergenceTest(self.tao, TaoDefaultConvergenceTest, NULL) )             # <<<<<<<<<<<<<<
 *             self.set_attr('__converged__', None)
 *         else:
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetConvergenceTest(__pyx_v_self->tao, TaoDefaultConvergenceTest, NULL)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(38, 380, __pyx_L1_error)

    /* "PETSc/TAO.pyx":381
 *         if converged is None:
 *             CHKERR( TaoSetConvergenceTest(self.tao, TaoDefaultConvergenceTest, NULL) )
 *             self.set_attr('__converged__', None)             # <<<<<<<<<<<<<<
 *         else:
 *             if args is None: args = ()
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__converged__"), Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/TAO.pyx":379
 *         """
 *         """
 *         if converged is None:             # <<<<<<<<<<<<<<
 *             CHKERR( TaoSetConvergenceTest(self.tao, TaoDefaultConvergenceTest, NULL) )
 *             self.set_attr('__converged__', None)
 */
    goto __pyx_L3;
  }

  /* "PETSc/TAO.pyx":383
 *             self.set_attr('__converged__', None)
 *         else:
 *             if args is None: args = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             self.set_attr('__converged__', (converged, args, kargs))
 */
  /*else*/ {
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/TAO.pyx":384
 *         else:
 *             if args is None: args = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             self.set_attr('__converged__', (converged, args, kargs))
 *             CHKERR( TaoSetConvergenceTest(self.tao, TAO_Converged, NULL) )
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_4);
      __pyx_t_4 = 0;
    }

    /* "PETSc/TAO.pyx":385
 *             if args is None: args = ()
 *             if kargs is None: kargs = {}
 *             self.set_attr('__converged__', (converged, args, kargs))             # <<<<<<<<<<<<<<
 *             CHKERR( TaoSetConvergenceTest(self.tao, TAO_Converged, NULL) )
 * 
 */
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 385, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_converged);
    __Pyx_GIVEREF(__pyx_v_converged);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_converged);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_kargs);
    __pyx_t_5 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__converged__"), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 385, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "PETSc/TAO.pyx":386
 *             if kargs is None: kargs = {}
 *             self.set_attr('__converged__', (converged, args, kargs))
 *             CHKERR( TaoSetConvergenceTest(self.tao, TAO_Converged, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def getConvergenceTest(self):
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetConvergenceTest(__pyx_v_self->tao, __pyx_f_8petsc4py_5PETSc_TAO_Converged, NULL)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(38, 386, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/TAO.pyx":376
 *         return (toReal(_catol), toReal(_crtol))
 * 
 *     def setConvergenceTest(self, converged, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":388
 *             CHKERR( TaoSetConvergenceTest(self.tao, TAO_Converged, NULL) )
 * 
 *     def getConvergenceTest(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_79getConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_78getConvergenceTest[] = "TAO.getConvergenceTest(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_79getConvergenceTest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvergenceTest (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getConvergenceTest", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getConvergenceTest", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_78getConvergenceTest(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_78getConvergenceTest(struct PyPetscTAOObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getConvergenceTest", 0);

  /* "PETSc/TAO.pyx":391
 *         """
 *         """
 *         return self.get_attr('__converged__')             # <<<<<<<<<<<<<<
 * 
 *     def setConvergedReason(self, reason):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__converged__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":388
 *             CHKERR( TaoSetConvergenceTest(self.tao, TAO_Converged, NULL) )
 * 
 *     def getConvergenceTest(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getConvergenceTest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":393
 *         return self.get_attr('__converged__')
 * 
 *     def setConvergedReason(self, reason):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_81setConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_80setConvergedReason[] = "TAO.setConvergedReason(self, reason)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_81setConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_reason = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvergedReason (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reason,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);
        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_reason)) != 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, "setConvergedReason") < 0)) __PYX_ERR(38, 393, __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_reason = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvergedReason", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 393, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_80setConvergedReason(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_reason);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_80setConvergedReason(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_reason) {
  TaoConvergedReason __pyx_v_creason;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  TaoConvergedReason __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setConvergedReason", 0);

  /* "PETSc/TAO.pyx":396
 *         """
 *         """
 *         cdef PetscTAOConvergedReason creason = reason             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSetConvergedReason(self.tao, creason) )
 * 
 */
  __pyx_t_1 = ((TaoConvergedReason)__Pyx_PyInt_As_TaoConvergedReason(__pyx_v_reason)); if (unlikely(PyErr_Occurred())) __PYX_ERR(38, 396, __pyx_L1_error)
  __pyx_v_creason = __pyx_t_1;

  /* "PETSc/TAO.pyx":397
 *         """
 *         cdef PetscTAOConvergedReason creason = reason
 *         CHKERR( TaoSetConvergedReason(self.tao, creason) )             # <<<<<<<<<<<<<<
 * 
 *     def getConvergedReason(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetConvergedReason(__pyx_v_self->tao, __pyx_v_creason)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(38, 397, __pyx_L1_error)

  /* "PETSc/TAO.pyx":393
 *         return self.get_attr('__converged__')
 * 
 *     def setConvergedReason(self, reason):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":399
 *         CHKERR( TaoSetConvergedReason(self.tao, creason) )
 * 
 *     def getConvergedReason(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_83getConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_82getConvergedReason[] = "TAO.getConvergedReason(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_83getConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvergedReason (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getConvergedReason", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getConvergedReason", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_82getConvergedReason(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_82getConvergedReason(struct PyPetscTAOObject *__pyx_v_self) {
  TaoConvergedReason __pyx_v_creason;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvergedReason", 0);

  /* "PETSc/TAO.pyx":402
 *         """
 *         """
 *         cdef PetscTAOConvergedReason creason = TAO_CONTINUE_ITERATING             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetConvergedReason(self.tao, &creason) )
 *         return creason
 */
  __pyx_v_creason = TAO_CONTINUE_ITERATING;

  /* "PETSc/TAO.pyx":403
 *         """
 *         cdef PetscTAOConvergedReason creason = TAO_CONTINUE_ITERATING
 *         CHKERR( TaoGetConvergedReason(self.tao, &creason) )             # <<<<<<<<<<<<<<
 *         return creason
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetConvergedReason(__pyx_v_self->tao, (&__pyx_v_creason))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 403, __pyx_L1_error)

  /* "PETSc/TAO.pyx":404
 *         cdef PetscTAOConvergedReason creason = TAO_CONTINUE_ITERATING
 *         CHKERR( TaoGetConvergedReason(self.tao, &creason) )
 *         return creason             # <<<<<<<<<<<<<<
 * 
 *     def setMonitor(self, monitor, args=None, kargs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_TaoConvergedReason(__pyx_v_creason); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":399
 *         CHKERR( TaoSetConvergedReason(self.tao, creason) )
 * 
 *     def getConvergedReason(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":406
 *         return creason
 * 
 *     def setMonitor(self, monitor, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_85setMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_84setMonitor[] = "TAO.setMonitor(self, monitor, args=None, kargs=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_85setMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_monitor = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMonitor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_monitor,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_monitor)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setMonitor") < 0)) __PYX_ERR(38, 406, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_monitor = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMonitor", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 406, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_84setMonitor(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_monitor, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_84setMonitor(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_monitor, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_monitorlist = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("setMonitor", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/TAO.pyx":409
 *         """
 *         """
 *         if monitor is None: return             # <<<<<<<<<<<<<<
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:
 */
  __pyx_t_1 = (__pyx_v_monitor == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "PETSc/TAO.pyx":410
 *         """
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')             # <<<<<<<<<<<<<<
 *         if monitorlist is None:
 *             CHKERR( TaoSetMonitor(self.tao, TAO_Monitor, NULL, NULL) )
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__")); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_monitorlist = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/TAO.pyx":411
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:             # <<<<<<<<<<<<<<
 *             CHKERR( TaoSetMonitor(self.tao, TAO_Monitor, NULL, NULL) )
 *             if args  is None: args  = ()
 */
  __pyx_t_2 = (__pyx_v_monitorlist == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/TAO.pyx":412
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:
 *             CHKERR( TaoSetMonitor(self.tao, TAO_Monitor, NULL, NULL) )             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetMonitor(__pyx_v_self->tao, __pyx_f_8petsc4py_5PETSc_TAO_Monitor, NULL, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(38, 412, __pyx_L1_error)

    /* "PETSc/TAO.pyx":413
 *         if monitorlist is None:
 *             CHKERR( TaoSetMonitor(self.tao, TAO_Monitor, NULL, NULL) )
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             self.set_attr('__monitor__',  [(monitor, args, kargs)])
 */
    __pyx_t_1 = (__pyx_v_args == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/TAO.pyx":414
 *             CHKERR( TaoSetMonitor(self.tao, TAO_Monitor, NULL, NULL) )
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             self.set_attr('__monitor__',  [(monitor, args, kargs)])
 *         else:
 */
    __pyx_t_2 = (__pyx_v_kargs == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/TAO.pyx":415
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             self.set_attr('__monitor__',  [(monitor, args, kargs)])             # <<<<<<<<<<<<<<
 *         else:
 *             monitorlist.append((monitor, args, kargs))
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_monitor);
    __Pyx_GIVEREF(__pyx_v_monitor);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_monitor);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__"), __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/TAO.pyx":411
 *         if monitor is None: return
 *         cdef object monitorlist = self.get_attr('__monitor__')
 *         if monitorlist is None:             # <<<<<<<<<<<<<<
 *             CHKERR( TaoSetMonitor(self.tao, TAO_Monitor, NULL, NULL) )
 *             if args  is None: args  = ()
 */
    goto __pyx_L4;
  }

  /* "PETSc/TAO.pyx":417
 *             self.set_attr('__monitor__',  [(monitor, args, kargs)])
 *         else:
 *             monitorlist.append((monitor, args, kargs))             # <<<<<<<<<<<<<<
 * 
 *     def getMonitor(self):
 */
  /*else*/ {
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_monitor);
    __Pyx_GIVEREF(__pyx_v_monitor);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_monitor);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_monitorlist, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(38, 417, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "PETSc/TAO.pyx":406
 *         return creason
 * 
 *     def setMonitor(self, monitor, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_monitorlist);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":419
 *             monitorlist.append((monitor, args, kargs))
 * 
 *     def getMonitor(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_87getMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_86getMonitor[] = "TAO.getMonitor(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_87getMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMonitor (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMonitor", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMonitor", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_86getMonitor(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_86getMonitor(struct PyPetscTAOObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getMonitor", 0);

  /* "PETSc/TAO.pyx":422
 *         """
 *         """
 *         return self.get_attr('__monitor__')             # <<<<<<<<<<<<<<
 * 
 *     def cancelMonitor(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":419
 *             monitorlist.append((monitor, args, kargs))
 * 
 *     def getMonitor(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":424
 *         return self.get_attr('__monitor__')
 * 
 *     def cancelMonitor(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_89cancelMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_88cancelMonitor[] = "TAO.cancelMonitor(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_89cancelMonitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cancelMonitor (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("cancelMonitor", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "cancelMonitor", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_88cancelMonitor(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_88cancelMonitor(struct PyPetscTAOObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("cancelMonitor", 0);

  /* "PETSc/TAO.pyx":427
 *         """
 *         """
 *         CHKERR( TaoCancelMonitors(self.tao) )             # <<<<<<<<<<<<<<
 *         self.set_attr('__monitor__',  None)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoCancelMonitors(__pyx_v_self->tao)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 427, __pyx_L1_error)

  /* "PETSc/TAO.pyx":428
 *         """
 *         CHKERR( TaoCancelMonitors(self.tao) )
 *         self.set_attr('__monitor__',  None)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_TAO *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__monitor__"), Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/TAO.pyx":424
 *         return self.get_attr('__monitor__')
 * 
 *     def cancelMonitor(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.cancelMonitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":432
 *     #
 * 
 *     def solve(self, Vec x=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_91solve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_90solve[] = "TAO.solve(self, Vec x=None)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_91solve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscVecObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solve") < 0)) __PYX_ERR(38, 432, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solve", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 432, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "x", 0))) __PYX_ERR(38, 432, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_90solve(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_x);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_90solve(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("solve", 0);

  /* "PETSc/TAO.pyx":435
 *         """
 *         """
 *         if x is not None:             # <<<<<<<<<<<<<<
 *             CHKERR( TaoSetInitialVector(self.tao, x.vec) )
 *         CHKERR( TaoSolve(self.tao) )
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_x) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/TAO.pyx":436
 *         """
 *         if x is not None:
 *             CHKERR( TaoSetInitialVector(self.tao, x.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( TaoSolve(self.tao) )
 * 
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetInitialVector(__pyx_v_self->tao, __pyx_v_x->vec)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(38, 436, __pyx_L1_error)

    /* "PETSc/TAO.pyx":435
 *         """
 *         """
 *         if x is not None:             # <<<<<<<<<<<<<<
 *             CHKERR( TaoSetInitialVector(self.tao, x.vec) )
 *         CHKERR( TaoSolve(self.tao) )
 */
  }

  /* "PETSc/TAO.pyx":437
 *         if x is not None:
 *             CHKERR( TaoSetInitialVector(self.tao, x.vec) )
 *         CHKERR( TaoSolve(self.tao) )             # <<<<<<<<<<<<<<
 * 
 *     def getSolution(self):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSolve(__pyx_v_self->tao)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(38, 437, __pyx_L1_error)

  /* "PETSc/TAO.pyx":432
 *     #
 * 
 *     def solve(self, Vec x=None):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":439
 *         CHKERR( TaoSolve(self.tao) )
 * 
 *     def getSolution(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_93getSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_92getSolution[] = "TAO.getSolution(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_93getSolution(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSolution (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSolution", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSolution", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_92getSolution(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_92getSolution(struct PyPetscTAOObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getSolution", 0);

  /* "PETSc/TAO.pyx":442
 *         """
 *         """
 *         cdef Vec vec = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetSolutionVector(self.tao, &vec.vec) )
 *         PetscINCREF(vec.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":443
 *         """
 *         cdef Vec vec = Vec()
 *         CHKERR( TaoGetSolutionVector(self.tao, &vec.vec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(vec.obj)
 *         return vec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetSolutionVector(__pyx_v_self->tao, (&__pyx_v_vec->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(38, 443, __pyx_L1_error)

  /* "PETSc/TAO.pyx":444
 *         cdef Vec vec = Vec()
 *         CHKERR( TaoGetSolutionVector(self.tao, &vec.vec) )
 *         PetscINCREF(vec.obj)             # <<<<<<<<<<<<<<
 *         return vec
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_vec->__pyx_base.obj);

  /* "PETSc/TAO.pyx":445
 *         CHKERR( TaoGetSolutionVector(self.tao, &vec.vec) )
 *         PetscINCREF(vec.obj)
 *         return vec             # <<<<<<<<<<<<<<
 * 
 *     def getGradient(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = ((PyObject *)__pyx_v_vec);
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":439
 *         CHKERR( TaoSolve(self.tao) )
 * 
 *     def getSolution(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getSolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":447
 *         return vec
 * 
 *     def getGradient(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_95getGradient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_94getGradient[] = "TAO.getGradient(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_95getGradient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getGradient (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getGradient", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getGradient", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_94getGradient(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_94getGradient(struct PyPetscTAOObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getGradient", 0);

  /* "PETSc/TAO.pyx":450
 *         """
 *         """
 *         cdef Vec vec = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetGradientVector(self.tao, &vec.vec) )
 *         PetscINCREF(vec.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vec = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":451
 *         """
 *         cdef Vec vec = Vec()
 *         CHKERR( TaoGetGradientVector(self.tao, &vec.vec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(vec.obj)
 *         return vec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetGradientVector(__pyx_v_self->tao, (&__pyx_v_vec->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(38, 451, __pyx_L1_error)

  /* "PETSc/TAO.pyx":452
 *         cdef Vec vec = Vec()
 *         CHKERR( TaoGetGradientVector(self.tao, &vec.vec) )
 *         PetscINCREF(vec.obj)             # <<<<<<<<<<<<<<
 *         return vec
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_vec->__pyx_base.obj);

  /* "PETSc/TAO.pyx":453
 *         CHKERR( TaoGetGradientVector(self.tao, &vec.vec) )
 *         PetscINCREF(vec.obj)
 *         return vec             # <<<<<<<<<<<<<<
 * 
 *     def setGradientNorm(self, Mat mat):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __pyx_r = ((PyObject *)__pyx_v_vec);
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":447
 *         return vec
 * 
 *     def getGradient(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getGradient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":455
 *         return vec
 * 
 *     def setGradientNorm(self, Mat mat):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_97setGradientNorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_96setGradientNorm[] = "TAO.setGradientNorm(self, Mat mat)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_97setGradientNorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setGradientNorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,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);
        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_mat)) != 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, "setGradientNorm") < 0)) __PYX_ERR(38, 455, __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_mat = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setGradientNorm", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 455, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setGradientNorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "mat", 0))) __PYX_ERR(38, 455, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_96setGradientNorm(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_mat);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_96setGradientNorm(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setGradientNorm", 0);

  /* "PETSc/TAO.pyx":458
 *         """
 *         """
 *         CHKERR( TaoSetGradientNorm(self.tao, mat.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def getGradientNorm(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoSetGradientNorm(__pyx_v_self->tao, __pyx_v_mat->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 458, __pyx_L1_error)

  /* "PETSc/TAO.pyx":455
 *         return vec
 * 
 *     def setGradientNorm(self, Mat mat):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setGradientNorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":460
 *         CHKERR( TaoSetGradientNorm(self.tao, mat.mat) )
 * 
 *     def getGradientNorm(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_99getGradientNorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_98getGradientNorm[] = "TAO.getGradientNorm(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_99getGradientNorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getGradientNorm (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getGradientNorm", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getGradientNorm", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_98getGradientNorm(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_98getGradientNorm(struct PyPetscTAOObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getGradientNorm", 0);

  /* "PETSc/TAO.pyx":463
 *         """
 *         """
 *         cdef Mat mat = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetGradientNorm(self.tao, &mat.mat) )
 *         PetscINCREF(mat.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":464
 *         """
 *         cdef Mat mat = Mat()
 *         CHKERR( TaoGetGradientNorm(self.tao, &mat.mat) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(mat.obj)
 *         return mat
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetGradientNorm(__pyx_v_self->tao, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(38, 464, __pyx_L1_error)

  /* "PETSc/TAO.pyx":465
 *         cdef Mat mat = Mat()
 *         CHKERR( TaoGetGradientNorm(self.tao, &mat.mat) )
 *         PetscINCREF(mat.obj)             # <<<<<<<<<<<<<<
 *         return mat
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_mat->__pyx_base.obj);

  /* "PETSc/TAO.pyx":466
 *         CHKERR( TaoGetGradientNorm(self.tao, &mat.mat) )
 *         PetscINCREF(mat.obj)
 *         return mat             # <<<<<<<<<<<<<<
 * 
 *     def setLMVMH0(self, Mat mat):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = ((PyObject *)__pyx_v_mat);
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":460
 *         CHKERR( TaoSetGradientNorm(self.tao, mat.mat) )
 * 
 *     def getGradientNorm(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getGradientNorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":468
 *         return mat
 * 
 *     def setLMVMH0(self, Mat mat):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_101setLMVMH0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_100setLMVMH0[] = "TAO.setLMVMH0(self, Mat mat)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_101setLMVMH0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setLMVMH0 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,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);
        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_mat)) != 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, "setLMVMH0") < 0)) __PYX_ERR(38, 468, __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_mat = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setLMVMH0", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(38, 468, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setLMVMH0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 1, "mat", 0))) __PYX_ERR(38, 468, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_100setLMVMH0(((struct PyPetscTAOObject *)__pyx_v_self), __pyx_v_mat);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_100setLMVMH0(struct PyPetscTAOObject *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setLMVMH0", 0);

  /* "PETSc/TAO.pyx":471
 *         """
 *         """
 *         CHKERR( TaoLMVMSetH0(self.tao, mat.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def getLMVMH0(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoLMVMSetH0(__pyx_v_self->tao, __pyx_v_mat->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 471, __pyx_L1_error)

  /* "PETSc/TAO.pyx":468
 *         return mat
 * 
 *     def setLMVMH0(self, Mat mat):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.setLMVMH0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":473
 *         CHKERR( TaoLMVMSetH0(self.tao, mat.mat) )
 * 
 *     def getLMVMH0(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_103getLMVMH0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_102getLMVMH0[] = "TAO.getLMVMH0(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_103getLMVMH0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLMVMH0 (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getLMVMH0", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getLMVMH0", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_102getLMVMH0(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_102getLMVMH0(struct PyPetscTAOObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getLMVMH0", 0);

  /* "PETSc/TAO.pyx":476
 *         """
 *         """
 *         cdef Mat mat = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( TaoLMVMGetH0(self.tao, &mat.mat) )
 *         PetscINCREF(mat.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":477
 *         """
 *         cdef Mat mat = Mat()
 *         CHKERR( TaoLMVMGetH0(self.tao, &mat.mat) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(mat.obj)
 *         return mat
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoLMVMGetH0(__pyx_v_self->tao, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(38, 477, __pyx_L1_error)

  /* "PETSc/TAO.pyx":478
 *         cdef Mat mat = Mat()
 *         CHKERR( TaoLMVMGetH0(self.tao, &mat.mat) )
 *         PetscINCREF(mat.obj)             # <<<<<<<<<<<<<<
 *         return mat
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_mat->__pyx_base.obj);

  /* "PETSc/TAO.pyx":479
 *         CHKERR( TaoLMVMGetH0(self.tao, &mat.mat) )
 *         PetscINCREF(mat.obj)
 *         return mat             # <<<<<<<<<<<<<<
 * 
 *     def getLMVMH0KSP(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = ((PyObject *)__pyx_v_mat);
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":473
 *         CHKERR( TaoLMVMSetH0(self.tao, mat.mat) )
 * 
 *     def getLMVMH0(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getLMVMH0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":481
 *         return mat
 * 
 *     def getLMVMH0KSP(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_105getLMVMH0KSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_104getLMVMH0KSP[] = "TAO.getLMVMH0KSP(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_105getLMVMH0KSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLMVMH0KSP (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getLMVMH0KSP", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getLMVMH0KSP", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_104getLMVMH0KSP(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_104getLMVMH0KSP(struct PyPetscTAOObject *__pyx_v_self) {
  struct PyPetscKSPObject *__pyx_v_ksp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getLMVMH0KSP", 0);

  /* "PETSc/TAO.pyx":484
 *         """
 *         """
 *         cdef KSP ksp = KSP()             # <<<<<<<<<<<<<<
 *         CHKERR( TaoLMVMGetH0KSP(self.tao, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ksp = ((struct PyPetscKSPObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":485
 *         """
 *         cdef KSP ksp = KSP()
 *         CHKERR( TaoLMVMGetH0KSP(self.tao, &ksp.ksp) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(ksp.obj)
 *         return ksp
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoLMVMGetH0KSP(__pyx_v_self->tao, (&__pyx_v_ksp->ksp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(38, 485, __pyx_L1_error)

  /* "PETSc/TAO.pyx":486
 *         cdef KSP ksp = KSP()
 *         CHKERR( TaoLMVMGetH0KSP(self.tao, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)             # <<<<<<<<<<<<<<
 *         return ksp
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ksp->__pyx_base.obj);

  /* "PETSc/TAO.pyx":487
 *         CHKERR( TaoLMVMGetH0KSP(self.tao, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 *         return ksp             # <<<<<<<<<<<<<<
 * 
 *     def getVariableBounds(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ksp));
  __pyx_r = ((PyObject *)__pyx_v_ksp);
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":481
 *         return mat
 * 
 *     def getLMVMH0KSP(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getLMVMH0KSP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ksp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":489
 *         return ksp
 * 
 *     def getVariableBounds(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_107getVariableBounds(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_106getVariableBounds[] = "TAO.getVariableBounds(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_107getVariableBounds(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getVariableBounds (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getVariableBounds", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getVariableBounds", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_106getVariableBounds(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_106getVariableBounds(struct PyPetscTAOObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_xl = 0;
  struct PyPetscVecObject *__pyx_v_xu = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getVariableBounds", 0);

  /* "PETSc/TAO.pyx":492
 *         """
 *         """
 *         cdef Vec xl = Vec(), xu = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetVariableBounds(self.tao, &xl.vec, &xu.vec) )
 *         PetscINCREF(xl.obj); PetscINCREF(xu.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xl = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xu = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":493
 *         """
 *         cdef Vec xl = Vec(), xu = Vec()
 *         CHKERR( TaoGetVariableBounds(self.tao, &xl.vec, &xu.vec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(xl.obj); PetscINCREF(xu.obj)
 *         return (xl, xu)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetVariableBounds(__pyx_v_self->tao, (&__pyx_v_xl->vec), (&__pyx_v_xu->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(38, 493, __pyx_L1_error)

  /* "PETSc/TAO.pyx":494
 *         cdef Vec xl = Vec(), xu = Vec()
 *         CHKERR( TaoGetVariableBounds(self.tao, &xl.vec, &xu.vec) )
 *         PetscINCREF(xl.obj); PetscINCREF(xu.obj)             # <<<<<<<<<<<<<<
 *         return (xl, xu)
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_xl->__pyx_base.obj);
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_xu->__pyx_base.obj);

  /* "PETSc/TAO.pyx":495
 *         CHKERR( TaoGetVariableBounds(self.tao, &xl.vec, &xu.vec) )
 *         PetscINCREF(xl.obj); PetscINCREF(xu.obj)
 *         return (xl, xu)             # <<<<<<<<<<<<<<
 * 
 *     def getIterationNumber(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_xl));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_xl));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_xl));
  __Pyx_INCREF(((PyObject *)__pyx_v_xu));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_xu));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_xu));
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":489
 *         return ksp
 * 
 *     def getVariableBounds(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getVariableBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_xl);
  __Pyx_XDECREF((PyObject *)__pyx_v_xu);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":497
 *         return (xl, xu)
 * 
 *     def getIterationNumber(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_109getIterationNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_108getIterationNumber[] = "TAO.getIterationNumber(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_109getIterationNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getIterationNumber (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getIterationNumber", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getIterationNumber", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_108getIterationNumber(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_108getIterationNumber(struct PyPetscTAOObject *__pyx_v_self) {
  PetscInt __pyx_v_its;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getIterationNumber", 0);

  /* "PETSc/TAO.pyx":500
 *         """
 *         """
 *         cdef PetscInt its=0             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetSolutionStatus(self.tao, &its, NULL, NULL, NULL, NULL, NULL) )
 *         return toInt(its)
 */
  __pyx_v_its = 0;

  /* "PETSc/TAO.pyx":501
 *         """
 *         cdef PetscInt its=0
 *         CHKERR( TaoGetSolutionStatus(self.tao, &its, NULL, NULL, NULL, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         return toInt(its)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetSolutionStatus(__pyx_v_self->tao, (&__pyx_v_its), NULL, NULL, NULL, NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 501, __pyx_L1_error)

  /* "PETSc/TAO.pyx":502
 *         cdef PetscInt its=0
 *         CHKERR( TaoGetSolutionStatus(self.tao, &its, NULL, NULL, NULL, NULL, NULL) )
 *         return toInt(its)             # <<<<<<<<<<<<<<
 * 
 *     def getObjectiveValue(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_its); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":497
 *         return (xl, xu)
 * 
 *     def getIterationNumber(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getIterationNumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":504
 *         return toInt(its)
 * 
 *     def getObjectiveValue(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_111getObjectiveValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_110getObjectiveValue[] = "TAO.getObjectiveValue(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_111getObjectiveValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getObjectiveValue (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getObjectiveValue", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getObjectiveValue", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_110getObjectiveValue(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_110getObjectiveValue(struct PyPetscTAOObject *__pyx_v_self) {
  PetscReal __pyx_v_fval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getObjectiveValue", 0);

  /* "PETSc/TAO.pyx":507
 *         """
 *         """
 *         cdef PetscReal fval=0             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetSolutionStatus(self.tao, NULL, &fval, NULL, NULL, NULL, NULL) )
 *         return toReal(fval)
 */
  __pyx_v_fval = 0.0;

  /* "PETSc/TAO.pyx":508
 *         """
 *         cdef PetscReal fval=0
 *         CHKERR( TaoGetSolutionStatus(self.tao, NULL, &fval, NULL, NULL, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         return toReal(fval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetSolutionStatus(__pyx_v_self->tao, NULL, (&__pyx_v_fval), NULL, NULL, NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 508, __pyx_L1_error)

  /* "PETSc/TAO.pyx":509
 *         cdef PetscReal fval=0
 *         CHKERR( TaoGetSolutionStatus(self.tao, NULL, &fval, NULL, NULL, NULL, NULL) )
 *         return toReal(fval)             # <<<<<<<<<<<<<<
 * 
 *     getFunctionValue = getObjectiveValue
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_fval); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":504
 *         return toInt(its)
 * 
 *     def getObjectiveValue(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getObjectiveValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":513
 *     getFunctionValue = getObjectiveValue
 * 
 *     def getConvergedReason(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_113getConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_112getConvergedReason[] = "TAO.getConvergedReason(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_113getConvergedReason(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvergedReason (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getConvergedReason", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getConvergedReason", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_112getConvergedReason(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_112getConvergedReason(struct PyPetscTAOObject *__pyx_v_self) {
  TaoConvergedReason __pyx_v_reason;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvergedReason", 0);

  /* "PETSc/TAO.pyx":516
 *         """
 *         """
 *         cdef PetscTAOConvergedReason reason = TAO_CONTINUE_ITERATING             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetConvergedReason(self.tao, &reason) )
 *         return reason
 */
  __pyx_v_reason = TAO_CONTINUE_ITERATING;

  /* "PETSc/TAO.pyx":517
 *         """
 *         cdef PetscTAOConvergedReason reason = TAO_CONTINUE_ITERATING
 *         CHKERR( TaoGetConvergedReason(self.tao, &reason) )             # <<<<<<<<<<<<<<
 *         return reason
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetConvergedReason(__pyx_v_self->tao, (&__pyx_v_reason))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 517, __pyx_L1_error)

  /* "PETSc/TAO.pyx":518
 *         cdef PetscTAOConvergedReason reason = TAO_CONTINUE_ITERATING
 *         CHKERR( TaoGetConvergedReason(self.tao, &reason) )
 *         return reason             # <<<<<<<<<<<<<<
 * 
 *     def getSolutionNorm(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_TaoConvergedReason(__pyx_v_reason); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":513
 *     getFunctionValue = getObjectiveValue
 * 
 *     def getConvergedReason(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getConvergedReason", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":520
 *         return reason
 * 
 *     def getSolutionNorm(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_115getSolutionNorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_114getSolutionNorm[] = "TAO.getSolutionNorm(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_115getSolutionNorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSolutionNorm (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSolutionNorm", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSolutionNorm", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_114getSolutionNorm(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_114getSolutionNorm(struct PyPetscTAOObject *__pyx_v_self) {
  PetscReal __pyx_v_gnorm;
  PetscReal __pyx_v_cnorm;
  PetscReal __pyx_v_fval;
  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;
  __Pyx_RefNannySetupContext("getSolutionNorm", 0);

  /* "PETSc/TAO.pyx":523
 *         """
 *         """
 *         cdef PetscReal gnorm=0             # <<<<<<<<<<<<<<
 *         cdef PetscReal cnorm=0
 *         cdef PetscReal fval=0
 */
  __pyx_v_gnorm = 0.0;

  /* "PETSc/TAO.pyx":524
 *         """
 *         cdef PetscReal gnorm=0
 *         cdef PetscReal cnorm=0             # <<<<<<<<<<<<<<
 *         cdef PetscReal fval=0
 *         CHKERR( TaoGetSolutionStatus(self.tao, NULL, &fval, &gnorm, &cnorm, NULL, NULL) )
 */
  __pyx_v_cnorm = 0.0;

  /* "PETSc/TAO.pyx":525
 *         cdef PetscReal gnorm=0
 *         cdef PetscReal cnorm=0
 *         cdef PetscReal fval=0             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetSolutionStatus(self.tao, NULL, &fval, &gnorm, &cnorm, NULL, NULL) )
 *         return (toReal(fval), toReal(gnorm), toReal(cnorm))
 */
  __pyx_v_fval = 0.0;

  /* "PETSc/TAO.pyx":526
 *         cdef PetscReal cnorm=0
 *         cdef PetscReal fval=0
 *         CHKERR( TaoGetSolutionStatus(self.tao, NULL, &fval, &gnorm, &cnorm, NULL, NULL) )             # <<<<<<<<<<<<<<
 *         return (toReal(fval), toReal(gnorm), toReal(cnorm))
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetSolutionStatus(__pyx_v_self->tao, NULL, (&__pyx_v_fval), (&__pyx_v_gnorm), (&__pyx_v_cnorm), NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 526, __pyx_L1_error)

  /* "PETSc/TAO.pyx":527
 *         cdef PetscReal fval=0
 *         CHKERR( TaoGetSolutionStatus(self.tao, NULL, &fval, &gnorm, &cnorm, NULL, NULL) )
 *         return (toReal(fval), toReal(gnorm), toReal(cnorm))             # <<<<<<<<<<<<<<
 * 
 *     def getSolutionStatus(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_fval); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_gnorm); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_cnorm); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":520
 *         return reason
 * 
 *     def getSolutionNorm(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* 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("petsc4py.PETSc.TAO.getSolutionNorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":529
 *         return (toReal(fval), toReal(gnorm), toReal(cnorm))
 * 
 *     def getSolutionStatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_117getSolutionStatus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_116getSolutionStatus[] = "TAO.getSolutionStatus(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_117getSolutionStatus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSolutionStatus (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSolutionStatus", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSolutionStatus", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_116getSolutionStatus(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_116getSolutionStatus(struct PyPetscTAOObject *__pyx_v_self) {
  PetscInt __pyx_v_its;
  PetscReal __pyx_v_fval;
  PetscReal __pyx_v_gnorm;
  PetscReal __pyx_v_cnorm;
  PetscReal __pyx_v_xdiff;
  TaoConvergedReason __pyx_v_reason;
  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;
  __Pyx_RefNannySetupContext("getSolutionStatus", 0);

  /* "PETSc/TAO.pyx":532
 *         """
 *         """
 *         cdef PetscInt its=0             # <<<<<<<<<<<<<<
 *         cdef PetscReal fval=0, gnorm=0, cnorm=0, xdiff=0
 *         cdef PetscTAOConvergedReason reason = TAO_CONTINUE_ITERATING
 */
  __pyx_v_its = 0;

  /* "PETSc/TAO.pyx":533
 *         """
 *         cdef PetscInt its=0
 *         cdef PetscReal fval=0, gnorm=0, cnorm=0, xdiff=0             # <<<<<<<<<<<<<<
 *         cdef PetscTAOConvergedReason reason = TAO_CONTINUE_ITERATING
 *         CHKERR( TaoGetSolutionStatus(self.tao, &its,
 */
  __pyx_v_fval = 0.0;
  __pyx_v_gnorm = 0.0;
  __pyx_v_cnorm = 0.0;
  __pyx_v_xdiff = 0.0;

  /* "PETSc/TAO.pyx":534
 *         cdef PetscInt its=0
 *         cdef PetscReal fval=0, gnorm=0, cnorm=0, xdiff=0
 *         cdef PetscTAOConvergedReason reason = TAO_CONTINUE_ITERATING             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetSolutionStatus(self.tao, &its,
 *                                      &fval, &gnorm, &cnorm, &xdiff,
 */
  __pyx_v_reason = TAO_CONTINUE_ITERATING;

  /* "PETSc/TAO.pyx":535
 *         cdef PetscReal fval=0, gnorm=0, cnorm=0, xdiff=0
 *         cdef PetscTAOConvergedReason reason = TAO_CONTINUE_ITERATING
 *         CHKERR( TaoGetSolutionStatus(self.tao, &its,             # <<<<<<<<<<<<<<
 *                                      &fval, &gnorm, &cnorm, &xdiff,
 *                                      &reason) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetSolutionStatus(__pyx_v_self->tao, (&__pyx_v_its), (&__pyx_v_fval), (&__pyx_v_gnorm), (&__pyx_v_cnorm), (&__pyx_v_xdiff), (&__pyx_v_reason))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(38, 535, __pyx_L1_error)

  /* "PETSc/TAO.pyx":538
 *                                      &fval, &gnorm, &cnorm, &xdiff,
 *                                      &reason) )
 *         return (toInt(its), toReal(fval),             # <<<<<<<<<<<<<<
 *                 toReal(gnorm), toReal(cnorm),
 *                 toReal(xdiff), reason)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_its); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_fval); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/TAO.pyx":539
 *                                      &reason) )
 *         return (toInt(its), toReal(fval),
 *                 toReal(gnorm), toReal(cnorm),             # <<<<<<<<<<<<<<
 *                 toReal(xdiff), reason)
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_gnorm); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_cnorm); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "PETSc/TAO.pyx":540
 *         return (toInt(its), toReal(fval),
 *                 toReal(gnorm), toReal(cnorm),
 *                 toReal(xdiff), reason)             # <<<<<<<<<<<<<<
 * 
 *     def getKSP(self):
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_xdiff); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_TaoConvergedReason(__pyx_v_reason); if (unlikely(!__pyx_t_7)) __PYX_ERR(38, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "PETSc/TAO.pyx":538
 *                                      &fval, &gnorm, &cnorm, &xdiff,
 *                                      &reason) )
 *         return (toInt(its), toReal(fval),             # <<<<<<<<<<<<<<
 *                 toReal(gnorm), toReal(cnorm),
 *                 toReal(xdiff), reason)
 */
  __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(38, 538, __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_3);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_7);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":529
 *         return (toReal(fval), toReal(gnorm), toReal(cnorm))
 * 
 *     def getSolutionStatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* 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_AddTraceback("petsc4py.PETSc.TAO.getSolutionStatus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":542
 *                 toReal(xdiff), reason)
 * 
 *     def getKSP(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_119getKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_3TAO_118getKSP[] = "TAO.getKSP(self)\n\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_119getKSP(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getKSP (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getKSP", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getKSP", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_118getKSP(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_118getKSP(struct PyPetscTAOObject *__pyx_v_self) {
  struct PyPetscKSPObject *__pyx_v_ksp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getKSP", 0);

  /* "PETSc/TAO.pyx":545
 *         """
 *         """
 *         cdef KSP ksp = KSP()             # <<<<<<<<<<<<<<
 *         CHKERR( TaoGetKSP(self.tao, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ksp = ((struct PyPetscKSPObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":546
 *         """
 *         cdef KSP ksp = KSP()
 *         CHKERR( TaoGetKSP(self.tao, &ksp.ksp) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(ksp.obj)
 *         return ksp
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(TaoGetKSP(__pyx_v_self->tao, (&__pyx_v_ksp->ksp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(38, 546, __pyx_L1_error)

  /* "PETSc/TAO.pyx":547
 *         cdef KSP ksp = KSP()
 *         CHKERR( TaoGetKSP(self.tao, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)             # <<<<<<<<<<<<<<
 *         return ksp
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ksp->__pyx_base.obj);

  /* "PETSc/TAO.pyx":548
 *         CHKERR( TaoGetKSP(self.tao, &ksp.ksp) )
 *         PetscINCREF(ksp.obj)
 *         return ksp             # <<<<<<<<<<<<<<
 * 
 *     # --- application context ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ksp));
  __pyx_r = ((PyObject *)__pyx_v_ksp);
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":542
 *                 toReal(xdiff), reason)
 * 
 *     def getKSP(self):             # <<<<<<<<<<<<<<
 *         """
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.getKSP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ksp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":553
 * 
 *     property appctx:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getAppCtx()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_6appctx_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_6appctx_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_6appctx___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_6appctx___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":554
 *     property appctx:
 *         def __get__(self):
 *             return self.getAppCtx()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             self.setAppCtx(value)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getAppCtx); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 554, __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(38, 554, __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;

  /* "PETSc/TAO.pyx":553
 * 
 *     property appctx:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getAppCtx()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.appctx.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":555
 *         def __get__(self):
 *             return self.getAppCtx()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setAppCtx(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3TAO_6appctx_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3TAO_6appctx_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_6appctx_2__set__(((struct PyPetscTAOObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3TAO_6appctx_2__set__(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_value) {
  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;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TAO.pyx":556
 *             return self.getAppCtx()
 *         def __set__(self, value):
 *             self.setAppCtx(value)             # <<<<<<<<<<<<<<
 * 
 *     # --- linear solver ---
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setAppCtx); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 556, __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_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 556, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":555
 *         def __get__(self):
 *             return self.getAppCtx()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self.setAppCtx(value)
 * 
 */

  /* 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.appctx.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":561
 * 
 *     property ksp:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getKSP()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_3ksp_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_3ksp_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_3ksp___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_3ksp___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":562
 *     property ksp:
 *         def __get__(self):
 *             return self.getKSP()             # <<<<<<<<<<<<<<
 * 
 *     # --- tolerances ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getKSP); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 562, __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(38, 562, __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;

  /* "PETSc/TAO.pyx":561
 * 
 *     property ksp:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getKSP()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.ksp.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":567
 * 
 *     property ftol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getFunctionTolerances()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_4ftol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_4ftol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_4ftol___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_4ftol___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":568
 *     property ftol:
 *         def __get__(self):
 *             return self.getFunctionTolerances()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             if isinstance(value, (tuple, list)):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getFunctionTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 568, __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(38, 568, __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;

  /* "PETSc/TAO.pyx":567
 * 
 *     property ftol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getFunctionTolerances()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.ftol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":569
 *         def __get__(self):
 *             return self.getFunctionTolerances()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             if isinstance(value, (tuple, list)):
 *                 self.setFunctionTolerances(*value)
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3TAO_4ftol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3TAO_4ftol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_4ftol_2__set__(((struct PyPetscTAOObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3TAO_4ftol_2__set__(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TAO.pyx":570
 *             return self.getFunctionTolerances()
 *         def __set__(self, value):
 *             if isinstance(value, (tuple, list)):             # <<<<<<<<<<<<<<
 *                 self.setFunctionTolerances(*value)
 *             elif isinstance(value, dict):
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
  __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 = PyList_Check(__pyx_v_value); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/TAO.pyx":571
 *         def __set__(self, value):
 *             if isinstance(value, (tuple, list)):
 *                 self.setFunctionTolerances(*value)             # <<<<<<<<<<<<<<
 *             elif isinstance(value, dict):
 *                 self.setFunctionTolerances(**value)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setFunctionTolerances); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PETSc/TAO.pyx":570
 *             return self.getFunctionTolerances()
 *         def __set__(self, value):
 *             if isinstance(value, (tuple, list)):             # <<<<<<<<<<<<<<
 *                 self.setFunctionTolerances(*value)
 *             elif isinstance(value, dict):
 */
    goto __pyx_L3;
  }

  /* "PETSc/TAO.pyx":572
 *             if isinstance(value, (tuple, list)):
 *                 self.setFunctionTolerances(*value)
 *             elif isinstance(value, dict):             # <<<<<<<<<<<<<<
 *                 self.setFunctionTolerances(**value)
 *             else:
 */
  __pyx_t_2 = PyDict_Check(__pyx_v_value); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/TAO.pyx":573
 *                 self.setFunctionTolerances(*value)
 *             elif isinstance(value, dict):
 *                 self.setFunctionTolerances(**value)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError("expecting tuple/list or dict")
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setFunctionTolerances); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_v_value == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(38, 573, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_value))) {
      __pyx_t_5 = PyDict_Copy(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_5 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_value, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 573, __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_4); __pyx_t_4 = 0;

    /* "PETSc/TAO.pyx":572
 *             if isinstance(value, (tuple, list)):
 *                 self.setFunctionTolerances(*value)
 *             elif isinstance(value, dict):             # <<<<<<<<<<<<<<
 *                 self.setFunctionTolerances(**value)
 *             else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/TAO.pyx":575
 *                 self.setFunctionTolerances(**value)
 *             else:
 *                 raise TypeError("expecting tuple/list or dict")             # <<<<<<<<<<<<<<
 * 
 *     property gtol:
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 575, __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(38, 575, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/TAO.pyx":569
 *         def __get__(self):
 *             return self.getFunctionTolerances()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             if isinstance(value, (tuple, list)):
 *                 self.setFunctionTolerances(*value)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.ftol.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":578
 * 
 *     property gtol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getGradientTolerances()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_4gtol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_4gtol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_4gtol___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_4gtol___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":579
 *     property gtol:
 *         def __get__(self):
 *             return self.getGradientTolerances()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             if isinstance(value, (tuple, list)):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getGradientTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 579, __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(38, 579, __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;

  /* "PETSc/TAO.pyx":578
 * 
 *     property gtol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getGradientTolerances()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.gtol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":580
 *         def __get__(self):
 *             return self.getGradientTolerances()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             if isinstance(value, (tuple, list)):
 *                 self.getGradientTolerances(*value)
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3TAO_4gtol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3TAO_4gtol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_4gtol_2__set__(((struct PyPetscTAOObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3TAO_4gtol_2__set__(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TAO.pyx":581
 *             return self.getGradientTolerances()
 *         def __set__(self, value):
 *             if isinstance(value, (tuple, list)):             # <<<<<<<<<<<<<<
 *                 self.getGradientTolerances(*value)
 *             elif isinstance(value, dict):
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
  __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 = PyList_Check(__pyx_v_value); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/TAO.pyx":582
 *         def __set__(self, value):
 *             if isinstance(value, (tuple, list)):
 *                 self.getGradientTolerances(*value)             # <<<<<<<<<<<<<<
 *             elif isinstance(value, dict):
 *                 self.getGradientTolerances(**value)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getGradientTolerances); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PETSc/TAO.pyx":581
 *             return self.getGradientTolerances()
 *         def __set__(self, value):
 *             if isinstance(value, (tuple, list)):             # <<<<<<<<<<<<<<
 *                 self.getGradientTolerances(*value)
 *             elif isinstance(value, dict):
 */
    goto __pyx_L3;
  }

  /* "PETSc/TAO.pyx":583
 *             if isinstance(value, (tuple, list)):
 *                 self.getGradientTolerances(*value)
 *             elif isinstance(value, dict):             # <<<<<<<<<<<<<<
 *                 self.getGradientTolerances(**value)
 *             else:
 */
  __pyx_t_2 = PyDict_Check(__pyx_v_value); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/TAO.pyx":584
 *                 self.getGradientTolerances(*value)
 *             elif isinstance(value, dict):
 *                 self.getGradientTolerances(**value)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError("expecting tuple/list or dict")
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getGradientTolerances); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_v_value == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(38, 584, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_value))) {
      __pyx_t_5 = PyDict_Copy(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_5 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_value, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 584, __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_4); __pyx_t_4 = 0;

    /* "PETSc/TAO.pyx":583
 *             if isinstance(value, (tuple, list)):
 *                 self.getGradientTolerances(*value)
 *             elif isinstance(value, dict):             # <<<<<<<<<<<<<<
 *                 self.getGradientTolerances(**value)
 *             else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/TAO.pyx":586
 *                 self.getGradientTolerances(**value)
 *             else:
 *                 raise TypeError("expecting tuple/list or dict")             # <<<<<<<<<<<<<<
 * 
 *     property ctol:
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__61, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 586, __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(38, 586, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/TAO.pyx":580
 *         def __get__(self):
 *             return self.getGradientTolerances()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             if isinstance(value, (tuple, list)):
 *                 self.getGradientTolerances(*value)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.gtol.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":589
 * 
 *     property ctol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConstraintTolerances()
 *         def __set__(self, value):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_4ctol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_4ctol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_4ctol___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_4ctol___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":590
 *     property ctol:
 *         def __get__(self):
 *             return self.getConstraintTolerances()             # <<<<<<<<<<<<<<
 *         def __set__(self, value):
 *             if isinstance(value, (tuple, list)):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getConstraintTolerances); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 590, __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(38, 590, __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;

  /* "PETSc/TAO.pyx":589
 * 
 *     property ctol:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConstraintTolerances()
 *         def __set__(self, value):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.ctol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":591
 *         def __get__(self):
 *             return self.getConstraintTolerances()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             if isinstance(value, (tuple, list)):
 *                 self.getConstraintTolerances(*value)
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_3TAO_4ctol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_3TAO_4ctol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_4ctol_2__set__(((struct PyPetscTAOObject *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_3TAO_4ctol_2__set__(struct PyPetscTAOObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "PETSc/TAO.pyx":592
 *             return self.getConstraintTolerances()
 *         def __set__(self, value):
 *             if isinstance(value, (tuple, list)):             # <<<<<<<<<<<<<<
 *                 self.getConstraintTolerances(*value)
 *             elif isinstance(value, dict):
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
  __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 = PyList_Check(__pyx_v_value); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/TAO.pyx":593
 *         def __set__(self, value):
 *             if isinstance(value, (tuple, list)):
 *                 self.getConstraintTolerances(*value)             # <<<<<<<<<<<<<<
 *             elif isinstance(value, dict):
 *                 self.getConstraintTolerances(**value)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getConstraintTolerances); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PETSc/TAO.pyx":592
 *             return self.getConstraintTolerances()
 *         def __set__(self, value):
 *             if isinstance(value, (tuple, list)):             # <<<<<<<<<<<<<<
 *                 self.getConstraintTolerances(*value)
 *             elif isinstance(value, dict):
 */
    goto __pyx_L3;
  }

  /* "PETSc/TAO.pyx":594
 *             if isinstance(value, (tuple, list)):
 *                 self.getConstraintTolerances(*value)
 *             elif isinstance(value, dict):             # <<<<<<<<<<<<<<
 *                 self.getConstraintTolerances(**value)
 *             else:
 */
  __pyx_t_2 = PyDict_Check(__pyx_v_value); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/TAO.pyx":595
 *                 self.getConstraintTolerances(*value)
 *             elif isinstance(value, dict):
 *                 self.getConstraintTolerances(**value)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError("expecting tuple/list or dict")
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getConstraintTolerances); if (unlikely(!__pyx_t_6)) __PYX_ERR(38, 595, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_v_value == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(38, 595, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_value))) {
      __pyx_t_5 = PyDict_Copy(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 595, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_5 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_value, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(38, 595, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 595, __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_4); __pyx_t_4 = 0;

    /* "PETSc/TAO.pyx":594
 *             if isinstance(value, (tuple, list)):
 *                 self.getConstraintTolerances(*value)
 *             elif isinstance(value, dict):             # <<<<<<<<<<<<<<
 *                 self.getConstraintTolerances(**value)
 *             else:
 */
    goto __pyx_L3;
  }

  /* "PETSc/TAO.pyx":597
 *                 self.getConstraintTolerances(**value)
 *             else:
 *                 raise TypeError("expecting tuple/list or dict")             # <<<<<<<<<<<<<<
 * 
 *     # --- iteration ---
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__62, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(38, 597, __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(38, 597, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/TAO.pyx":591
 *         def __get__(self):
 *             return self.getConstraintTolerances()
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             if isinstance(value, (tuple, list)):
 *                 self.getConstraintTolerances(*value)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.ctol.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":602
 * 
 *     property its:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getIterationNumber()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_3its_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_3its_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_3its___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_3its___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":603
 *     property its:
 *         def __get__(self):
 *             return self.getIterationNumber()             # <<<<<<<<<<<<<<
 * 
 *     property gnorm:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getIterationNumber); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 603, __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(38, 603, __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;

  /* "PETSc/TAO.pyx":602
 * 
 *     property its:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getIterationNumber()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.its.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":606
 * 
 *     property gnorm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolutionNorm()[1]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_5gnorm_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_5gnorm_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_5gnorm___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_5gnorm___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":607
 *     property gnorm:
 *         def __get__(self):
 *             return self.getSolutionNorm()[1]             # <<<<<<<<<<<<<<
 * 
 *     property cnorm:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSolutionNorm); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 607, __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(38, 607, __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, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 607, __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;

  /* "PETSc/TAO.pyx":606
 * 
 *     property gnorm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolutionNorm()[1]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.gnorm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":610
 * 
 *     property cnorm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolutionNorm()[2]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_5cnorm_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_5cnorm_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_5cnorm___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_5cnorm___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":611
 *     property cnorm:
 *         def __get__(self):
 *             return self.getSolutionNorm()[2]             # <<<<<<<<<<<<<<
 * 
 *     property solution:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSolutionNorm); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 611, __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(38, 611, __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, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 611, __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;

  /* "PETSc/TAO.pyx":610
 * 
 *     property cnorm:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolutionNorm()[2]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.cnorm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":614
 * 
 *     property solution:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolution()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_8solution_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_8solution_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_8solution___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_8solution___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":615
 *     property solution:
 *         def __get__(self):
 *             return self.getSolution()             # <<<<<<<<<<<<<<
 * 
 *     property objective:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSolution); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 615, __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(38, 615, __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;

  /* "PETSc/TAO.pyx":614
 * 
 *     property solution:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSolution()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.solution.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":618
 * 
 *     property objective:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getObjectiveValue()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_9objective_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_9objective_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_9objective___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_9objective___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":619
 *     property objective:
 *         def __get__(self):
 *             return self.getObjectiveValue()             # <<<<<<<<<<<<<<
 * 
 *     property function:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getObjectiveValue); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 619, __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(38, 619, __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;

  /* "PETSc/TAO.pyx":618
 * 
 *     property objective:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getObjectiveValue()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.objective.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":622
 * 
 *     property function:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getFunctionValue()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_8function_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_8function_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_8function___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_8function___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":623
 *     property function:
 *         def __get__(self):
 *             return self.getFunctionValue()             # <<<<<<<<<<<<<<
 * 
 *     property gradient:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getFunctionValue); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 623, __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(38, 623, __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;

  /* "PETSc/TAO.pyx":622
 * 
 *     property function:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getFunctionValue()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.function.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":626
 * 
 *     property gradient:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getGradient()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_8gradient_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_8gradient_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_8gradient___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_8gradient___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":627
 *     property gradient:
 *         def __get__(self):
 *             return self.getGradient()             # <<<<<<<<<<<<<<
 * 
 *     # --- convergence ---
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getGradient); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 627, __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(38, 627, __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;

  /* "PETSc/TAO.pyx":626
 * 
 *     property gradient:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getGradient()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.gradient.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":632
 * 
 *     property reason:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConvergedReason()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_6reason_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_6reason_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_6reason___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_6reason___get__(struct PyPetscTAOObject *__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);

  /* "PETSc/TAO.pyx":633
 *     property reason:
 *         def __get__(self):
 *             return self.getConvergedReason()             # <<<<<<<<<<<<<<
 * 
 *     property iterating:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getConvergedReason); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(38, 633, __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(38, 633, __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;

  /* "PETSc/TAO.pyx":632
 * 
 *     property reason:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getConvergedReason()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.reason.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":636
 * 
 *     property iterating:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason == 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_9iterating_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_9iterating_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_9iterating___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_9iterating___get__(struct PyPetscTAOObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/TAO.pyx":637
 *     property iterating:
 *         def __get__(self):
 *             return self.reason == 0             # <<<<<<<<<<<<<<
 * 
 *     property converged:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reason); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 637, __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;

  /* "PETSc/TAO.pyx":636
 * 
 *     property iterating:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason == 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.iterating.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":640
 * 
 *     property converged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason > 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_9converged_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_9converged_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_9converged___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_9converged___get__(struct PyPetscTAOObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/TAO.pyx":641
 *     property converged:
 *         def __get__(self):
 *             return self.reason > 0             # <<<<<<<<<<<<<<
 * 
 *     property diverged:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reason); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 641, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":640
 * 
 *     property converged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason > 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.converged.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/TAO.pyx":644
 * 
 *     property diverged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason < 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_8diverged_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_3TAO_8diverged_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_3TAO_8diverged___get__(((struct PyPetscTAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_3TAO_8diverged___get__(struct PyPetscTAOObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "PETSc/TAO.pyx":645
 *     property diverged:
 *         def __get__(self):
 *             return self.reason < 0             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reason); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(38, 645, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/TAO.pyx":644
 * 
 *     property diverged:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.reason < 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.TAO.diverged.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/AO.pyx":15
 *     Type = AOType
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.ao
 *         self.ao = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2AO_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2AO_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2AO___cinit__(((struct PyPetscAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2AO___cinit__(struct PyPetscAOObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/AO.pyx":16
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.ao             # <<<<<<<<<<<<<<
 *         self.ao = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->ao));

  /* "PETSc/AO.pyx":17
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.ao
 *         self.ao = NULL             # <<<<<<<<<<<<<<
 * 
 *     def view(self, Viewer viewer=None):
 */
  __pyx_v_self->ao = NULL;

  /* "PETSc/AO.pyx":15
 *     Type = AOType
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.ao
 *         self.ao = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/AO.pyx":19
 *         self.ao = NULL
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_3view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2AO_2view[] = "AO.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_3view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(39, 19, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(39, 19, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.AO.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(39, 19, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2AO_2view(((struct PyPetscAOObject *)__pyx_v_self), __pyx_v_viewer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_2view(struct PyPetscAOObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_cviewer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/AO.pyx":20
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer cviewer = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: cviewer = viewer.vwr
 *         CHKERR( AOView(self.ao, cviewer) )
 */
  __pyx_v_cviewer = NULL;

  /* "PETSc/AO.pyx":21
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( AOView(self.ao, cviewer) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_cviewer = __pyx_t_3;
  }

  /* "PETSc/AO.pyx":22
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 *         CHKERR( AOView(self.ao, cviewer) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(AOView(__pyx_v_self->ao, __pyx_v_cviewer)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(39, 22, __pyx_L1_error)

  /* "PETSc/AO.pyx":19
 *         self.ao = NULL
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer cviewer = NULL
 *         if viewer is not None: cviewer = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.AO.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/AO.pyx":24
 *         CHKERR( AOView(self.ao, cviewer) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( AODestroy(&self.ao) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_5destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2AO_4destroy[] = "AO.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_5destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2AO_4destroy(((struct PyPetscAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_4destroy(struct PyPetscAOObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/AO.pyx":25
 * 
 *     def destroy(self):
 *         CHKERR( AODestroy(&self.ao) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(AODestroy((&__pyx_v_self->ao))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(39, 25, __pyx_L1_error)

  /* "PETSc/AO.pyx":26
 *     def destroy(self):
 *         CHKERR( AODestroy(&self.ao) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createBasic(self, app, petsc=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/AO.pyx":24
 *         CHKERR( AOView(self.ao, cviewer) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( AODestroy(&self.ao) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.AO.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/AO.pyx":28
 *         return self
 * 
 *     def createBasic(self, app, petsc=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef PetscIS isapp = NULL, ispetsc = NULL
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_7createBasic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2AO_6createBasic[] = "AO.createBasic(self, app, petsc=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_7createBasic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_app = 0;
  PyObject *__pyx_v_petsc = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createBasic (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_app,&__pyx_n_s_petsc,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_app)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_petsc);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createBasic") < 0)) __PYX_ERR(39, 28, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_app = values[0];
    __pyx_v_petsc = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createBasic", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(39, 28, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.AO.createBasic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2AO_6createBasic(((struct PyPetscAOObject *)__pyx_v_self), __pyx_v_app, __pyx_v_petsc, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_6createBasic(struct PyPetscAOObject *__pyx_v_self, PyObject *__pyx_v_app, PyObject *__pyx_v_petsc, PyObject *__pyx_v_comm) {
  IS __pyx_v_isapp;
  IS __pyx_v_ispetsc;
  PetscInt __pyx_v_napp;
  PetscInt *__pyx_v_idxapp;
  PetscInt __pyx_v_npetsc;
  PetscInt *__pyx_v_idxpetsc;
  MPI_Comm __pyx_v_ccomm;
  AO __pyx_v_newao;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  IS __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("createBasic", 0);
  __Pyx_INCREF(__pyx_v_app);
  __Pyx_INCREF(__pyx_v_petsc);

  /* "PETSc/AO.pyx":29
 * 
 *     def createBasic(self, app, petsc=None, comm=None):
 *         cdef PetscIS isapp = NULL, ispetsc = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL
 */
  __pyx_v_isapp = NULL;
  __pyx_v_ispetsc = NULL;

  /* "PETSc/AO.pyx":30
 *     def createBasic(self, app, petsc=None, comm=None):
 *         cdef PetscIS isapp = NULL, ispetsc = NULL
 *         cdef PetscInt napp = 0, *idxapp = NULL,             # <<<<<<<<<<<<<<
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_v_napp = 0;
  __pyx_v_idxapp = NULL;

  /* "PETSc/AO.pyx":31
 *         cdef PetscIS isapp = NULL, ispetsc = NULL
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscAO newao = NULL
 */
  __pyx_v_npetsc = 0;
  __pyx_v_idxpetsc = NULL;

  /* "PETSc/AO.pyx":32
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscAO newao = NULL
 *         if isinstance(app, IS):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(39, 32, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/AO.pyx":33
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscAO newao = NULL             # <<<<<<<<<<<<<<
 *         if isinstance(app, IS):
 *             isapp = (<IS>app).iset
 */
  __pyx_v_newao = NULL;

  /* "PETSc/AO.pyx":34
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscAO newao = NULL
 *         if isinstance(app, IS):             # <<<<<<<<<<<<<<
 *             isapp = (<IS>app).iset
 *             if petsc is not None:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_app, __pyx_ptype_8petsc4py_5PETSc_IS); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/AO.pyx":35
 *         cdef PetscAO newao = NULL
 *         if isinstance(app, IS):
 *             isapp = (<IS>app).iset             # <<<<<<<<<<<<<<
 *             if petsc is not None:
 *                 ispetsc = (<IS?>petsc).iset
 */
    __pyx_t_4 = ((struct PyPetscISObject *)__pyx_v_app)->iset;
    __pyx_v_isapp = __pyx_t_4;

    /* "PETSc/AO.pyx":36
 *         if isinstance(app, IS):
 *             isapp = (<IS>app).iset
 *             if petsc is not None:             # <<<<<<<<<<<<<<
 *                 ispetsc = (<IS?>petsc).iset
 *             CHKERR( AOCreateBasicIS(isapp, ispetsc, &newao) )
 */
    __pyx_t_3 = (__pyx_v_petsc != Py_None);
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "PETSc/AO.pyx":37
 *             isapp = (<IS>app).iset
 *             if petsc is not None:
 *                 ispetsc = (<IS?>petsc).iset             # <<<<<<<<<<<<<<
 *             CHKERR( AOCreateBasicIS(isapp, ispetsc, &newao) )
 *         else:
 */
      if (!(likely(__Pyx_TypeTest(__pyx_v_petsc, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(39, 37, __pyx_L1_error)
      __pyx_t_4 = ((struct PyPetscISObject *)__pyx_v_petsc)->iset;
      __pyx_v_ispetsc = __pyx_t_4;

      /* "PETSc/AO.pyx":36
 *         if isinstance(app, IS):
 *             isapp = (<IS>app).iset
 *             if petsc is not None:             # <<<<<<<<<<<<<<
 *                 ispetsc = (<IS?>petsc).iset
 *             CHKERR( AOCreateBasicIS(isapp, ispetsc, &newao) )
 */
    }

    /* "PETSc/AO.pyx":38
 *             if petsc is not None:
 *                 ispetsc = (<IS?>petsc).iset
 *             CHKERR( AOCreateBasicIS(isapp, ispetsc, &newao) )             # <<<<<<<<<<<<<<
 *         else:
 *             app = iarray_i(app, &napp, &idxapp)
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(AOCreateBasicIS(__pyx_v_isapp, __pyx_v_ispetsc, (&__pyx_v_newao))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(39, 38, __pyx_L1_error)

    /* "PETSc/AO.pyx":34
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscAO newao = NULL
 *         if isinstance(app, IS):             # <<<<<<<<<<<<<<
 *             isapp = (<IS>app).iset
 *             if petsc is not None:
 */
    goto __pyx_L3;
  }

  /* "PETSc/AO.pyx":40
 *             CHKERR( AOCreateBasicIS(isapp, ispetsc, &newao) )
 *         else:
 *             app = iarray_i(app, &napp, &idxapp)             # <<<<<<<<<<<<<<
 *             if petsc is not None:
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 */
  /*else*/ {
    __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_app, (&__pyx_v_napp), (&__pyx_v_idxapp))); if (unlikely(!__pyx_t_6)) __PYX_ERR(39, 40, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF_SET(__pyx_v_app, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "PETSc/AO.pyx":41
 *         else:
 *             app = iarray_i(app, &napp, &idxapp)
 *             if petsc is not None:             # <<<<<<<<<<<<<<
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 *                 assert napp == npetsc, "incompatible array sizes"
 */
    __pyx_t_2 = (__pyx_v_petsc != Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (__pyx_t_3) {

      /* "PETSc/AO.pyx":42
 *             app = iarray_i(app, &napp, &idxapp)
 *             if petsc is not None:
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)             # <<<<<<<<<<<<<<
 *                 assert napp == npetsc, "incompatible array sizes"
 *             CHKERR( AOCreateBasic(ccomm, napp, idxapp, idxpetsc, &newao) )
 */
      __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_petsc, (&__pyx_v_npetsc), (&__pyx_v_idxpetsc))); if (unlikely(!__pyx_t_6)) __PYX_ERR(39, 42, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_petsc, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "PETSc/AO.pyx":43
 *             if petsc is not None:
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 *                 assert napp == npetsc, "incompatible array sizes"             # <<<<<<<<<<<<<<
 *             CHKERR( AOCreateBasic(ccomm, napp, idxapp, idxpetsc, &newao) )
 *         PetscCLEAR(self.obj); self.ao = newao
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_napp == __pyx_v_npetsc) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_incompatible_array_sizes);
          __PYX_ERR(39, 43, __pyx_L1_error)
        }
      }
      #endif

      /* "PETSc/AO.pyx":41
 *         else:
 *             app = iarray_i(app, &napp, &idxapp)
 *             if petsc is not None:             # <<<<<<<<<<<<<<
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 *                 assert napp == npetsc, "incompatible array sizes"
 */
    }

    /* "PETSc/AO.pyx":44
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 *                 assert napp == npetsc, "incompatible array sizes"
 *             CHKERR( AOCreateBasic(ccomm, napp, idxapp, idxpetsc, &newao) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.ao = newao
 *         return self
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(AOCreateBasic(__pyx_v_ccomm, __pyx_v_napp, __pyx_v_idxapp, __pyx_v_idxpetsc, (&__pyx_v_newao))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(39, 44, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/AO.pyx":45
 *                 assert napp == npetsc, "incompatible array sizes"
 *             CHKERR( AOCreateBasic(ccomm, napp, idxapp, idxpetsc, &newao) )
 *         PetscCLEAR(self.obj); self.ao = newao             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->ao = __pyx_v_newao;

  /* "PETSc/AO.pyx":46
 *             CHKERR( AOCreateBasic(ccomm, napp, idxapp, idxpetsc, &newao) )
 *         PetscCLEAR(self.obj); self.ao = newao
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createMemoryScalable(self, app, petsc=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/AO.pyx":28
 *         return self
 * 
 *     def createBasic(self, app, petsc=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef PetscIS isapp = NULL, ispetsc = NULL
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.AO.createBasic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_app);
  __Pyx_XDECREF(__pyx_v_petsc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/AO.pyx":48
 *         return self
 * 
 *     def createMemoryScalable(self, app, petsc=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef PetscIS isapp = NULL, ispetsc = NULL
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_9createMemoryScalable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2AO_8createMemoryScalable[] = "AO.createMemoryScalable(self, app, petsc=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_9createMemoryScalable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_app = 0;
  PyObject *__pyx_v_petsc = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createMemoryScalable (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_app,&__pyx_n_s_petsc,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_app)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_petsc);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createMemoryScalable") < 0)) __PYX_ERR(39, 48, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_app = values[0];
    __pyx_v_petsc = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createMemoryScalable", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(39, 48, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.AO.createMemoryScalable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2AO_8createMemoryScalable(((struct PyPetscAOObject *)__pyx_v_self), __pyx_v_app, __pyx_v_petsc, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_8createMemoryScalable(struct PyPetscAOObject *__pyx_v_self, PyObject *__pyx_v_app, PyObject *__pyx_v_petsc, PyObject *__pyx_v_comm) {
  IS __pyx_v_isapp;
  IS __pyx_v_ispetsc;
  PetscInt __pyx_v_napp;
  PetscInt *__pyx_v_idxapp;
  PetscInt __pyx_v_npetsc;
  PetscInt *__pyx_v_idxpetsc;
  MPI_Comm __pyx_v_ccomm;
  AO __pyx_v_newao;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  IS __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("createMemoryScalable", 0);
  __Pyx_INCREF(__pyx_v_app);
  __Pyx_INCREF(__pyx_v_petsc);

  /* "PETSc/AO.pyx":49
 * 
 *     def createMemoryScalable(self, app, petsc=None, comm=None):
 *         cdef PetscIS isapp = NULL, ispetsc = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL
 */
  __pyx_v_isapp = NULL;
  __pyx_v_ispetsc = NULL;

  /* "PETSc/AO.pyx":50
 *     def createMemoryScalable(self, app, petsc=None, comm=None):
 *         cdef PetscIS isapp = NULL, ispetsc = NULL
 *         cdef PetscInt napp = 0, *idxapp = NULL,             # <<<<<<<<<<<<<<
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_v_napp = 0;
  __pyx_v_idxapp = NULL;

  /* "PETSc/AO.pyx":51
 *         cdef PetscIS isapp = NULL, ispetsc = NULL
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscAO newao = NULL
 */
  __pyx_v_npetsc = 0;
  __pyx_v_idxpetsc = NULL;

  /* "PETSc/AO.pyx":52
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscAO newao = NULL
 *         if isinstance(app, IS):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(39, 52, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/AO.pyx":53
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscAO newao = NULL             # <<<<<<<<<<<<<<
 *         if isinstance(app, IS):
 *             isapp = (<IS>app).iset
 */
  __pyx_v_newao = NULL;

  /* "PETSc/AO.pyx":54
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscAO newao = NULL
 *         if isinstance(app, IS):             # <<<<<<<<<<<<<<
 *             isapp = (<IS>app).iset
 *             if petsc is not None:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_app, __pyx_ptype_8petsc4py_5PETSc_IS); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/AO.pyx":55
 *         cdef PetscAO newao = NULL
 *         if isinstance(app, IS):
 *             isapp = (<IS>app).iset             # <<<<<<<<<<<<<<
 *             if petsc is not None:
 *                 ispetsc = (<IS?>petsc).iset
 */
    __pyx_t_4 = ((struct PyPetscISObject *)__pyx_v_app)->iset;
    __pyx_v_isapp = __pyx_t_4;

    /* "PETSc/AO.pyx":56
 *         if isinstance(app, IS):
 *             isapp = (<IS>app).iset
 *             if petsc is not None:             # <<<<<<<<<<<<<<
 *                 ispetsc = (<IS?>petsc).iset
 *             CHKERR( AOCreateMemoryScalableIS(isapp, ispetsc, &newao) )
 */
    __pyx_t_3 = (__pyx_v_petsc != Py_None);
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "PETSc/AO.pyx":57
 *             isapp = (<IS>app).iset
 *             if petsc is not None:
 *                 ispetsc = (<IS?>petsc).iset             # <<<<<<<<<<<<<<
 *             CHKERR( AOCreateMemoryScalableIS(isapp, ispetsc, &newao) )
 *         else:
 */
      if (!(likely(__Pyx_TypeTest(__pyx_v_petsc, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(39, 57, __pyx_L1_error)
      __pyx_t_4 = ((struct PyPetscISObject *)__pyx_v_petsc)->iset;
      __pyx_v_ispetsc = __pyx_t_4;

      /* "PETSc/AO.pyx":56
 *         if isinstance(app, IS):
 *             isapp = (<IS>app).iset
 *             if petsc is not None:             # <<<<<<<<<<<<<<
 *                 ispetsc = (<IS?>petsc).iset
 *             CHKERR( AOCreateMemoryScalableIS(isapp, ispetsc, &newao) )
 */
    }

    /* "PETSc/AO.pyx":58
 *             if petsc is not None:
 *                 ispetsc = (<IS?>petsc).iset
 *             CHKERR( AOCreateMemoryScalableIS(isapp, ispetsc, &newao) )             # <<<<<<<<<<<<<<
 *         else:
 *             app = iarray_i(app, &napp, &idxapp)
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(AOCreateMemoryScalableIS(__pyx_v_isapp, __pyx_v_ispetsc, (&__pyx_v_newao))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(39, 58, __pyx_L1_error)

    /* "PETSc/AO.pyx":54
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscAO newao = NULL
 *         if isinstance(app, IS):             # <<<<<<<<<<<<<<
 *             isapp = (<IS>app).iset
 *             if petsc is not None:
 */
    goto __pyx_L3;
  }

  /* "PETSc/AO.pyx":60
 *             CHKERR( AOCreateMemoryScalableIS(isapp, ispetsc, &newao) )
 *         else:
 *             app = iarray_i(app, &napp, &idxapp)             # <<<<<<<<<<<<<<
 *             if petsc is not None:
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 */
  /*else*/ {
    __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_app, (&__pyx_v_napp), (&__pyx_v_idxapp))); if (unlikely(!__pyx_t_6)) __PYX_ERR(39, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF_SET(__pyx_v_app, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "PETSc/AO.pyx":61
 *         else:
 *             app = iarray_i(app, &napp, &idxapp)
 *             if petsc is not None:             # <<<<<<<<<<<<<<
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 *                 assert napp == npetsc, "incompatible array sizes"
 */
    __pyx_t_2 = (__pyx_v_petsc != Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (__pyx_t_3) {

      /* "PETSc/AO.pyx":62
 *             app = iarray_i(app, &napp, &idxapp)
 *             if petsc is not None:
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)             # <<<<<<<<<<<<<<
 *                 assert napp == npetsc, "incompatible array sizes"
 *             CHKERR( AOCreateMemoryScalable(ccomm, napp, idxapp, idxpetsc, &newao) )
 */
      __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_petsc, (&__pyx_v_npetsc), (&__pyx_v_idxpetsc))); if (unlikely(!__pyx_t_6)) __PYX_ERR(39, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_petsc, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "PETSc/AO.pyx":63
 *             if petsc is not None:
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 *                 assert napp == npetsc, "incompatible array sizes"             # <<<<<<<<<<<<<<
 *             CHKERR( AOCreateMemoryScalable(ccomm, napp, idxapp, idxpetsc, &newao) )
 *         PetscCLEAR(self.obj); self.ao = newao
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_napp == __pyx_v_npetsc) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_incompatible_array_sizes);
          __PYX_ERR(39, 63, __pyx_L1_error)
        }
      }
      #endif

      /* "PETSc/AO.pyx":61
 *         else:
 *             app = iarray_i(app, &napp, &idxapp)
 *             if petsc is not None:             # <<<<<<<<<<<<<<
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 *                 assert napp == npetsc, "incompatible array sizes"
 */
    }

    /* "PETSc/AO.pyx":64
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 *                 assert napp == npetsc, "incompatible array sizes"
 *             CHKERR( AOCreateMemoryScalable(ccomm, napp, idxapp, idxpetsc, &newao) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.ao = newao
 *         return self
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(AOCreateMemoryScalable(__pyx_v_ccomm, __pyx_v_napp, __pyx_v_idxapp, __pyx_v_idxpetsc, (&__pyx_v_newao))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(39, 64, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/AO.pyx":65
 *                 assert napp == npetsc, "incompatible array sizes"
 *             CHKERR( AOCreateMemoryScalable(ccomm, napp, idxapp, idxpetsc, &newao) )
 *         PetscCLEAR(self.obj); self.ao = newao             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->ao = __pyx_v_newao;

  /* "PETSc/AO.pyx":66
 *             CHKERR( AOCreateMemoryScalable(ccomm, napp, idxapp, idxpetsc, &newao) )
 *         PetscCLEAR(self.obj); self.ao = newao
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createMapping(self, app, petsc=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/AO.pyx":48
 *         return self
 * 
 *     def createMemoryScalable(self, app, petsc=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef PetscIS isapp = NULL, ispetsc = NULL
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.AO.createMemoryScalable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_app);
  __Pyx_XDECREF(__pyx_v_petsc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/AO.pyx":68
 *         return self
 * 
 *     def createMapping(self, app, petsc=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef PetscIS isapp = NULL, ispetsc = NULL
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_11createMapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2AO_10createMapping[] = "AO.createMapping(self, app, petsc=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_11createMapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_app = 0;
  PyObject *__pyx_v_petsc = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createMapping (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_app,&__pyx_n_s_petsc,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_app)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_petsc);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createMapping") < 0)) __PYX_ERR(39, 68, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_app = values[0];
    __pyx_v_petsc = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createMapping", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(39, 68, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.AO.createMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2AO_10createMapping(((struct PyPetscAOObject *)__pyx_v_self), __pyx_v_app, __pyx_v_petsc, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_10createMapping(struct PyPetscAOObject *__pyx_v_self, PyObject *__pyx_v_app, PyObject *__pyx_v_petsc, PyObject *__pyx_v_comm) {
  IS __pyx_v_isapp;
  IS __pyx_v_ispetsc;
  PetscInt __pyx_v_napp;
  PetscInt *__pyx_v_idxapp;
  PetscInt __pyx_v_npetsc;
  PetscInt *__pyx_v_idxpetsc;
  MPI_Comm __pyx_v_ccomm;
  AO __pyx_v_newao;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  IS __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("createMapping", 0);
  __Pyx_INCREF(__pyx_v_app);
  __Pyx_INCREF(__pyx_v_petsc);

  /* "PETSc/AO.pyx":69
 * 
 *     def createMapping(self, app, petsc=None, comm=None):
 *         cdef PetscIS isapp = NULL, ispetsc = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL
 */
  __pyx_v_isapp = NULL;
  __pyx_v_ispetsc = NULL;

  /* "PETSc/AO.pyx":70
 *     def createMapping(self, app, petsc=None, comm=None):
 *         cdef PetscIS isapp = NULL, ispetsc = NULL
 *         cdef PetscInt napp = 0, *idxapp = NULL,             # <<<<<<<<<<<<<<
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_v_napp = 0;
  __pyx_v_idxapp = NULL;

  /* "PETSc/AO.pyx":71
 *         cdef PetscIS isapp = NULL, ispetsc = NULL
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscAO newao = NULL
 */
  __pyx_v_npetsc = 0;
  __pyx_v_idxpetsc = NULL;

  /* "PETSc/AO.pyx":72
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscAO newao = NULL
 *         if isinstance(app, IS):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(39, 72, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/AO.pyx":73
 *         cdef PetscInt npetsc = 0, *idxpetsc = NULL
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscAO newao = NULL             # <<<<<<<<<<<<<<
 *         if isinstance(app, IS):
 *             isapp = (<IS>app).iset
 */
  __pyx_v_newao = NULL;

  /* "PETSc/AO.pyx":74
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscAO newao = NULL
 *         if isinstance(app, IS):             # <<<<<<<<<<<<<<
 *             isapp = (<IS>app).iset
 *             if petsc is not None:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_app, __pyx_ptype_8petsc4py_5PETSc_IS); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/AO.pyx":75
 *         cdef PetscAO newao = NULL
 *         if isinstance(app, IS):
 *             isapp = (<IS>app).iset             # <<<<<<<<<<<<<<
 *             if petsc is not None:
 *                 ispetsc = (<IS?>petsc).iset
 */
    __pyx_t_4 = ((struct PyPetscISObject *)__pyx_v_app)->iset;
    __pyx_v_isapp = __pyx_t_4;

    /* "PETSc/AO.pyx":76
 *         if isinstance(app, IS):
 *             isapp = (<IS>app).iset
 *             if petsc is not None:             # <<<<<<<<<<<<<<
 *                 ispetsc = (<IS?>petsc).iset
 *             CHKERR( AOCreateMappingIS(isapp, ispetsc, &newao) )
 */
    __pyx_t_3 = (__pyx_v_petsc != Py_None);
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "PETSc/AO.pyx":77
 *             isapp = (<IS>app).iset
 *             if petsc is not None:
 *                 ispetsc = (<IS?>petsc).iset             # <<<<<<<<<<<<<<
 *             CHKERR( AOCreateMappingIS(isapp, ispetsc, &newao) )
 *         else:
 */
      if (!(likely(__Pyx_TypeTest(__pyx_v_petsc, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(39, 77, __pyx_L1_error)
      __pyx_t_4 = ((struct PyPetscISObject *)__pyx_v_petsc)->iset;
      __pyx_v_ispetsc = __pyx_t_4;

      /* "PETSc/AO.pyx":76
 *         if isinstance(app, IS):
 *             isapp = (<IS>app).iset
 *             if petsc is not None:             # <<<<<<<<<<<<<<
 *                 ispetsc = (<IS?>petsc).iset
 *             CHKERR( AOCreateMappingIS(isapp, ispetsc, &newao) )
 */
    }

    /* "PETSc/AO.pyx":78
 *             if petsc is not None:
 *                 ispetsc = (<IS?>petsc).iset
 *             CHKERR( AOCreateMappingIS(isapp, ispetsc, &newao) )             # <<<<<<<<<<<<<<
 *         else:
 *             app = iarray_i(app, &napp, &idxapp)
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(AOCreateMappingIS(__pyx_v_isapp, __pyx_v_ispetsc, (&__pyx_v_newao))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(39, 78, __pyx_L1_error)

    /* "PETSc/AO.pyx":74
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscAO newao = NULL
 *         if isinstance(app, IS):             # <<<<<<<<<<<<<<
 *             isapp = (<IS>app).iset
 *             if petsc is not None:
 */
    goto __pyx_L3;
  }

  /* "PETSc/AO.pyx":80
 *             CHKERR( AOCreateMappingIS(isapp, ispetsc, &newao) )
 *         else:
 *             app = iarray_i(app, &napp, &idxapp)             # <<<<<<<<<<<<<<
 *             if petsc is not None:
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 */
  /*else*/ {
    __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_app, (&__pyx_v_napp), (&__pyx_v_idxapp))); if (unlikely(!__pyx_t_6)) __PYX_ERR(39, 80, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF_SET(__pyx_v_app, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "PETSc/AO.pyx":81
 *         else:
 *             app = iarray_i(app, &napp, &idxapp)
 *             if petsc is not None:             # <<<<<<<<<<<<<<
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 *                 assert napp == npetsc, "incompatible array sizes"
 */
    __pyx_t_2 = (__pyx_v_petsc != Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (__pyx_t_3) {

      /* "PETSc/AO.pyx":82
 *             app = iarray_i(app, &napp, &idxapp)
 *             if petsc is not None:
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)             # <<<<<<<<<<<<<<
 *                 assert napp == npetsc, "incompatible array sizes"
 *             CHKERR( AOCreateMapping(ccomm, napp, idxapp, idxpetsc, &newao) )
 */
      __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_petsc, (&__pyx_v_npetsc), (&__pyx_v_idxpetsc))); if (unlikely(!__pyx_t_6)) __PYX_ERR(39, 82, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_petsc, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "PETSc/AO.pyx":83
 *             if petsc is not None:
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 *                 assert napp == npetsc, "incompatible array sizes"             # <<<<<<<<<<<<<<
 *             CHKERR( AOCreateMapping(ccomm, napp, idxapp, idxpetsc, &newao) )
 *         PetscCLEAR(self.obj); self.ao = newao
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_napp == __pyx_v_npetsc) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_incompatible_array_sizes);
          __PYX_ERR(39, 83, __pyx_L1_error)
        }
      }
      #endif

      /* "PETSc/AO.pyx":81
 *         else:
 *             app = iarray_i(app, &napp, &idxapp)
 *             if petsc is not None:             # <<<<<<<<<<<<<<
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 *                 assert napp == npetsc, "incompatible array sizes"
 */
    }

    /* "PETSc/AO.pyx":84
 *                 petsc = iarray_i(petsc, &npetsc, &idxpetsc)
 *                 assert napp == npetsc, "incompatible array sizes"
 *             CHKERR( AOCreateMapping(ccomm, napp, idxapp, idxpetsc, &newao) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.ao = newao
 *         return self
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(AOCreateMapping(__pyx_v_ccomm, __pyx_v_napp, __pyx_v_idxapp, __pyx_v_idxpetsc, (&__pyx_v_newao))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(39, 84, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/AO.pyx":85
 *                 assert napp == npetsc, "incompatible array sizes"
 *             CHKERR( AOCreateMapping(ccomm, napp, idxapp, idxpetsc, &newao) )
 *         PetscCLEAR(self.obj); self.ao = newao             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->ao = __pyx_v_newao;

  /* "PETSc/AO.pyx":86
 *             CHKERR( AOCreateMapping(ccomm, napp, idxapp, idxpetsc, &newao) )
 *         PetscCLEAR(self.obj); self.ao = newao
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/AO.pyx":68
 *         return self
 * 
 *     def createMapping(self, app, petsc=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef PetscIS isapp = NULL, ispetsc = NULL
 *         cdef PetscInt napp = 0, *idxapp = NULL,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.AO.createMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_app);
  __Pyx_XDECREF(__pyx_v_petsc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/AO.pyx":88
 *         return self
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscAOType cval = NULL
 *         CHKERR( AOGetType(self.ao, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_13getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2AO_12getType[] = "AO.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_13getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2AO_12getType(((struct PyPetscAOObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_12getType(struct PyPetscAOObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/AO.pyx":89
 * 
 *     def getType(self):
 *         cdef PetscAOType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( AOGetType(self.ao, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/AO.pyx":90
 *     def getType(self):
 *         cdef PetscAOType cval = NULL
 *         CHKERR( AOGetType(self.ao, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(AOGetType(__pyx_v_self->ao, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(39, 90, __pyx_L1_error)

  /* "PETSc/AO.pyx":91
 *         cdef PetscAOType cval = NULL
 *         CHKERR( AOGetType(self.ao, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def app2petsc(self, indices):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(39, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/AO.pyx":88
 *         return self
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscAOType cval = NULL
 *         CHKERR( AOGetType(self.ao, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.AO.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/AO.pyx":93
 *         return bytes2str(cval)
 * 
 *     def app2petsc(self, indices):             # <<<<<<<<<<<<<<
 *         cdef PetscIS iset = NULL
 *         cdef PetscInt nidx = 0, *idx = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_15app2petsc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2AO_14app2petsc[] = "AO.app2petsc(self, indices)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_15app2petsc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("app2petsc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,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);
        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_indices)) != 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, "app2petsc") < 0)) __PYX_ERR(39, 93, __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_indices = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("app2petsc", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(39, 93, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.AO.app2petsc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2AO_14app2petsc(((struct PyPetscAOObject *)__pyx_v_self), __pyx_v_indices);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_14app2petsc(struct PyPetscAOObject *__pyx_v_self, PyObject *__pyx_v_indices) {
  IS __pyx_v_iset;
  PetscInt __pyx_v_nidx;
  PetscInt *__pyx_v_idx;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  IS __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("app2petsc", 0);
  __Pyx_INCREF(__pyx_v_indices);

  /* "PETSc/AO.pyx":94
 * 
 *     def app2petsc(self, indices):
 *         cdef PetscIS iset = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         if isinstance(indices, IS):
 */
  __pyx_v_iset = NULL;

  /* "PETSc/AO.pyx":95
 *     def app2petsc(self, indices):
 *         cdef PetscIS iset = NULL
 *         cdef PetscInt nidx = 0, *idx = NULL             # <<<<<<<<<<<<<<
 *         if isinstance(indices, IS):
 *             iset = (<IS>indices).iset
 */
  __pyx_v_nidx = 0;
  __pyx_v_idx = NULL;

  /* "PETSc/AO.pyx":96
 *         cdef PetscIS iset = NULL
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         if isinstance(indices, IS):             # <<<<<<<<<<<<<<
 *             iset = (<IS>indices).iset
 *             CHKERR( AOApplicationToPetscIS(self.ao, iset) )
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_indices, __pyx_ptype_8petsc4py_5PETSc_IS); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/AO.pyx":97
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         if isinstance(indices, IS):
 *             iset = (<IS>indices).iset             # <<<<<<<<<<<<<<
 *             CHKERR( AOApplicationToPetscIS(self.ao, iset) )
 *         else:
 */
    __pyx_t_3 = ((struct PyPetscISObject *)__pyx_v_indices)->iset;
    __pyx_v_iset = __pyx_t_3;

    /* "PETSc/AO.pyx":98
 *         if isinstance(indices, IS):
 *             iset = (<IS>indices).iset
 *             CHKERR( AOApplicationToPetscIS(self.ao, iset) )             # <<<<<<<<<<<<<<
 *         else:
 *             indices = oarray_i(indices, &nidx, &idx)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(AOApplicationToPetscIS(__pyx_v_self->ao, __pyx_v_iset)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(39, 98, __pyx_L1_error)

    /* "PETSc/AO.pyx":96
 *         cdef PetscIS iset = NULL
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         if isinstance(indices, IS):             # <<<<<<<<<<<<<<
 *             iset = (<IS>indices).iset
 *             CHKERR( AOApplicationToPetscIS(self.ao, iset) )
 */
    goto __pyx_L3;
  }

  /* "PETSc/AO.pyx":100
 *             CHKERR( AOApplicationToPetscIS(self.ao, iset) )
 *         else:
 *             indices = oarray_i(indices, &nidx, &idx)             # <<<<<<<<<<<<<<
 *             CHKERR( AOApplicationToPetsc(self.ao, nidx, idx) )
 *         return indices
 */
  /*else*/ {
    __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_i(__pyx_v_indices, (&__pyx_v_nidx), (&__pyx_v_idx))); if (unlikely(!__pyx_t_5)) __PYX_ERR(39, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PETSc/AO.pyx":101
 *         else:
 *             indices = oarray_i(indices, &nidx, &idx)
 *             CHKERR( AOApplicationToPetsc(self.ao, nidx, idx) )             # <<<<<<<<<<<<<<
 *         return indices
 * 
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(AOApplicationToPetsc(__pyx_v_self->ao, __pyx_v_nidx, __pyx_v_idx)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(39, 101, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/AO.pyx":102
 *             indices = oarray_i(indices, &nidx, &idx)
 *             CHKERR( AOApplicationToPetsc(self.ao, nidx, idx) )
 *         return indices             # <<<<<<<<<<<<<<
 * 
 *     def petsc2app(self, indices):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_indices);
  __pyx_r = __pyx_v_indices;
  goto __pyx_L0;

  /* "PETSc/AO.pyx":93
 *         return bytes2str(cval)
 * 
 *     def app2petsc(self, indices):             # <<<<<<<<<<<<<<
 *         cdef PetscIS iset = NULL
 *         cdef PetscInt nidx = 0, *idx = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.AO.app2petsc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/AO.pyx":104
 *         return indices
 * 
 *     def petsc2app(self, indices):             # <<<<<<<<<<<<<<
 *         cdef PetscIS iset = NULL
 *         cdef PetscInt nidx = 0, *idx = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_17petsc2app(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2AO_16petsc2app[] = "AO.petsc2app(self, indices)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2AO_17petsc2app(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("petsc2app (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,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);
        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_indices)) != 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, "petsc2app") < 0)) __PYX_ERR(39, 104, __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_indices = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("petsc2app", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(39, 104, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.AO.petsc2app", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2AO_16petsc2app(((struct PyPetscAOObject *)__pyx_v_self), __pyx_v_indices);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2AO_16petsc2app(struct PyPetscAOObject *__pyx_v_self, PyObject *__pyx_v_indices) {
  IS __pyx_v_iset;
  PetscInt __pyx_v_nidx;
  PetscInt *__pyx_v_idx;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  IS __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("petsc2app", 0);
  __Pyx_INCREF(__pyx_v_indices);

  /* "PETSc/AO.pyx":105
 * 
 *     def petsc2app(self, indices):
 *         cdef PetscIS iset = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         if isinstance(indices, IS):
 */
  __pyx_v_iset = NULL;

  /* "PETSc/AO.pyx":106
 *     def petsc2app(self, indices):
 *         cdef PetscIS iset = NULL
 *         cdef PetscInt nidx = 0, *idx = NULL             # <<<<<<<<<<<<<<
 *         if isinstance(indices, IS):
 *             iset = (<IS>indices).iset
 */
  __pyx_v_nidx = 0;
  __pyx_v_idx = NULL;

  /* "PETSc/AO.pyx":107
 *         cdef PetscIS iset = NULL
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         if isinstance(indices, IS):             # <<<<<<<<<<<<<<
 *             iset = (<IS>indices).iset
 *             CHKERR( AOPetscToApplicationIS(self.ao, iset) )
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_indices, __pyx_ptype_8petsc4py_5PETSc_IS); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/AO.pyx":108
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         if isinstance(indices, IS):
 *             iset = (<IS>indices).iset             # <<<<<<<<<<<<<<
 *             CHKERR( AOPetscToApplicationIS(self.ao, iset) )
 *         else:
 */
    __pyx_t_3 = ((struct PyPetscISObject *)__pyx_v_indices)->iset;
    __pyx_v_iset = __pyx_t_3;

    /* "PETSc/AO.pyx":109
 *         if isinstance(indices, IS):
 *             iset = (<IS>indices).iset
 *             CHKERR( AOPetscToApplicationIS(self.ao, iset) )             # <<<<<<<<<<<<<<
 *         else:
 *             indices = oarray_i(indices, &nidx, &idx)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(AOPetscToApplicationIS(__pyx_v_self->ao, __pyx_v_iset)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(39, 109, __pyx_L1_error)

    /* "PETSc/AO.pyx":107
 *         cdef PetscIS iset = NULL
 *         cdef PetscInt nidx = 0, *idx = NULL
 *         if isinstance(indices, IS):             # <<<<<<<<<<<<<<
 *             iset = (<IS>indices).iset
 *             CHKERR( AOPetscToApplicationIS(self.ao, iset) )
 */
    goto __pyx_L3;
  }

  /* "PETSc/AO.pyx":111
 *             CHKERR( AOPetscToApplicationIS(self.ao, iset) )
 *         else:
 *             indices = oarray_i(indices, &nidx, &idx)             # <<<<<<<<<<<<<<
 *             CHKERR( AOPetscToApplication(self.ao, nidx, idx) )
 *         return indices
 */
  /*else*/ {
    __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_i(__pyx_v_indices, (&__pyx_v_nidx), (&__pyx_v_idx))); if (unlikely(!__pyx_t_5)) __PYX_ERR(39, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PETSc/AO.pyx":112
 *         else:
 *             indices = oarray_i(indices, &nidx, &idx)
 *             CHKERR( AOPetscToApplication(self.ao, nidx, idx) )             # <<<<<<<<<<<<<<
 *         return indices
 * 
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(AOPetscToApplication(__pyx_v_self->ao, __pyx_v_nidx, __pyx_v_idx)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(39, 112, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/AO.pyx":113
 *             indices = oarray_i(indices, &nidx, &idx)
 *             CHKERR( AOPetscToApplication(self.ao, nidx, idx) )
 *         return indices             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_indices);
  __pyx_r = __pyx_v_indices;
  goto __pyx_L0;

  /* "PETSc/AO.pyx":104
 *         return indices
 * 
 *     def petsc2app(self, indices):             # <<<<<<<<<<<<<<
 *         cdef PetscIS iset = NULL
 *         cdef PetscInt nidx = 0, *idx = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.AO.petsc2app", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":31
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.dm
 *         self.dm  = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2DM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2DM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM___cinit__(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2DM___cinit__(struct PyPetscDMObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/DM.pyx":32
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.dm             # <<<<<<<<<<<<<<
 *         self.dm  = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->dm));

  /* "PETSc/DM.pyx":33
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.dm
 *         self.dm  = NULL             # <<<<<<<<<<<<<<
 * 
 *     def view(self, Viewer viewer=None):
 */
  __pyx_v_self->dm = NULL;

  /* "PETSc/DM.pyx":31
 *     #
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.dm
 *         self.dm  = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":35
 *         self.dm  = NULL
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_3view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_2view[] = "DM.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_3view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(40, 35, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 35, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(40, 35, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_2view(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_viewer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_2view(struct PyPetscDMObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/DM.pyx":36
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( DMView(self.dm, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/DM.pyx":37
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( DMView(self.dm, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/DM.pyx":38
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( DMView(self.dm, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMView(__pyx_v_self->dm, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(40, 38, __pyx_L1_error)

  /* "PETSc/DM.pyx":35
 *         self.dm  = NULL
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":40
 *         CHKERR( DMView(self.dm, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMDestroy(&self.dm) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_5destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_4destroy[] = "DM.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_5destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_4destroy(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_4destroy(struct PyPetscDMObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/DM.pyx":41
 * 
 *     def destroy(self):
 *         CHKERR( DMDestroy(&self.dm) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDestroy((&__pyx_v_self->dm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 41, __pyx_L1_error)

  /* "PETSc/DM.pyx":42
 *     def destroy(self):
 *         CHKERR( DMDestroy(&self.dm) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":40
 *         CHKERR( DMView(self.dm, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMDestroy(&self.dm) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":44
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_7create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_6create[] = "DM.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_7create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(40, 44, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 44, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_6create(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_6create(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  DM __pyx_v_newdm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/DM.pyx":45
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMCreate(ccomm, &newdm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(40, 45, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/DM.pyx":46
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMCreate(ccomm, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DM.pyx":47
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMCreate(ccomm, &newdm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCreate(__pyx_v_ccomm, (&__pyx_v_newdm))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 47, __pyx_L1_error)

  /* "PETSc/DM.pyx":48
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMCreate(ccomm, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->dm = __pyx_v_newdm;

  /* "PETSc/DM.pyx":49
 *         CHKERR( DMCreate(ccomm, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def clone(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":44
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":51
 *         return self
 * 
 *     def clone(self):             # <<<<<<<<<<<<<<
 *         cdef DM dm = type(self)()
 *         CHKERR( DMClone(self.dm, &dm.dm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_9clone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_8clone[] = "DM.clone(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_9clone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clone (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("clone", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "clone", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_8clone(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_8clone(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscDMObject *__pyx_v_dm = 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;
  __Pyx_RefNannySetupContext("clone", 0);

  /* "PETSc/DM.pyx":52
 * 
 *     def clone(self):
 *         cdef DM dm = type(self)()             # <<<<<<<<<<<<<<
 *         CHKERR( DMClone(self.dm, &dm.dm) )
 *         return dm
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __pyx_t_2 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 52, __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(40, 52, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(40, 52, __pyx_L1_error)
  __pyx_v_dm = ((struct PyPetscDMObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":53
 *     def clone(self):
 *         cdef DM dm = type(self)()
 *         CHKERR( DMClone(self.dm, &dm.dm) )             # <<<<<<<<<<<<<<
 *         return dm
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMClone(__pyx_v_self->dm, (&__pyx_v_dm->dm))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(40, 53, __pyx_L1_error)

  /* "PETSc/DM.pyx":54
 *         cdef DM dm = type(self)()
 *         CHKERR( DMClone(self.dm, &dm.dm) )
 *         return dm             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, dm_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dm));
  __pyx_r = ((PyObject *)__pyx_v_dm);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":51
 *         return self
 * 
 *     def clone(self):             # <<<<<<<<<<<<<<
 *         cdef DM dm = type(self)()
 *         CHKERR( DMClone(self.dm, &dm.dm) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":56
 *         return dm
 * 
 *     def setType(self, dm_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         dm_type = str2bytes(dm_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_11setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_10setType[] = "DM.setType(self, dm_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_11setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dm_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dm_type,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);
        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_dm_type)) != 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, "setType") < 0)) __PYX_ERR(40, 56, __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_dm_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 56, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_10setType(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_dm_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_10setType(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_dm_type) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_dm_type);

  /* "PETSc/DM.pyx":57
 * 
 *     def setType(self, dm_type):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         dm_type = str2bytes(dm_type, &cval)
 *         CHKERR( DMSetType(self.dm, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/DM.pyx":58
 *     def setType(self, dm_type):
 *         cdef const_char *cval = NULL
 *         dm_type = str2bytes(dm_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetType(self.dm, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_dm_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dm_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":59
 *         cdef const_char *cval = NULL
 *         dm_type = str2bytes(dm_type, &cval)
 *         CHKERR( DMSetType(self.dm, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetType(__pyx_v_self->dm, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 59, __pyx_L1_error)

  /* "PETSc/DM.pyx":56
 *         return dm
 * 
 *     def setType(self, dm_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         dm_type = str2bytes(dm_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dm_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":61
 *         CHKERR( DMSetType(self.dm, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDMType cval = NULL
 *         CHKERR( DMGetType(self.dm, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_13getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_12getType[] = "DM.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_13getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_12getType(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_12getType(struct PyPetscDMObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/DM.pyx":62
 * 
 *     def getType(self):
 *         cdef PetscDMType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetType(self.dm, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/DM.pyx":63
 *     def getType(self):
 *         cdef PetscDMType cval = NULL
 *         CHKERR( DMGetType(self.dm, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetType(__pyx_v_self->dm, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 63, __pyx_L1_error)

  /* "PETSc/DM.pyx":64
 *         cdef PetscDMType cval = NULL
 *         CHKERR( DMGetType(self.dm, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def getDimension(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":61
 *         CHKERR( DMSetType(self.dm, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDMType cval = NULL
 *         CHKERR( DMGetType(self.dm, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":66
 *         return bytes2str(cval)
 * 
 *     def getDimension(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = 0
 *         CHKERR( DMGetDimension(self.dm, &dim) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_15getDimension(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_14getDimension[] = "DM.getDimension(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_15getDimension(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDimension (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDimension", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDimension", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_14getDimension(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_14getDimension(struct PyPetscDMObject *__pyx_v_self) {
  PetscInt __pyx_v_dim;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getDimension", 0);

  /* "PETSc/DM.pyx":67
 * 
 *     def getDimension(self):
 *         cdef PetscInt dim = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetDimension(self.dm, &dim) )
 *         return toInt(dim)
 */
  __pyx_v_dim = 0;

  /* "PETSc/DM.pyx":68
 *     def getDimension(self):
 *         cdef PetscInt dim = 0
 *         CHKERR( DMGetDimension(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         return toInt(dim)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetDimension(__pyx_v_self->dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 68, __pyx_L1_error)

  /* "PETSc/DM.pyx":69
 *         cdef PetscInt dim = 0
 *         CHKERR( DMGetDimension(self.dm, &dim) )
 *         return toInt(dim)             # <<<<<<<<<<<<<<
 * 
 *     def setDimension(self, dim):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":66
 *         return bytes2str(cval)
 * 
 *     def getDimension(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = 0
 *         CHKERR( DMGetDimension(self.dm, &dim) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getDimension", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":71
 *         return toInt(dim)
 * 
 *     def setDimension(self, dim):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cdim = asInt(dim)
 *         CHKERR( DMSetDimension(self.dm, cdim) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_17setDimension(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_16setDimension[] = "DM.setDimension(self, dim)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_17setDimension(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dim = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDimension (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dim,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);
        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_dim)) != 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, "setDimension") < 0)) __PYX_ERR(40, 71, __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_dim = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDimension", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 71, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setDimension", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_16setDimension(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_dim);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_16setDimension(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_dim) {
  PetscInt __pyx_v_cdim;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setDimension", 0);

  /* "PETSc/DM.pyx":72
 * 
 *     def setDimension(self, dim):
 *         cdef PetscInt cdim = asInt(dim)             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetDimension(self.dm, cdim) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_dim); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(40, 72, __pyx_L1_error)
  __pyx_v_cdim = __pyx_t_1;

  /* "PETSc/DM.pyx":73
 *     def setDimension(self, dim):
 *         cdef PetscInt cdim = asInt(dim)
 *         CHKERR( DMSetDimension(self.dm, cdim) )             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetDimension(__pyx_v_self->dm, __pyx_v_cdim)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 73, __pyx_L1_error)

  /* "PETSc/DM.pyx":71
 *         return toInt(dim)
 * 
 *     def setDimension(self, dim):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cdim = asInt(dim)
 *         CHKERR( DMSetDimension(self.dm, cdim) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setDimension", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":76
 * 
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_19setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_18setOptionsPrefix[] = "DM.setOptionsPrefix(self, prefix)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_19setOptionsPrefix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOptionsPrefix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,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);
        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_prefix)) != 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, "setOptionsPrefix") < 0)) __PYX_ERR(40, 76, __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_prefix = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOptionsPrefix", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 76, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_18setOptionsPrefix(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_prefix);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_18setOptionsPrefix(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setOptionsPrefix", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "PETSc/DM.pyx":77
 * 
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( DMSetOptionsPrefix(self.dm, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/DM.pyx":78
 *     def setOptionsPrefix(self, prefix):
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetOptionsPrefix(self.dm, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_prefix, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":79
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 *         CHKERR( DMSetOptionsPrefix(self.dm, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetOptionsPrefix(__pyx_v_self->dm, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 79, __pyx_L1_error)

  /* "PETSc/DM.pyx":76
 * 
 * 
 *     def setOptionsPrefix(self, prefix):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         prefix = str2bytes(prefix, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setOptionsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":81
 *         CHKERR( DMSetOptionsPrefix(self.dm, cval) )
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetFromOptions(self.dm) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_21setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_20setFromOptions[] = "DM.setFromOptions(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_21setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_20setFromOptions(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_20setFromOptions(struct PyPetscDMObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/DM.pyx":82
 * 
 *     def setFromOptions(self):
 *         CHKERR( DMSetFromOptions(self.dm) )             # <<<<<<<<<<<<<<
 * 
 *     def setUp(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetFromOptions(__pyx_v_self->dm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 82, __pyx_L1_error)

  /* "PETSc/DM.pyx":81
 *         CHKERR( DMSetOptionsPrefix(self.dm, cval) )
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetFromOptions(self.dm) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":84
 *         CHKERR( DMSetFromOptions(self.dm) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetUp(self.dm) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_23setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_22setUp[] = "DM.setUp(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_23setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUp (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUp", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUp", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_22setUp(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_22setUp(struct PyPetscDMObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUp", 0);

  /* "PETSc/DM.pyx":85
 * 
 *     def setUp(self):
 *         CHKERR( DMSetUp(self.dm) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetUp(__pyx_v_self->dm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 85, __pyx_L1_error)

  /* "PETSc/DM.pyx":86
 *     def setUp(self):
 *         CHKERR( DMSetUp(self.dm) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     # --- application context ---
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":84
 *         CHKERR( DMSetFromOptions(self.dm) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetUp(self.dm) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":90
 *     # --- application context ---
 * 
 *     def setAppCtx(self, appctx):             # <<<<<<<<<<<<<<
 *         self.set_attr('__appctx__', appctx)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_25setAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_24setAppCtx[] = "DM.setAppCtx(self, appctx)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_25setAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_appctx = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setAppCtx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_appctx,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);
        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_appctx)) != 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, "setAppCtx") < 0)) __PYX_ERR(40, 90, __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_appctx = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setAppCtx", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 90, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_24setAppCtx(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_appctx);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_24setAppCtx(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_appctx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setAppCtx", 0);

  /* "PETSc/DM.pyx":91
 * 
 *     def setAppCtx(self, appctx):
 *         self.set_attr('__appctx__', appctx)             # <<<<<<<<<<<<<<
 * 
 *     def getAppCtx(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__appctx__"), __pyx_v_appctx); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":90
 *     # --- application context ---
 * 
 *     def setAppCtx(self, appctx):             # <<<<<<<<<<<<<<
 *         self.set_attr('__appctx__', appctx)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":93
 *         self.set_attr('__appctx__', appctx)
 * 
 *     def getAppCtx(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__appctx__')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_27getAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_26getAppCtx[] = "DM.getAppCtx(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_27getAppCtx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getAppCtx (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getAppCtx", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getAppCtx", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_26getAppCtx(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_26getAppCtx(struct PyPetscDMObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getAppCtx", 0);

  /* "PETSc/DM.pyx":94
 * 
 *     def getAppCtx(self):
 *         return self.get_attr('__appctx__')             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DM *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__appctx__")); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":93
 *         self.set_attr('__appctx__', appctx)
 * 
 *     def getAppCtx(self):             # <<<<<<<<<<<<<<
 *         return self.get_attr('__appctx__')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getAppCtx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":98
 *     #
 * 
 *     def getBlockSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = 1
 *         CHKERR( DMGetBlockSize(self.dm, &bs) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_29getBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_28getBlockSize[] = "DM.getBlockSize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_29getBlockSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBlockSize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getBlockSize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getBlockSize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_28getBlockSize(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_28getBlockSize(struct PyPetscDMObject *__pyx_v_self) {
  PetscInt __pyx_v_bs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getBlockSize", 0);

  /* "PETSc/DM.pyx":99
 * 
 *     def getBlockSize(self):
 *         cdef PetscInt bs = 1             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetBlockSize(self.dm, &bs) )
 *         return toInt(bs)
 */
  __pyx_v_bs = 1;

  /* "PETSc/DM.pyx":100
 *     def getBlockSize(self):
 *         cdef PetscInt bs = 1
 *         CHKERR( DMGetBlockSize(self.dm, &bs) )             # <<<<<<<<<<<<<<
 *         return toInt(bs)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetBlockSize(__pyx_v_self->dm, (&__pyx_v_bs))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 100, __pyx_L1_error)

  /* "PETSc/DM.pyx":101
 *         cdef PetscInt bs = 1
 *         CHKERR( DMGetBlockSize(self.dm, &bs) )
 *         return toInt(bs)             # <<<<<<<<<<<<<<
 * 
 *     def setVecType(self, vec_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_bs); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":98
 *     #
 * 
 *     def getBlockSize(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt bs = 1
 *         CHKERR( DMGetBlockSize(self.dm, &bs) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getBlockSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":103
 *         return toInt(bs)
 * 
 *     def setVecType(self, vec_type):             # <<<<<<<<<<<<<<
 *         cdef PetscVecType vtype = NULL
 *         vec_type = str2bytes(vec_type, &vtype)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_31setVecType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_30setVecType[] = "DM.setVecType(self, vec_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_31setVecType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vec_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setVecType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec_type,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);
        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_vec_type)) != 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, "setVecType") < 0)) __PYX_ERR(40, 103, __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_vec_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setVecType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 103, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setVecType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_30setVecType(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_vec_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_30setVecType(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_vec_type) {
  const char* __pyx_v_vtype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setVecType", 0);
  __Pyx_INCREF(__pyx_v_vec_type);

  /* "PETSc/DM.pyx":104
 * 
 *     def setVecType(self, vec_type):
 *         cdef PetscVecType vtype = NULL             # <<<<<<<<<<<<<<
 *         vec_type = str2bytes(vec_type, &vtype)
 *         CHKERR( DMSetVecType(self.dm, vtype) )
 */
  __pyx_v_vtype = NULL;

  /* "PETSc/DM.pyx":105
 *     def setVecType(self, vec_type):
 *         cdef PetscVecType vtype = NULL
 *         vec_type = str2bytes(vec_type, &vtype)             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetVecType(self.dm, vtype) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_vec_type, (&__pyx_v_vtype)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_vec_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":106
 *         cdef PetscVecType vtype = NULL
 *         vec_type = str2bytes(vec_type, &vtype)
 *         CHKERR( DMSetVecType(self.dm, vtype) )             # <<<<<<<<<<<<<<
 * 
 *     def createGlobalVec(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetVecType(__pyx_v_self->dm, __pyx_v_vtype)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 106, __pyx_L1_error)

  /* "PETSc/DM.pyx":103
 *         return toInt(bs)
 * 
 *     def setVecType(self, vec_type):             # <<<<<<<<<<<<<<
 *         cdef PetscVecType vtype = NULL
 *         vec_type = str2bytes(vec_type, &vtype)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setVecType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_vec_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":108
 *         CHKERR( DMSetVecType(self.dm, vtype) )
 * 
 *     def createGlobalVec(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vg = Vec()
 *         CHKERR( DMCreateGlobalVector(self.dm, &vg.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_33createGlobalVec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_32createGlobalVec[] = "DM.createGlobalVec(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_33createGlobalVec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createGlobalVec (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("createGlobalVec", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "createGlobalVec", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_32createGlobalVec(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_32createGlobalVec(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vg = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createGlobalVec", 0);

  /* "PETSc/DM.pyx":109
 * 
 *     def createGlobalVec(self):
 *         cdef Vec vg = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( DMCreateGlobalVector(self.dm, &vg.vec) )
 *         return vg
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vg = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":110
 *     def createGlobalVec(self):
 *         cdef Vec vg = Vec()
 *         CHKERR( DMCreateGlobalVector(self.dm, &vg.vec) )             # <<<<<<<<<<<<<<
 *         return vg
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCreateGlobalVector(__pyx_v_self->dm, (&__pyx_v_vg->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 110, __pyx_L1_error)

  /* "PETSc/DM.pyx":111
 *         cdef Vec vg = Vec()
 *         CHKERR( DMCreateGlobalVector(self.dm, &vg.vec) )
 *         return vg             # <<<<<<<<<<<<<<
 * 
 *     def createLocalVec(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vg));
  __pyx_r = ((PyObject *)__pyx_v_vg);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":108
 *         CHKERR( DMSetVecType(self.dm, vtype) )
 * 
 *     def createGlobalVec(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vg = Vec()
 *         CHKERR( DMCreateGlobalVector(self.dm, &vg.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createGlobalVec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":113
 *         return vg
 * 
 *     def createLocalVec(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vl = Vec()
 *         CHKERR( DMCreateLocalVector(self.dm, &vl.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_35createLocalVec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_34createLocalVec[] = "DM.createLocalVec(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_35createLocalVec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createLocalVec (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("createLocalVec", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "createLocalVec", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_34createLocalVec(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_34createLocalVec(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vl = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createLocalVec", 0);

  /* "PETSc/DM.pyx":114
 * 
 *     def createLocalVec(self):
 *         cdef Vec vl = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( DMCreateLocalVector(self.dm, &vl.vec) )
 *         return vl
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vl = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":115
 *     def createLocalVec(self):
 *         cdef Vec vl = Vec()
 *         CHKERR( DMCreateLocalVector(self.dm, &vl.vec) )             # <<<<<<<<<<<<<<
 *         return vl
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCreateLocalVector(__pyx_v_self->dm, (&__pyx_v_vl->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 115, __pyx_L1_error)

  /* "PETSc/DM.pyx":116
 *         cdef Vec vl = Vec()
 *         CHKERR( DMCreateLocalVector(self.dm, &vl.vec) )
 *         return vl             # <<<<<<<<<<<<<<
 * 
 *     def globalToLocal(self, Vec vg not None, Vec vl not None, addv=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vl));
  __pyx_r = ((PyObject *)__pyx_v_vl);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":113
 *         return vg
 * 
 *     def createLocalVec(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vl = Vec()
 *         CHKERR( DMCreateLocalVector(self.dm, &vl.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createLocalVec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":118
 *         return vl
 * 
 *     def globalToLocal(self, Vec vg not None, Vec vl not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMGlobalToLocalBegin(self.dm, vg.vec, im, vl.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_37globalToLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_36globalToLocal[] = "DM.globalToLocal(self, Vec vg, Vec vl, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_37globalToLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vg = 0;
  struct PyPetscVecObject *__pyx_v_vl = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("globalToLocal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vg,&__pyx_n_s_vl,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vg)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vl)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("globalToLocal", 0, 2, 3, 1); __PYX_ERR(40, 118, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "globalToLocal") < 0)) __PYX_ERR(40, 118, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_vg = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_vl = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("globalToLocal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 118, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.globalToLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vg), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vg", 0))) __PYX_ERR(40, 118, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vl), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vl", 0))) __PYX_ERR(40, 118, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_36globalToLocal(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_vg, __pyx_v_vl, __pyx_v_addv);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_36globalToLocal(struct PyPetscDMObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vg, struct PyPetscVecObject *__pyx_v_vl, PyObject *__pyx_v_addv) {
  InsertMode __pyx_v_im;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("globalToLocal", 0);

  /* "PETSc/DM.pyx":119
 * 
 *     def globalToLocal(self, Vec vg not None, Vec vl not None, addv=None):
 *         cdef PetscInsertMode im = insertmode(addv)             # <<<<<<<<<<<<<<
 *         CHKERR( DMGlobalToLocalBegin(self.dm, vg.vec, im, vl.vec) )
 *         CHKERR( DMGlobalToLocalEnd  (self.dm, vg.vec, im, vl.vec) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(40, 119, __pyx_L1_error)
  __pyx_v_im = __pyx_t_1;

  /* "PETSc/DM.pyx":120
 *     def globalToLocal(self, Vec vg not None, Vec vl not None, addv=None):
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMGlobalToLocalBegin(self.dm, vg.vec, im, vl.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMGlobalToLocalEnd  (self.dm, vg.vec, im, vl.vec) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGlobalToLocalBegin(__pyx_v_self->dm, __pyx_v_vg->vec, __pyx_v_im, __pyx_v_vl->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 120, __pyx_L1_error)

  /* "PETSc/DM.pyx":121
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMGlobalToLocalBegin(self.dm, vg.vec, im, vl.vec) )
 *         CHKERR( DMGlobalToLocalEnd  (self.dm, vg.vec, im, vl.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def localToGlobal(self, Vec vl not None, Vec vg not None, addv=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGlobalToLocalEnd(__pyx_v_self->dm, __pyx_v_vg->vec, __pyx_v_im, __pyx_v_vl->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 121, __pyx_L1_error)

  /* "PETSc/DM.pyx":118
 *         return vl
 * 
 *     def globalToLocal(self, Vec vg not None, Vec vl not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMGlobalToLocalBegin(self.dm, vg.vec, im, vl.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.globalToLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":123
 *         CHKERR( DMGlobalToLocalEnd  (self.dm, vg.vec, im, vl.vec) )
 * 
 *     def localToGlobal(self, Vec vl not None, Vec vg not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMLocalToGlobalBegin(self.dm, vl.vec, im, vg.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_39localToGlobal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_38localToGlobal[] = "DM.localToGlobal(self, Vec vl, Vec vg, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_39localToGlobal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vl = 0;
  struct PyPetscVecObject *__pyx_v_vg = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("localToGlobal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vl,&__pyx_n_s_vg,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vl)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vg)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("localToGlobal", 0, 2, 3, 1); __PYX_ERR(40, 123, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "localToGlobal") < 0)) __PYX_ERR(40, 123, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_vl = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_vg = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("localToGlobal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 123, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.localToGlobal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vl), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vl", 0))) __PYX_ERR(40, 123, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vg), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vg", 0))) __PYX_ERR(40, 123, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_38localToGlobal(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_vl, __pyx_v_vg, __pyx_v_addv);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_38localToGlobal(struct PyPetscDMObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vl, struct PyPetscVecObject *__pyx_v_vg, PyObject *__pyx_v_addv) {
  InsertMode __pyx_v_im;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("localToGlobal", 0);

  /* "PETSc/DM.pyx":124
 * 
 *     def localToGlobal(self, Vec vl not None, Vec vg not None, addv=None):
 *         cdef PetscInsertMode im = insertmode(addv)             # <<<<<<<<<<<<<<
 *         CHKERR( DMLocalToGlobalBegin(self.dm, vl.vec, im, vg.vec) )
 *         CHKERR( DMLocalToGlobalEnd(self.dm, vl.vec, im, vg.vec) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(40, 124, __pyx_L1_error)
  __pyx_v_im = __pyx_t_1;

  /* "PETSc/DM.pyx":125
 *     def localToGlobal(self, Vec vl not None, Vec vg not None, addv=None):
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMLocalToGlobalBegin(self.dm, vl.vec, im, vg.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMLocalToGlobalEnd(self.dm, vl.vec, im, vg.vec) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMLocalToGlobalBegin(__pyx_v_self->dm, __pyx_v_vl->vec, __pyx_v_im, __pyx_v_vg->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 125, __pyx_L1_error)

  /* "PETSc/DM.pyx":126
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMLocalToGlobalBegin(self.dm, vl.vec, im, vg.vec) )
 *         CHKERR( DMLocalToGlobalEnd(self.dm, vl.vec, im, vg.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def localToLocal(self, Vec vl not None, Vec vlg not None, addv=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMLocalToGlobalEnd(__pyx_v_self->dm, __pyx_v_vl->vec, __pyx_v_im, __pyx_v_vg->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 126, __pyx_L1_error)

  /* "PETSc/DM.pyx":123
 *         CHKERR( DMGlobalToLocalEnd  (self.dm, vg.vec, im, vl.vec) )
 * 
 *     def localToGlobal(self, Vec vl not None, Vec vg not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMLocalToGlobalBegin(self.dm, vl.vec, im, vg.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.localToGlobal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":128
 *         CHKERR( DMLocalToGlobalEnd(self.dm, vl.vec, im, vg.vec) )
 * 
 *     def localToLocal(self, Vec vl not None, Vec vlg not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMLocalToLocalBegin(self.dm, vl.vec, im, vlg.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_41localToLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_40localToLocal[] = "DM.localToLocal(self, Vec vl, Vec vlg, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_41localToLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vl = 0;
  struct PyPetscVecObject *__pyx_v_vlg = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("localToLocal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vl,&__pyx_n_s_vlg,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vl)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vlg)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("localToLocal", 0, 2, 3, 1); __PYX_ERR(40, 128, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "localToLocal") < 0)) __PYX_ERR(40, 128, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_vl = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_vlg = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("localToLocal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 128, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.localToLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vl), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vl", 0))) __PYX_ERR(40, 128, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vlg), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vlg", 0))) __PYX_ERR(40, 128, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_40localToLocal(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_vl, __pyx_v_vlg, __pyx_v_addv);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_40localToLocal(struct PyPetscDMObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vl, struct PyPetscVecObject *__pyx_v_vlg, PyObject *__pyx_v_addv) {
  InsertMode __pyx_v_im;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("localToLocal", 0);

  /* "PETSc/DM.pyx":129
 * 
 *     def localToLocal(self, Vec vl not None, Vec vlg not None, addv=None):
 *         cdef PetscInsertMode im = insertmode(addv)             # <<<<<<<<<<<<<<
 *         CHKERR( DMLocalToLocalBegin(self.dm, vl.vec, im, vlg.vec) )
 *         CHKERR( DMLocalToLocalEnd  (self.dm, vl.vec, im, vlg.vec) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(40, 129, __pyx_L1_error)
  __pyx_v_im = __pyx_t_1;

  /* "PETSc/DM.pyx":130
 *     def localToLocal(self, Vec vl not None, Vec vlg not None, addv=None):
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMLocalToLocalBegin(self.dm, vl.vec, im, vlg.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMLocalToLocalEnd  (self.dm, vl.vec, im, vlg.vec) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMLocalToLocalBegin(__pyx_v_self->dm, __pyx_v_vl->vec, __pyx_v_im, __pyx_v_vlg->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 130, __pyx_L1_error)

  /* "PETSc/DM.pyx":131
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMLocalToLocalBegin(self.dm, vl.vec, im, vlg.vec) )
 *         CHKERR( DMLocalToLocalEnd  (self.dm, vl.vec, im, vlg.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def getLGMap(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMLocalToLocalEnd(__pyx_v_self->dm, __pyx_v_vl->vec, __pyx_v_im, __pyx_v_vlg->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 131, __pyx_L1_error)

  /* "PETSc/DM.pyx":128
 *         CHKERR( DMLocalToGlobalEnd(self.dm, vl.vec, im, vg.vec) )
 * 
 *     def localToLocal(self, Vec vl not None, Vec vlg not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMLocalToLocalBegin(self.dm, vl.vec, im, vlg.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.localToLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":133
 *         CHKERR( DMLocalToLocalEnd  (self.dm, vl.vec, im, vlg.vec) )
 * 
 *     def getLGMap(self):             # <<<<<<<<<<<<<<
 *         cdef LGMap lgm = LGMap()
 *         CHKERR( DMGetLocalToGlobalMapping(self.dm, &lgm.lgm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_43getLGMap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_42getLGMap[] = "DM.getLGMap(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_43getLGMap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLGMap (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getLGMap", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getLGMap", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_42getLGMap(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_42getLGMap(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscLGMapObject *__pyx_v_lgm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getLGMap", 0);

  /* "PETSc/DM.pyx":134
 * 
 *     def getLGMap(self):
 *         cdef LGMap lgm = LGMap()             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetLocalToGlobalMapping(self.dm, &lgm.lgm) )
 *         PetscINCREF(lgm.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_LGMap), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_lgm = ((struct PyPetscLGMapObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":135
 *     def getLGMap(self):
 *         cdef LGMap lgm = LGMap()
 *         CHKERR( DMGetLocalToGlobalMapping(self.dm, &lgm.lgm) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(lgm.obj)
 *         return lgm
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetLocalToGlobalMapping(__pyx_v_self->dm, (&__pyx_v_lgm->lgm))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 135, __pyx_L1_error)

  /* "PETSc/DM.pyx":136
 *         cdef LGMap lgm = LGMap()
 *         CHKERR( DMGetLocalToGlobalMapping(self.dm, &lgm.lgm) )
 *         PetscINCREF(lgm.obj)             # <<<<<<<<<<<<<<
 *         return lgm
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_lgm->__pyx_base.obj);

  /* "PETSc/DM.pyx":137
 *         CHKERR( DMGetLocalToGlobalMapping(self.dm, &lgm.lgm) )
 *         PetscINCREF(lgm.obj)
 *         return lgm             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_lgm));
  __pyx_r = ((PyObject *)__pyx_v_lgm);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":133
 *         CHKERR( DMLocalToLocalEnd  (self.dm, vl.vec, im, vlg.vec) )
 * 
 *     def getLGMap(self):             # <<<<<<<<<<<<<<
 *         cdef LGMap lgm = LGMap()
 *         CHKERR( DMGetLocalToGlobalMapping(self.dm, &lgm.lgm) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getLGMap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lgm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":141
 *     #
 * 
 *     def getCoordinateDM(self):             # <<<<<<<<<<<<<<
 *         cdef DM cdm = type(self)()
 *         CHKERR( DMGetCoordinateDM(self.dm, &cdm.dm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_45getCoordinateDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_44getCoordinateDM[] = "DM.getCoordinateDM(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_45getCoordinateDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCoordinateDM (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getCoordinateDM", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getCoordinateDM", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_44getCoordinateDM(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_44getCoordinateDM(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscDMObject *__pyx_v_cdm = 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;
  __Pyx_RefNannySetupContext("getCoordinateDM", 0);

  /* "PETSc/DM.pyx":142
 * 
 *     def getCoordinateDM(self):
 *         cdef DM cdm = type(self)()             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetCoordinateDM(self.dm, &cdm.dm) )
 *         PetscINCREF(cdm.obj)
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __pyx_t_2 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 142, __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(40, 142, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(40, 142, __pyx_L1_error)
  __pyx_v_cdm = ((struct PyPetscDMObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":143
 *     def getCoordinateDM(self):
 *         cdef DM cdm = type(self)()
 *         CHKERR( DMGetCoordinateDM(self.dm, &cdm.dm) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(cdm.obj)
 *         return cdm
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetCoordinateDM(__pyx_v_self->dm, (&__pyx_v_cdm->dm))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(40, 143, __pyx_L1_error)

  /* "PETSc/DM.pyx":144
 *         cdef DM cdm = type(self)()
 *         CHKERR( DMGetCoordinateDM(self.dm, &cdm.dm) )
 *         PetscINCREF(cdm.obj)             # <<<<<<<<<<<<<<
 *         return cdm
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_cdm->__pyx_base.obj);

  /* "PETSc/DM.pyx":145
 *         CHKERR( DMGetCoordinateDM(self.dm, &cdm.dm) )
 *         PetscINCREF(cdm.obj)
 *         return cdm             # <<<<<<<<<<<<<<
 * 
 *     def getCoordinateSection(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_cdm));
  __pyx_r = ((PyObject *)__pyx_v_cdm);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":141
 *     #
 * 
 *     def getCoordinateDM(self):             # <<<<<<<<<<<<<<
 *         cdef DM cdm = type(self)()
 *         CHKERR( DMGetCoordinateDM(self.dm, &cdm.dm) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getCoordinateDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_cdm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":147
 *         return cdm
 * 
 *     def getCoordinateSection(self):             # <<<<<<<<<<<<<<
 *         cdef Section sec = Section()
 *         CHKERR( DMGetCoordinateSection(self.dm, &sec.sec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_47getCoordinateSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_46getCoordinateSection[] = "DM.getCoordinateSection(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_47getCoordinateSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCoordinateSection (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getCoordinateSection", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getCoordinateSection", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_46getCoordinateSection(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_46getCoordinateSection(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscSectionObject *__pyx_v_sec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getCoordinateSection", 0);

  /* "PETSc/DM.pyx":148
 * 
 *     def getCoordinateSection(self):
 *         cdef Section sec = Section()             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetCoordinateSection(self.dm, &sec.sec) )
 *         PetscINCREF(sec.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Section), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sec = ((struct PyPetscSectionObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":149
 *     def getCoordinateSection(self):
 *         cdef Section sec = Section()
 *         CHKERR( DMGetCoordinateSection(self.dm, &sec.sec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(sec.obj)
 *         return sec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetCoordinateSection(__pyx_v_self->dm, (&__pyx_v_sec->sec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 149, __pyx_L1_error)

  /* "PETSc/DM.pyx":150
 *         cdef Section sec = Section()
 *         CHKERR( DMGetCoordinateSection(self.dm, &sec.sec) )
 *         PetscINCREF(sec.obj)             # <<<<<<<<<<<<<<
 *         return sec
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_sec->__pyx_base.obj);

  /* "PETSc/DM.pyx":151
 *         CHKERR( DMGetCoordinateSection(self.dm, &sec.sec) )
 *         PetscINCREF(sec.obj)
 *         return sec             # <<<<<<<<<<<<<<
 * 
 *     def setCoordinates(self, Vec c not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_sec));
  __pyx_r = ((PyObject *)__pyx_v_sec);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":147
 *         return cdm
 * 
 *     def getCoordinateSection(self):             # <<<<<<<<<<<<<<
 *         cdef Section sec = Section()
 *         CHKERR( DMGetCoordinateSection(self.dm, &sec.sec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getCoordinateSection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":153
 *         return sec
 * 
 *     def setCoordinates(self, Vec c not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetCoordinates(self.dm, c.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_49setCoordinates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_48setCoordinates[] = "DM.setCoordinates(self, Vec c)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_49setCoordinates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_c = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCoordinates (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_c,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);
        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_c)) != 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, "setCoordinates") < 0)) __PYX_ERR(40, 153, __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_c = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCoordinates", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 153, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setCoordinates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_c), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "c", 0))) __PYX_ERR(40, 153, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_48setCoordinates(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_c);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_48setCoordinates(struct PyPetscDMObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setCoordinates", 0);

  /* "PETSc/DM.pyx":154
 * 
 *     def setCoordinates(self, Vec c not None):
 *         CHKERR( DMSetCoordinates(self.dm, c.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def getCoordinates(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetCoordinates(__pyx_v_self->dm, __pyx_v_c->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 154, __pyx_L1_error)

  /* "PETSc/DM.pyx":153
 *         return sec
 * 
 *     def setCoordinates(self, Vec c not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetCoordinates(self.dm, c.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setCoordinates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":156
 *         CHKERR( DMSetCoordinates(self.dm, c.vec) )
 * 
 *     def getCoordinates(self):             # <<<<<<<<<<<<<<
 *         cdef Vec c = Vec()
 *         CHKERR( DMGetCoordinates(self.dm, &c.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_51getCoordinates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_50getCoordinates[] = "DM.getCoordinates(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_51getCoordinates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCoordinates (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getCoordinates", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getCoordinates", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_50getCoordinates(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_50getCoordinates(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_c = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getCoordinates", 0);

  /* "PETSc/DM.pyx":157
 * 
 *     def getCoordinates(self):
 *         cdef Vec c = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetCoordinates(self.dm, &c.vec) )
 *         PetscINCREF(c.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_c = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":158
 *     def getCoordinates(self):
 *         cdef Vec c = Vec()
 *         CHKERR( DMGetCoordinates(self.dm, &c.vec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(c.obj)
 *         return c
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetCoordinates(__pyx_v_self->dm, (&__pyx_v_c->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 158, __pyx_L1_error)

  /* "PETSc/DM.pyx":159
 *         cdef Vec c = Vec()
 *         CHKERR( DMGetCoordinates(self.dm, &c.vec) )
 *         PetscINCREF(c.obj)             # <<<<<<<<<<<<<<
 *         return c
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_c->__pyx_base.obj);

  /* "PETSc/DM.pyx":160
 *         CHKERR( DMGetCoordinates(self.dm, &c.vec) )
 *         PetscINCREF(c.obj)
 *         return c             # <<<<<<<<<<<<<<
 * 
 *     def setCoordinatesLocal(self, Vec c not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_c));
  __pyx_r = ((PyObject *)__pyx_v_c);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":156
 *         CHKERR( DMSetCoordinates(self.dm, c.vec) )
 * 
 *     def getCoordinates(self):             # <<<<<<<<<<<<<<
 *         cdef Vec c = Vec()
 *         CHKERR( DMGetCoordinates(self.dm, &c.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getCoordinates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":162
 *         return c
 * 
 *     def setCoordinatesLocal(self, Vec c not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetCoordinatesLocal(self.dm, c.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_53setCoordinatesLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_52setCoordinatesLocal[] = "DM.setCoordinatesLocal(self, Vec c)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_53setCoordinatesLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_c = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCoordinatesLocal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_c,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);
        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_c)) != 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, "setCoordinatesLocal") < 0)) __PYX_ERR(40, 162, __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_c = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCoordinatesLocal", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 162, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setCoordinatesLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_c), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "c", 0))) __PYX_ERR(40, 162, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_52setCoordinatesLocal(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_c);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_52setCoordinatesLocal(struct PyPetscDMObject *__pyx_v_self, struct PyPetscVecObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setCoordinatesLocal", 0);

  /* "PETSc/DM.pyx":163
 * 
 *     def setCoordinatesLocal(self, Vec c not None):
 *         CHKERR( DMSetCoordinatesLocal(self.dm, c.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def getCoordinatesLocal(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetCoordinatesLocal(__pyx_v_self->dm, __pyx_v_c->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 163, __pyx_L1_error)

  /* "PETSc/DM.pyx":162
 *         return c
 * 
 *     def setCoordinatesLocal(self, Vec c not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetCoordinatesLocal(self.dm, c.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setCoordinatesLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":165
 *         CHKERR( DMSetCoordinatesLocal(self.dm, c.vec) )
 * 
 *     def getCoordinatesLocal(self):             # <<<<<<<<<<<<<<
 *         cdef Vec c = Vec()
 *         CHKERR( DMGetCoordinatesLocal(self.dm, &c.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_55getCoordinatesLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_54getCoordinatesLocal[] = "DM.getCoordinatesLocal(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_55getCoordinatesLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCoordinatesLocal (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getCoordinatesLocal", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getCoordinatesLocal", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_54getCoordinatesLocal(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_54getCoordinatesLocal(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_c = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getCoordinatesLocal", 0);

  /* "PETSc/DM.pyx":166
 * 
 *     def getCoordinatesLocal(self):
 *         cdef Vec c = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetCoordinatesLocal(self.dm, &c.vec) )
 *         PetscINCREF(c.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_c = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":167
 *     def getCoordinatesLocal(self):
 *         cdef Vec c = Vec()
 *         CHKERR( DMGetCoordinatesLocal(self.dm, &c.vec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(c.obj)
 *         return c
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetCoordinatesLocal(__pyx_v_self->dm, (&__pyx_v_c->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 167, __pyx_L1_error)

  /* "PETSc/DM.pyx":168
 *         cdef Vec c = Vec()
 *         CHKERR( DMGetCoordinatesLocal(self.dm, &c.vec) )
 *         PetscINCREF(c.obj)             # <<<<<<<<<<<<<<
 *         return c
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_c->__pyx_base.obj);

  /* "PETSc/DM.pyx":169
 *         CHKERR( DMGetCoordinatesLocal(self.dm, &c.vec) )
 *         PetscINCREF(c.obj)
 *         return c             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_c));
  __pyx_r = ((PyObject *)__pyx_v_c);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":165
 *         CHKERR( DMSetCoordinatesLocal(self.dm, c.vec) )
 * 
 *     def getCoordinatesLocal(self):             # <<<<<<<<<<<<<<
 *         cdef Vec c = Vec()
 *         CHKERR( DMGetCoordinatesLocal(self.dm, &c.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getCoordinatesLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":173
 *     #
 * 
 *     def setMatType(self, mat_type):             # <<<<<<<<<<<<<<
 *         """Set matrix type to be used by DM.createMat"""
 *         cdef PetscMatType mtype = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_57setMatType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_56setMatType[] = "DM.setMatType(self, mat_type)\nSet matrix type to be used by DM.createMat";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_57setMatType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mat_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMatType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat_type,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);
        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_mat_type)) != 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, "setMatType") < 0)) __PYX_ERR(40, 173, __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_mat_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMatType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 173, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setMatType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_56setMatType(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_mat_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_56setMatType(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_mat_type) {
  const char* __pyx_v_mtype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setMatType", 0);
  __Pyx_INCREF(__pyx_v_mat_type);

  /* "PETSc/DM.pyx":175
 *     def setMatType(self, mat_type):
 *         """Set matrix type to be used by DM.createMat"""
 *         cdef PetscMatType mtype = NULL             # <<<<<<<<<<<<<<
 *         mat_type = str2bytes(mat_type, &mtype)
 *         CHKERR( DMSetMatType(self.dm, mtype) )
 */
  __pyx_v_mtype = NULL;

  /* "PETSc/DM.pyx":176
 *         """Set matrix type to be used by DM.createMat"""
 *         cdef PetscMatType mtype = NULL
 *         mat_type = str2bytes(mat_type, &mtype)             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetMatType(self.dm, mtype) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_mat_type, (&__pyx_v_mtype)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mat_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":177
 *         cdef PetscMatType mtype = NULL
 *         mat_type = str2bytes(mat_type, &mtype)
 *         CHKERR( DMSetMatType(self.dm, mtype) )             # <<<<<<<<<<<<<<
 * 
 *     def createMat(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetMatType(__pyx_v_self->dm, __pyx_v_mtype)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 177, __pyx_L1_error)

  /* "PETSc/DM.pyx":173
 *     #
 * 
 *     def setMatType(self, mat_type):             # <<<<<<<<<<<<<<
 *         """Set matrix type to be used by DM.createMat"""
 *         cdef PetscMatType mtype = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setMatType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mat_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":179
 *         CHKERR( DMSetMatType(self.dm, mtype) )
 * 
 *     def createMat(self):             # <<<<<<<<<<<<<<
 *         cdef Mat mat = Mat()
 *         CHKERR( DMCreateMatrix(self.dm, &mat.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_59createMat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_58createMat[] = "DM.createMat(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_59createMat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createMat (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("createMat", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "createMat", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_58createMat(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_58createMat(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createMat", 0);

  /* "PETSc/DM.pyx":180
 * 
 *     def createMat(self):
 *         cdef Mat mat = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( DMCreateMatrix(self.dm, &mat.mat) )
 *         return mat
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":181
 *     def createMat(self):
 *         cdef Mat mat = Mat()
 *         CHKERR( DMCreateMatrix(self.dm, &mat.mat) )             # <<<<<<<<<<<<<<
 *         return mat
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCreateMatrix(__pyx_v_self->dm, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 181, __pyx_L1_error)

  /* "PETSc/DM.pyx":182
 *         cdef Mat mat = Mat()
 *         CHKERR( DMCreateMatrix(self.dm, &mat.mat) )
 *         return mat             # <<<<<<<<<<<<<<
 * 
 *     def createInterpolation(self, DM dm not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = ((PyObject *)__pyx_v_mat);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":179
 *         CHKERR( DMSetMatType(self.dm, mtype) )
 * 
 *     def createMat(self):             # <<<<<<<<<<<<<<
 *         cdef Mat mat = Mat()
 *         CHKERR( DMCreateMatrix(self.dm, &mat.mat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createMat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":184
 *         return mat
 * 
 *     def createInterpolation(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         cdef Mat A = Mat()
 *         cdef Vec scale = Vec()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_61createInterpolation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_60createInterpolation[] = "DM.createInterpolation(self, DM dm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_61createInterpolation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createInterpolation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dm,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);
        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_dm)) != 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, "createInterpolation") < 0)) __PYX_ERR(40, 184, __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_dm = ((struct PyPetscDMObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createInterpolation", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 184, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_8petsc4py_5PETSc_DM, 0, "dm", 0))) __PYX_ERR(40, 184, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_60createInterpolation(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_dm);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_60createInterpolation(struct PyPetscDMObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm) {
  struct PyPetscMatObject *__pyx_v_A = 0;
  struct PyPetscVecObject *__pyx_v_scale = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createInterpolation", 0);

  /* "PETSc/DM.pyx":185
 * 
 *     def createInterpolation(self, DM dm not None):
 *         cdef Mat A = Mat()             # <<<<<<<<<<<<<<
 *         cdef Vec scale = Vec()
 *         CHKERR( DMCreateInterpolation(self.dm, dm.dm,
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_A = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":186
 *     def createInterpolation(self, DM dm not None):
 *         cdef Mat A = Mat()
 *         cdef Vec scale = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( DMCreateInterpolation(self.dm, dm.dm,
 *                                    &A.mat, &scale.vec))
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_scale = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":187
 *         cdef Mat A = Mat()
 *         cdef Vec scale = Vec()
 *         CHKERR( DMCreateInterpolation(self.dm, dm.dm,             # <<<<<<<<<<<<<<
 *                                    &A.mat, &scale.vec))
 *         return(A, scale)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCreateInterpolation(__pyx_v_self->dm, __pyx_v_dm->dm, (&__pyx_v_A->mat), (&__pyx_v_scale->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 187, __pyx_L1_error)

  /* "PETSc/DM.pyx":189
 *         CHKERR( DMCreateInterpolation(self.dm, dm.dm,
 *                                    &A.mat, &scale.vec))
 *         return(A, scale)             # <<<<<<<<<<<<<<
 * 
 *     def createInjection(self, DM dm not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_A));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_A));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_A));
  __Pyx_INCREF(((PyObject *)__pyx_v_scale));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_scale));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_scale));
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":184
 *         return mat
 * 
 *     def createInterpolation(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         cdef Mat A = Mat()
 *         cdef Vec scale = Vec()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_A);
  __Pyx_XDECREF((PyObject *)__pyx_v_scale);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":191
 *         return(A, scale)
 * 
 *     def createInjection(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         cdef Mat inject = Mat()
 *         CHKERR( DMCreateInjection(self.dm, dm.dm, &inject.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_63createInjection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_62createInjection[] = "DM.createInjection(self, DM dm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_63createInjection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createInjection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dm,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);
        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_dm)) != 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, "createInjection") < 0)) __PYX_ERR(40, 191, __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_dm = ((struct PyPetscDMObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createInjection", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 191, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createInjection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_8petsc4py_5PETSc_DM, 0, "dm", 0))) __PYX_ERR(40, 191, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_62createInjection(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_dm);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_62createInjection(struct PyPetscDMObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm) {
  struct PyPetscMatObject *__pyx_v_inject = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createInjection", 0);

  /* "PETSc/DM.pyx":192
 * 
 *     def createInjection(self, DM dm not None):
 *         cdef Mat inject = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( DMCreateInjection(self.dm, dm.dm, &inject.mat) )
 *         return inject
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_inject = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":193
 *     def createInjection(self, DM dm not None):
 *         cdef Mat inject = Mat()
 *         CHKERR( DMCreateInjection(self.dm, dm.dm, &inject.mat) )             # <<<<<<<<<<<<<<
 *         return inject
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCreateInjection(__pyx_v_self->dm, __pyx_v_dm->dm, (&__pyx_v_inject->mat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 193, __pyx_L1_error)

  /* "PETSc/DM.pyx":194
 *         cdef Mat inject = Mat()
 *         CHKERR( DMCreateInjection(self.dm, dm.dm, &inject.mat) )
 *         return inject             # <<<<<<<<<<<<<<
 * 
 *     def createAggregates(self, DM dm not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_inject));
  __pyx_r = ((PyObject *)__pyx_v_inject);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":191
 *         return(A, scale)
 * 
 *     def createInjection(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         cdef Mat inject = Mat()
 *         CHKERR( DMCreateInjection(self.dm, dm.dm, &inject.mat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createInjection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_inject);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":196
 *         return inject
 * 
 *     def createAggregates(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         cdef Mat mat = Mat()
 *         CHKERR( DMCreateAggregates(self.dm, dm.dm, &mat.mat) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_65createAggregates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_64createAggregates[] = "DM.createAggregates(self, DM dm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_65createAggregates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createAggregates (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dm,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);
        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_dm)) != 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, "createAggregates") < 0)) __PYX_ERR(40, 196, __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_dm = ((struct PyPetscDMObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createAggregates", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 196, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createAggregates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_8petsc4py_5PETSc_DM, 0, "dm", 0))) __PYX_ERR(40, 196, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_64createAggregates(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_dm);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_64createAggregates(struct PyPetscDMObject *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createAggregates", 0);

  /* "PETSc/DM.pyx":197
 * 
 *     def createAggregates(self, DM dm not None):
 *         cdef Mat mat = Mat()             # <<<<<<<<<<<<<<
 *         CHKERR( DMCreateAggregates(self.dm, dm.dm, &mat.mat) )
 *         return mat
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mat = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":198
 *     def createAggregates(self, DM dm not None):
 *         cdef Mat mat = Mat()
 *         CHKERR( DMCreateAggregates(self.dm, dm.dm, &mat.mat) )             # <<<<<<<<<<<<<<
 *         return mat
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCreateAggregates(__pyx_v_self->dm, __pyx_v_dm->dm, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 198, __pyx_L1_error)

  /* "PETSc/DM.pyx":199
 *         cdef Mat mat = Mat()
 *         CHKERR( DMCreateAggregates(self.dm, dm.dm, &mat.mat) )
 *         return mat             # <<<<<<<<<<<<<<
 * 
 *     def convert(self, dm_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  __pyx_r = ((PyObject *)__pyx_v_mat);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":196
 *         return inject
 * 
 *     def createAggregates(self, DM dm not None):             # <<<<<<<<<<<<<<
 *         cdef Mat mat = Mat()
 *         CHKERR( DMCreateAggregates(self.dm, dm.dm, &mat.mat) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createAggregates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":201
 *         return mat
 * 
 *     def convert(self, dm_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         dm_type = str2bytes(dm_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_67convert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_66convert[] = "DM.convert(self, dm_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_67convert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dm_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dm_type,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);
        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_dm_type)) != 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, "convert") < 0)) __PYX_ERR(40, 201, __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_dm_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("convert", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 201, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.convert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_66convert(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_dm_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_66convert(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_dm_type) {
  const char *__pyx_v_cval;
  DM __pyx_v_newdm;
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("convert", 0);
  __Pyx_INCREF(__pyx_v_dm_type);

  /* "PETSc/DM.pyx":202
 * 
 *     def convert(self, dm_type):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         dm_type = str2bytes(dm_type, &cval)
 *         cdef PetscDM newdm = NULL
 */
  __pyx_v_cval = NULL;

  /* "PETSc/DM.pyx":203
 *     def convert(self, dm_type):
 *         cdef const_char *cval = NULL
 *         dm_type = str2bytes(dm_type, &cval)             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMConvert(self.dm, cval, &newdm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_dm_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dm_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":204
 *         cdef const_char *cval = NULL
 *         dm_type = str2bytes(dm_type, &cval)
 *         cdef PetscDM newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMConvert(self.dm, cval, &newdm) )
 *         cdef DM dm = <DM>subtype_DM(newdm)()
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DM.pyx":205
 *         dm_type = str2bytes(dm_type, &cval)
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMConvert(self.dm, cval, &newdm) )             # <<<<<<<<<<<<<<
 *         cdef DM dm = <DM>subtype_DM(newdm)()
 *         dm.dm = newdm
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMConvert(__pyx_v_self->dm, __pyx_v_cval, (&__pyx_v_newdm))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 205, __pyx_L1_error)

  /* "PETSc/DM.pyx":206
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMConvert(self.dm, cval, &newdm) )
 *         cdef DM dm = <DM>subtype_DM(newdm)()             # <<<<<<<<<<<<<<
 *         dm.dm = newdm
 *         return dm
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_newdm)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_dm = ((struct PyPetscDMObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":207
 *         CHKERR( DMConvert(self.dm, cval, &newdm) )
 *         cdef DM dm = <DM>subtype_DM(newdm)()
 *         dm.dm = newdm             # <<<<<<<<<<<<<<
 *         return dm
 * 
 */
  __pyx_v_dm->dm = __pyx_v_newdm;

  /* "PETSc/DM.pyx":208
 *         cdef DM dm = <DM>subtype_DM(newdm)()
 *         dm.dm = newdm
 *         return dm             # <<<<<<<<<<<<<<
 * 
 *     def refine(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dm));
  __pyx_r = ((PyObject *)__pyx_v_dm);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":201
 *         return mat
 * 
 *     def convert(self, dm_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         dm_type = str2bytes(dm_type, &cval)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.convert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dm);
  __Pyx_XDECREF(__pyx_v_dm_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":210
 *         return dm
 * 
 *     def refine(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm dmcomm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &dmcomm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_69refine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_68refine[] = "DM.refine(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_69refine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refine (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "refine") < 0)) __PYX_ERR(40, 210, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refine", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 210, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.refine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_68refine(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_68refine(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_dmcomm;
  DM __pyx_v_newdm;
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  MPI_Comm __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("refine", 0);

  /* "PETSc/DM.pyx":211
 * 
 *     def refine(self, comm=None):
 *         cdef MPI_Comm dmcomm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &dmcomm) )
 *         dmcomm = def_Comm(comm, dmcomm)
 */
  __pyx_v_dmcomm = MPI_COMM_NULL;

  /* "PETSc/DM.pyx":212
 *     def refine(self, comm=None):
 *         cdef MPI_Comm dmcomm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &dmcomm) )             # <<<<<<<<<<<<<<
 *         dmcomm = def_Comm(comm, dmcomm)
 *         cdef PetscDM newdm = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetComm(((PetscObject)__pyx_v_self->dm), (&__pyx_v_dmcomm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 212, __pyx_L1_error)

  /* "PETSc/DM.pyx":213
 *         cdef MPI_Comm dmcomm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &dmcomm) )
 *         dmcomm = def_Comm(comm, dmcomm)             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMRefine(self.dm, dmcomm, &newdm) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_dmcomm); if (unlikely(PyErr_Occurred())) __PYX_ERR(40, 213, __pyx_L1_error)
  __pyx_v_dmcomm = __pyx_t_2;

  /* "PETSc/DM.pyx":214
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &dmcomm) )
 *         dmcomm = def_Comm(comm, dmcomm)
 *         cdef PetscDM newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMRefine(self.dm, dmcomm, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DM.pyx":215
 *         dmcomm = def_Comm(comm, dmcomm)
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMRefine(self.dm, dmcomm, &newdm) )             # <<<<<<<<<<<<<<
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMRefine(__pyx_v_self->dm, __pyx_v_dmcomm, (&__pyx_v_newdm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 215, __pyx_L1_error)

  /* "PETSc/DM.pyx":216
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMRefine(self.dm, dmcomm, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()             # <<<<<<<<<<<<<<
 *         dm.dm = newdm
 *         return dm
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_newdm)); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(40, 216, __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_8petsc4py_5PETSc_DM))))) __PYX_ERR(40, 216, __pyx_L1_error)
  __pyx_v_dm = ((struct PyPetscDMObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/DM.pyx":217
 *         CHKERR( DMRefine(self.dm, dmcomm, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm             # <<<<<<<<<<<<<<
 *         return dm
 * 
 */
  __pyx_v_dm->dm = __pyx_v_newdm;

  /* "PETSc/DM.pyx":218
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm
 *         return dm             # <<<<<<<<<<<<<<
 * 
 *     def coarsen(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dm));
  __pyx_r = ((PyObject *)__pyx_v_dm);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":210
 *         return dm
 * 
 *     def refine(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm dmcomm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &dmcomm) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.refine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":220
 *         return dm
 * 
 *     def coarsen(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm dmcomm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &dmcomm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_71coarsen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_70coarsen[] = "DM.coarsen(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_71coarsen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coarsen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "coarsen") < 0)) __PYX_ERR(40, 220, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("coarsen", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 220, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.coarsen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_70coarsen(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_70coarsen(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_dmcomm;
  DM __pyx_v_newdm;
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  MPI_Comm __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("coarsen", 0);

  /* "PETSc/DM.pyx":221
 * 
 *     def coarsen(self, comm=None):
 *         cdef MPI_Comm dmcomm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &dmcomm) )
 *         dmcomm = def_Comm(comm, dmcomm)
 */
  __pyx_v_dmcomm = MPI_COMM_NULL;

  /* "PETSc/DM.pyx":222
 *     def coarsen(self, comm=None):
 *         cdef MPI_Comm dmcomm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &dmcomm) )             # <<<<<<<<<<<<<<
 *         dmcomm = def_Comm(comm, dmcomm)
 *         cdef PetscDM newdm = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetComm(((PetscObject)__pyx_v_self->dm), (&__pyx_v_dmcomm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 222, __pyx_L1_error)

  /* "PETSc/DM.pyx":223
 *         cdef MPI_Comm dmcomm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &dmcomm) )
 *         dmcomm = def_Comm(comm, dmcomm)             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMCoarsen(self.dm, dmcomm, &newdm) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_dmcomm); if (unlikely(PyErr_Occurred())) __PYX_ERR(40, 223, __pyx_L1_error)
  __pyx_v_dmcomm = __pyx_t_2;

  /* "PETSc/DM.pyx":224
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &dmcomm) )
 *         dmcomm = def_Comm(comm, dmcomm)
 *         cdef PetscDM newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMCoarsen(self.dm, dmcomm, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DM.pyx":225
 *         dmcomm = def_Comm(comm, dmcomm)
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMCoarsen(self.dm, dmcomm, &newdm) )             # <<<<<<<<<<<<<<
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCoarsen(__pyx_v_self->dm, __pyx_v_dmcomm, (&__pyx_v_newdm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 225, __pyx_L1_error)

  /* "PETSc/DM.pyx":226
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMCoarsen(self.dm, dmcomm, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()             # <<<<<<<<<<<<<<
 *         dm.dm = newdm
 *         return dm
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_newdm)); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(40, 226, __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_8petsc4py_5PETSc_DM))))) __PYX_ERR(40, 226, __pyx_L1_error)
  __pyx_v_dm = ((struct PyPetscDMObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/DM.pyx":227
 *         CHKERR( DMCoarsen(self.dm, dmcomm, &newdm) )
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm             # <<<<<<<<<<<<<<
 *         return dm
 * 
 */
  __pyx_v_dm->dm = __pyx_v_newdm;

  /* "PETSc/DM.pyx":228
 *         cdef DM dm = subtype_DM(newdm)()
 *         dm.dm = newdm
 *         return dm             # <<<<<<<<<<<<<<
 * 
 *     def refineHierarchy(self, nlevels):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dm));
  __pyx_r = ((PyObject *)__pyx_v_dm);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":220
 *         return dm
 * 
 *     def coarsen(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm dmcomm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &dmcomm) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.coarsen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":230
 *         return dm
 * 
 *     def refineHierarchy(self, nlevels):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, n = asInt(nlevels)
 *         cdef PetscDM *newdmf = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_73refineHierarchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_72refineHierarchy[] = "DM.refineHierarchy(self, nlevels)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_73refineHierarchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nlevels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refineHierarchy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nlevels,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);
        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_nlevels)) != 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, "refineHierarchy") < 0)) __PYX_ERR(40, 230, __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_nlevels = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refineHierarchy", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 230, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.refineHierarchy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_72refineHierarchy(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_nlevels);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_72refineHierarchy(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_nlevels) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_n;
  DM *__pyx_v_newdmf;
  CYTHON_UNUSED PyObject *__pyx_v_tmp = 0;
  struct PyPetscDMObject *__pyx_v_dmf = 0;
  PyObject *__pyx_v_hierarchy = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("refineHierarchy", 0);

  /* "PETSc/DM.pyx":231
 * 
 *     def refineHierarchy(self, nlevels):
 *         cdef PetscInt i, n = asInt(nlevels)             # <<<<<<<<<<<<<<
 *         cdef PetscDM *newdmf = NULL
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&newdmf)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_nlevels); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(40, 231, __pyx_L1_error)
  __pyx_v_n = __pyx_t_1;

  /* "PETSc/DM.pyx":232
 *     def refineHierarchy(self, nlevels):
 *         cdef PetscInt i, n = asInt(nlevels)
 *         cdef PetscDM *newdmf = NULL             # <<<<<<<<<<<<<<
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&newdmf)
 *         CHKERR( DMRefineHierarchy(self.dm, n, newdmf) )
 */
  __pyx_v_newdmf = NULL;

  /* "PETSc/DM.pyx":233
 *         cdef PetscInt i, n = asInt(nlevels)
 *         cdef PetscDM *newdmf = NULL
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&newdmf)             # <<<<<<<<<<<<<<
 *         CHKERR( DMRefineHierarchy(self.dm, n, newdmf) )
 *         cdef DM dmf = None
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_2, NULL, ((void **)(&__pyx_v_newdmf)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_tmp = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/DM.pyx":234
 *         cdef PetscDM *newdmf = NULL
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&newdmf)
 *         CHKERR( DMRefineHierarchy(self.dm, n, newdmf) )             # <<<<<<<<<<<<<<
 *         cdef DM dmf = None
 *         cdef list hierarchy = []
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMRefineHierarchy(__pyx_v_self->dm, __pyx_v_n, __pyx_v_newdmf)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(40, 234, __pyx_L1_error)

  /* "PETSc/DM.pyx":235
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&newdmf)
 *         CHKERR( DMRefineHierarchy(self.dm, n, newdmf) )
 *         cdef DM dmf = None             # <<<<<<<<<<<<<<
 *         cdef list hierarchy = []
 *         for i from 0 <= i < n:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_dmf = ((struct PyPetscDMObject *)Py_None);

  /* "PETSc/DM.pyx":236
 *         CHKERR( DMRefineHierarchy(self.dm, n, newdmf) )
 *         cdef DM dmf = None
 *         cdef list hierarchy = []             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n:
 *             dmf = subtype_DM(newdmf[i])()
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_hierarchy = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/DM.pyx":237
 *         cdef DM dmf = None
 *         cdef list hierarchy = []
 *         for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *             dmf = subtype_DM(newdmf[i])()
 *             dmf.dm = newdmf[i]
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "PETSc/DM.pyx":238
 *         cdef list hierarchy = []
 *         for i from 0 <= i < n:
 *             dmf = subtype_DM(newdmf[i])()             # <<<<<<<<<<<<<<
 *             dmf.dm = newdmf[i]
 *             hierarchy.append(dmf)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM((__pyx_v_newdmf[__pyx_v_i]))); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(40, 238, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_dmf, ((struct PyPetscDMObject *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "PETSc/DM.pyx":239
 *         for i from 0 <= i < n:
 *             dmf = subtype_DM(newdmf[i])()
 *             dmf.dm = newdmf[i]             # <<<<<<<<<<<<<<
 *             hierarchy.append(dmf)
 *         return hierarchy
 */
    __pyx_v_dmf->dm = (__pyx_v_newdmf[__pyx_v_i]);

    /* "PETSc/DM.pyx":240
 *             dmf = subtype_DM(newdmf[i])()
 *             dmf.dm = newdmf[i]
 *             hierarchy.append(dmf)             # <<<<<<<<<<<<<<
 *         return hierarchy
 * 
 */
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_hierarchy, ((PyObject *)__pyx_v_dmf)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(40, 240, __pyx_L1_error)
  }

  /* "PETSc/DM.pyx":241
 *             dmf.dm = newdmf[i]
 *             hierarchy.append(dmf)
 *         return hierarchy             # <<<<<<<<<<<<<<
 * 
 *     def coarsenHierarchy(self, nlevels):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_hierarchy);
  __pyx_r = __pyx_v_hierarchy;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":230
 *         return dm
 * 
 *     def refineHierarchy(self, nlevels):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, n = asInt(nlevels)
 *         cdef PetscDM *newdmf = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.refineHierarchy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp);
  __Pyx_XDECREF((PyObject *)__pyx_v_dmf);
  __Pyx_XDECREF(__pyx_v_hierarchy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":243
 *         return hierarchy
 * 
 *     def coarsenHierarchy(self, nlevels):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, n = asInt(nlevels)
 *         cdef PetscDM *newdmc = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_75coarsenHierarchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_74coarsenHierarchy[] = "DM.coarsenHierarchy(self, nlevels)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_75coarsenHierarchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nlevels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coarsenHierarchy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nlevels,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);
        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_nlevels)) != 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, "coarsenHierarchy") < 0)) __PYX_ERR(40, 243, __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_nlevels = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("coarsenHierarchy", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 243, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.coarsenHierarchy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_74coarsenHierarchy(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_nlevels);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_74coarsenHierarchy(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_nlevels) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_n;
  DM *__pyx_v_newdmc;
  CYTHON_UNUSED PyObject *__pyx_v_tmp = 0;
  struct PyPetscDMObject *__pyx_v_dmc = 0;
  PyObject *__pyx_v_hierarchy = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("coarsenHierarchy", 0);

  /* "PETSc/DM.pyx":244
 * 
 *     def coarsenHierarchy(self, nlevels):
 *         cdef PetscInt i, n = asInt(nlevels)             # <<<<<<<<<<<<<<
 *         cdef PetscDM *newdmc = NULL
 *         cdef object tmp = oarray_p(empty_p(n),NULL, <void**>&newdmc)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_nlevels); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(40, 244, __pyx_L1_error)
  __pyx_v_n = __pyx_t_1;

  /* "PETSc/DM.pyx":245
 *     def coarsenHierarchy(self, nlevels):
 *         cdef PetscInt i, n = asInt(nlevels)
 *         cdef PetscDM *newdmc = NULL             # <<<<<<<<<<<<<<
 *         cdef object tmp = oarray_p(empty_p(n),NULL, <void**>&newdmc)
 *         CHKERR( DMCoarsenHierarchy(self.dm, n, newdmc) )
 */
  __pyx_v_newdmc = NULL;

  /* "PETSc/DM.pyx":246
 *         cdef PetscInt i, n = asInt(nlevels)
 *         cdef PetscDM *newdmc = NULL
 *         cdef object tmp = oarray_p(empty_p(n),NULL, <void**>&newdmc)             # <<<<<<<<<<<<<<
 *         CHKERR( DMCoarsenHierarchy(self.dm, n, newdmc) )
 *         cdef DM dmc = None
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_2, NULL, ((void **)(&__pyx_v_newdmc)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_tmp = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/DM.pyx":247
 *         cdef PetscDM *newdmc = NULL
 *         cdef object tmp = oarray_p(empty_p(n),NULL, <void**>&newdmc)
 *         CHKERR( DMCoarsenHierarchy(self.dm, n, newdmc) )             # <<<<<<<<<<<<<<
 *         cdef DM dmc = None
 *         cdef list hierarchy = []
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCoarsenHierarchy(__pyx_v_self->dm, __pyx_v_n, __pyx_v_newdmc)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(40, 247, __pyx_L1_error)

  /* "PETSc/DM.pyx":248
 *         cdef object tmp = oarray_p(empty_p(n),NULL, <void**>&newdmc)
 *         CHKERR( DMCoarsenHierarchy(self.dm, n, newdmc) )
 *         cdef DM dmc = None             # <<<<<<<<<<<<<<
 *         cdef list hierarchy = []
 *         for i from 0 <= i < n:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_dmc = ((struct PyPetscDMObject *)Py_None);

  /* "PETSc/DM.pyx":249
 *         CHKERR( DMCoarsenHierarchy(self.dm, n, newdmc) )
 *         cdef DM dmc = None
 *         cdef list hierarchy = []             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n:
 *             dmc = subtype_DM(newdmc[i])()
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_hierarchy = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/DM.pyx":250
 *         cdef DM dmc = None
 *         cdef list hierarchy = []
 *         for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *             dmc = subtype_DM(newdmc[i])()
 *             dmc.dm = newdmc[i]
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "PETSc/DM.pyx":251
 *         cdef list hierarchy = []
 *         for i from 0 <= i < n:
 *             dmc = subtype_DM(newdmc[i])()             # <<<<<<<<<<<<<<
 *             dmc.dm = newdmc[i]
 *             hierarchy.append(dmc)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM((__pyx_v_newdmc[__pyx_v_i]))); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(40, 251, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_dmc, ((struct PyPetscDMObject *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "PETSc/DM.pyx":252
 *         for i from 0 <= i < n:
 *             dmc = subtype_DM(newdmc[i])()
 *             dmc.dm = newdmc[i]             # <<<<<<<<<<<<<<
 *             hierarchy.append(dmc)
 *         return hierarchy
 */
    __pyx_v_dmc->dm = (__pyx_v_newdmc[__pyx_v_i]);

    /* "PETSc/DM.pyx":253
 *             dmc = subtype_DM(newdmc[i])()
 *             dmc.dm = newdmc[i]
 *             hierarchy.append(dmc)             # <<<<<<<<<<<<<<
 *         return hierarchy
 * 
 */
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_hierarchy, ((PyObject *)__pyx_v_dmc)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(40, 253, __pyx_L1_error)
  }

  /* "PETSc/DM.pyx":254
 *             dmc.dm = newdmc[i]
 *             hierarchy.append(dmc)
 *         return hierarchy             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_hierarchy);
  __pyx_r = __pyx_v_hierarchy;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":243
 *         return hierarchy
 * 
 *     def coarsenHierarchy(self, nlevels):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, n = asInt(nlevels)
 *         cdef PetscDM *newdmc = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.coarsenHierarchy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp);
  __Pyx_XDECREF((PyObject *)__pyx_v_dmc);
  __Pyx_XDECREF(__pyx_v_hierarchy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":258
 *     #
 * 
 *     def setDefaultSection(self, Section sec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetDefaultSection(self.dm, sec.sec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_77setDefaultSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_76setDefaultSection[] = "DM.setDefaultSection(self, Section sec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_77setDefaultSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscSectionObject *__pyx_v_sec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDefaultSection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sec,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);
        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_sec)) != 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, "setDefaultSection") < 0)) __PYX_ERR(40, 258, __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_sec = ((struct PyPetscSectionObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDefaultSection", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 258, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setDefaultSection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sec), __pyx_ptype_8petsc4py_5PETSc_Section, 0, "sec", 0))) __PYX_ERR(40, 258, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_76setDefaultSection(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_sec);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_76setDefaultSection(struct PyPetscDMObject *__pyx_v_self, struct PyPetscSectionObject *__pyx_v_sec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setDefaultSection", 0);

  /* "PETSc/DM.pyx":259
 * 
 *     def setDefaultSection(self, Section sec not None):
 *         CHKERR( DMSetDefaultSection(self.dm, sec.sec) )             # <<<<<<<<<<<<<<
 * 
 *     def getDefaultSection(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetDefaultSection(__pyx_v_self->dm, __pyx_v_sec->sec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 259, __pyx_L1_error)

  /* "PETSc/DM.pyx":258
 *     #
 * 
 *     def setDefaultSection(self, Section sec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetDefaultSection(self.dm, sec.sec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setDefaultSection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":261
 *         CHKERR( DMSetDefaultSection(self.dm, sec.sec) )
 * 
 *     def getDefaultSection(self):             # <<<<<<<<<<<<<<
 *         cdef Section sec = Section()
 *         CHKERR( DMGetDefaultSection(self.dm, &sec.sec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_79getDefaultSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_78getDefaultSection[] = "DM.getDefaultSection(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_79getDefaultSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDefaultSection (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDefaultSection", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDefaultSection", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_78getDefaultSection(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_78getDefaultSection(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscSectionObject *__pyx_v_sec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getDefaultSection", 0);

  /* "PETSc/DM.pyx":262
 * 
 *     def getDefaultSection(self):
 *         cdef Section sec = Section()             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetDefaultSection(self.dm, &sec.sec) )
 *         PetscINCREF(sec.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Section), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sec = ((struct PyPetscSectionObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":263
 *     def getDefaultSection(self):
 *         cdef Section sec = Section()
 *         CHKERR( DMGetDefaultSection(self.dm, &sec.sec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(sec.obj)
 *         return sec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetDefaultSection(__pyx_v_self->dm, (&__pyx_v_sec->sec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 263, __pyx_L1_error)

  /* "PETSc/DM.pyx":264
 *         cdef Section sec = Section()
 *         CHKERR( DMGetDefaultSection(self.dm, &sec.sec) )
 *         PetscINCREF(sec.obj)             # <<<<<<<<<<<<<<
 *         return sec
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_sec->__pyx_base.obj);

  /* "PETSc/DM.pyx":265
 *         CHKERR( DMGetDefaultSection(self.dm, &sec.sec) )
 *         PetscINCREF(sec.obj)
 *         return sec             # <<<<<<<<<<<<<<
 * 
 *     def setDefaultGlobalSection(self, Section sec not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_sec));
  __pyx_r = ((PyObject *)__pyx_v_sec);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":261
 *         CHKERR( DMSetDefaultSection(self.dm, sec.sec) )
 * 
 *     def getDefaultSection(self):             # <<<<<<<<<<<<<<
 *         cdef Section sec = Section()
 *         CHKERR( DMGetDefaultSection(self.dm, &sec.sec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getDefaultSection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":267
 *         return sec
 * 
 *     def setDefaultGlobalSection(self, Section sec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetDefaultGlobalSection(self.dm, sec.sec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_81setDefaultGlobalSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_80setDefaultGlobalSection[] = "DM.setDefaultGlobalSection(self, Section sec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_81setDefaultGlobalSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscSectionObject *__pyx_v_sec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDefaultGlobalSection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sec,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);
        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_sec)) != 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, "setDefaultGlobalSection") < 0)) __PYX_ERR(40, 267, __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_sec = ((struct PyPetscSectionObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDefaultGlobalSection", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 267, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setDefaultGlobalSection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sec), __pyx_ptype_8petsc4py_5PETSc_Section, 0, "sec", 0))) __PYX_ERR(40, 267, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_80setDefaultGlobalSection(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_sec);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_80setDefaultGlobalSection(struct PyPetscDMObject *__pyx_v_self, struct PyPetscSectionObject *__pyx_v_sec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setDefaultGlobalSection", 0);

  /* "PETSc/DM.pyx":268
 * 
 *     def setDefaultGlobalSection(self, Section sec not None):
 *         CHKERR( DMSetDefaultGlobalSection(self.dm, sec.sec) )             # <<<<<<<<<<<<<<
 * 
 *     def getDefaultGlobalSection(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetDefaultGlobalSection(__pyx_v_self->dm, __pyx_v_sec->sec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 268, __pyx_L1_error)

  /* "PETSc/DM.pyx":267
 *         return sec
 * 
 *     def setDefaultGlobalSection(self, Section sec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetDefaultGlobalSection(self.dm, sec.sec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setDefaultGlobalSection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":270
 *         CHKERR( DMSetDefaultGlobalSection(self.dm, sec.sec) )
 * 
 *     def getDefaultGlobalSection(self):             # <<<<<<<<<<<<<<
 *         cdef Section sec = Section()
 *         CHKERR( DMGetDefaultGlobalSection(self.dm, &sec.sec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_83getDefaultGlobalSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_82getDefaultGlobalSection[] = "DM.getDefaultGlobalSection(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_83getDefaultGlobalSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDefaultGlobalSection (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDefaultGlobalSection", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDefaultGlobalSection", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_82getDefaultGlobalSection(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_82getDefaultGlobalSection(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscSectionObject *__pyx_v_sec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getDefaultGlobalSection", 0);

  /* "PETSc/DM.pyx":271
 * 
 *     def getDefaultGlobalSection(self):
 *         cdef Section sec = Section()             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetDefaultGlobalSection(self.dm, &sec.sec) )
 *         PetscINCREF(sec.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Section), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sec = ((struct PyPetscSectionObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":272
 *     def getDefaultGlobalSection(self):
 *         cdef Section sec = Section()
 *         CHKERR( DMGetDefaultGlobalSection(self.dm, &sec.sec) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(sec.obj)
 *         return sec
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetDefaultGlobalSection(__pyx_v_self->dm, (&__pyx_v_sec->sec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 272, __pyx_L1_error)

  /* "PETSc/DM.pyx":273
 *         cdef Section sec = Section()
 *         CHKERR( DMGetDefaultGlobalSection(self.dm, &sec.sec) )
 *         PetscINCREF(sec.obj)             # <<<<<<<<<<<<<<
 *         return sec
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_sec->__pyx_base.obj);

  /* "PETSc/DM.pyx":274
 *         CHKERR( DMGetDefaultGlobalSection(self.dm, &sec.sec) )
 *         PetscINCREF(sec.obj)
 *         return sec             # <<<<<<<<<<<<<<
 * 
 *     def createDefaultSF(self, Section localsec not None, Section globalsec not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_sec));
  __pyx_r = ((PyObject *)__pyx_v_sec);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":270
 *         CHKERR( DMSetDefaultGlobalSection(self.dm, sec.sec) )
 * 
 *     def getDefaultGlobalSection(self):             # <<<<<<<<<<<<<<
 *         cdef Section sec = Section()
 *         CHKERR( DMGetDefaultGlobalSection(self.dm, &sec.sec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getDefaultGlobalSection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":276
 *         return sec
 * 
 *     def createDefaultSF(self, Section localsec not None, Section globalsec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMCreateDefaultSF(self.dm, localsec.sec, globalsec.sec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_85createDefaultSF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_84createDefaultSF[] = "DM.createDefaultSF(self, Section localsec, Section globalsec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_85createDefaultSF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscSectionObject *__pyx_v_localsec = 0;
  struct PyPetscSectionObject *__pyx_v_globalsec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createDefaultSF (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_localsec,&__pyx_n_s_globalsec,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_localsec)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_globalsec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createDefaultSF", 1, 2, 2, 1); __PYX_ERR(40, 276, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createDefaultSF") < 0)) __PYX_ERR(40, 276, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_localsec = ((struct PyPetscSectionObject *)values[0]);
    __pyx_v_globalsec = ((struct PyPetscSectionObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createDefaultSF", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 276, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createDefaultSF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_localsec), __pyx_ptype_8petsc4py_5PETSc_Section, 0, "localsec", 0))) __PYX_ERR(40, 276, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_globalsec), __pyx_ptype_8petsc4py_5PETSc_Section, 0, "globalsec", 0))) __PYX_ERR(40, 276, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_84createDefaultSF(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_localsec, __pyx_v_globalsec);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_84createDefaultSF(struct PyPetscDMObject *__pyx_v_self, struct PyPetscSectionObject *__pyx_v_localsec, struct PyPetscSectionObject *__pyx_v_globalsec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("createDefaultSF", 0);

  /* "PETSc/DM.pyx":277
 * 
 *     def createDefaultSF(self, Section localsec not None, Section globalsec not None):
 *         CHKERR( DMCreateDefaultSF(self.dm, localsec.sec, globalsec.sec) )             # <<<<<<<<<<<<<<
 * 
 *     def getDefaultSF(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCreateDefaultSF(__pyx_v_self->dm, __pyx_v_localsec->sec, __pyx_v_globalsec->sec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 277, __pyx_L1_error)

  /* "PETSc/DM.pyx":276
 *         return sec
 * 
 *     def createDefaultSF(self, Section localsec not None, Section globalsec not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMCreateDefaultSF(self.dm, localsec.sec, globalsec.sec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createDefaultSF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":279
 *         CHKERR( DMCreateDefaultSF(self.dm, localsec.sec, globalsec.sec) )
 * 
 *     def getDefaultSF(self):             # <<<<<<<<<<<<<<
 *         cdef SF sf = SF()
 *         CHKERR( DMGetDefaultSF(self.dm, &sf.sf) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_87getDefaultSF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_86getDefaultSF[] = "DM.getDefaultSF(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_87getDefaultSF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDefaultSF (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDefaultSF", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDefaultSF", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_86getDefaultSF(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_86getDefaultSF(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscSFObject *__pyx_v_sf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getDefaultSF", 0);

  /* "PETSc/DM.pyx":280
 * 
 *     def getDefaultSF(self):
 *         cdef SF sf = SF()             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetDefaultSF(self.dm, &sf.sf) )
 *         PetscINCREF(sf.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SF), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sf = ((struct PyPetscSFObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":281
 *     def getDefaultSF(self):
 *         cdef SF sf = SF()
 *         CHKERR( DMGetDefaultSF(self.dm, &sf.sf) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(sf.obj)
 *         return sf
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetDefaultSF(__pyx_v_self->dm, (&__pyx_v_sf->sf))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 281, __pyx_L1_error)

  /* "PETSc/DM.pyx":282
 *         cdef SF sf = SF()
 *         CHKERR( DMGetDefaultSF(self.dm, &sf.sf) )
 *         PetscINCREF(sf.obj)             # <<<<<<<<<<<<<<
 *         return sf
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_sf->__pyx_base.obj);

  /* "PETSc/DM.pyx":283
 *         CHKERR( DMGetDefaultSF(self.dm, &sf.sf) )
 *         PetscINCREF(sf.obj)
 *         return sf             # <<<<<<<<<<<<<<
 * 
 *     def getPointSF(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_sf));
  __pyx_r = ((PyObject *)__pyx_v_sf);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":279
 *         CHKERR( DMCreateDefaultSF(self.dm, localsec.sec, globalsec.sec) )
 * 
 *     def getDefaultSF(self):             # <<<<<<<<<<<<<<
 *         cdef SF sf = SF()
 *         CHKERR( DMGetDefaultSF(self.dm, &sf.sf) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getDefaultSF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":285
 *         return sf
 * 
 *     def getPointSF(self):             # <<<<<<<<<<<<<<
 *         cdef SF sf = SF()
 *         CHKERR( DMGetPointSF(self.dm, &sf.sf) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_89getPointSF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_88getPointSF[] = "DM.getPointSF(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_89getPointSF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPointSF (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getPointSF", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getPointSF", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_88getPointSF(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_88getPointSF(struct PyPetscDMObject *__pyx_v_self) {
  struct PyPetscSFObject *__pyx_v_sf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getPointSF", 0);

  /* "PETSc/DM.pyx":286
 * 
 *     def getPointSF(self):
 *         cdef SF sf = SF()             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetPointSF(self.dm, &sf.sf) )
 *         PetscINCREF(sf.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SF), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sf = ((struct PyPetscSFObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":287
 *     def getPointSF(self):
 *         cdef SF sf = SF()
 *         CHKERR( DMGetPointSF(self.dm, &sf.sf) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(sf.obj)
 *         return sf
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetPointSF(__pyx_v_self->dm, (&__pyx_v_sf->sf))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 287, __pyx_L1_error)

  /* "PETSc/DM.pyx":288
 *         cdef SF sf = SF()
 *         CHKERR( DMGetPointSF(self.dm, &sf.sf) )
 *         PetscINCREF(sf.obj)             # <<<<<<<<<<<<<<
 *         return sf
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_sf->__pyx_base.obj);

  /* "PETSc/DM.pyx":289
 *         CHKERR( DMGetPointSF(self.dm, &sf.sf) )
 *         PetscINCREF(sf.obj)
 *         return sf             # <<<<<<<<<<<<<<
 * 
 *     def setPointSF(self, SF sf not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_sf));
  __pyx_r = ((PyObject *)__pyx_v_sf);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":285
 *         return sf
 * 
 *     def getPointSF(self):             # <<<<<<<<<<<<<<
 *         cdef SF sf = SF()
 *         CHKERR( DMGetPointSF(self.dm, &sf.sf) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getPointSF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":291
 *         return sf
 * 
 *     def setPointSF(self, SF sf not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetPointSF(self.dm, sf.sf) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_91setPointSF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_90setPointSF[] = "DM.setPointSF(self, SF sf)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_91setPointSF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscSFObject *__pyx_v_sf = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPointSF (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sf,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);
        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_sf)) != 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, "setPointSF") < 0)) __PYX_ERR(40, 291, __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_sf = ((struct PyPetscSFObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPointSF", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 291, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setPointSF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sf), __pyx_ptype_8petsc4py_5PETSc_SF, 0, "sf", 0))) __PYX_ERR(40, 291, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_90setPointSF(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_sf);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_90setPointSF(struct PyPetscDMObject *__pyx_v_self, struct PyPetscSFObject *__pyx_v_sf) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setPointSF", 0);

  /* "PETSc/DM.pyx":292
 * 
 *     def setPointSF(self, SF sf not None):
 *         CHKERR( DMSetPointSF(self.dm, sf.sf) )             # <<<<<<<<<<<<<<
 * 
 *     def getNumLabels(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetPointSF(__pyx_v_self->dm, __pyx_v_sf->sf)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 292, __pyx_L1_error)

  /* "PETSc/DM.pyx":291
 *         return sf
 * 
 *     def setPointSF(self, SF sf not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetPointSF(self.dm, sf.sf) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setPointSF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":294
 *         CHKERR( DMSetPointSF(self.dm, sf.sf) )
 * 
 *     def getNumLabels(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt nLabels = 0
 *         CHKERR( DMGetNumLabels(self.dm, &nLabels) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_93getNumLabels(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_92getNumLabels[] = "DM.getNumLabels(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_93getNumLabels(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getNumLabels (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getNumLabels", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getNumLabels", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_92getNumLabels(((struct PyPetscDMObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_92getNumLabels(struct PyPetscDMObject *__pyx_v_self) {
  PetscInt __pyx_v_nLabels;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getNumLabels", 0);

  /* "PETSc/DM.pyx":295
 * 
 *     def getNumLabels(self):
 *         cdef PetscInt nLabels = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetNumLabels(self.dm, &nLabels) )
 *         return toInt(nLabels)
 */
  __pyx_v_nLabels = 0;

  /* "PETSc/DM.pyx":296
 *     def getNumLabels(self):
 *         cdef PetscInt nLabels = 0
 *         CHKERR( DMGetNumLabels(self.dm, &nLabels) )             # <<<<<<<<<<<<<<
 *         return toInt(nLabels)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetNumLabels(__pyx_v_self->dm, (&__pyx_v_nLabels))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(40, 296, __pyx_L1_error)

  /* "PETSc/DM.pyx":297
 *         cdef PetscInt nLabels = 0
 *         CHKERR( DMGetNumLabels(self.dm, &nLabels) )
 *         return toInt(nLabels)             # <<<<<<<<<<<<<<
 * 
 *     def getLabelName(self, index):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nLabels); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":294
 *         CHKERR( DMSetPointSF(self.dm, sf.sf) )
 * 
 *     def getNumLabels(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt nLabels = 0
 *         CHKERR( DMGetNumLabels(self.dm, &nLabels) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getNumLabels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":299
 *         return toInt(nLabels)
 * 
 *     def getLabelName(self, index):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cindex = asInt(index)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_95getLabelName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_94getLabelName[] = "DM.getLabelName(self, index)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_95getLabelName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLabelName (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,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);
        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_index)) != 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, "getLabelName") < 0)) __PYX_ERR(40, 299, __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_index = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getLabelName", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 299, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getLabelName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_94getLabelName(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_index);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_94getLabelName(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PetscInt __pyx_v_cindex;
  const char *__pyx_v_cname;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getLabelName", 0);

  /* "PETSc/DM.pyx":300
 * 
 *     def getLabelName(self, index):
 *         cdef PetscInt cindex = asInt(index)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         CHKERR( DMGetLabelName(self.dm, cindex, &cname) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_index); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(40, 300, __pyx_L1_error)
  __pyx_v_cindex = __pyx_t_1;

  /* "PETSc/DM.pyx":301
 *     def getLabelName(self, index):
 *         cdef PetscInt cindex = asInt(index)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetLabelName(self.dm, cindex, &cname) )
 *         return bytes2str(cname)
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":302
 *         cdef PetscInt cindex = asInt(index)
 *         cdef const_char *cname = NULL
 *         CHKERR( DMGetLabelName(self.dm, cindex, &cname) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cname)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetLabelName(__pyx_v_self->dm, __pyx_v_cindex, (&__pyx_v_cname))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 302, __pyx_L1_error)

  /* "PETSc/DM.pyx":303
 *         cdef const_char *cname = NULL
 *         CHKERR( DMGetLabelName(self.dm, cindex, &cname) )
 *         return bytes2str(cname)             # <<<<<<<<<<<<<<
 * 
 *     def hasLabel(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cname); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":299
 *         return toInt(nLabels)
 * 
 *     def getLabelName(self, index):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cindex = asInt(index)
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getLabelName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":305
 *         return bytes2str(cname)
 * 
 *     def hasLabel(self, name):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_97hasLabel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_96hasLabel[] = "DM.hasLabel(self, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_97hasLabel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hasLabel (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);
        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, "hasLabel") < 0)) __PYX_ERR(40, 305, __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("hasLabel", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 305, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.hasLabel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_96hasLabel(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_96hasLabel(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PetscBool __pyx_v_flag;
  const char *__pyx_v_cname;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("hasLabel", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":306
 * 
 *     def hasLabel(self, name):
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/DM.pyx":307
 *     def hasLabel(self, name):
 *         cdef PetscBool flag = PETSC_FALSE
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMHasLabel(self.dm, cname, &flag) )
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":308
 *         cdef PetscBool flag = PETSC_FALSE
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         CHKERR( DMHasLabel(self.dm, cname, &flag) )
 *         return <bint> flag
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":309
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMHasLabel(self.dm, cname, &flag) )             # <<<<<<<<<<<<<<
 *         return <bint> flag
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMHasLabel(__pyx_v_self->dm, __pyx_v_cname, (&__pyx_v_flag))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 309, __pyx_L1_error)

  /* "PETSc/DM.pyx":310
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMHasLabel(self.dm, cname, &flag) )
 *         return <bint> flag             # <<<<<<<<<<<<<<
 * 
 *     def createLabel(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":305
 *         return bytes2str(cname)
 * 
 *     def hasLabel(self, name):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.hasLabel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":312
 *         return <bint> flag
 * 
 *     def createLabel(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_99createLabel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_98createLabel[] = "DM.createLabel(self, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_99createLabel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createLabel (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);
        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, "createLabel") < 0)) __PYX_ERR(40, 312, __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("createLabel", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 312, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createLabel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_98createLabel(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_98createLabel(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name) {
  const char *__pyx_v_cname;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createLabel", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":313
 * 
 *     def createLabel(self, name):
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMCreateLabel(self.dm, cname) )
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":314
 *     def createLabel(self, name):
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         CHKERR( DMCreateLabel(self.dm, cname) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":315
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMCreateLabel(self.dm, cname) )             # <<<<<<<<<<<<<<
 * 
 *     def removeLabel(self, name):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCreateLabel(__pyx_v_self->dm, __pyx_v_cname)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 315, __pyx_L1_error)

  /* "PETSc/DM.pyx":312
 *         return <bint> flag
 * 
 *     def createLabel(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.createLabel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":317
 *         CHKERR( DMCreateLabel(self.dm, cname) )
 * 
 *     def removeLabel(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         cdef PetscDMLabel clbl = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_101removeLabel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_100removeLabel[] = "DM.removeLabel(self, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_101removeLabel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("removeLabel (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);
        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, "removeLabel") < 0)) __PYX_ERR(40, 317, __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("removeLabel", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 317, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.removeLabel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_100removeLabel(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_100removeLabel(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name) {
  const char *__pyx_v_cname;
  DMLabel __pyx_v_clbl;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("removeLabel", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":318
 * 
 *     def removeLabel(self, name):
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscDMLabel clbl = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":319
 *     def removeLabel(self, name):
 *         cdef const_char *cname = NULL
 *         cdef PetscDMLabel clbl = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMRemoveLabel(self.dm, cname, &clbl) )
 */
  __pyx_v_clbl = NULL;

  /* "PETSc/DM.pyx":320
 *         cdef const_char *cname = NULL
 *         cdef PetscDMLabel clbl = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         CHKERR( DMRemoveLabel(self.dm, cname, &clbl) )
 *         # CHKERR( DMLabelDestroy(&clbl) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":321
 *         cdef PetscDMLabel clbl = NULL
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMRemoveLabel(self.dm, cname, &clbl) )             # <<<<<<<<<<<<<<
 *         # CHKERR( DMLabelDestroy(&clbl) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMRemoveLabel(__pyx_v_self->dm, __pyx_v_cname, (&__pyx_v_clbl))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 321, __pyx_L1_error)

  /* "PETSc/DM.pyx":317
 *         CHKERR( DMCreateLabel(self.dm, cname) )
 * 
 *     def removeLabel(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         cdef PetscDMLabel clbl = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.removeLabel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":324
 *         # CHKERR( DMLabelDestroy(&clbl) )
 * 
 *     def getLabelValue(self, name, point):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), value = 0
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_103getLabelValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_102getLabelValue[] = "DM.getLabelValue(self, name, point)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_103getLabelValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLabelValue (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_point,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getLabelValue", 1, 2, 2, 1); __PYX_ERR(40, 324, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getLabelValue") < 0)) __PYX_ERR(40, 324, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_name = values[0];
    __pyx_v_point = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getLabelValue", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 324, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getLabelValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_102getLabelValue(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name, __pyx_v_point);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_102getLabelValue(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_point) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_value;
  const char *__pyx_v_cname;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getLabelValue", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":325
 * 
 *     def getLabelValue(self, name, point):
 *         cdef PetscInt cpoint = asInt(point), value = 0             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(40, 325, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;
  __pyx_v_value = 0;

  /* "PETSc/DM.pyx":326
 *     def getLabelValue(self, name, point):
 *         cdef PetscInt cpoint = asInt(point), value = 0
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMGetLabelValue(self.dm, cname, cpoint, &value) )
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":327
 *         cdef PetscInt cpoint = asInt(point), value = 0
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetLabelValue(self.dm, cname, cpoint, &value) )
 *         return toInt(value)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DM.pyx":328
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMGetLabelValue(self.dm, cname, cpoint, &value) )             # <<<<<<<<<<<<<<
 *         return toInt(value)
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetLabelValue(__pyx_v_self->dm, __pyx_v_cname, __pyx_v_cpoint, (&__pyx_v_value))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(40, 328, __pyx_L1_error)

  /* "PETSc/DM.pyx":329
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMGetLabelValue(self.dm, cname, cpoint, &value) )
 *         return toInt(value)             # <<<<<<<<<<<<<<
 * 
 *     def setLabelValue(self, name, point, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":324
 *         # CHKERR( DMLabelDestroy(&clbl) )
 * 
 *     def getLabelValue(self, name, point):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), value = 0
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getLabelValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":331
 *         return toInt(value)
 * 
 *     def setLabelValue(self, name, point, value):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), cvalue = asInt(value)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_105setLabelValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_104setLabelValue[] = "DM.setLabelValue(self, name, point, value)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_105setLabelValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setLabelValue (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_point,&__pyx_n_s_value,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setLabelValue", 1, 3, 3, 1); __PYX_ERR(40, 331, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setLabelValue", 1, 3, 3, 2); __PYX_ERR(40, 331, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setLabelValue") < 0)) __PYX_ERR(40, 331, __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_name = values[0];
    __pyx_v_point = values[1];
    __pyx_v_value = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setLabelValue", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 331, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setLabelValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_104setLabelValue(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name, __pyx_v_point, __pyx_v_value);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_104setLabelValue(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_point, PyObject *__pyx_v_value) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cvalue;
  const char *__pyx_v_cname;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setLabelValue", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":332
 * 
 *     def setLabelValue(self, name, point, value):
 *         cdef PetscInt cpoint = asInt(point), cvalue = asInt(value)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(40, 332, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_value); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(40, 332, __pyx_L1_error)
  __pyx_v_cvalue = __pyx_t_1;

  /* "PETSc/DM.pyx":333
 *     def setLabelValue(self, name, point, value):
 *         cdef PetscInt cpoint = asInt(point), cvalue = asInt(value)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMSetLabelValue(self.dm, cname, cpoint, cvalue) )
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":334
 *         cdef PetscInt cpoint = asInt(point), cvalue = asInt(value)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetLabelValue(self.dm, cname, cpoint, cvalue) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DM.pyx":335
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMSetLabelValue(self.dm, cname, cpoint, cvalue) )             # <<<<<<<<<<<<<<
 * 
 *     def clearLabelValue(self, name, point, value):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetLabelValue(__pyx_v_self->dm, __pyx_v_cname, __pyx_v_cpoint, __pyx_v_cvalue)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(40, 335, __pyx_L1_error)

  /* "PETSc/DM.pyx":331
 *         return toInt(value)
 * 
 *     def setLabelValue(self, name, point, value):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), cvalue = asInt(value)
 *         cdef const_char *cname = 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("petsc4py.PETSc.DM.setLabelValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":337
 *         CHKERR( DMSetLabelValue(self.dm, cname, cpoint, cvalue) )
 * 
 *     def clearLabelValue(self, name, point, value):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), cvalue = asInt(value)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_107clearLabelValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_106clearLabelValue[] = "DM.clearLabelValue(self, name, point, value)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_107clearLabelValue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_point = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clearLabelValue (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_point,&__pyx_n_s_value,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("clearLabelValue", 1, 3, 3, 1); __PYX_ERR(40, 337, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("clearLabelValue", 1, 3, 3, 2); __PYX_ERR(40, 337, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "clearLabelValue") < 0)) __PYX_ERR(40, 337, __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_name = values[0];
    __pyx_v_point = values[1];
    __pyx_v_value = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("clearLabelValue", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 337, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.clearLabelValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_106clearLabelValue(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name, __pyx_v_point, __pyx_v_value);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_106clearLabelValue(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_point, PyObject *__pyx_v_value) {
  PetscInt __pyx_v_cpoint;
  PetscInt __pyx_v_cvalue;
  const char *__pyx_v_cname;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("clearLabelValue", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":338
 * 
 *     def clearLabelValue(self, name, point, value):
 *         cdef PetscInt cpoint = asInt(point), cvalue = asInt(value)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_point); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(40, 338, __pyx_L1_error)
  __pyx_v_cpoint = __pyx_t_1;
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_value); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(40, 338, __pyx_L1_error)
  __pyx_v_cvalue = __pyx_t_1;

  /* "PETSc/DM.pyx":339
 *     def clearLabelValue(self, name, point, value):
 *         cdef PetscInt cpoint = asInt(point), cvalue = asInt(value)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMClearLabelValue(self.dm, cname, cpoint, cvalue) )
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":340
 *         cdef PetscInt cpoint = asInt(point), cvalue = asInt(value)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         CHKERR( DMClearLabelValue(self.dm, cname, cpoint, cvalue) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DM.pyx":341
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMClearLabelValue(self.dm, cname, cpoint, cvalue) )             # <<<<<<<<<<<<<<
 * 
 *     def getLabelSize(self, name):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMClearLabelValue(__pyx_v_self->dm, __pyx_v_cname, __pyx_v_cpoint, __pyx_v_cvalue)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(40, 341, __pyx_L1_error)

  /* "PETSc/DM.pyx":337
 *         CHKERR( DMSetLabelValue(self.dm, cname, cpoint, cvalue) )
 * 
 *     def clearLabelValue(self, name, point, value):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cpoint = asInt(point), cvalue = asInt(value)
 *         cdef const_char *cname = 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("petsc4py.PETSc.DM.clearLabelValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":343
 *         CHKERR( DMClearLabelValue(self.dm, cname, cpoint, cvalue) )
 * 
 *     def getLabelSize(self, name):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_109getLabelSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_108getLabelSize[] = "DM.getLabelSize(self, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_109getLabelSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLabelSize (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);
        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, "getLabelSize") < 0)) __PYX_ERR(40, 343, __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("getLabelSize", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 343, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getLabelSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_108getLabelSize(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_108getLabelSize(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PetscInt __pyx_v_size;
  const char *__pyx_v_cname;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getLabelSize", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":344
 * 
 *     def getLabelSize(self, name):
 *         cdef PetscInt size = 0             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_v_size = 0;

  /* "PETSc/DM.pyx":345
 *     def getLabelSize(self, name):
 *         cdef PetscInt size = 0
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMGetLabelSize(self.dm, cname, &size) )
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":346
 *         cdef PetscInt size = 0
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetLabelSize(self.dm, cname, &size) )
 *         return toInt(size)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":347
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMGetLabelSize(self.dm, cname, &size) )             # <<<<<<<<<<<<<<
 *         return toInt(size)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetLabelSize(__pyx_v_self->dm, __pyx_v_cname, (&__pyx_v_size))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 347, __pyx_L1_error)

  /* "PETSc/DM.pyx":348
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMGetLabelSize(self.dm, cname, &size) )
 *         return toInt(size)             # <<<<<<<<<<<<<<
 * 
 *     def getLabelIdIS(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":343
 *         CHKERR( DMClearLabelValue(self.dm, cname, cpoint, cvalue) )
 * 
 *     def getLabelSize(self, name):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getLabelSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":350
 *         return toInt(size)
 * 
 *     def getLabelIdIS(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_111getLabelIdIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_110getLabelIdIS[] = "DM.getLabelIdIS(self, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_111getLabelIdIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLabelIdIS (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);
        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, "getLabelIdIS") < 0)) __PYX_ERR(40, 350, __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("getLabelIdIS", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 350, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getLabelIdIS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_110getLabelIdIS(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_110getLabelIdIS(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name) {
  const char *__pyx_v_cname;
  struct PyPetscISObject *__pyx_v_lis = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getLabelIdIS", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":351
 * 
 *     def getLabelIdIS(self, name):
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef IS lis = IS()
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":352
 *     def getLabelIdIS(self, name):
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef IS lis = IS()
 *         CHKERR( DMGetLabelIdIS(self.dm, cname, &lis.iset) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":353
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef IS lis = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetLabelIdIS(self.dm, cname, &lis.iset) )
 *         return lis
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_lis = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":354
 *         name = str2bytes(name, &cname)
 *         cdef IS lis = IS()
 *         CHKERR( DMGetLabelIdIS(self.dm, cname, &lis.iset) )             # <<<<<<<<<<<<<<
 *         return lis
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetLabelIdIS(__pyx_v_self->dm, __pyx_v_cname, (&__pyx_v_lis->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 354, __pyx_L1_error)

  /* "PETSc/DM.pyx":355
 *         cdef IS lis = IS()
 *         CHKERR( DMGetLabelIdIS(self.dm, cname, &lis.iset) )
 *         return lis             # <<<<<<<<<<<<<<
 * 
 *     def getStratumSize(self, name, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_lis));
  __pyx_r = ((PyObject *)__pyx_v_lis);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":350
 *         return toInt(size)
 * 
 *     def getLabelIdIS(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getLabelIdIS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lis);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":357
 *         return lis
 * 
 *     def getStratumSize(self, name, value):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0
 *         cdef PetscInt cvalue = asInt(value)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_113getStratumSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_112getStratumSize[] = "DM.getStratumSize(self, name, value)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_113getStratumSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getStratumSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_value,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getStratumSize", 1, 2, 2, 1); __PYX_ERR(40, 357, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getStratumSize") < 0)) __PYX_ERR(40, 357, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_name = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getStratumSize", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 357, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getStratumSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_112getStratumSize(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_112getStratumSize(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PetscInt __pyx_v_size;
  PetscInt __pyx_v_cvalue;
  const char *__pyx_v_cname;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getStratumSize", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":358
 * 
 *     def getStratumSize(self, name, value):
 *         cdef PetscInt size = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef const_char *cname = NULL
 */
  __pyx_v_size = 0;

  /* "PETSc/DM.pyx":359
 *     def getStratumSize(self, name, value):
 *         cdef PetscInt size = 0
 *         cdef PetscInt cvalue = asInt(value)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_value); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(40, 359, __pyx_L1_error)
  __pyx_v_cvalue = __pyx_t_1;

  /* "PETSc/DM.pyx":360
 *         cdef PetscInt size = 0
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMGetStratumSize(self.dm, cname, cvalue, &size) )
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":361
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetStratumSize(self.dm, cname, cvalue, &size) )
 *         return toInt(size)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DM.pyx":362
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMGetStratumSize(self.dm, cname, cvalue, &size) )             # <<<<<<<<<<<<<<
 *         return toInt(size)
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetStratumSize(__pyx_v_self->dm, __pyx_v_cname, __pyx_v_cvalue, (&__pyx_v_size))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(40, 362, __pyx_L1_error)

  /* "PETSc/DM.pyx":363
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMGetStratumSize(self.dm, cname, cvalue, &size) )
 *         return toInt(size)             # <<<<<<<<<<<<<<
 * 
 *     def getStratumIS(self, name, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":357
 *         return lis
 * 
 *     def getStratumSize(self, name, value):             # <<<<<<<<<<<<<<
 *         cdef PetscInt size = 0
 *         cdef PetscInt cvalue = asInt(value)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getStratumSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":365
 *         return toInt(size)
 * 
 *     def getStratumIS(self, name, value):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_115getStratumIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_114getStratumIS[] = "DM.getStratumIS(self, name, value)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_115getStratumIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getStratumIS (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_value,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getStratumIS", 1, 2, 2, 1); __PYX_ERR(40, 365, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getStratumIS") < 0)) __PYX_ERR(40, 365, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_name = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getStratumIS", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 365, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getStratumIS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_114getStratumIS(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_114getStratumIS(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PetscInt __pyx_v_cvalue;
  const char *__pyx_v_cname;
  struct PyPetscISObject *__pyx_v_sis = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getStratumIS", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":366
 * 
 *     def getStratumIS(self, name, value):
 *         cdef PetscInt cvalue = asInt(value)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_value); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(40, 366, __pyx_L1_error)
  __pyx_v_cvalue = __pyx_t_1;

  /* "PETSc/DM.pyx":367
 *     def getStratumIS(self, name, value):
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef IS sis = IS()
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":368
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef IS sis = IS()
 *         CHKERR( DMGetStratumIS(self.dm, cname, cvalue, &sis.iset) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DM.pyx":369
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef IS sis = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetStratumIS(self.dm, cname, cvalue, &sis.iset) )
 *         return sis
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_sis = ((struct PyPetscISObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DM.pyx":370
 *         name = str2bytes(name, &cname)
 *         cdef IS sis = IS()
 *         CHKERR( DMGetStratumIS(self.dm, cname, cvalue, &sis.iset) )             # <<<<<<<<<<<<<<
 *         return sis
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetStratumIS(__pyx_v_self->dm, __pyx_v_cname, __pyx_v_cvalue, (&__pyx_v_sis->iset))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(40, 370, __pyx_L1_error)

  /* "PETSc/DM.pyx":371
 *         cdef IS sis = IS()
 *         CHKERR( DMGetStratumIS(self.dm, cname, cvalue, &sis.iset) )
 *         return sis             # <<<<<<<<<<<<<<
 * 
 *     def clearLabelStratum(self, name, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_sis));
  __pyx_r = ((PyObject *)__pyx_v_sis);
  goto __pyx_L0;

  /* "PETSc/DM.pyx":365
 *         return toInt(size)
 * 
 *     def getStratumIS(self, name, value):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getStratumIS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sis);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":373
 *         return sis
 * 
 *     def clearLabelStratum(self, name, value):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_117clearLabelStratum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_116clearLabelStratum[] = "DM.clearLabelStratum(self, name, value)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_117clearLabelStratum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clearLabelStratum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_value,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("clearLabelStratum", 1, 2, 2, 1); __PYX_ERR(40, 373, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "clearLabelStratum") < 0)) __PYX_ERR(40, 373, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_name = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("clearLabelStratum", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 373, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.clearLabelStratum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_116clearLabelStratum(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_116clearLabelStratum(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PetscInt __pyx_v_cvalue;
  const char *__pyx_v_cname;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("clearLabelStratum", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":374
 * 
 *     def clearLabelStratum(self, name, value):
 *         cdef PetscInt cvalue = asInt(value)             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_value); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(40, 374, __pyx_L1_error)
  __pyx_v_cvalue = __pyx_t_1;

  /* "PETSc/DM.pyx":375
 *     def clearLabelStratum(self, name, value):
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMClearLabelStratum(self.dm, cname, cvalue) )
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":376
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         CHKERR( DMClearLabelStratum(self.dm, cname, cvalue) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_2)) __PYX_ERR(40, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DM.pyx":377
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         CHKERR( DMClearLabelStratum(self.dm, cname, cvalue) )             # <<<<<<<<<<<<<<
 * 
 *     def setLabelOutput(self, name, output):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMClearLabelStratum(__pyx_v_self->dm, __pyx_v_cname, __pyx_v_cvalue)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(40, 377, __pyx_L1_error)

  /* "PETSc/DM.pyx":373
 *         return sis
 * 
 *     def clearLabelStratum(self, name, value):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef const_char *cname = 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("petsc4py.PETSc.DM.clearLabelStratum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":379
 *         CHKERR( DMClearLabelStratum(self.dm, cname, cvalue) )
 * 
 *     def setLabelOutput(self, name, output):             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_119setLabelOutput(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_118setLabelOutput[] = "DM.setLabelOutput(self, name, output)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_119setLabelOutput(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_output = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setLabelOutput (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_output,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_output)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setLabelOutput", 1, 2, 2, 1); __PYX_ERR(40, 379, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setLabelOutput") < 0)) __PYX_ERR(40, 379, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_name = values[0];
    __pyx_v_output = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setLabelOutput", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 379, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setLabelOutput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_118setLabelOutput(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name, __pyx_v_output);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_118setLabelOutput(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_output) {
  const char *__pyx_v_cname;
  PetscBool __pyx_v_coutput;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PetscBool __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setLabelOutput", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":380
 * 
 *     def setLabelOutput(self, name, output):
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef PetscBool coutput = output
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":381
 *     def setLabelOutput(self, name, output):
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscBool coutput = output
 *         CHKERR( DMSetLabelOutput(self.dm, cname, coutput) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":382
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef PetscBool coutput = output             # <<<<<<<<<<<<<<
 *         CHKERR( DMSetLabelOutput(self.dm, cname, coutput) )
 * 
 */
  __pyx_t_2 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_output)); if (unlikely(PyErr_Occurred())) __PYX_ERR(40, 382, __pyx_L1_error)
  __pyx_v_coutput = __pyx_t_2;

  /* "PETSc/DM.pyx":383
 *         name = str2bytes(name, &cname)
 *         cdef PetscBool coutput = output
 *         CHKERR( DMSetLabelOutput(self.dm, cname, coutput) )             # <<<<<<<<<<<<<<
 * 
 *     def getLabelOutput(self, name):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetLabelOutput(__pyx_v_self->dm, __pyx_v_cname, __pyx_v_coutput)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(40, 383, __pyx_L1_error)

  /* "PETSc/DM.pyx":379
 *         CHKERR( DMClearLabelStratum(self.dm, cname, cvalue) )
 * 
 *     def setLabelOutput(self, name, output):             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.setLabelOutput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DM.pyx":385
 *         CHKERR( DMSetLabelOutput(self.dm, cname, coutput) )
 * 
 *     def getLabelOutput(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_121getLabelOutput(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2DM_120getLabelOutput[] = "DM.getLabelOutput(self, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2DM_121getLabelOutput(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLabelOutput (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);
        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, "getLabelOutput") < 0)) __PYX_ERR(40, 385, __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("getLabelOutput", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(40, 385, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getLabelOutput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2DM_120getLabelOutput(((struct PyPetscDMObject *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2DM_120getLabelOutput(struct PyPetscDMObject *__pyx_v_self, PyObject *__pyx_v_name) {
  const char *__pyx_v_cname;
  PetscBool __pyx_v_coutput;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getLabelOutput", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DM.pyx":386
 * 
 *     def getLabelOutput(self, name):
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cname)
 *         cdef PetscBool coutput = PETSC_FALSE
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DM.pyx":387
 *     def getLabelOutput(self, name):
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscBool coutput = PETSC_FALSE
 *         CHKERR( DMGetLabelOutput(self.dm, cname, &coutput) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DM.pyx":388
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 *         cdef PetscBool coutput = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetLabelOutput(self.dm, cname, &coutput) )
 *         return coutput
 */
  __pyx_v_coutput = PETSC_FALSE;

  /* "PETSc/DM.pyx":389
 *         name = str2bytes(name, &cname)
 *         cdef PetscBool coutput = PETSC_FALSE
 *         CHKERR( DMGetLabelOutput(self.dm, cname, &coutput) )             # <<<<<<<<<<<<<<
 *         return coutput
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetLabelOutput(__pyx_v_self->dm, __pyx_v_cname, (&__pyx_v_coutput))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(40, 389, __pyx_L1_error)

  /* "PETSc/DM.pyx":390
 *         cdef PetscBool coutput = PETSC_FALSE
 *         CHKERR( DMGetLabelOutput(self.dm, cname, &coutput) )
 *         return coutput             # <<<<<<<<<<<<<<
 * 
 *     # backward compatibility
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_PetscBool(__pyx_v_coutput); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/DM.pyx":385
 *         CHKERR( DMSetLabelOutput(self.dm, cname, coutput) )
 * 
 *     def getLabelOutput(self, name):             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DM.getLabelOutput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":25
 *     #
 * 
 *     def create(self, dim=None, dof=None,             # <<<<<<<<<<<<<<
 *                sizes=None, proc_sizes=None, boundary_type=None,
 *                stencil_type=None, stencil_width=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_1create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_create[] = "DMDA.create(self, dim=None, dof=None, sizes=None, proc_sizes=None, boundary_type=None, stencil_type=None, stencil_width=None, bool setup=True, ownership_ranges=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_1create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dim = 0;
  PyObject *__pyx_v_dof = 0;
  PyObject *__pyx_v_sizes = 0;
  PyObject *__pyx_v_proc_sizes = 0;
  PyObject *__pyx_v_boundary_type = 0;
  PyObject *__pyx_v_stencil_type = 0;
  PyObject *__pyx_v_stencil_width = 0;
  int __pyx_v_setup;
  PyObject *__pyx_v_ownership_ranges = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dim,&__pyx_n_s_dof,&__pyx_n_s_sizes,&__pyx_n_s_proc_sizes,&__pyx_n_s_boundary_type,&__pyx_n_s_stencil_type,&__pyx_n_s_stencil_width,&__pyx_n_s_setup,&__pyx_n_s_ownership_ranges,&__pyx_n_s_comm,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);

    /* "PETSc/DMDA.pyx":26
 * 
 *     def create(self, dim=None, dof=None,
 *                sizes=None, proc_sizes=None, boundary_type=None,             # <<<<<<<<<<<<<<
 *                stencil_type=None, stencil_width=None,
 *                bint setup=True, ownership_ranges=None, comm=None):
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);

    /* "PETSc/DMDA.pyx":27
 *     def create(self, dim=None, dof=None,
 *                sizes=None, proc_sizes=None, boundary_type=None,
 *                stencil_type=None, stencil_width=None,             # <<<<<<<<<<<<<<
 *                bint setup=True, ownership_ranges=None, comm=None):
 *         #
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);

    /* "PETSc/DMDA.pyx":28
 *                sizes=None, proc_sizes=None, boundary_type=None,
 *                stencil_type=None, stencil_width=None,
 *                bint setup=True, ownership_ranges=None, comm=None):             # <<<<<<<<<<<<<<
 *         #
 *         cdef object arg = 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 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dim);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dof);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sizes);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_proc_sizes);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boundary_type);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stencil_type);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stencil_width);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_setup);
          if (value) { values[7] = value; kw_args--; }
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ownership_ranges);
          if (value) { values[8] = value; kw_args--; }
        }
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[9] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(41, 25, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_dim = values[0];
    __pyx_v_dof = values[1];
    __pyx_v_sizes = values[2];
    __pyx_v_proc_sizes = values[3];
    __pyx_v_boundary_type = values[4];
    __pyx_v_stencil_type = values[5];
    __pyx_v_stencil_width = values[6];
    if (values[7]) {
      __pyx_v_setup = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_setup == (int)-1) && PyErr_Occurred())) __PYX_ERR(41, 28, __pyx_L3_error)
    } else {
      __pyx_v_setup = ((int)1);
    }
    __pyx_v_ownership_ranges = values[8];
    __pyx_v_comm = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 25, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_create(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_dim, __pyx_v_dof, __pyx_v_sizes, __pyx_v_proc_sizes, __pyx_v_boundary_type, __pyx_v_stencil_type, __pyx_v_stencil_width, __pyx_v_setup, __pyx_v_ownership_ranges, __pyx_v_comm);

  /* "PETSc/DMDA.pyx":25
 *     #
 * 
 *     def create(self, dim=None, dof=None,             # <<<<<<<<<<<<<<
 *                sizes=None, proc_sizes=None, boundary_type=None,
 *                stencil_type=None, stencil_width=None,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_create(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_dim, PyObject *__pyx_v_dof, PyObject *__pyx_v_sizes, PyObject *__pyx_v_proc_sizes, PyObject *__pyx_v_boundary_type, PyObject *__pyx_v_stencil_type, PyObject *__pyx_v_stencil_width, int __pyx_v_setup, PyObject *__pyx_v_ownership_ranges, PyObject *__pyx_v_comm) {
  PyObject *__pyx_v_arg = 0;
  PetscInt __pyx_v_ndim;
  PetscInt __pyx_v_ndof;
  PetscInt __pyx_v_M;
  PetscInt __pyx_v_m;
  PetscInt *__pyx_v_lx;
  PetscInt __pyx_v_N;
  PetscInt __pyx_v_n;
  PetscInt *__pyx_v_ly;
  PetscInt __pyx_v_P;
  PetscInt __pyx_v_p;
  PetscInt *__pyx_v_lz;
  DMBoundaryType __pyx_v_btx;
  DMBoundaryType __pyx_v_bty;
  DMBoundaryType __pyx_v_btz;
  DMDAStencilType __pyx_v_stype;
  PetscInt __pyx_v_swidth;
  PyObject *__pyx_v_gsizes = 0;
  PyObject *__pyx_v_psizes = 0;
  PetscInt __pyx_v_gdim;
  PetscInt __pyx_v_pdim;
  MPI_Comm __pyx_v_ccomm;
  DM __pyx_v_newda;
  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;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PetscInt __pyx_t_9;
  DMDAStencilType __pyx_t_10;
  MPI_Comm __pyx_t_11;
  __Pyx_RefNannySetupContext("create", 0);
  __Pyx_INCREF(__pyx_v_dim);
  __Pyx_INCREF(__pyx_v_sizes);
  __Pyx_INCREF(__pyx_v_ownership_ranges);

  /* "PETSc/DMDA.pyx":30
 *                bint setup=True, ownership_ranges=None, comm=None):
 *         #
 *         cdef object arg = None             # <<<<<<<<<<<<<<
 *         try: arg = tuple(dim)
 *         except TypeError: pass
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_arg = Py_None;

  /* "PETSc/DMDA.pyx":31
 *         #
 *         cdef object arg = None
 *         try: arg = tuple(dim)             # <<<<<<<<<<<<<<
 *         except TypeError: pass
 *         else: dim, sizes = None, arg
 */
  {
    __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:*/ {
      __pyx_t_4 = PySequence_Tuple(__pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 31, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_arg, __pyx_t_4);
      __pyx_t_4 = 0;
    }

    /* "PETSc/DMDA.pyx":33
 *         try: arg = tuple(dim)
 *         except TypeError: pass
 *         else: dim, sizes = None, arg             # <<<<<<<<<<<<<<
 *         #
 *         cdef PetscInt ndim = PETSC_DECIDE
 */
    /*else:*/ {
      __pyx_t_4 = Py_None;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = __pyx_v_arg;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_dim, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_sizes, __pyx_t_5);
      __pyx_t_5 = 0;
    }
    __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_L10_try_end;
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/DMDA.pyx":32
 *         cdef object arg = None
 *         try: arg = tuple(dim)
 *         except TypeError: pass             # <<<<<<<<<<<<<<
 *         else: dim, sizes = None, arg
 *         #
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
    if (__pyx_t_6) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "PETSc/DMDA.pyx":31
 *         #
 *         cdef object arg = None
 *         try: arg = tuple(dim)             # <<<<<<<<<<<<<<
 *         except TypeError: pass
 *         else: dim, sizes = None, arg
 */
    __Pyx_PyThreadState_assign
    __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_L4_exception_handled:;
    __Pyx_PyThreadState_assign
    __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);
    __pyx_L10_try_end:;
  }

  /* "PETSc/DMDA.pyx":35
 *         else: dim, sizes = None, arg
 *         #
 *         cdef PetscInt ndim = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         cdef PetscInt ndof = PETSC_DECIDE
 *         cdef PetscInt M = 1, m = PETSC_DECIDE, *lx = NULL
 */
  __pyx_v_ndim = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":36
 *         #
 *         cdef PetscInt ndim = PETSC_DECIDE
 *         cdef PetscInt ndof = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         cdef PetscInt M = 1, m = PETSC_DECIDE, *lx = NULL
 *         cdef PetscInt N = 1, n = PETSC_DECIDE, *ly = NULL
 */
  __pyx_v_ndof = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":37
 *         cdef PetscInt ndim = PETSC_DECIDE
 *         cdef PetscInt ndof = PETSC_DECIDE
 *         cdef PetscInt M = 1, m = PETSC_DECIDE, *lx = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt N = 1, n = PETSC_DECIDE, *ly = NULL
 *         cdef PetscInt P = 1, p = PETSC_DECIDE, *lz = NULL
 */
  __pyx_v_M = 1;
  __pyx_v_m = PETSC_DECIDE;
  __pyx_v_lx = NULL;

  /* "PETSc/DMDA.pyx":38
 *         cdef PetscInt ndof = PETSC_DECIDE
 *         cdef PetscInt M = 1, m = PETSC_DECIDE, *lx = NULL
 *         cdef PetscInt N = 1, n = PETSC_DECIDE, *ly = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt P = 1, p = PETSC_DECIDE, *lz = NULL
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 */
  __pyx_v_N = 1;
  __pyx_v_n = PETSC_DECIDE;
  __pyx_v_ly = NULL;

  /* "PETSc/DMDA.pyx":39
 *         cdef PetscInt M = 1, m = PETSC_DECIDE, *lx = NULL
 *         cdef PetscInt N = 1, n = PETSC_DECIDE, *ly = NULL
 *         cdef PetscInt P = 1, p = PETSC_DECIDE, *lz = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 */
  __pyx_v_P = 1;
  __pyx_v_p = PETSC_DECIDE;
  __pyx_v_lz = NULL;

  /* "PETSc/DMDA.pyx":40
 *         cdef PetscInt N = 1, n = PETSC_DECIDE, *ly = NULL
 *         cdef PetscInt P = 1, p = PETSC_DECIDE, *lz = NULL
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 */
  __pyx_v_btx = DM_BOUNDARY_NONE;

  /* "PETSc/DMDA.pyx":41
 *         cdef PetscInt P = 1, p = PETSC_DECIDE, *lz = NULL
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         cdef PetscDMDAStencilType stype  = DMDA_STENCIL_BOX
 */
  __pyx_v_bty = DM_BOUNDARY_NONE;

  /* "PETSc/DMDA.pyx":42
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAStencilType stype  = DMDA_STENCIL_BOX
 *         cdef PetscInt             swidth = PETSC_DECIDE
 */
  __pyx_v_btz = DM_BOUNDARY_NONE;

  /* "PETSc/DMDA.pyx":43
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         cdef PetscDMDAStencilType stype  = DMDA_STENCIL_BOX             # <<<<<<<<<<<<<<
 *         cdef PetscInt             swidth = PETSC_DECIDE
 *         # grid and proc sizes
 */
  __pyx_v_stype = DMDA_STENCIL_BOX;

  /* "PETSc/DMDA.pyx":44
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         cdef PetscDMDAStencilType stype  = DMDA_STENCIL_BOX
 *         cdef PetscInt             swidth = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         # grid and proc sizes
 *         cdef object gsizes = sizes
 */
  __pyx_v_swidth = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":46
 *         cdef PetscInt             swidth = PETSC_DECIDE
 *         # grid and proc sizes
 *         cdef object gsizes = sizes             # <<<<<<<<<<<<<<
 *         cdef object psizes = proc_sizes
 *         cdef PetscInt gdim = PETSC_DECIDE
 */
  __Pyx_INCREF(__pyx_v_sizes);
  __pyx_v_gsizes = __pyx_v_sizes;

  /* "PETSc/DMDA.pyx":47
 *         # grid and proc sizes
 *         cdef object gsizes = sizes
 *         cdef object psizes = proc_sizes             # <<<<<<<<<<<<<<
 *         cdef PetscInt gdim = PETSC_DECIDE
 *         cdef PetscInt pdim = PETSC_DECIDE
 */
  __Pyx_INCREF(__pyx_v_proc_sizes);
  __pyx_v_psizes = __pyx_v_proc_sizes;

  /* "PETSc/DMDA.pyx":48
 *         cdef object gsizes = sizes
 *         cdef object psizes = proc_sizes
 *         cdef PetscInt gdim = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         cdef PetscInt pdim = PETSC_DECIDE
 *         if sizes is not None:
 */
  __pyx_v_gdim = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":49
 *         cdef object psizes = proc_sizes
 *         cdef PetscInt gdim = PETSC_DECIDE
 *         cdef PetscInt pdim = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         if sizes is not None:
 *             gdim = asDims(gsizes, &M, &N, &P)
 */
  __pyx_v_pdim = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":50
 *         cdef PetscInt gdim = PETSC_DECIDE
 *         cdef PetscInt pdim = PETSC_DECIDE
 *         if sizes is not None:             # <<<<<<<<<<<<<<
 *             gdim = asDims(gsizes, &M, &N, &P)
 *         if psizes is not None:
 */
  __pyx_t_7 = (__pyx_v_sizes != Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "PETSc/DMDA.pyx":51
 *         cdef PetscInt pdim = PETSC_DECIDE
 *         if sizes is not None:
 *             gdim = asDims(gsizes, &M, &N, &P)             # <<<<<<<<<<<<<<
 *         if psizes is not None:
 *             pdim = asDims(psizes, &m, &n, &p)
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_asDims(__pyx_v_gsizes, (&__pyx_v_M), (&__pyx_v_N), (&__pyx_v_P)); if (unlikely(__pyx_t_9 == -1L && PyErr_Occurred())) __PYX_ERR(41, 51, __pyx_L1_error)
    __pyx_v_gdim = __pyx_t_9;

    /* "PETSc/DMDA.pyx":50
 *         cdef PetscInt gdim = PETSC_DECIDE
 *         cdef PetscInt pdim = PETSC_DECIDE
 *         if sizes is not None:             # <<<<<<<<<<<<<<
 *             gdim = asDims(gsizes, &M, &N, &P)
 *         if psizes is not None:
 */
  }

  /* "PETSc/DMDA.pyx":52
 *         if sizes is not None:
 *             gdim = asDims(gsizes, &M, &N, &P)
 *         if psizes is not None:             # <<<<<<<<<<<<<<
 *             pdim = asDims(psizes, &m, &n, &p)
 *         if gdim>=0 and pdim>=0:
 */
  __pyx_t_8 = (__pyx_v_psizes != Py_None);
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (__pyx_t_7) {

    /* "PETSc/DMDA.pyx":53
 *             gdim = asDims(gsizes, &M, &N, &P)
 *         if psizes is not None:
 *             pdim = asDims(psizes, &m, &n, &p)             # <<<<<<<<<<<<<<
 *         if gdim>=0 and pdim>=0:
 *             assert gdim == pdim
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_asDims(__pyx_v_psizes, (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_p)); if (unlikely(__pyx_t_9 == -1L && PyErr_Occurred())) __PYX_ERR(41, 53, __pyx_L1_error)
    __pyx_v_pdim = __pyx_t_9;

    /* "PETSc/DMDA.pyx":52
 *         if sizes is not None:
 *             gdim = asDims(gsizes, &M, &N, &P)
 *         if psizes is not None:             # <<<<<<<<<<<<<<
 *             pdim = asDims(psizes, &m, &n, &p)
 *         if gdim>=0 and pdim>=0:
 */
  }

  /* "PETSc/DMDA.pyx":54
 *         if psizes is not None:
 *             pdim = asDims(psizes, &m, &n, &p)
 *         if gdim>=0 and pdim>=0:             # <<<<<<<<<<<<<<
 *             assert gdim == pdim
 *         # dim and dof
 */
  __pyx_t_8 = ((__pyx_v_gdim >= 0) != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_8 = ((__pyx_v_pdim >= 0) != 0);
  __pyx_t_7 = __pyx_t_8;
  __pyx_L14_bool_binop_done:;
  if (__pyx_t_7) {

    /* "PETSc/DMDA.pyx":55
 *             pdim = asDims(psizes, &m, &n, &p)
 *         if gdim>=0 and pdim>=0:
 *             assert gdim == pdim             # <<<<<<<<<<<<<<
 *         # dim and dof
 *         if dim is not None: ndim = asInt(dim)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!((__pyx_v_gdim == __pyx_v_pdim) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(41, 55, __pyx_L1_error)
      }
    }
    #endif

    /* "PETSc/DMDA.pyx":54
 *         if psizes is not None:
 *             pdim = asDims(psizes, &m, &n, &p)
 *         if gdim>=0 and pdim>=0:             # <<<<<<<<<<<<<<
 *             assert gdim == pdim
 *         # dim and dof
 */
  }

  /* "PETSc/DMDA.pyx":57
 *             assert gdim == pdim
 *         # dim and dof
 *         if dim is not None: ndim = asInt(dim)             # <<<<<<<<<<<<<<
 *         if dof is not None: ndof = asInt(dof)
 *         if ndim==PETSC_DECIDE: ndim = gdim
 */
  __pyx_t_7 = (__pyx_v_dim != Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_dim); if (unlikely(__pyx_t_9 == -1L && PyErr_Occurred())) __PYX_ERR(41, 57, __pyx_L1_error)
    __pyx_v_ndim = __pyx_t_9;
  }

  /* "PETSc/DMDA.pyx":58
 *         # dim and dof
 *         if dim is not None: ndim = asInt(dim)
 *         if dof is not None: ndof = asInt(dof)             # <<<<<<<<<<<<<<
 *         if ndim==PETSC_DECIDE: ndim = gdim
 *         if ndof==PETSC_DECIDE: ndof = 1
 */
  __pyx_t_8 = (__pyx_v_dof != Py_None);
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (__pyx_t_7) {
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_dof); if (unlikely(__pyx_t_9 == -1L && PyErr_Occurred())) __PYX_ERR(41, 58, __pyx_L1_error)
    __pyx_v_ndof = __pyx_t_9;
  }

  /* "PETSc/DMDA.pyx":59
 *         if dim is not None: ndim = asInt(dim)
 *         if dof is not None: ndof = asInt(dof)
 *         if ndim==PETSC_DECIDE: ndim = gdim             # <<<<<<<<<<<<<<
 *         if ndof==PETSC_DECIDE: ndof = 1
 *         # vertex distribution
 */
  __pyx_t_7 = ((__pyx_v_ndim == PETSC_DECIDE) != 0);
  if (__pyx_t_7) {
    __pyx_v_ndim = __pyx_v_gdim;
  }

  /* "PETSc/DMDA.pyx":60
 *         if dof is not None: ndof = asInt(dof)
 *         if ndim==PETSC_DECIDE: ndim = gdim
 *         if ndof==PETSC_DECIDE: ndof = 1             # <<<<<<<<<<<<<<
 *         # vertex distribution
 *         if ownership_ranges is not None:
 */
  __pyx_t_7 = ((__pyx_v_ndof == PETSC_DECIDE) != 0);
  if (__pyx_t_7) {
    __pyx_v_ndof = 1;
  }

  /* "PETSc/DMDA.pyx":62
 *         if ndof==PETSC_DECIDE: ndof = 1
 *         # vertex distribution
 *         if ownership_ranges is not None:             # <<<<<<<<<<<<<<
 *             ownership_ranges = asOwnershipRanges(ownership_ranges,
 *                                                  ndim, &m, &n, &p,
 */
  __pyx_t_7 = (__pyx_v_ownership_ranges != Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "PETSc/DMDA.pyx":63
 *         # vertex distribution
 *         if ownership_ranges is not None:
 *             ownership_ranges = asOwnershipRanges(ownership_ranges,             # <<<<<<<<<<<<<<
 *                                                  ndim, &m, &n, &p,
 *                                                  &lx, &ly, &lz)
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_asOwnershipRanges(__pyx_v_ownership_ranges, __pyx_v_ndim, (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_p), (&__pyx_v_lx), (&__pyx_v_ly), (&__pyx_v_lz)); if (unlikely(!__pyx_t_5)) __PYX_ERR(41, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_ownership_ranges, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PETSc/DMDA.pyx":62
 *         if ndof==PETSC_DECIDE: ndof = 1
 *         # vertex distribution
 *         if ownership_ranges is not None:             # <<<<<<<<<<<<<<
 *             ownership_ranges = asOwnershipRanges(ownership_ranges,
 *                                                  ndim, &m, &n, &p,
 */
  }

  /* "PETSc/DMDA.pyx":67
 *                                                  &lx, &ly, &lz)
 *         # periodicity, stencil type & width
 *         if boundary_type is not None:             # <<<<<<<<<<<<<<
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         if stencil_type is not None:
 */
  __pyx_t_8 = (__pyx_v_boundary_type != Py_None);
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (__pyx_t_7) {

    /* "PETSc/DMDA.pyx":68
 *         # periodicity, stencil type & width
 *         if boundary_type is not None:
 *             asBoundary(boundary_type, &btx, &bty, &btz)             # <<<<<<<<<<<<<<
 *         if stencil_type is not None:
 *             stype = asStencil(stencil_type)
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_asBoundary(__pyx_v_boundary_type, (&__pyx_v_btx), (&__pyx_v_bty), (&__pyx_v_btz)); if (unlikely(__pyx_t_9 == -1L && PyErr_Occurred())) __PYX_ERR(41, 68, __pyx_L1_error)

    /* "PETSc/DMDA.pyx":67
 *                                                  &lx, &ly, &lz)
 *         # periodicity, stencil type & width
 *         if boundary_type is not None:             # <<<<<<<<<<<<<<
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         if stencil_type is not None:
 */
  }

  /* "PETSc/DMDA.pyx":69
 *         if boundary_type is not None:
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         if stencil_type is not None:             # <<<<<<<<<<<<<<
 *             stype = asStencil(stencil_type)
 *         if stencil_width is not None:
 */
  __pyx_t_7 = (__pyx_v_stencil_type != Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "PETSc/DMDA.pyx":70
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         if stencil_type is not None:
 *             stype = asStencil(stencil_type)             # <<<<<<<<<<<<<<
 *         if stencil_width is not None:
 *             swidth = asInt(stencil_width)
 */
    __pyx_t_10 = __pyx_f_8petsc4py_5PETSc_asStencil(__pyx_v_stencil_type); if (unlikely(__pyx_t_10 == ((DMDAStencilType)-1L))) __PYX_ERR(41, 70, __pyx_L1_error)
    __pyx_v_stype = __pyx_t_10;

    /* "PETSc/DMDA.pyx":69
 *         if boundary_type is not None:
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         if stencil_type is not None:             # <<<<<<<<<<<<<<
 *             stype = asStencil(stencil_type)
 *         if stencil_width is not None:
 */
  }

  /* "PETSc/DMDA.pyx":71
 *         if stencil_type is not None:
 *             stype = asStencil(stencil_type)
 *         if stencil_width is not None:             # <<<<<<<<<<<<<<
 *             swidth = asInt(stencil_width)
 *         if setup and swidth == PETSC_DECIDE: swidth = 0
 */
  __pyx_t_8 = (__pyx_v_stencil_width != Py_None);
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (__pyx_t_7) {

    /* "PETSc/DMDA.pyx":72
 *             stype = asStencil(stencil_type)
 *         if stencil_width is not None:
 *             swidth = asInt(stencil_width)             # <<<<<<<<<<<<<<
 *         if setup and swidth == PETSC_DECIDE: swidth = 0
 *         # create the DMDA object
 */
    __pyx_t_9 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_stencil_width); if (unlikely(__pyx_t_9 == -1L && PyErr_Occurred())) __PYX_ERR(41, 72, __pyx_L1_error)
    __pyx_v_swidth = __pyx_t_9;

    /* "PETSc/DMDA.pyx":71
 *         if stencil_type is not None:
 *             stype = asStencil(stencil_type)
 *         if stencil_width is not None:             # <<<<<<<<<<<<<<
 *             swidth = asInt(stencil_width)
 *         if setup and swidth == PETSC_DECIDE: swidth = 0
 */
  }

  /* "PETSc/DMDA.pyx":73
 *         if stencil_width is not None:
 *             swidth = asInt(stencil_width)
 *         if setup and swidth == PETSC_DECIDE: swidth = 0             # <<<<<<<<<<<<<<
 *         # create the DMDA object
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_8 = (__pyx_v_setup != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L25_bool_binop_done;
  }
  __pyx_t_8 = ((__pyx_v_swidth == PETSC_DECIDE) != 0);
  __pyx_t_7 = __pyx_t_8;
  __pyx_L25_bool_binop_done:;
  if (__pyx_t_7) {
    __pyx_v_swidth = 0;
  }

  /* "PETSc/DMDA.pyx":75
 *         if setup and swidth == PETSC_DECIDE: swidth = 0
 *         # create the DMDA object
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscDM newda = NULL
 *         CHKERR( DMDACreateND(ccomm, ndim, ndof,
 */
  __pyx_t_11 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(41, 75, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_11;

  /* "PETSc/DMDA.pyx":76
 *         # create the DMDA object
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newda = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMDACreateND(ccomm, ndim, ndof,
 *                              M, N, P, m, n, p, lx, ly, lz,
 */
  __pyx_v_newda = NULL;

  /* "PETSc/DMDA.pyx":77
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newda = NULL
 *         CHKERR( DMDACreateND(ccomm, ndim, ndof,             # <<<<<<<<<<<<<<
 *                              M, N, P, m, n, p, lx, ly, lz,
 *                              btx, bty, btz, stype, swidth,
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDACreateND(__pyx_v_ccomm, __pyx_v_ndim, __pyx_v_ndof, __pyx_v_M, __pyx_v_N, __pyx_v_P, __pyx_v_m, __pyx_v_n, __pyx_v_p, __pyx_v_lx, __pyx_v_ly, __pyx_v_lz, __pyx_v_btx, __pyx_v_bty, __pyx_v_btz, __pyx_v_stype, __pyx_v_swidth, (&__pyx_v_newda))); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(41, 77, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":81
 *                              btx, bty, btz, stype, swidth,
 *                              &newda) )
 *         if setup and ndim > 0: CHKERR( DMSetUp(newda) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newda
 *         return self
 */
  __pyx_t_8 = (__pyx_v_setup != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L28_bool_binop_done;
  }
  __pyx_t_8 = ((__pyx_v_ndim > 0) != 0);
  __pyx_t_7 = __pyx_t_8;
  __pyx_L28_bool_binop_done:;
  if (__pyx_t_7) {
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetUp(__pyx_v_newda)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(41, 81, __pyx_L1_error)
  }

  /* "PETSc/DMDA.pyx":82
 *                              &newda) )
 *         if setup and ndim > 0: CHKERR( DMSetUp(newda) )
 *         PetscCLEAR(self.obj); self.dm = newda             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newda;

  /* "PETSc/DMDA.pyx":83
 *         if setup and ndim > 0: CHKERR( DMSetUp(newda) )
 *         PetscCLEAR(self.obj); self.dm = newda
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def duplicate(self, dof=None, boundary_type=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":25
 *     #
 * 
 *     def create(self, dim=None, dof=None,             # <<<<<<<<<<<<<<
 *                sizes=None, proc_sizes=None, boundary_type=None,
 *                stencil_type=None, stencil_width=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XDECREF(__pyx_v_gsizes);
  __Pyx_XDECREF(__pyx_v_psizes);
  __Pyx_XDECREF(__pyx_v_dim);
  __Pyx_XDECREF(__pyx_v_sizes);
  __Pyx_XDECREF(__pyx_v_ownership_ranges);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":85
 *         return self
 * 
 *     def duplicate(self, dof=None, boundary_type=None,             # <<<<<<<<<<<<<<
 *                   stencil_type=None, stencil_width=None):
 *         cdef PetscInt ndim = 0, ndof = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_3duplicate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_2duplicate[] = "DMDA.duplicate(self, dof=None, boundary_type=None, stencil_type=None, stencil_width=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_3duplicate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dof = 0;
  PyObject *__pyx_v_boundary_type = 0;
  PyObject *__pyx_v_stencil_type = 0;
  PyObject *__pyx_v_stencil_width = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("duplicate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dof,&__pyx_n_s_boundary_type,&__pyx_n_s_stencil_type,&__pyx_n_s_stencil_width,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);

    /* "PETSc/DMDA.pyx":86
 * 
 *     def duplicate(self, dof=None, boundary_type=None,
 *                   stencil_type=None, stencil_width=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ndim = 0, ndof = 0
 *         cdef PetscInt M = 1, N = 1, P = 1
 */
    values[2] = ((PyObject *)Py_None);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dof);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boundary_type);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stencil_type);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stencil_width);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "duplicate") < 0)) __PYX_ERR(41, 85, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_dof = values[0];
    __pyx_v_boundary_type = values[1];
    __pyx_v_stencil_type = values[2];
    __pyx_v_stencil_width = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("duplicate", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 85, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.duplicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_2duplicate(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_dof, __pyx_v_boundary_type, __pyx_v_stencil_type, __pyx_v_stencil_width);

  /* "PETSc/DMDA.pyx":85
 *         return self
 * 
 *     def duplicate(self, dof=None, boundary_type=None,             # <<<<<<<<<<<<<<
 *                   stencil_type=None, stencil_width=None):
 *         cdef PetscInt ndim = 0, ndof = 0
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_2duplicate(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_dof, PyObject *__pyx_v_boundary_type, PyObject *__pyx_v_stencil_type, PyObject *__pyx_v_stencil_width) {
  PetscInt __pyx_v_ndim;
  PetscInt __pyx_v_ndof;
  PetscInt __pyx_v_M;
  PetscInt __pyx_v_N;
  PetscInt __pyx_v_P;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_p;
  DMBoundaryType __pyx_v_btx;
  DMBoundaryType __pyx_v_bty;
  DMBoundaryType __pyx_v_btz;
  DMDAStencilType __pyx_v_stype;
  PetscInt __pyx_v_swidth;
  const PetscInt *__pyx_v_lx;
  const PetscInt *__pyx_v_ly;
  const PetscInt *__pyx_v_lz;
  MPI_Comm __pyx_v_comm;
  struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_da = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PetscInt __pyx_t_4;
  DMDAStencilType __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("duplicate", 0);

  /* "PETSc/DMDA.pyx":87
 *     def duplicate(self, dof=None, boundary_type=None,
 *                   stencil_type=None, stencil_width=None):
 *         cdef PetscInt ndim = 0, ndof = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt M = 1, N = 1, P = 1
 *         cdef PetscInt m = 1, n = 1, p = 1
 */
  __pyx_v_ndim = 0;
  __pyx_v_ndof = 0;

  /* "PETSc/DMDA.pyx":88
 *                   stencil_type=None, stencil_width=None):
 *         cdef PetscInt ndim = 0, ndof = 0
 *         cdef PetscInt M = 1, N = 1, P = 1             # <<<<<<<<<<<<<<
 *         cdef PetscInt m = 1, n = 1, p = 1
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 */
  __pyx_v_M = 1;
  __pyx_v_N = 1;
  __pyx_v_P = 1;

  /* "PETSc/DMDA.pyx":89
 *         cdef PetscInt ndim = 0, ndof = 0
 *         cdef PetscInt M = 1, N = 1, P = 1
 *         cdef PetscInt m = 1, n = 1, p = 1             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 */
  __pyx_v_m = 1;
  __pyx_v_n = 1;
  __pyx_v_p = 1;

  /* "PETSc/DMDA.pyx":90
 *         cdef PetscInt M = 1, N = 1, P = 1
 *         cdef PetscInt m = 1, n = 1, p = 1
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 */
  __pyx_v_btx = DM_BOUNDARY_NONE;

  /* "PETSc/DMDA.pyx":91
 *         cdef PetscInt m = 1, n = 1, p = 1
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         cdef PetscDMDAStencilType  stype  = DMDA_STENCIL_BOX
 */
  __pyx_v_bty = DM_BOUNDARY_NONE;

  /* "PETSc/DMDA.pyx":92
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAStencilType  stype  = DMDA_STENCIL_BOX
 *         cdef PetscInt              swidth = PETSC_DECIDE
 */
  __pyx_v_btz = DM_BOUNDARY_NONE;

  /* "PETSc/DMDA.pyx":93
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         cdef PetscDMDAStencilType  stype  = DMDA_STENCIL_BOX             # <<<<<<<<<<<<<<
 *         cdef PetscInt              swidth = PETSC_DECIDE
 *         CHKERR( DMDAGetInfo(self.dm,
 */
  __pyx_v_stype = DMDA_STENCIL_BOX;

  /* "PETSc/DMDA.pyx":94
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         cdef PetscDMDAStencilType  stype  = DMDA_STENCIL_BOX
 *         cdef PetscInt              swidth = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetInfo(self.dm,
 *                           &ndim,
 */
  __pyx_v_swidth = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":95
 *         cdef PetscDMDAStencilType  stype  = DMDA_STENCIL_BOX
 *         cdef PetscInt              swidth = PETSC_DECIDE
 *         CHKERR( DMDAGetInfo(self.dm,             # <<<<<<<<<<<<<<
 *                           &ndim,
 *                           &M, &N, &P,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetInfo(__pyx_v_self->__pyx_base.dm, (&__pyx_v_ndim), (&__pyx_v_M), (&__pyx_v_N), (&__pyx_v_P), (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_p), (&__pyx_v_ndof), (&__pyx_v_swidth), (&__pyx_v_btx), (&__pyx_v_bty), (&__pyx_v_btz), (&__pyx_v_stype))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 95, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":102
 *                           &btx, &bty, &btz,
 *                           &stype) )
 *         cdef const_PetscInt *lx = NULL, *ly = NULL, *lz = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetOwnershipRanges(self.dm, &lx, &ly, &lz) )
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 */
  __pyx_v_lx = NULL;
  __pyx_v_ly = NULL;
  __pyx_v_lz = NULL;

  /* "PETSc/DMDA.pyx":103
 *                           &stype) )
 *         cdef const_PetscInt *lx = NULL, *ly = NULL, *lz = NULL
 *         CHKERR( DMDAGetOwnershipRanges(self.dm, &lx, &ly, &lz) )             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &comm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetOwnershipRanges(__pyx_v_self->__pyx_base.dm, (&__pyx_v_lx), (&__pyx_v_ly), (&__pyx_v_lz))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 103, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":104
 *         cdef const_PetscInt *lx = NULL, *ly = NULL, *lz = NULL
 *         CHKERR( DMDAGetOwnershipRanges(self.dm, &lx, &ly, &lz) )
 *         cdef MPI_Comm comm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &comm) )
 *         #
 */
  __pyx_v_comm = MPI_COMM_NULL;

  /* "PETSc/DMDA.pyx":105
 *         CHKERR( DMDAGetOwnershipRanges(self.dm, &lx, &ly, &lz) )
 *         cdef MPI_Comm comm = MPI_COMM_NULL
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &comm) )             # <<<<<<<<<<<<<<
 *         #
 *         if dof is not None:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetComm(((PetscObject)__pyx_v_self->__pyx_base.dm), (&__pyx_v_comm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 105, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":107
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &comm) )
 *         #
 *         if dof is not None:             # <<<<<<<<<<<<<<
 *             ndof = asInt(dof)
 *         if boundary_type is not None:
 */
  __pyx_t_2 = (__pyx_v_dof != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/DMDA.pyx":108
 *         #
 *         if dof is not None:
 *             ndof = asInt(dof)             # <<<<<<<<<<<<<<
 *         if boundary_type is not None:
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_dof); if (unlikely(__pyx_t_4 == -1L && PyErr_Occurred())) __PYX_ERR(41, 108, __pyx_L1_error)
    __pyx_v_ndof = __pyx_t_4;

    /* "PETSc/DMDA.pyx":107
 *         CHKERR( PetscObjectGetComm(<PetscObject>self.dm, &comm) )
 *         #
 *         if dof is not None:             # <<<<<<<<<<<<<<
 *             ndof = asInt(dof)
 *         if boundary_type is not None:
 */
  }

  /* "PETSc/DMDA.pyx":109
 *         if dof is not None:
 *             ndof = asInt(dof)
 *         if boundary_type is not None:             # <<<<<<<<<<<<<<
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         if stencil_type  is not None:
 */
  __pyx_t_3 = (__pyx_v_boundary_type != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMDA.pyx":110
 *             ndof = asInt(dof)
 *         if boundary_type is not None:
 *             asBoundary(boundary_type, &btx, &bty, &btz)             # <<<<<<<<<<<<<<
 *         if stencil_type  is not None:
 *             stype = asStencil(stencil_type)
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asBoundary(__pyx_v_boundary_type, (&__pyx_v_btx), (&__pyx_v_bty), (&__pyx_v_btz)); if (unlikely(__pyx_t_4 == -1L && PyErr_Occurred())) __PYX_ERR(41, 110, __pyx_L1_error)

    /* "PETSc/DMDA.pyx":109
 *         if dof is not None:
 *             ndof = asInt(dof)
 *         if boundary_type is not None:             # <<<<<<<<<<<<<<
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         if stencil_type  is not None:
 */
  }

  /* "PETSc/DMDA.pyx":111
 *         if boundary_type is not None:
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         if stencil_type  is not None:             # <<<<<<<<<<<<<<
 *             stype = asStencil(stencil_type)
 *         if stencil_width is not None:
 */
  __pyx_t_2 = (__pyx_v_stencil_type != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/DMDA.pyx":112
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         if stencil_type  is not None:
 *             stype = asStencil(stencil_type)             # <<<<<<<<<<<<<<
 *         if stencil_width is not None:
 *             swidth = asInt(stencil_width)
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_asStencil(__pyx_v_stencil_type); if (unlikely(__pyx_t_5 == ((DMDAStencilType)-1L))) __PYX_ERR(41, 112, __pyx_L1_error)
    __pyx_v_stype = __pyx_t_5;

    /* "PETSc/DMDA.pyx":111
 *         if boundary_type is not None:
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         if stencil_type  is not None:             # <<<<<<<<<<<<<<
 *             stype = asStencil(stencil_type)
 *         if stencil_width is not None:
 */
  }

  /* "PETSc/DMDA.pyx":113
 *         if stencil_type  is not None:
 *             stype = asStencil(stencil_type)
 *         if stencil_width is not None:             # <<<<<<<<<<<<<<
 *             swidth = asInt(stencil_width)
 *         #
 */
  __pyx_t_3 = (__pyx_v_stencil_width != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMDA.pyx":114
 *             stype = asStencil(stencil_type)
 *         if stencil_width is not None:
 *             swidth = asInt(stencil_width)             # <<<<<<<<<<<<<<
 *         #
 *         cdef DMDA da = DMDA()
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_stencil_width); if (unlikely(__pyx_t_4 == -1L && PyErr_Occurred())) __PYX_ERR(41, 114, __pyx_L1_error)
    __pyx_v_swidth = __pyx_t_4;

    /* "PETSc/DMDA.pyx":113
 *         if stencil_type  is not None:
 *             stype = asStencil(stencil_type)
 *         if stencil_width is not None:             # <<<<<<<<<<<<<<
 *             swidth = asInt(stencil_width)
 *         #
 */
  }

  /* "PETSc/DMDA.pyx":116
 *             swidth = asInt(stencil_width)
 *         #
 *         cdef DMDA da = DMDA()             # <<<<<<<<<<<<<<
 *         CHKERR( DMDACreateND(comm, ndim, ndof,
 *                              M, N, P, m, n, p, lx, ly, lz,
 */
  __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMDA), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(41, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_v_da = ((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "PETSc/DMDA.pyx":117
 *         #
 *         cdef DMDA da = DMDA()
 *         CHKERR( DMDACreateND(comm, ndim, ndof,             # <<<<<<<<<<<<<<
 *                              M, N, P, m, n, p, lx, ly, lz,
 *                              btx, bty, btz, stype, swidth,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDACreateND(__pyx_v_comm, __pyx_v_ndim, __pyx_v_ndof, __pyx_v_M, __pyx_v_N, __pyx_v_P, __pyx_v_m, __pyx_v_n, __pyx_v_p, __pyx_v_lx, __pyx_v_ly, __pyx_v_lz, __pyx_v_btx, __pyx_v_bty, __pyx_v_btz, __pyx_v_stype, __pyx_v_swidth, (&__pyx_v_da->__pyx_base.dm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 117, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":121
 *                              btx, bty, btz, stype, swidth,
 *                              &da.dm) )
 *         CHKERR( DMSetUp(da.dm) )             # <<<<<<<<<<<<<<
 *         return da
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetUp(__pyx_v_da->__pyx_base.dm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 121, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":122
 *                              &da.dm) )
 *         CHKERR( DMSetUp(da.dm) )
 *         return da             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_da));
  __pyx_r = ((PyObject *)__pyx_v_da);
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":85
 *         return self
 * 
 *     def duplicate(self, dof=None, boundary_type=None,             # <<<<<<<<<<<<<<
 *                   stencil_type=None, stencil_width=None):
 *         cdef PetscInt ndim = 0, ndof = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.duplicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_da);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":126
 *     #
 * 
 *     def setDim(self, dim):             # <<<<<<<<<<<<<<
 *         return self.setDimension(dim)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_5setDim(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_4setDim[] = "DMDA.setDim(self, dim)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_5setDim(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dim = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDim (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dim,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);
        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_dim)) != 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, "setDim") < 0)) __PYX_ERR(41, 126, __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_dim = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDim", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 126, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setDim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_4setDim(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_dim);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_4setDim(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_dim) {
  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_RefNannySetupContext("setDim", 0);

  /* "PETSc/DMDA.pyx":127
 * 
 *     def setDim(self, dim):
 *         return self.setDimension(dim)             # <<<<<<<<<<<<<<
 * 
 *     def getDim(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setDimension); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 127, __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_dim);
    __Pyx_GIVEREF(__pyx_v_dim);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_dim);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 127, __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_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":126
 *     #
 * 
 *     def setDim(self, dim):             # <<<<<<<<<<<<<<
 *         return self.setDimension(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_AddTraceback("petsc4py.PETSc.DMDA.setDim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":129
 *         return self.setDimension(dim)
 * 
 *     def getDim(self):             # <<<<<<<<<<<<<<
 *         return self.getDimension()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_7getDim(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_6getDim[] = "DMDA.getDim(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_7getDim(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDim (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDim", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDim", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_6getDim(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_6getDim(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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("getDim", 0);

  /* "PETSc/DMDA.pyx":130
 * 
 *     def getDim(self):
 *         return self.getDimension()             # <<<<<<<<<<<<<<
 * 
 *     def setDof(self, dof):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getDimension); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 130, __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(41, 130, __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;

  /* "PETSc/DMDA.pyx":129
 *         return self.setDimension(dim)
 * 
 *     def getDim(self):             # <<<<<<<<<<<<<<
 *         return self.getDimension()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getDim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":132
 *         return self.getDimension()
 * 
 *     def setDof(self, dof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ndof = asInt(dof)
 *         CHKERR( DMDASetDof(self.dm, ndof) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_9setDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_8setDof[] = "DMDA.setDof(self, dof)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_9setDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dof = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDof (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dof,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);
        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_dof)) != 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, "setDof") < 0)) __PYX_ERR(41, 132, __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_dof = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDof", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 132, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_8setDof(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_dof);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_8setDof(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_dof) {
  PetscInt __pyx_v_ndof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setDof", 0);

  /* "PETSc/DMDA.pyx":133
 * 
 *     def setDof(self, dof):
 *         cdef PetscInt ndof = asInt(dof)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetDof(self.dm, ndof) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_dof); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(41, 133, __pyx_L1_error)
  __pyx_v_ndof = __pyx_t_1;

  /* "PETSc/DMDA.pyx":134
 *     def setDof(self, dof):
 *         cdef PetscInt ndof = asInt(dof)
 *         CHKERR( DMDASetDof(self.dm, ndof) )             # <<<<<<<<<<<<<<
 * 
 *     def getDof(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetDof(__pyx_v_self->__pyx_base.dm, __pyx_v_ndof)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 134, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":132
 *         return self.getDimension()
 * 
 *     def setDof(self, dof):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ndof = asInt(dof)
 *         CHKERR( DMDASetDof(self.dm, ndof) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":136
 *         CHKERR( DMDASetDof(self.dm, ndof) )
 * 
 *     def getDof(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dof = 0
 *         CHKERR( DMDAGetInfo(self.dm,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_11getDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_10getDof[] = "DMDA.getDof(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_11getDof(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDof (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDof", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDof", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_10getDof(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_10getDof(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_dof;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getDof", 0);

  /* "PETSc/DMDA.pyx":137
 * 
 *     def getDof(self):
 *         cdef PetscInt dof = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetInfo(self.dm,
 *                             NULL,
 */
  __pyx_v_dof = 0;

  /* "PETSc/DMDA.pyx":138
 *     def getDof(self):
 *         cdef PetscInt dof = 0
 *         CHKERR( DMDAGetInfo(self.dm,             # <<<<<<<<<<<<<<
 *                             NULL,
 *                             NULL, NULL, NULL,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetInfo(__pyx_v_self->__pyx_base.dm, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (&__pyx_v_dof), NULL, NULL, NULL, NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 138, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":145
 *                             NULL, NULL, NULL,
 *                             NULL) )
 *         return toInt(dof)             # <<<<<<<<<<<<<<
 * 
 *     def setSizes(self, sizes):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_dof); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":136
 *         CHKERR( DMDASetDof(self.dm, ndof) )
 * 
 *     def getDof(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dof = 0
 *         CHKERR( DMDAGetInfo(self.dm,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getDof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":147
 *         return toInt(dof)
 * 
 *     def setSizes(self, sizes):             # <<<<<<<<<<<<<<
 *         cdef tuple gsizes = tuple(sizes)
 *         cdef PetscInt gdim = PETSC_DECIDE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_13setSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_12setSizes[] = "DMDA.setSizes(self, sizes)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_13setSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sizes = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setSizes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sizes,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);
        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_sizes)) != 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, "setSizes") < 0)) __PYX_ERR(41, 147, __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_sizes = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setSizes", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 147, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_12setSizes(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_sizes);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_12setSizes(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_sizes) {
  PyObject *__pyx_v_gsizes = 0;
  PetscInt __pyx_v_gdim;
  PetscInt __pyx_v_M;
  PetscInt __pyx_v_N;
  PetscInt __pyx_v_P;
  PetscInt __pyx_v_dim;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PetscInt __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setSizes", 0);

  /* "PETSc/DMDA.pyx":148
 * 
 *     def setSizes(self, sizes):
 *         cdef tuple gsizes = tuple(sizes)             # <<<<<<<<<<<<<<
 *         cdef PetscInt gdim = PETSC_DECIDE
 *         cdef PetscInt M = 1
 */
  __pyx_t_1 = PySequence_Tuple(__pyx_v_sizes); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_gsizes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMDA.pyx":149
 *     def setSizes(self, sizes):
 *         cdef tuple gsizes = tuple(sizes)
 *         cdef PetscInt gdim = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         cdef PetscInt M = 1
 *         cdef PetscInt N = 1
 */
  __pyx_v_gdim = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":150
 *         cdef tuple gsizes = tuple(sizes)
 *         cdef PetscInt gdim = PETSC_DECIDE
 *         cdef PetscInt M = 1             # <<<<<<<<<<<<<<
 *         cdef PetscInt N = 1
 *         cdef PetscInt P = 1
 */
  __pyx_v_M = 1;

  /* "PETSc/DMDA.pyx":151
 *         cdef PetscInt gdim = PETSC_DECIDE
 *         cdef PetscInt M = 1
 *         cdef PetscInt N = 1             # <<<<<<<<<<<<<<
 *         cdef PetscInt P = 1
 *         gdim = asDims(gsizes, &M, &N, &P)
 */
  __pyx_v_N = 1;

  /* "PETSc/DMDA.pyx":152
 *         cdef PetscInt M = 1
 *         cdef PetscInt N = 1
 *         cdef PetscInt P = 1             # <<<<<<<<<<<<<<
 *         gdim = asDims(gsizes, &M, &N, &P)
 *         cdef PetscInt dim = PETSC_DECIDE
 */
  __pyx_v_P = 1;

  /* "PETSc/DMDA.pyx":153
 *         cdef PetscInt N = 1
 *         cdef PetscInt P = 1
 *         gdim = asDims(gsizes, &M, &N, &P)             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = PETSC_DECIDE
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asDims(__pyx_v_gsizes, (&__pyx_v_M), (&__pyx_v_N), (&__pyx_v_P)); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(41, 153, __pyx_L1_error)
  __pyx_v_gdim = __pyx_t_2;

  /* "PETSc/DMDA.pyx":154
 *         cdef PetscInt P = 1
 *         gdim = asDims(gsizes, &M, &N, &P)
 *         cdef PetscInt dim = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         if dim == PETSC_DECIDE:
 */
  __pyx_v_dim = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":155
 *         gdim = asDims(gsizes, &M, &N, &P)
 *         cdef PetscInt dim = PETSC_DECIDE
 *         CHKERR( DMDAGetDim(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         if dim == PETSC_DECIDE:
 *             CHKERR( DMSetDimension(self.dm, gdim) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_DMDAGetDim(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(41, 155, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":156
 *         cdef PetscInt dim = PETSC_DECIDE
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         if dim == PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             CHKERR( DMSetDimension(self.dm, gdim) )
 *         CHKERR( DMDASetSizes(self.dm, M, N, P) )
 */
  __pyx_t_4 = ((__pyx_v_dim == PETSC_DECIDE) != 0);
  if (__pyx_t_4) {

    /* "PETSc/DMDA.pyx":157
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         if dim == PETSC_DECIDE:
 *             CHKERR( DMSetDimension(self.dm, gdim) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetSizes(self.dm, M, N, P) )
 * 
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetDimension(__pyx_v_self->__pyx_base.dm, __pyx_v_gdim)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(41, 157, __pyx_L1_error)

    /* "PETSc/DMDA.pyx":156
 *         cdef PetscInt dim = PETSC_DECIDE
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         if dim == PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             CHKERR( DMSetDimension(self.dm, gdim) )
 *         CHKERR( DMDASetSizes(self.dm, M, N, P) )
 */
  }

  /* "PETSc/DMDA.pyx":158
 *         if dim == PETSC_DECIDE:
 *             CHKERR( DMSetDimension(self.dm, gdim) )
 *         CHKERR( DMDASetSizes(self.dm, M, N, P) )             # <<<<<<<<<<<<<<
 * 
 *     def getSizes(self):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetSizes(__pyx_v_self->__pyx_base.dm, __pyx_v_M, __pyx_v_N, __pyx_v_P)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(41, 158, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":147
 *         return toInt(dof)
 * 
 *     def setSizes(self, sizes):             # <<<<<<<<<<<<<<
 *         cdef tuple gsizes = tuple(sizes)
 *         cdef PetscInt gdim = PETSC_DECIDE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gsizes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":160
 *         CHKERR( DMDASetSizes(self.dm, M, N, P) )
 * 
 *     def getSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = 0
 *         cdef PetscInt M = PETSC_DECIDE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_15getSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_14getSizes[] = "DMDA.getSizes(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_15getSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSizes (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getSizes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getSizes", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_14getSizes(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_14getSizes(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_dim;
  PetscInt __pyx_v_M;
  PetscInt __pyx_v_N;
  PetscInt __pyx_v_P;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getSizes", 0);

  /* "PETSc/DMDA.pyx":161
 * 
 *     def getSizes(self):
 *         cdef PetscInt dim = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt M = PETSC_DECIDE
 *         cdef PetscInt N = PETSC_DECIDE
 */
  __pyx_v_dim = 0;

  /* "PETSc/DMDA.pyx":162
 *     def getSizes(self):
 *         cdef PetscInt dim = 0
 *         cdef PetscInt M = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         cdef PetscInt N = PETSC_DECIDE
 *         cdef PetscInt P = PETSC_DECIDE
 */
  __pyx_v_M = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":163
 *         cdef PetscInt dim = 0
 *         cdef PetscInt M = PETSC_DECIDE
 *         cdef PetscInt N = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         cdef PetscInt P = PETSC_DECIDE
 *         CHKERR( DMDAGetInfo(self.dm,
 */
  __pyx_v_N = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":164
 *         cdef PetscInt M = PETSC_DECIDE
 *         cdef PetscInt N = PETSC_DECIDE
 *         cdef PetscInt P = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetInfo(self.dm,
 *                             &dim,
 */
  __pyx_v_P = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":165
 *         cdef PetscInt N = PETSC_DECIDE
 *         cdef PetscInt P = PETSC_DECIDE
 *         CHKERR( DMDAGetInfo(self.dm,             # <<<<<<<<<<<<<<
 *                             &dim,
 *                             &M, &N, &P,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetInfo(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim), (&__pyx_v_M), (&__pyx_v_N), (&__pyx_v_P), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 165, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":172
 *                             NULL, NULL, NULL,
 *                             NULL) )
 *         return toDims(dim, M, N, P)             # <<<<<<<<<<<<<<
 * 
 *     def setProcSizes(self, proc_sizes):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toDims(__pyx_v_dim, __pyx_v_M, __pyx_v_N, __pyx_v_P); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":160
 *         CHKERR( DMDASetSizes(self.dm, M, N, P) )
 * 
 *     def getSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = 0
 *         cdef PetscInt M = PETSC_DECIDE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":174
 *         return toDims(dim, M, N, P)
 * 
 *     def setProcSizes(self, proc_sizes):             # <<<<<<<<<<<<<<
 *         cdef tuple psizes = tuple(proc_sizes)
 *         cdef PetscInt pdim = PETSC_DECIDE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_17setProcSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_16setProcSizes[] = "DMDA.setProcSizes(self, proc_sizes)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_17setProcSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_proc_sizes = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setProcSizes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_proc_sizes,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);
        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_proc_sizes)) != 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, "setProcSizes") < 0)) __PYX_ERR(41, 174, __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_proc_sizes = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setProcSizes", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 174, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setProcSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_16setProcSizes(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_proc_sizes);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_16setProcSizes(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_proc_sizes) {
  PyObject *__pyx_v_psizes = 0;
  PetscInt __pyx_v_pdim;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_p;
  PetscInt __pyx_v_dim;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PetscInt __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setProcSizes", 0);

  /* "PETSc/DMDA.pyx":175
 * 
 *     def setProcSizes(self, proc_sizes):
 *         cdef tuple psizes = tuple(proc_sizes)             # <<<<<<<<<<<<<<
 *         cdef PetscInt pdim = PETSC_DECIDE
 *         cdef PetscInt m = PETSC_DECIDE
 */
  __pyx_t_1 = PySequence_Tuple(__pyx_v_proc_sizes); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_psizes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMDA.pyx":176
 *     def setProcSizes(self, proc_sizes):
 *         cdef tuple psizes = tuple(proc_sizes)
 *         cdef PetscInt pdim = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         cdef PetscInt m = PETSC_DECIDE
 *         cdef PetscInt n = PETSC_DECIDE
 */
  __pyx_v_pdim = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":177
 *         cdef tuple psizes = tuple(proc_sizes)
 *         cdef PetscInt pdim = PETSC_DECIDE
 *         cdef PetscInt m = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = PETSC_DECIDE
 *         cdef PetscInt p = PETSC_DECIDE
 */
  __pyx_v_m = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":178
 *         cdef PetscInt pdim = PETSC_DECIDE
 *         cdef PetscInt m = PETSC_DECIDE
 *         cdef PetscInt n = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         cdef PetscInt p = PETSC_DECIDE
 *         pdim = asDims(psizes, &m, &n, &p)
 */
  __pyx_v_n = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":179
 *         cdef PetscInt m = PETSC_DECIDE
 *         cdef PetscInt n = PETSC_DECIDE
 *         cdef PetscInt p = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         pdim = asDims(psizes, &m, &n, &p)
 *         cdef PetscInt dim = PETSC_DECIDE
 */
  __pyx_v_p = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":180
 *         cdef PetscInt n = PETSC_DECIDE
 *         cdef PetscInt p = PETSC_DECIDE
 *         pdim = asDims(psizes, &m, &n, &p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = PETSC_DECIDE
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asDims(__pyx_v_psizes, (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_p)); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(41, 180, __pyx_L1_error)
  __pyx_v_pdim = __pyx_t_2;

  /* "PETSc/DMDA.pyx":181
 *         cdef PetscInt p = PETSC_DECIDE
 *         pdim = asDims(psizes, &m, &n, &p)
 *         cdef PetscInt dim = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         if dim == PETSC_DECIDE:
 */
  __pyx_v_dim = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":182
 *         pdim = asDims(psizes, &m, &n, &p)
 *         cdef PetscInt dim = PETSC_DECIDE
 *         CHKERR( DMDAGetDim(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         if dim == PETSC_DECIDE:
 *             CHKERR( DMSetDimension(self.dm, pdim) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_DMDAGetDim(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(41, 182, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":183
 *         cdef PetscInt dim = PETSC_DECIDE
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         if dim == PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             CHKERR( DMSetDimension(self.dm, pdim) )
 *         CHKERR( DMDASetNumProcs(self.dm, m, n, p) )
 */
  __pyx_t_4 = ((__pyx_v_dim == PETSC_DECIDE) != 0);
  if (__pyx_t_4) {

    /* "PETSc/DMDA.pyx":184
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         if dim == PETSC_DECIDE:
 *             CHKERR( DMSetDimension(self.dm, pdim) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetNumProcs(self.dm, m, n, p) )
 * 
 */
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMSetDimension(__pyx_v_self->__pyx_base.dm, __pyx_v_pdim)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(41, 184, __pyx_L1_error)

    /* "PETSc/DMDA.pyx":183
 *         cdef PetscInt dim = PETSC_DECIDE
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         if dim == PETSC_DECIDE:             # <<<<<<<<<<<<<<
 *             CHKERR( DMSetDimension(self.dm, pdim) )
 *         CHKERR( DMDASetNumProcs(self.dm, m, n, p) )
 */
  }

  /* "PETSc/DMDA.pyx":185
 *         if dim == PETSC_DECIDE:
 *             CHKERR( DMSetDimension(self.dm, pdim) )
 *         CHKERR( DMDASetNumProcs(self.dm, m, n, p) )             # <<<<<<<<<<<<<<
 * 
 *     def getProcSizes(self):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetNumProcs(__pyx_v_self->__pyx_base.dm, __pyx_v_m, __pyx_v_n, __pyx_v_p)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(41, 185, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":174
 *         return toDims(dim, M, N, P)
 * 
 *     def setProcSizes(self, proc_sizes):             # <<<<<<<<<<<<<<
 *         cdef tuple psizes = tuple(proc_sizes)
 *         cdef PetscInt pdim = PETSC_DECIDE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setProcSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_psizes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":187
 *         CHKERR( DMDASetNumProcs(self.dm, m, n, p) )
 * 
 *     def getProcSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = 0
 *         cdef PetscInt m = PETSC_DECIDE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_19getProcSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_18getProcSizes[] = "DMDA.getProcSizes(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_19getProcSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getProcSizes (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getProcSizes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getProcSizes", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_18getProcSizes(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_18getProcSizes(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_dim;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getProcSizes", 0);

  /* "PETSc/DMDA.pyx":188
 * 
 *     def getProcSizes(self):
 *         cdef PetscInt dim = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt m = PETSC_DECIDE
 *         cdef PetscInt n = PETSC_DECIDE
 */
  __pyx_v_dim = 0;

  /* "PETSc/DMDA.pyx":189
 *     def getProcSizes(self):
 *         cdef PetscInt dim = 0
 *         cdef PetscInt m = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         cdef PetscInt n = PETSC_DECIDE
 *         cdef PetscInt p = PETSC_DECIDE
 */
  __pyx_v_m = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":190
 *         cdef PetscInt dim = 0
 *         cdef PetscInt m = PETSC_DECIDE
 *         cdef PetscInt n = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         cdef PetscInt p = PETSC_DECIDE
 *         CHKERR( DMDAGetInfo(self.dm,
 */
  __pyx_v_n = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":191
 *         cdef PetscInt m = PETSC_DECIDE
 *         cdef PetscInt n = PETSC_DECIDE
 *         cdef PetscInt p = PETSC_DECIDE             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetInfo(self.dm,
 *                             &dim,
 */
  __pyx_v_p = PETSC_DECIDE;

  /* "PETSc/DMDA.pyx":192
 *         cdef PetscInt n = PETSC_DECIDE
 *         cdef PetscInt p = PETSC_DECIDE
 *         CHKERR( DMDAGetInfo(self.dm,             # <<<<<<<<<<<<<<
 *                             &dim,
 *                             NULL, NULL, NULL,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetInfo(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim), NULL, NULL, NULL, (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_p), NULL, NULL, NULL, NULL, NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 192, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":199
 *                             NULL, NULL, NULL,
 *                             NULL) )
 *         return toDims(dim, m, n, p)             # <<<<<<<<<<<<<<
 * 
 *     def setBoundaryType(self, boundary_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toDims(__pyx_v_dim, __pyx_v_m, __pyx_v_n, __pyx_v_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":187
 *         CHKERR( DMDASetNumProcs(self.dm, m, n, p) )
 * 
 *     def getProcSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = 0
 *         cdef PetscInt m = PETSC_DECIDE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getProcSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":201
 *         return toDims(dim, m, n, p)
 * 
 *     def setBoundaryType(self, boundary_type):             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_21setBoundaryType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_20setBoundaryType[] = "DMDA.setBoundaryType(self, boundary_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_21setBoundaryType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_boundary_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setBoundaryType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_boundary_type,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);
        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_boundary_type)) != 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, "setBoundaryType") < 0)) __PYX_ERR(41, 201, __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_boundary_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setBoundaryType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 201, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setBoundaryType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_20setBoundaryType(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_boundary_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_20setBoundaryType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_boundary_type) {
  DMBoundaryType __pyx_v_btx;
  DMBoundaryType __pyx_v_bty;
  DMBoundaryType __pyx_v_btz;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setBoundaryType", 0);

  /* "PETSc/DMDA.pyx":202
 * 
 *     def setBoundaryType(self, boundary_type):
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 */
  __pyx_v_btx = DM_BOUNDARY_NONE;

  /* "PETSc/DMDA.pyx":203
 *     def setBoundaryType(self, boundary_type):
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         asBoundary(boundary_type, &btx, &bty, &btz)
 */
  __pyx_v_bty = DM_BOUNDARY_NONE;

  /* "PETSc/DMDA.pyx":204
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         asBoundary(boundary_type, &btx, &bty, &btz)
 *         CHKERR( DMDASetBoundaryType(self.dm, btx, bty, btz) )
 */
  __pyx_v_btz = DM_BOUNDARY_NONE;

  /* "PETSc/DMDA.pyx":205
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         asBoundary(boundary_type, &btx, &bty, &btz)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetBoundaryType(self.dm, btx, bty, btz) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asBoundary(__pyx_v_boundary_type, (&__pyx_v_btx), (&__pyx_v_bty), (&__pyx_v_btz)); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(41, 205, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":206
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         asBoundary(boundary_type, &btx, &bty, &btz)
 *         CHKERR( DMDASetBoundaryType(self.dm, btx, bty, btz) )             # <<<<<<<<<<<<<<
 * 
 *     def getBoundaryType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetBoundaryType(__pyx_v_self->__pyx_base.dm, __pyx_v_btx, __pyx_v_bty, __pyx_v_btz)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 206, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":201
 *         return toDims(dim, m, n, p)
 * 
 *     def setBoundaryType(self, boundary_type):             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setBoundaryType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":208
 *         CHKERR( DMDASetBoundaryType(self.dm, btx, bty, btz) )
 * 
 *     def getBoundaryType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = 0
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_23getBoundaryType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_22getBoundaryType[] = "DMDA.getBoundaryType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_23getBoundaryType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBoundaryType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getBoundaryType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getBoundaryType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_22getBoundaryType(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_22getBoundaryType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_dim;
  DMBoundaryType __pyx_v_btx;
  DMBoundaryType __pyx_v_bty;
  DMBoundaryType __pyx_v_btz;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getBoundaryType", 0);

  /* "PETSc/DMDA.pyx":209
 * 
 *     def getBoundaryType(self):
 *         cdef PetscInt dim = 0             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 */
  __pyx_v_dim = 0;

  /* "PETSc/DMDA.pyx":210
 *     def getBoundaryType(self):
 *         cdef PetscInt dim = 0
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 */
  __pyx_v_btx = DM_BOUNDARY_NONE;

  /* "PETSc/DMDA.pyx":211
 *         cdef PetscInt dim = 0
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         CHKERR( DMDAGetInfo(self.dm,
 */
  __pyx_v_bty = DM_BOUNDARY_NONE;

  /* "PETSc/DMDA.pyx":212
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetInfo(self.dm,
 *                           &dim,
 */
  __pyx_v_btz = DM_BOUNDARY_NONE;

  /* "PETSc/DMDA.pyx":213
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         CHKERR( DMDAGetInfo(self.dm,             # <<<<<<<<<<<<<<
 *                           &dim,
 *                           NULL, NULL, NULL,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetInfo(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (&__pyx_v_btx), (&__pyx_v_bty), (&__pyx_v_btz), NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 213, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":220
 *                           &btx, &bty, &btz,
 *                           NULL) )
 *         return toDims(dim, btx, bty, btz)             # <<<<<<<<<<<<<<
 * 
 *     def setStencilType(self, stencil_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toDims(__pyx_v_dim, __pyx_v_btx, __pyx_v_bty, __pyx_v_btz); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":208
 *         CHKERR( DMDASetBoundaryType(self.dm, btx, bty, btz) )
 * 
 *     def getBoundaryType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = 0
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getBoundaryType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":222
 *         return toDims(dim, btx, bty, btz)
 * 
 *     def setStencilType(self, stencil_type):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAStencilType stype = asStencil(stencil_type)
 *         CHKERR( DMDASetStencilType(self.dm, stype) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_25setStencilType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_24setStencilType[] = "DMDA.setStencilType(self, stencil_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_25setStencilType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_stencil_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setStencilType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stencil_type,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);
        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_stencil_type)) != 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, "setStencilType") < 0)) __PYX_ERR(41, 222, __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_stencil_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setStencilType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 222, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setStencilType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_24setStencilType(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_stencil_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_24setStencilType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_stencil_type) {
  DMDAStencilType __pyx_v_stype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  DMDAStencilType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setStencilType", 0);

  /* "PETSc/DMDA.pyx":223
 * 
 *     def setStencilType(self, stencil_type):
 *         cdef PetscDMDAStencilType stype = asStencil(stencil_type)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetStencilType(self.dm, stype) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asStencil(__pyx_v_stencil_type); if (unlikely(__pyx_t_1 == ((DMDAStencilType)-1L))) __PYX_ERR(41, 223, __pyx_L1_error)
  __pyx_v_stype = __pyx_t_1;

  /* "PETSc/DMDA.pyx":224
 *     def setStencilType(self, stencil_type):
 *         cdef PetscDMDAStencilType stype = asStencil(stencil_type)
 *         CHKERR( DMDASetStencilType(self.dm, stype) )             # <<<<<<<<<<<<<<
 * 
 *     def getStencilType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetStencilType(__pyx_v_self->__pyx_base.dm, __pyx_v_stype)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 224, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":222
 *         return toDims(dim, btx, bty, btz)
 * 
 *     def setStencilType(self, stencil_type):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAStencilType stype = asStencil(stencil_type)
 *         CHKERR( DMDASetStencilType(self.dm, stype) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setStencilType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":226
 *         CHKERR( DMDASetStencilType(self.dm, stype) )
 * 
 *     def getStencilType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAStencilType stype = DMDA_STENCIL_BOX
 *         CHKERR( DMDAGetInfo(self.dm,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_27getStencilType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_26getStencilType[] = "DMDA.getStencilType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_27getStencilType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getStencilType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getStencilType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getStencilType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_26getStencilType(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_26getStencilType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  DMDAStencilType __pyx_v_stype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getStencilType", 0);

  /* "PETSc/DMDA.pyx":227
 * 
 *     def getStencilType(self):
 *         cdef PetscDMDAStencilType stype = DMDA_STENCIL_BOX             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetInfo(self.dm,
 *                           NULL,
 */
  __pyx_v_stype = DMDA_STENCIL_BOX;

  /* "PETSc/DMDA.pyx":228
 *     def getStencilType(self):
 *         cdef PetscDMDAStencilType stype = DMDA_STENCIL_BOX
 *         CHKERR( DMDAGetInfo(self.dm,             # <<<<<<<<<<<<<<
 *                           NULL,
 *                           NULL, NULL, NULL,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetInfo(__pyx_v_self->__pyx_base.dm, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (&__pyx_v_stype))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 228, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":235
 *                           NULL, NULL, NULL,
 *                           &stype) )
 *         return stype             # <<<<<<<<<<<<<<
 * 
 *     def setStencilWidth(self, stencil_width):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_DMDAStencilType(__pyx_v_stype); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":226
 *         CHKERR( DMDASetStencilType(self.dm, stype) )
 * 
 *     def getStencilType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAStencilType stype = DMDA_STENCIL_BOX
 *         CHKERR( DMDAGetInfo(self.dm,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getStencilType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":237
 *         return stype
 * 
 *     def setStencilWidth(self, stencil_width):             # <<<<<<<<<<<<<<
 *         cdef PetscInt swidth = asInt(stencil_width)
 *         CHKERR( DMDASetStencilWidth(self.dm, swidth) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_29setStencilWidth(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_28setStencilWidth[] = "DMDA.setStencilWidth(self, stencil_width)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_29setStencilWidth(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_stencil_width = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setStencilWidth (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stencil_width,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);
        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_stencil_width)) != 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, "setStencilWidth") < 0)) __PYX_ERR(41, 237, __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_stencil_width = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setStencilWidth", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 237, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setStencilWidth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_28setStencilWidth(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_stencil_width);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_28setStencilWidth(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_stencil_width) {
  PetscInt __pyx_v_swidth;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setStencilWidth", 0);

  /* "PETSc/DMDA.pyx":238
 * 
 *     def setStencilWidth(self, stencil_width):
 *         cdef PetscInt swidth = asInt(stencil_width)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetStencilWidth(self.dm, swidth) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_stencil_width); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(41, 238, __pyx_L1_error)
  __pyx_v_swidth = __pyx_t_1;

  /* "PETSc/DMDA.pyx":239
 *     def setStencilWidth(self, stencil_width):
 *         cdef PetscInt swidth = asInt(stencil_width)
 *         CHKERR( DMDASetStencilWidth(self.dm, swidth) )             # <<<<<<<<<<<<<<
 * 
 *     def getStencilWidth(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetStencilWidth(__pyx_v_self->__pyx_base.dm, __pyx_v_swidth)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 239, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":237
 *         return stype
 * 
 *     def setStencilWidth(self, stencil_width):             # <<<<<<<<<<<<<<
 *         cdef PetscInt swidth = asInt(stencil_width)
 *         CHKERR( DMDASetStencilWidth(self.dm, swidth) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setStencilWidth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":241
 *         CHKERR( DMDASetStencilWidth(self.dm, swidth) )
 * 
 *     def getStencilWidth(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt swidth = 0
 *         CHKERR( DMDAGetInfo(self.dm,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_31getStencilWidth(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_30getStencilWidth[] = "DMDA.getStencilWidth(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_31getStencilWidth(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getStencilWidth (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getStencilWidth", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getStencilWidth", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_30getStencilWidth(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_30getStencilWidth(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_swidth;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getStencilWidth", 0);

  /* "PETSc/DMDA.pyx":242
 * 
 *     def getStencilWidth(self):
 *         cdef PetscInt swidth = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetInfo(self.dm,
 *                             NULL,
 */
  __pyx_v_swidth = 0;

  /* "PETSc/DMDA.pyx":243
 *     def getStencilWidth(self):
 *         cdef PetscInt swidth = 0
 *         CHKERR( DMDAGetInfo(self.dm,             # <<<<<<<<<<<<<<
 *                             NULL,
 *                             NULL, NULL, NULL,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetInfo(__pyx_v_self->__pyx_base.dm, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (&__pyx_v_swidth), NULL, NULL, NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 243, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":250
 *                             NULL, NULL, NULL,
 *                             NULL) )
 *         return toInt(swidth)             # <<<<<<<<<<<<<<
 * 
 *     def setStencil(self, stencil_type, stencil_width):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_swidth); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":241
 *         CHKERR( DMDASetStencilWidth(self.dm, swidth) )
 * 
 *     def getStencilWidth(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt swidth = 0
 *         CHKERR( DMDAGetInfo(self.dm,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getStencilWidth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":252
 *         return toInt(swidth)
 * 
 *     def setStencil(self, stencil_type, stencil_width):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAStencilType stype = asStencil(stencil_type)
 *         cdef PetscInt swidth = asInt(stencil_width)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_33setStencil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_32setStencil[] = "DMDA.setStencil(self, stencil_type, stencil_width)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_33setStencil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_stencil_type = 0;
  PyObject *__pyx_v_stencil_width = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setStencil (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stencil_type,&__pyx_n_s_stencil_width,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_stencil_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stencil_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setStencil", 1, 2, 2, 1); __PYX_ERR(41, 252, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setStencil") < 0)) __PYX_ERR(41, 252, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_stencil_type = values[0];
    __pyx_v_stencil_width = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setStencil", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 252, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setStencil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_32setStencil(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_stencil_type, __pyx_v_stencil_width);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_32setStencil(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_stencil_type, PyObject *__pyx_v_stencil_width) {
  DMDAStencilType __pyx_v_stype;
  PetscInt __pyx_v_swidth;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  DMDAStencilType __pyx_t_1;
  PetscInt __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setStencil", 0);

  /* "PETSc/DMDA.pyx":253
 * 
 *     def setStencil(self, stencil_type, stencil_width):
 *         cdef PetscDMDAStencilType stype = asStencil(stencil_type)             # <<<<<<<<<<<<<<
 *         cdef PetscInt swidth = asInt(stencil_width)
 *         CHKERR( DMDASetStencilType(self.dm, stype) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asStencil(__pyx_v_stencil_type); if (unlikely(__pyx_t_1 == ((DMDAStencilType)-1L))) __PYX_ERR(41, 253, __pyx_L1_error)
  __pyx_v_stype = __pyx_t_1;

  /* "PETSc/DMDA.pyx":254
 *     def setStencil(self, stencil_type, stencil_width):
 *         cdef PetscDMDAStencilType stype = asStencil(stencil_type)
 *         cdef PetscInt swidth = asInt(stencil_width)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetStencilType(self.dm, stype) )
 *         CHKERR( DMDASetStencilWidth(self.dm, swidth) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_stencil_width); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(41, 254, __pyx_L1_error)
  __pyx_v_swidth = __pyx_t_2;

  /* "PETSc/DMDA.pyx":255
 *         cdef PetscDMDAStencilType stype = asStencil(stencil_type)
 *         cdef PetscInt swidth = asInt(stencil_width)
 *         CHKERR( DMDASetStencilType(self.dm, stype) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetStencilWidth(self.dm, swidth) )
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetStencilType(__pyx_v_self->__pyx_base.dm, __pyx_v_stype)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(41, 255, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":256
 *         cdef PetscInt swidth = asInt(stencil_width)
 *         CHKERR( DMDASetStencilType(self.dm, stype) )
 *         CHKERR( DMDASetStencilWidth(self.dm, swidth) )             # <<<<<<<<<<<<<<
 * 
 *     def getStencil(self):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetStencilWidth(__pyx_v_self->__pyx_base.dm, __pyx_v_swidth)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(41, 256, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":252
 *         return toInt(swidth)
 * 
 *     def setStencil(self, stencil_type, stencil_width):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAStencilType stype = asStencil(stencil_type)
 *         cdef PetscInt swidth = asInt(stencil_width)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setStencil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":258
 *         CHKERR( DMDASetStencilWidth(self.dm, swidth) )
 * 
 *     def getStencil(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAStencilType stype = DMDA_STENCIL_BOX
 *         cdef PetscInt swidth = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_35getStencil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_34getStencil[] = "DMDA.getStencil(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_35getStencil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getStencil (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getStencil", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getStencil", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_34getStencil(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_34getStencil(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  DMDAStencilType __pyx_v_stype;
  PetscInt __pyx_v_swidth;
  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;
  __Pyx_RefNannySetupContext("getStencil", 0);

  /* "PETSc/DMDA.pyx":259
 * 
 *     def getStencil(self):
 *         cdef PetscDMDAStencilType stype = DMDA_STENCIL_BOX             # <<<<<<<<<<<<<<
 *         cdef PetscInt swidth = 0
 *         CHKERR( DMDAGetInfo(self.dm,
 */
  __pyx_v_stype = DMDA_STENCIL_BOX;

  /* "PETSc/DMDA.pyx":260
 *     def getStencil(self):
 *         cdef PetscDMDAStencilType stype = DMDA_STENCIL_BOX
 *         cdef PetscInt swidth = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetInfo(self.dm,
 *                             NULL,
 */
  __pyx_v_swidth = 0;

  /* "PETSc/DMDA.pyx":261
 *         cdef PetscDMDAStencilType stype = DMDA_STENCIL_BOX
 *         cdef PetscInt swidth = 0
 *         CHKERR( DMDAGetInfo(self.dm,             # <<<<<<<<<<<<<<
 *                             NULL,
 *                             NULL, NULL, NULL,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetInfo(__pyx_v_self->__pyx_base.dm, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (&__pyx_v_swidth), NULL, NULL, NULL, (&__pyx_v_stype))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 261, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":268
 *                             NULL, NULL, NULL,
 *                             &stype) )
 *         return (toStencil(stype), toInt(swidth))             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toStencil(__pyx_v_stype); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_swidth); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 268, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":258
 *         CHKERR( DMDASetStencilWidth(self.dm, swidth) )
 * 
 *     def getStencil(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAStencilType stype = DMDA_STENCIL_BOX
 *         cdef PetscInt swidth = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getStencil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":272
 *     #
 * 
 *     def getRanges(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_37getRanges(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_36getRanges[] = "DMDA.getRanges(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_37getRanges(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRanges (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getRanges", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getRanges", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_36getRanges(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_36getRanges(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_dim;
  PetscInt __pyx_v_x;
  PetscInt __pyx_v_y;
  PetscInt __pyx_v_z;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_p;
  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;
  __Pyx_RefNannySetupContext("getRanges", 0);

  /* "PETSc/DMDA.pyx":273
 * 
 *     def getRanges(self):
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         CHKERR( DMDAGetCorners(self.dm,
 */
  __pyx_v_dim = 0;
  __pyx_v_x = 0;
  __pyx_v_y = 0;
  __pyx_v_z = 0;
  __pyx_v_m = 0;
  __pyx_v_n = 0;
  __pyx_v_p = 0;

  /* "PETSc/DMDA.pyx":274
 *     def getRanges(self):
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetCorners(self.dm,
 *                                &x, &y, &z,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_DMDAGetDim(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 274, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":275
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         CHKERR( DMDAGetCorners(self.dm,             # <<<<<<<<<<<<<<
 *                                &x, &y, &z,
 *                                &m, &n, &p) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetCorners(__pyx_v_self->__pyx_base.dm, (&__pyx_v_x), (&__pyx_v_y), (&__pyx_v_z), (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_p))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 275, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":278
 *                                &x, &y, &z,
 *                                &m, &n, &p) )
 *         return ((toInt(x), toInt(x+m)),             # <<<<<<<<<<<<<<
 *                 (toInt(y), toInt(y+n)),
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_x + __pyx_v_m)); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 278, __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_t_2 = 0;
  __pyx_t_3 = 0;

  /* "PETSc/DMDA.pyx":279
 *                                &m, &n, &p) )
 *         return ((toInt(x), toInt(x+m)),
 *                 (toInt(y), toInt(y+n)),             # <<<<<<<<<<<<<<
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_y + __pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(41, 279, __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_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;

  /* "PETSc/DMDA.pyx":280
 *         return ((toInt(x), toInt(x+m)),
 *                 (toInt(y), toInt(y+n)),
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]             # <<<<<<<<<<<<<<
 * 
 *     def getGhostRanges(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_z); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_z + __pyx_v_p)); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(41, 280, __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_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;

  /* "PETSc/DMDA.pyx":278
 *                                &x, &y, &z,
 *                                &m, &n, &p) )
 *         return ((toInt(x), toInt(x+m)),             # <<<<<<<<<<<<<<
 *                 (toInt(y), toInt(y+n)),
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]
 */
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 278, __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_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_6);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;

  /* "PETSc/DMDA.pyx":280
 *         return ((toInt(x), toInt(x+m)),
 *                 (toInt(y), toInt(y+n)),
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]             # <<<<<<<<<<<<<<
 * 
 *     def getGhostRanges(self):
 */
  __pyx_t_6 = __Pyx_PyTuple_GetSlice(__pyx_t_3, 0, ((Py_ssize_t)__pyx_v_dim)); if (unlikely(!__pyx_t_6)) __PYX_ERR(41, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":272
 *     #
 * 
 *     def getRanges(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

  /* 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("petsc4py.PETSc.DMDA.getRanges", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":282
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]
 * 
 *     def getGhostRanges(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_39getGhostRanges(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_38getGhostRanges[] = "DMDA.getGhostRanges(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_39getGhostRanges(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getGhostRanges (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getGhostRanges", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getGhostRanges", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_38getGhostRanges(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_38getGhostRanges(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_dim;
  PetscInt __pyx_v_x;
  PetscInt __pyx_v_y;
  PetscInt __pyx_v_z;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_p;
  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;
  __Pyx_RefNannySetupContext("getGhostRanges", 0);

  /* "PETSc/DMDA.pyx":283
 * 
 *     def getGhostRanges(self):
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         CHKERR( DMDAGetGhostCorners(self.dm,
 */
  __pyx_v_dim = 0;
  __pyx_v_x = 0;
  __pyx_v_y = 0;
  __pyx_v_z = 0;
  __pyx_v_m = 0;
  __pyx_v_n = 0;
  __pyx_v_p = 0;

  /* "PETSc/DMDA.pyx":284
 *     def getGhostRanges(self):
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetGhostCorners(self.dm,
 *                                     &x, &y, &z,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_DMDAGetDim(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 284, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":285
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         CHKERR( DMDAGetGhostCorners(self.dm,             # <<<<<<<<<<<<<<
 *                                     &x, &y, &z,
 *                                     &m, &n, &p) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetGhostCorners(__pyx_v_self->__pyx_base.dm, (&__pyx_v_x), (&__pyx_v_y), (&__pyx_v_z), (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_p))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 285, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":288
 *                                     &x, &y, &z,
 *                                     &m, &n, &p) )
 *         return ((toInt(x), toInt(x+m)),             # <<<<<<<<<<<<<<
 *                 (toInt(y), toInt(y+n)),
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_x + __pyx_v_m)); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 288, __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_t_2 = 0;
  __pyx_t_3 = 0;

  /* "PETSc/DMDA.pyx":289
 *                                     &m, &n, &p) )
 *         return ((toInt(x), toInt(x+m)),
 *                 (toInt(y), toInt(y+n)),             # <<<<<<<<<<<<<<
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_y + __pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(41, 289, __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_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;

  /* "PETSc/DMDA.pyx":290
 *         return ((toInt(x), toInt(x+m)),
 *                 (toInt(y), toInt(y+n)),
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]             # <<<<<<<<<<<<<<
 * 
 *     def getOwnershipRanges(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_z); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_z + __pyx_v_p)); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(41, 290, __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_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;

  /* "PETSc/DMDA.pyx":288
 *                                     &x, &y, &z,
 *                                     &m, &n, &p) )
 *         return ((toInt(x), toInt(x+m)),             # <<<<<<<<<<<<<<
 *                 (toInt(y), toInt(y+n)),
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]
 */
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 288, __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_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_6);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;

  /* "PETSc/DMDA.pyx":290
 *         return ((toInt(x), toInt(x+m)),
 *                 (toInt(y), toInt(y+n)),
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]             # <<<<<<<<<<<<<<
 * 
 *     def getOwnershipRanges(self):
 */
  __pyx_t_6 = __Pyx_PyTuple_GetSlice(__pyx_t_3, 0, ((Py_ssize_t)__pyx_v_dim)); if (unlikely(!__pyx_t_6)) __PYX_ERR(41, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":282
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]
 * 
 *     def getGhostRanges(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

  /* 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("petsc4py.PETSc.DMDA.getGhostRanges", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":292
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]
 * 
 *     def getOwnershipRanges(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim=0, m=0, n=0, p=0
 *         cdef const_PetscInt *lx = NULL, *ly = NULL, *lz = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_41getOwnershipRanges(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_40getOwnershipRanges[] = "DMDA.getOwnershipRanges(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_41getOwnershipRanges(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOwnershipRanges (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getOwnershipRanges", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getOwnershipRanges", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_40getOwnershipRanges(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_40getOwnershipRanges(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_dim;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_p;
  const PetscInt *__pyx_v_lx;
  const PetscInt *__pyx_v_ly;
  const PetscInt *__pyx_v_lz;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getOwnershipRanges", 0);

  /* "PETSc/DMDA.pyx":293
 * 
 *     def getOwnershipRanges(self):
 *         cdef PetscInt dim=0, m=0, n=0, p=0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *lx = NULL, *ly = NULL, *lz = NULL
 *         CHKERR( DMDAGetInfo(self.dm,
 */
  __pyx_v_dim = 0;
  __pyx_v_m = 0;
  __pyx_v_n = 0;
  __pyx_v_p = 0;

  /* "PETSc/DMDA.pyx":294
 *     def getOwnershipRanges(self):
 *         cdef PetscInt dim=0, m=0, n=0, p=0
 *         cdef const_PetscInt *lx = NULL, *ly = NULL, *lz = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetInfo(self.dm,
 *                             &dim,
 */
  __pyx_v_lx = NULL;
  __pyx_v_ly = NULL;
  __pyx_v_lz = NULL;

  /* "PETSc/DMDA.pyx":295
 *         cdef PetscInt dim=0, m=0, n=0, p=0
 *         cdef const_PetscInt *lx = NULL, *ly = NULL, *lz = NULL
 *         CHKERR( DMDAGetInfo(self.dm,             # <<<<<<<<<<<<<<
 *                             &dim,
 *                             NULL, NULL, NULL,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetInfo(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim), NULL, NULL, NULL, (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_p), NULL, NULL, NULL, NULL, NULL, NULL)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 295, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":302
 *                             NULL, NULL, NULL,
 *                             NULL) )
 *         CHKERR( DMDAGetOwnershipRanges(self.dm, &lx, &ly, &lz) )             # <<<<<<<<<<<<<<
 *         return toOwnershipRanges(dim, m, n, p, lx, ly, lz)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetOwnershipRanges(__pyx_v_self->__pyx_base.dm, (&__pyx_v_lx), (&__pyx_v_ly), (&__pyx_v_lz))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 302, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":303
 *                             NULL) )
 *         CHKERR( DMDAGetOwnershipRanges(self.dm, &lx, &ly, &lz) )
 *         return toOwnershipRanges(dim, m, n, p, lx, ly, lz)             # <<<<<<<<<<<<<<
 * 
 *     def getCorners(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toOwnershipRanges(__pyx_v_dim, __pyx_v_m, __pyx_v_n, __pyx_v_p, __pyx_v_lx, __pyx_v_ly, __pyx_v_lz); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":292
 *                 (toInt(z), toInt(z+p)))[:<Py_ssize_t>dim]
 * 
 *     def getOwnershipRanges(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim=0, m=0, n=0, p=0
 *         cdef const_PetscInt *lx = NULL, *ly = NULL, *lz = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getOwnershipRanges", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":305
 *         return toOwnershipRanges(dim, m, n, p, lx, ly, lz)
 * 
 *     def getCorners(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_43getCorners(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_42getCorners[] = "DMDA.getCorners(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_43getCorners(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCorners (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getCorners", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getCorners", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_42getCorners(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_42getCorners(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_dim;
  PetscInt __pyx_v_x;
  PetscInt __pyx_v_y;
  PetscInt __pyx_v_z;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_p;
  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;
  __Pyx_RefNannySetupContext("getCorners", 0);

  /* "PETSc/DMDA.pyx":306
 * 
 *     def getCorners(self):
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         CHKERR( DMDAGetCorners(self.dm,
 */
  __pyx_v_dim = 0;
  __pyx_v_x = 0;
  __pyx_v_y = 0;
  __pyx_v_z = 0;
  __pyx_v_m = 0;
  __pyx_v_n = 0;
  __pyx_v_p = 0;

  /* "PETSc/DMDA.pyx":307
 *     def getCorners(self):
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetCorners(self.dm,
 *                                &x, &y, &z,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_DMDAGetDim(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 307, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":308
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         CHKERR( DMDAGetCorners(self.dm,             # <<<<<<<<<<<<<<
 *                                &x, &y, &z,
 *                                &m, &n, &p) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetCorners(__pyx_v_self->__pyx_base.dm, (&__pyx_v_x), (&__pyx_v_y), (&__pyx_v_z), (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_p))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 308, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":311
 *                                &x, &y, &z,
 *                                &m, &n, &p) )
 *         return ((toInt(x), toInt(y), toInt(z))[:<Py_ssize_t>dim],             # <<<<<<<<<<<<<<
 *                 (toInt(m), toInt(n), toInt(p))[:<Py_ssize_t>dim])
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_z); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(41, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyTuple_GetSlice(__pyx_t_5, 0, ((Py_ssize_t)__pyx_v_dim)); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/DMDA.pyx":312
 *                                &m, &n, &p) )
 *         return ((toInt(x), toInt(y), toInt(z))[:<Py_ssize_t>dim],
 *                 (toInt(m), toInt(n), toInt(p))[:<Py_ssize_t>dim])             # <<<<<<<<<<<<<<
 * 
 *     def getGhostCorners(self):
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_m); if (unlikely(!__pyx_t_5)) __PYX_ERR(41, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(41, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
  __pyx_t_5 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyTuple_GetSlice(__pyx_t_6, 0, ((Py_ssize_t)__pyx_v_dim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PETSc/DMDA.pyx":311
 *                                &x, &y, &z,
 *                                &m, &n, &p) )
 *         return ((toInt(x), toInt(y), toInt(z))[:<Py_ssize_t>dim],             # <<<<<<<<<<<<<<
 *                 (toInt(m), toInt(n), toInt(p))[:<Py_ssize_t>dim])
 * 
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(41, 311, __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_2);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":305
 *         return toOwnershipRanges(dim, m, n, p, lx, ly, lz)
 * 
 *     def getCorners(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

  /* 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("petsc4py.PETSc.DMDA.getCorners", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":314
 *                 (toInt(m), toInt(n), toInt(p))[:<Py_ssize_t>dim])
 * 
 *     def getGhostCorners(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_45getGhostCorners(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_44getGhostCorners[] = "DMDA.getGhostCorners(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_45getGhostCorners(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getGhostCorners (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getGhostCorners", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getGhostCorners", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_44getGhostCorners(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_44getGhostCorners(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_dim;
  PetscInt __pyx_v_x;
  PetscInt __pyx_v_y;
  PetscInt __pyx_v_z;
  PetscInt __pyx_v_m;
  PetscInt __pyx_v_n;
  PetscInt __pyx_v_p;
  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;
  __Pyx_RefNannySetupContext("getGhostCorners", 0);

  /* "PETSc/DMDA.pyx":315
 * 
 *     def getGhostCorners(self):
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         CHKERR( DMDAGetGhostCorners(self.dm,
 */
  __pyx_v_dim = 0;
  __pyx_v_x = 0;
  __pyx_v_y = 0;
  __pyx_v_z = 0;
  __pyx_v_m = 0;
  __pyx_v_n = 0;
  __pyx_v_p = 0;

  /* "PETSc/DMDA.pyx":316
 *     def getGhostCorners(self):
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetGhostCorners(self.dm,
 *                                     &x, &y, &z,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_DMDAGetDim(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 316, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":317
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         CHKERR( DMDAGetGhostCorners(self.dm,             # <<<<<<<<<<<<<<
 *                                     &x, &y, &z,
 *                                     &m, &n, &p) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetGhostCorners(__pyx_v_self->__pyx_base.dm, (&__pyx_v_x), (&__pyx_v_y), (&__pyx_v_z), (&__pyx_v_m), (&__pyx_v_n), (&__pyx_v_p))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 317, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":320
 *                                     &x, &y, &z,
 *                                     &m, &n, &p) )
 *         return ((toInt(x), toInt(y), toInt(z))[:<Py_ssize_t>dim],             # <<<<<<<<<<<<<<
 *                 (toInt(m), toInt(n), toInt(p))[:<Py_ssize_t>dim])
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_z); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(41, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyTuple_GetSlice(__pyx_t_5, 0, ((Py_ssize_t)__pyx_v_dim)); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/DMDA.pyx":321
 *                                     &m, &n, &p) )
 *         return ((toInt(x), toInt(y), toInt(z))[:<Py_ssize_t>dim],
 *                 (toInt(m), toInt(n), toInt(p))[:<Py_ssize_t>dim])             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_m); if (unlikely(!__pyx_t_5)) __PYX_ERR(41, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(41, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
  __pyx_t_5 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyTuple_GetSlice(__pyx_t_6, 0, ((Py_ssize_t)__pyx_v_dim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "PETSc/DMDA.pyx":320
 *                                     &x, &y, &z,
 *                                     &m, &n, &p) )
 *         return ((toInt(x), toInt(y), toInt(z))[:<Py_ssize_t>dim],             # <<<<<<<<<<<<<<
 *                 (toInt(m), toInt(n), toInt(p))[:<Py_ssize_t>dim])
 * 
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(41, 320, __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_2);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":314
 *                 (toInt(m), toInt(n), toInt(p))[:<Py_ssize_t>dim])
 * 
 *     def getGhostCorners(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim=0, x=0, y=0, z=0, m=0, n=0, p=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

  /* 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("petsc4py.PETSc.DMDA.getGhostCorners", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":325
 *     #
 * 
 *     def setFieldName(self, field, name):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(field)
 *         cdef const_char *cval = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_47setFieldName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_46setFieldName[] = "DMDA.setFieldName(self, field, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_47setFieldName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFieldName (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,&__pyx_n_s_name,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_field)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFieldName", 1, 2, 2, 1); __PYX_ERR(41, 325, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFieldName") < 0)) __PYX_ERR(41, 325, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_field = values[0];
    __pyx_v_name = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFieldName", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 325, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setFieldName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_46setFieldName(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_field, __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_46setFieldName(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_name) {
  PetscInt __pyx_v_ival;
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setFieldName", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DMDA.pyx":326
 * 
 *     def setFieldName(self, field, name):
 *         cdef PetscInt ival = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(41, 326, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/DMDA.pyx":327
 *     def setFieldName(self, field, name):
 *         cdef PetscInt ival = asInt(field)
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cval)
 *         CHKERR( DMDASetFieldName(self.dm, ival, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/DMDA.pyx":328
 *         cdef PetscInt ival = asInt(field)
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetFieldName(self.dm, ival, cval) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cval)); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DMDA.pyx":329
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 *         CHKERR( DMDASetFieldName(self.dm, ival, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getFieldName(self, field):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetFieldName(__pyx_v_self->__pyx_base.dm, __pyx_v_ival, __pyx_v_cval)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(41, 329, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":325
 *     #
 * 
 *     def setFieldName(self, field, name):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(field)
 *         cdef const_char *cval = 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("petsc4py.PETSc.DMDA.setFieldName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":331
 *         CHKERR( DMDASetFieldName(self.dm, ival, cval) )
 * 
 *     def getFieldName(self, field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(field)
 *         cdef const_char *cval = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_49getFieldName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_48getFieldName[] = "DMDA.getFieldName(self, field)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_49getFieldName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_field = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFieldName (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,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);
        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_field)) != 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, "getFieldName") < 0)) __PYX_ERR(41, 331, __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_field = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFieldName", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 331, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getFieldName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_48getFieldName(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_field);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_48getFieldName(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_field) {
  PetscInt __pyx_v_ival;
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getFieldName", 0);

  /* "PETSc/DMDA.pyx":332
 * 
 *     def getFieldName(self, field):
 *         cdef PetscInt ival = asInt(field)             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( DMDAGetFieldName(self.dm, ival, &cval) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_field); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(41, 332, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/DMDA.pyx":333
 *     def getFieldName(self, field):
 *         cdef PetscInt ival = asInt(field)
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetFieldName(self.dm, ival, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/DMDA.pyx":334
 *         cdef PetscInt ival = asInt(field)
 *         cdef const_char *cval = NULL
 *         CHKERR( DMDAGetFieldName(self.dm, ival, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetFieldName(__pyx_v_self->__pyx_base.dm, __pyx_v_ival, (&__pyx_v_cval))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 334, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":335
 *         cdef const_char *cval = NULL
 *         CHKERR( DMDAGetFieldName(self.dm, ival, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":331
 *         CHKERR( DMDASetFieldName(self.dm, ival, cval) )
 * 
 *     def getFieldName(self, field):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(field)
 *         cdef const_char *cval = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getFieldName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":339
 *     #
 * 
 *     def getVecArray(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         return _DMDA_Vec_array(self, vec)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_51getVecArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_50getVecArray[] = "DMDA.getVecArray(self, Vec vec)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_51getVecArray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getVecArray (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vec,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);
        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_vec)) != 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, "getVecArray") < 0)) __PYX_ERR(41, 339, __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_vec = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getVecArray", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 339, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getVecArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(41, 339, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_50getVecArray(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_vec);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_50getVecArray(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getVecArray", 0);

  /* "PETSc/DMDA.pyx":340
 * 
 *     def getVecArray(self, Vec vec not None):
 *         return _DMDA_Vec_array(self, vec)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_INCREF(((PyObject *)__pyx_v_vec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vec));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_vec));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc__DMDA_Vec_array), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 340, __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;

  /* "PETSc/DMDA.pyx":339
 *     #
 * 
 *     def getVecArray(self, Vec vec not None):             # <<<<<<<<<<<<<<
 *         return _DMDA_Vec_array(self, vec)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getVecArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":344
 *     #
 * 
 *     def setUniformCoordinates(self,             # <<<<<<<<<<<<<<
 *                               xmin=0, xmax=1,
 *                               ymin=0, ymax=1,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_53setUniformCoordinates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_52setUniformCoordinates[] = "DMDA.setUniformCoordinates(self, xmin=0, xmax=1, ymin=0, ymax=1, zmin=0, zmax=1)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_53setUniformCoordinates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_xmin = 0;
  PyObject *__pyx_v_xmax = 0;
  PyObject *__pyx_v_ymin = 0;
  PyObject *__pyx_v_ymax = 0;
  PyObject *__pyx_v_zmin = 0;
  PyObject *__pyx_v_zmax = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUniformCoordinates (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xmin,&__pyx_n_s_xmax,&__pyx_n_s_ymin,&__pyx_n_s_ymax,&__pyx_n_s_zmin,&__pyx_n_s_zmax,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[0] = ((PyObject *)__pyx_int_0);
    values[1] = ((PyObject *)__pyx_int_1);
    values[2] = ((PyObject *)__pyx_int_0);
    values[3] = ((PyObject *)__pyx_int_1);
    values[4] = ((PyObject *)__pyx_int_0);
    values[5] = ((PyObject *)__pyx_int_1);
    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);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xmin);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xmax);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ymin);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ymax);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zmin);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zmax);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setUniformCoordinates") < 0)) __PYX_ERR(41, 344, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_xmin = values[0];
    __pyx_v_xmax = values[1];
    __pyx_v_ymin = values[2];
    __pyx_v_ymax = values[3];
    __pyx_v_zmin = values[4];
    __pyx_v_zmax = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setUniformCoordinates", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 344, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setUniformCoordinates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_52setUniformCoordinates(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_xmin, __pyx_v_xmax, __pyx_v_ymin, __pyx_v_ymax, __pyx_v_zmin, __pyx_v_zmax);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_52setUniformCoordinates(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_xmin, PyObject *__pyx_v_xmax, PyObject *__pyx_v_ymin, PyObject *__pyx_v_ymax, PyObject *__pyx_v_zmin, PyObject *__pyx_v_zmax) {
  PetscReal __pyx_v__xmin;
  PetscReal __pyx_v__xmax;
  PetscReal __pyx_v__ymin;
  PetscReal __pyx_v__ymax;
  PetscReal __pyx_v__zmin;
  PetscReal __pyx_v__zmax;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setUniformCoordinates", 0);

  /* "PETSc/DMDA.pyx":348
 *                               ymin=0, ymax=1,
 *                               zmin=0, zmax=1):
 *         cdef PetscReal _xmin = asReal(xmin), _xmax = asReal(xmax)             # <<<<<<<<<<<<<<
 *         cdef PetscReal _ymin = asReal(ymin), _ymax = asReal(ymax)
 *         cdef PetscReal _zmin = asReal(zmin), _zmax = asReal(zmax)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_xmin); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(41, 348, __pyx_L1_error)
  __pyx_v__xmin = __pyx_t_1;
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_xmax); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(41, 348, __pyx_L1_error)
  __pyx_v__xmax = __pyx_t_1;

  /* "PETSc/DMDA.pyx":349
 *                               zmin=0, zmax=1):
 *         cdef PetscReal _xmin = asReal(xmin), _xmax = asReal(xmax)
 *         cdef PetscReal _ymin = asReal(ymin), _ymax = asReal(ymax)             # <<<<<<<<<<<<<<
 *         cdef PetscReal _zmin = asReal(zmin), _zmax = asReal(zmax)
 *         CHKERR( DMDASetUniformCoordinates(self.dm,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_ymin); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(41, 349, __pyx_L1_error)
  __pyx_v__ymin = __pyx_t_1;
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_ymax); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(41, 349, __pyx_L1_error)
  __pyx_v__ymax = __pyx_t_1;

  /* "PETSc/DMDA.pyx":350
 *         cdef PetscReal _xmin = asReal(xmin), _xmax = asReal(xmax)
 *         cdef PetscReal _ymin = asReal(ymin), _ymax = asReal(ymax)
 *         cdef PetscReal _zmin = asReal(zmin), _zmax = asReal(zmax)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetUniformCoordinates(self.dm,
 *                                           _xmin, _xmax,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_zmin); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(41, 350, __pyx_L1_error)
  __pyx_v__zmin = __pyx_t_1;
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_zmax); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(41, 350, __pyx_L1_error)
  __pyx_v__zmax = __pyx_t_1;

  /* "PETSc/DMDA.pyx":351
 *         cdef PetscReal _ymin = asReal(ymin), _ymax = asReal(ymax)
 *         cdef PetscReal _zmin = asReal(zmin), _zmax = asReal(zmax)
 *         CHKERR( DMDASetUniformCoordinates(self.dm,             # <<<<<<<<<<<<<<
 *                                           _xmin, _xmax,
 *                                           _ymin, _ymax,
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetUniformCoordinates(__pyx_v_self->__pyx_base.dm, __pyx_v__xmin, __pyx_v__xmax, __pyx_v__ymin, __pyx_v__ymax, __pyx_v__zmin, __pyx_v__zmax)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 351, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":344
 *     #
 * 
 *     def setUniformCoordinates(self,             # <<<<<<<<<<<<<<
 *                               xmin=0, xmax=1,
 *                               ymin=0, ymax=1,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setUniformCoordinates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":356
 *                                           _zmin, _zmax) )
 * 
 *     def setCoordinateName(self, index, name):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(index)
 *         cdef const_char *cval = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_55setCoordinateName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_54setCoordinateName[] = "DMDA.setCoordinateName(self, index, name)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_55setCoordinateName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCoordinateName (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,&__pyx_n_s_name,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setCoordinateName", 1, 2, 2, 1); __PYX_ERR(41, 356, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setCoordinateName") < 0)) __PYX_ERR(41, 356, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = values[0];
    __pyx_v_name = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCoordinateName", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 356, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setCoordinateName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_54setCoordinateName(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_index, __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_54setCoordinateName(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_name) {
  PetscInt __pyx_v_ival;
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("setCoordinateName", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DMDA.pyx":357
 * 
 *     def setCoordinateName(self, index, name):
 *         cdef PetscInt ival = asInt(index)             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_index); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(41, 357, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/DMDA.pyx":358
 *     def setCoordinateName(self, index, name):
 *         cdef PetscInt ival = asInt(index)
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         name = str2bytes(name, &cval)
 *         CHKERR( DMDASetCoordinateName(self.dm, ival, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/DMDA.pyx":359
 *         cdef PetscInt ival = asInt(index)
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetCoordinateName(self.dm, ival, cval) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cval)); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DMDA.pyx":360
 *         cdef const_char *cval = NULL
 *         name = str2bytes(name, &cval)
 *         CHKERR( DMDASetCoordinateName(self.dm, ival, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getCoordinateName(self, index):
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetCoordinateName(__pyx_v_self->__pyx_base.dm, __pyx_v_ival, __pyx_v_cval)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(41, 360, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":356
 *                                           _zmin, _zmax) )
 * 
 *     def setCoordinateName(self, index, name):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(index)
 *         cdef const_char *cval = 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("petsc4py.PETSc.DMDA.setCoordinateName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":362
 *         CHKERR( DMDASetCoordinateName(self.dm, ival, cval) )
 * 
 *     def getCoordinateName(self, index):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(index)
 *         cdef const_char *cval = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_57getCoordinateName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_56getCoordinateName[] = "DMDA.getCoordinateName(self, index)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_57getCoordinateName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCoordinateName (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,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);
        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_index)) != 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, "getCoordinateName") < 0)) __PYX_ERR(41, 362, __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_index = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getCoordinateName", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 362, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getCoordinateName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_56getCoordinateName(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_index);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_56getCoordinateName(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_index) {
  PetscInt __pyx_v_ival;
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getCoordinateName", 0);

  /* "PETSc/DMDA.pyx":363
 * 
 *     def getCoordinateName(self, index):
 *         cdef PetscInt ival = asInt(index)             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         CHKERR( DMDAGetCoordinateName(self.dm, ival, &cval) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_index); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(41, 363, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/DMDA.pyx":364
 *     def getCoordinateName(self, index):
 *         cdef PetscInt ival = asInt(index)
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetCoordinateName(self.dm, ival, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/DMDA.pyx":365
 *         cdef PetscInt ival = asInt(index)
 *         cdef const_char *cval = NULL
 *         CHKERR( DMDAGetCoordinateName(self.dm, ival, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetCoordinateName(__pyx_v_self->__pyx_base.dm, __pyx_v_ival, (&__pyx_v_cval))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 365, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":366
 *         cdef const_char *cval = NULL
 *         CHKERR( DMDAGetCoordinateName(self.dm, ival, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def getBoundingBox(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":362
 *         CHKERR( DMDASetCoordinateName(self.dm, ival, cval) )
 * 
 *     def getCoordinateName(self, index):             # <<<<<<<<<<<<<<
 *         cdef PetscInt ival = asInt(index)
 *         cdef const_char *cval = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getCoordinateName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":368
 *         return bytes2str(cval)
 * 
 *     def getBoundingBox(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i,dim=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_59getBoundingBox(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_58getBoundingBox[] = "DMDA.getBoundingBox(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_59getBoundingBox(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBoundingBox (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getBoundingBox", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getBoundingBox", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_58getBoundingBox(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_58getBoundingBox(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_dim;
  PetscReal __pyx_v_gmin[3];
  PetscReal __pyx_v_gmax[3];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("getBoundingBox", 0);

  /* "PETSc/DMDA.pyx":369
 * 
 *     def getBoundingBox(self):
 *         cdef PetscInt i,dim=0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         cdef PetscReal gmin[3], gmax[3]
 */
  __pyx_v_dim = 0;

  /* "PETSc/DMDA.pyx":370
 *     def getBoundingBox(self):
 *         cdef PetscInt i,dim=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         cdef PetscReal gmin[3], gmax[3]
 *         CHKERR( DMDAGetBoundingBox(self.dm, gmin, gmax) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_DMDAGetDim(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 370, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":372
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         cdef PetscReal gmin[3], gmax[3]
 *         CHKERR( DMDAGetBoundingBox(self.dm, gmin, gmax) )             # <<<<<<<<<<<<<<
 *         return tuple([(toReal(gmin[i]), toReal(gmax[i]))
 *                       for i from 0 <= i < dim])
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetBoundingBox(__pyx_v_self->__pyx_base.dm, __pyx_v_gmin, __pyx_v_gmax)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 372, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":373
 *         cdef PetscReal gmin[3], gmax[3]
 *         CHKERR( DMDAGetBoundingBox(self.dm, gmin, gmax) )
 *         return tuple([(toReal(gmin[i]), toReal(gmax[i]))             # <<<<<<<<<<<<<<
 *                       for i from 0 <= i < dim])
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "PETSc/DMDA.pyx":374
 *         CHKERR( DMDAGetBoundingBox(self.dm, gmin, gmax) )
 *         return tuple([(toReal(gmin[i]), toReal(gmax[i]))
 *                       for i from 0 <= i < dim])             # <<<<<<<<<<<<<<
 * 
 *     def getLocalBoundingBox(self):
 */
  __pyx_t_3 = __pyx_v_dim;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

    /* "PETSc/DMDA.pyx":373
 *         cdef PetscReal gmin[3], gmax[3]
 *         CHKERR( DMDAGetBoundingBox(self.dm, gmin, gmax) )
 *         return tuple([(toReal(gmin[i]), toReal(gmax[i]))             # <<<<<<<<<<<<<<
 *                       for i from 0 <= i < dim])
 * 
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_gmin[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_gmax[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(41, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(41, 373, __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_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(41, 373, __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(41, 373, __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;

  /* "PETSc/DMDA.pyx":368
 *         return bytes2str(cval)
 * 
 *     def getBoundingBox(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i,dim=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getBoundingBox", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":376
 *                       for i from 0 <= i < dim])
 * 
 *     def getLocalBoundingBox(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i,dim=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_61getLocalBoundingBox(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_60getLocalBoundingBox[] = "DMDA.getLocalBoundingBox(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_61getLocalBoundingBox(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLocalBoundingBox (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getLocalBoundingBox", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getLocalBoundingBox", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_60getLocalBoundingBox(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_60getLocalBoundingBox(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_dim;
  PetscReal __pyx_v_lmin[3];
  PetscReal __pyx_v_lmax[3];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("getLocalBoundingBox", 0);

  /* "PETSc/DMDA.pyx":377
 * 
 *     def getLocalBoundingBox(self):
 *         cdef PetscInt i,dim=0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         cdef PetscReal lmin[3], lmax[3]
 */
  __pyx_v_dim = 0;

  /* "PETSc/DMDA.pyx":378
 *     def getLocalBoundingBox(self):
 *         cdef PetscInt i,dim=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         cdef PetscReal lmin[3], lmax[3]
 *         CHKERR( DMDAGetLocalBoundingBox(self.dm, lmin, lmax) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_DMDAGetDim(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 378, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":380
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         cdef PetscReal lmin[3], lmax[3]
 *         CHKERR( DMDAGetLocalBoundingBox(self.dm, lmin, lmax) )             # <<<<<<<<<<<<<<
 *         return tuple([(toReal(lmin[i]), toReal(lmax[i]))
 *                       for i from 0 <= i < dim])
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetLocalBoundingBox(__pyx_v_self->__pyx_base.dm, __pyx_v_lmin, __pyx_v_lmax)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 380, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":381
 *         cdef PetscReal lmin[3], lmax[3]
 *         CHKERR( DMDAGetLocalBoundingBox(self.dm, lmin, lmax) )
 *         return tuple([(toReal(lmin[i]), toReal(lmax[i]))             # <<<<<<<<<<<<<<
 *                       for i from 0 <= i < dim])
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "PETSc/DMDA.pyx":382
 *         CHKERR( DMDAGetLocalBoundingBox(self.dm, lmin, lmax) )
 *         return tuple([(toReal(lmin[i]), toReal(lmax[i]))
 *                       for i from 0 <= i < dim])             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_3 = __pyx_v_dim;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

    /* "PETSc/DMDA.pyx":381
 *         cdef PetscReal lmin[3], lmax[3]
 *         CHKERR( DMDAGetLocalBoundingBox(self.dm, lmin, lmax) )
 *         return tuple([(toReal(lmin[i]), toReal(lmax[i]))             # <<<<<<<<<<<<<<
 *                       for i from 0 <= i < dim])
 * 
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_lmin[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toReal((__pyx_v_lmax[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(41, 381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(41, 381, __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_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(41, 381, __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(41, 381, __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;

  /* "PETSc/DMDA.pyx":376
 *                       for i from 0 <= i < dim])
 * 
 *     def getLocalBoundingBox(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i,dim=0
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getLocalBoundingBox", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":386
 *     #
 * 
 *     def createNaturalVec(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vn = Vec()
 *         CHKERR( DMDACreateNaturalVector(self.dm, &vn.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_63createNaturalVec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_62createNaturalVec[] = "DMDA.createNaturalVec(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_63createNaturalVec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createNaturalVec (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("createNaturalVec", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "createNaturalVec", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_62createNaturalVec(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_62createNaturalVec(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  struct PyPetscVecObject *__pyx_v_vn = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createNaturalVec", 0);

  /* "PETSc/DMDA.pyx":387
 * 
 *     def createNaturalVec(self):
 *         cdef Vec vn = Vec()             # <<<<<<<<<<<<<<
 *         CHKERR( DMDACreateNaturalVector(self.dm, &vn.vec) )
 *         return vn
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vn = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMDA.pyx":388
 *     def createNaturalVec(self):
 *         cdef Vec vn = Vec()
 *         CHKERR( DMDACreateNaturalVector(self.dm, &vn.vec) )             # <<<<<<<<<<<<<<
 *         return vn
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDACreateNaturalVector(__pyx_v_self->__pyx_base.dm, (&__pyx_v_vn->vec))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 388, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":389
 *         cdef Vec vn = Vec()
 *         CHKERR( DMDACreateNaturalVector(self.dm, &vn.vec) )
 *         return vn             # <<<<<<<<<<<<<<
 * 
 *     def globalToNatural(self, Vec vg not None, Vec vn not None, addv=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_vn));
  __pyx_r = ((PyObject *)__pyx_v_vn);
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":386
 *     #
 * 
 *     def createNaturalVec(self):             # <<<<<<<<<<<<<<
 *         cdef Vec vn = Vec()
 *         CHKERR( DMDACreateNaturalVector(self.dm, &vn.vec) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.createNaturalVec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":391
 *         return vn
 * 
 *     def globalToNatural(self, Vec vg not None, Vec vn not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMDAGlobalToNaturalBegin(self.dm, vg.vec, im, vn.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_65globalToNatural(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_64globalToNatural[] = "DMDA.globalToNatural(self, Vec vg, Vec vn, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_65globalToNatural(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vg = 0;
  struct PyPetscVecObject *__pyx_v_vn = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("globalToNatural (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vg,&__pyx_n_s_vn,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vg)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("globalToNatural", 0, 2, 3, 1); __PYX_ERR(41, 391, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "globalToNatural") < 0)) __PYX_ERR(41, 391, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_vg = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_vn = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("globalToNatural", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 391, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.globalToNatural", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vg), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vg", 0))) __PYX_ERR(41, 391, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vn), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vn", 0))) __PYX_ERR(41, 391, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_64globalToNatural(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_vg, __pyx_v_vn, __pyx_v_addv);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_64globalToNatural(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vg, struct PyPetscVecObject *__pyx_v_vn, PyObject *__pyx_v_addv) {
  InsertMode __pyx_v_im;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("globalToNatural", 0);

  /* "PETSc/DMDA.pyx":392
 * 
 *     def globalToNatural(self, Vec vg not None, Vec vn not None, addv=None):
 *         cdef PetscInsertMode im = insertmode(addv)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGlobalToNaturalBegin(self.dm, vg.vec, im, vn.vec) )
 *         CHKERR( DMDAGlobalToNaturalEnd  (self.dm, vg.vec, im, vn.vec) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(41, 392, __pyx_L1_error)
  __pyx_v_im = __pyx_t_1;

  /* "PETSc/DMDA.pyx":393
 *     def globalToNatural(self, Vec vg not None, Vec vn not None, addv=None):
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMDAGlobalToNaturalBegin(self.dm, vg.vec, im, vn.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGlobalToNaturalEnd  (self.dm, vg.vec, im, vn.vec) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGlobalToNaturalBegin(__pyx_v_self->__pyx_base.dm, __pyx_v_vg->vec, __pyx_v_im, __pyx_v_vn->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 393, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":394
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMDAGlobalToNaturalBegin(self.dm, vg.vec, im, vn.vec) )
 *         CHKERR( DMDAGlobalToNaturalEnd  (self.dm, vg.vec, im, vn.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def naturalToGlobal(self, Vec vn not None, Vec vg not None, addv=None):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGlobalToNaturalEnd(__pyx_v_self->__pyx_base.dm, __pyx_v_vg->vec, __pyx_v_im, __pyx_v_vn->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 394, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":391
 *         return vn
 * 
 *     def globalToNatural(self, Vec vg not None, Vec vn not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMDAGlobalToNaturalBegin(self.dm, vg.vec, im, vn.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.globalToNatural", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":396
 *         CHKERR( DMDAGlobalToNaturalEnd  (self.dm, vg.vec, im, vn.vec) )
 * 
 *     def naturalToGlobal(self, Vec vn not None, Vec vg not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMDANaturalToGlobalBegin(self.dm, vn.vec, im, vg.vec) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_67naturalToGlobal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_66naturalToGlobal[] = "DMDA.naturalToGlobal(self, Vec vn, Vec vg, addv=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_67naturalToGlobal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_vn = 0;
  struct PyPetscVecObject *__pyx_v_vg = 0;
  PyObject *__pyx_v_addv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("naturalToGlobal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vn,&__pyx_n_s_vg,&__pyx_n_s_addv,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_vn)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vg)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("naturalToGlobal", 0, 2, 3, 1); __PYX_ERR(41, 396, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addv);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "naturalToGlobal") < 0)) __PYX_ERR(41, 396, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_vn = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_vg = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_addv = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("naturalToGlobal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 396, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.naturalToGlobal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vn), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vn", 0))) __PYX_ERR(41, 396, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vg), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vg", 0))) __PYX_ERR(41, 396, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_66naturalToGlobal(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_vn, __pyx_v_vg, __pyx_v_addv);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_66naturalToGlobal(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, struct PyPetscVecObject *__pyx_v_vn, struct PyPetscVecObject *__pyx_v_vg, PyObject *__pyx_v_addv) {
  InsertMode __pyx_v_im;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("naturalToGlobal", 0);

  /* "PETSc/DMDA.pyx":397
 * 
 *     def naturalToGlobal(self, Vec vn not None, Vec vg not None, addv=None):
 *         cdef PetscInsertMode im = insertmode(addv)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDANaturalToGlobalBegin(self.dm, vn.vec, im, vg.vec) )
 *         CHKERR( DMDANaturalToGlobalEnd  (self.dm, vn.vec, im, vg.vec) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_addv); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(41, 397, __pyx_L1_error)
  __pyx_v_im = __pyx_t_1;

  /* "PETSc/DMDA.pyx":398
 *     def naturalToGlobal(self, Vec vn not None, Vec vg not None, addv=None):
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMDANaturalToGlobalBegin(self.dm, vn.vec, im, vg.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMDANaturalToGlobalEnd  (self.dm, vn.vec, im, vg.vec) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDANaturalToGlobalBegin(__pyx_v_self->__pyx_base.dm, __pyx_v_vn->vec, __pyx_v_im, __pyx_v_vg->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 398, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":399
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMDANaturalToGlobalBegin(self.dm, vn.vec, im, vg.vec) )
 *         CHKERR( DMDANaturalToGlobalEnd  (self.dm, vn.vec, im, vg.vec) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDANaturalToGlobalEnd(__pyx_v_self->__pyx_base.dm, __pyx_v_vn->vec, __pyx_v_im, __pyx_v_vg->vec)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 399, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":396
 *         CHKERR( DMDAGlobalToNaturalEnd  (self.dm, vg.vec, im, vn.vec) )
 * 
 *     def naturalToGlobal(self, Vec vn not None, Vec vg not None, addv=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInsertMode im = insertmode(addv)
 *         CHKERR( DMDANaturalToGlobalBegin(self.dm, vn.vec, im, vg.vec) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.naturalToGlobal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":403
 *     #
 * 
 *     def getAO(self):             # <<<<<<<<<<<<<<
 *         cdef AO ao = AO()
 *         CHKERR( DMDAGetAO(self.dm, &ao.ao) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_69getAO(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_68getAO[] = "DMDA.getAO(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_69getAO(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getAO (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getAO", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getAO", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_68getAO(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_68getAO(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  struct PyPetscAOObject *__pyx_v_ao = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getAO", 0);

  /* "PETSc/DMDA.pyx":404
 * 
 *     def getAO(self):
 *         cdef AO ao = AO()             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetAO(self.dm, &ao.ao) )
 *         PetscINCREF(ao.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_AO), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ao = ((struct PyPetscAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMDA.pyx":405
 *     def getAO(self):
 *         cdef AO ao = AO()
 *         CHKERR( DMDAGetAO(self.dm, &ao.ao) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(ao.obj)
 *         return ao
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetAO(__pyx_v_self->__pyx_base.dm, (&__pyx_v_ao->ao))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 405, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":406
 *         cdef AO ao = AO()
 *         CHKERR( DMDAGetAO(self.dm, &ao.ao) )
 *         PetscINCREF(ao.obj)             # <<<<<<<<<<<<<<
 *         return ao
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_ao->__pyx_base.obj);

  /* "PETSc/DMDA.pyx":407
 *         CHKERR( DMDAGetAO(self.dm, &ao.ao) )
 *         PetscINCREF(ao.obj)
 *         return ao             # <<<<<<<<<<<<<<
 * 
 *     def getScatter(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ao));
  __pyx_r = ((PyObject *)__pyx_v_ao);
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":403
 *     #
 * 
 *     def getAO(self):             # <<<<<<<<<<<<<<
 *         cdef AO ao = AO()
 *         CHKERR( DMDAGetAO(self.dm, &ao.ao) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getAO", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ao);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":409
 *         return ao
 * 
 *     def getScatter(self):             # <<<<<<<<<<<<<<
 *         cdef Scatter l2g = Scatter()
 *         cdef Scatter g2l = Scatter()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_71getScatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_70getScatter[] = "DMDA.getScatter(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_71getScatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getScatter (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getScatter", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getScatter", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_70getScatter(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_70getScatter(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  struct PyPetscScatterObject *__pyx_v_l2g = 0;
  struct PyPetscScatterObject *__pyx_v_g2l = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getScatter", 0);

  /* "PETSc/DMDA.pyx":410
 * 
 *     def getScatter(self):
 *         cdef Scatter l2g = Scatter()             # <<<<<<<<<<<<<<
 *         cdef Scatter g2l = Scatter()
 *         CHKERR( DMDAGetScatter(self.dm, &l2g.sct, &g2l.sct) )
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Scatter), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_l2g = ((struct PyPetscScatterObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMDA.pyx":411
 *     def getScatter(self):
 *         cdef Scatter l2g = Scatter()
 *         cdef Scatter g2l = Scatter()             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetScatter(self.dm, &l2g.sct, &g2l.sct) )
 *         PetscINCREF(l2g.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Scatter), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_g2l = ((struct PyPetscScatterObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMDA.pyx":412
 *         cdef Scatter l2g = Scatter()
 *         cdef Scatter g2l = Scatter()
 *         CHKERR( DMDAGetScatter(self.dm, &l2g.sct, &g2l.sct) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(l2g.obj)
 *         PetscINCREF(g2l.obj)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetScatter(__pyx_v_self->__pyx_base.dm, (&__pyx_v_l2g->sct), (&__pyx_v_g2l->sct))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 412, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":413
 *         cdef Scatter g2l = Scatter()
 *         CHKERR( DMDAGetScatter(self.dm, &l2g.sct, &g2l.sct) )
 *         PetscINCREF(l2g.obj)             # <<<<<<<<<<<<<<
 *         PetscINCREF(g2l.obj)
 *         return (l2g, g2l)
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_l2g->__pyx_base.obj);

  /* "PETSc/DMDA.pyx":414
 *         CHKERR( DMDAGetScatter(self.dm, &l2g.sct, &g2l.sct) )
 *         PetscINCREF(l2g.obj)
 *         PetscINCREF(g2l.obj)             # <<<<<<<<<<<<<<
 *         return (l2g, g2l)
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_g2l->__pyx_base.obj);

  /* "PETSc/DMDA.pyx":415
 *         PetscINCREF(l2g.obj)
 *         PetscINCREF(g2l.obj)
 *         return (l2g, g2l)             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_l2g));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_l2g));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_l2g));
  __Pyx_INCREF(((PyObject *)__pyx_v_g2l));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_g2l));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_g2l));
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":409
 *         return ao
 * 
 *     def getScatter(self):             # <<<<<<<<<<<<<<
 *         cdef Scatter l2g = Scatter()
 *         cdef Scatter g2l = Scatter()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getScatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_l2g);
  __Pyx_XDECREF((PyObject *)__pyx_v_g2l);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":419
 *     #
 * 
 *     def setRefinementFactor(self,             # <<<<<<<<<<<<<<
 *                             refine_x=2,
 *                             refine_y=2,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_73setRefinementFactor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_72setRefinementFactor[] = "DMDA.setRefinementFactor(self, refine_x=2, refine_y=2, refine_z=2)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_73setRefinementFactor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_refine_x = 0;
  PyObject *__pyx_v_refine_y = 0;
  PyObject *__pyx_v_refine_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRefinementFactor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_refine_x,&__pyx_n_s_refine_y,&__pyx_n_s_refine_z,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)__pyx_int_2);
    values[1] = ((PyObject *)__pyx_int_2);
    values[2] = ((PyObject *)__pyx_int_2);
    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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refine_x);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refine_y);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refine_z);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setRefinementFactor") < 0)) __PYX_ERR(41, 419, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_refine_x = values[0];
    __pyx_v_refine_y = values[1];
    __pyx_v_refine_z = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRefinementFactor", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 419, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setRefinementFactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_72setRefinementFactor(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_refine_x, __pyx_v_refine_y, __pyx_v_refine_z);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_72setRefinementFactor(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_refine_x, PyObject *__pyx_v_refine_y, PyObject *__pyx_v_refine_z) {
  PetscInt __pyx_v_refine[3];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setRefinementFactor", 0);

  /* "PETSc/DMDA.pyx":424
 *                             refine_z=2):
 *         cdef PetscInt refine[3]
 *         refine[0] = asInt(refine_x)             # <<<<<<<<<<<<<<
 *         refine[1] = asInt(refine_y)
 *         refine[2] = asInt(refine_z)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_refine_x); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(41, 424, __pyx_L1_error)
  (__pyx_v_refine[0]) = __pyx_t_1;

  /* "PETSc/DMDA.pyx":425
 *         cdef PetscInt refine[3]
 *         refine[0] = asInt(refine_x)
 *         refine[1] = asInt(refine_y)             # <<<<<<<<<<<<<<
 *         refine[2] = asInt(refine_z)
 *         CHKERR( DMDASetRefinementFactor(self.dm,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_refine_y); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(41, 425, __pyx_L1_error)
  (__pyx_v_refine[1]) = __pyx_t_1;

  /* "PETSc/DMDA.pyx":426
 *         refine[0] = asInt(refine_x)
 *         refine[1] = asInt(refine_y)
 *         refine[2] = asInt(refine_z)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetRefinementFactor(self.dm,
 *                                       refine[0],
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_refine_z); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(41, 426, __pyx_L1_error)
  (__pyx_v_refine[2]) = __pyx_t_1;

  /* "PETSc/DMDA.pyx":427
 *         refine[1] = asInt(refine_y)
 *         refine[2] = asInt(refine_z)
 *         CHKERR( DMDASetRefinementFactor(self.dm,             # <<<<<<<<<<<<<<
 *                                       refine[0],
 *                                       refine[1],
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetRefinementFactor(__pyx_v_self->__pyx_base.dm, (__pyx_v_refine[0]), (__pyx_v_refine[1]), (__pyx_v_refine[2]))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 427, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":419
 *     #
 * 
 *     def setRefinementFactor(self,             # <<<<<<<<<<<<<<
 *                             refine_x=2,
 *                             refine_y=2,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setRefinementFactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":432
 *                                       refine[2]) )
 * 
 *     def getRefinementFactor(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, dim = 0, refine[3]
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_75getRefinementFactor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_74getRefinementFactor[] = "DMDA.getRefinementFactor(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_75getRefinementFactor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRefinementFactor (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getRefinementFactor", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getRefinementFactor", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_74getRefinementFactor(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_74getRefinementFactor(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_dim;
  PetscInt __pyx_v_refine[3];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("getRefinementFactor", 0);

  /* "PETSc/DMDA.pyx":433
 * 
 *     def getRefinementFactor(self):
 *         cdef PetscInt i, dim = 0, refine[3]             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         CHKERR( DMDAGetRefinementFactor(self.dm,
 */
  __pyx_v_dim = 0;

  /* "PETSc/DMDA.pyx":434
 *     def getRefinementFactor(self):
 *         cdef PetscInt i, dim = 0, refine[3]
 *         CHKERR( DMDAGetDim(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetRefinementFactor(self.dm,
 *                                       &refine[0],
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_DMDAGetDim(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 434, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":435
 *         cdef PetscInt i, dim = 0, refine[3]
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         CHKERR( DMDAGetRefinementFactor(self.dm,             # <<<<<<<<<<<<<<
 *                                       &refine[0],
 *                                       &refine[1],
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetRefinementFactor(__pyx_v_self->__pyx_base.dm, (&(__pyx_v_refine[0])), (&(__pyx_v_refine[1])), (&(__pyx_v_refine[2])))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 435, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":439
 *                                       &refine[1],
 *                                       &refine[2]) )
 *         return tuple([toInt(refine[i]) for 0 <= i < dim])             # <<<<<<<<<<<<<<
 * 
 *     def setInterpolationType(self, interp_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_v_dim;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_refine[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_4))) __PYX_ERR(41, 439, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_4 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":432
 *                                       refine[2]) )
 * 
 *     def getRefinementFactor(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, dim = 0, refine[3]
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getRefinementFactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":441
 *         return tuple([toInt(refine[i]) for 0 <= i < dim])
 * 
 *     def setInterpolationType(self, interp_type):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAInterpolationType ival = dainterpolationtype(interp_type)
 *         CHKERR( DMDASetInterpolationType(self.dm, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_77setInterpolationType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_76setInterpolationType[] = "DMDA.setInterpolationType(self, interp_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_77setInterpolationType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_interp_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setInterpolationType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_interp_type,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);
        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_interp_type)) != 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, "setInterpolationType") < 0)) __PYX_ERR(41, 441, __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_interp_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setInterpolationType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 441, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setInterpolationType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_76setInterpolationType(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_interp_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_76setInterpolationType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_interp_type) {
  DMDAInterpolationType __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  DMDAInterpolationType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setInterpolationType", 0);

  /* "PETSc/DMDA.pyx":442
 * 
 *     def setInterpolationType(self, interp_type):
 *         cdef PetscDMDAInterpolationType ival = dainterpolationtype(interp_type)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetInterpolationType(self.dm, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_dainterpolationtype(__pyx_v_interp_type); if (unlikely(__pyx_t_1 == ((DMDAInterpolationType)-1L))) __PYX_ERR(41, 442, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/DMDA.pyx":443
 *     def setInterpolationType(self, interp_type):
 *         cdef PetscDMDAInterpolationType ival = dainterpolationtype(interp_type)
 *         CHKERR( DMDASetInterpolationType(self.dm, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def getInterpolationType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetInterpolationType(__pyx_v_self->__pyx_base.dm, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 443, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":441
 *         return tuple([toInt(refine[i]) for 0 <= i < dim])
 * 
 *     def setInterpolationType(self, interp_type):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAInterpolationType ival = dainterpolationtype(interp_type)
 *         CHKERR( DMDASetInterpolationType(self.dm, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setInterpolationType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":445
 *         CHKERR( DMDASetInterpolationType(self.dm, ival) )
 * 
 *     def getInterpolationType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAInterpolationType ival = DMDA_INTERPOLATION_Q0
 *         CHKERR( DMDAGetInterpolationType(self.dm, &ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_79getInterpolationType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_78getInterpolationType[] = "DMDA.getInterpolationType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_79getInterpolationType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getInterpolationType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getInterpolationType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getInterpolationType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_78getInterpolationType(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_78getInterpolationType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  DMDAInterpolationType __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getInterpolationType", 0);

  /* "PETSc/DMDA.pyx":446
 * 
 *     def getInterpolationType(self):
 *         cdef PetscDMDAInterpolationType ival = DMDA_INTERPOLATION_Q0             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetInterpolationType(self.dm, &ival) )
 *         return <long>ival
 */
  __pyx_v_ival = DMDA_Q0;

  /* "PETSc/DMDA.pyx":447
 *     def getInterpolationType(self):
 *         cdef PetscDMDAInterpolationType ival = DMDA_INTERPOLATION_Q0
 *         CHKERR( DMDAGetInterpolationType(self.dm, &ival) )             # <<<<<<<<<<<<<<
 *         return <long>ival
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetInterpolationType(__pyx_v_self->__pyx_base.dm, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 447, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":448
 *         cdef PetscDMDAInterpolationType ival = DMDA_INTERPOLATION_Q0
 *         CHKERR( DMDAGetInterpolationType(self.dm, &ival) )
 *         return <long>ival             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(((long)__pyx_v_ival)); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":445
 *         CHKERR( DMDASetInterpolationType(self.dm, ival) )
 * 
 *     def getInterpolationType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAInterpolationType ival = DMDA_INTERPOLATION_Q0
 *         CHKERR( DMDAGetInterpolationType(self.dm, &ival) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getInterpolationType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":452
 *     #
 * 
 *     def setElementType(self, elem_type):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAElementType ival = daelementtype(elem_type)
 *         CHKERR( DMDASetElementType(self.dm, ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_81setElementType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_80setElementType[] = "DMDA.setElementType(self, elem_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_81setElementType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_elem_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setElementType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elem_type,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);
        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_elem_type)) != 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, "setElementType") < 0)) __PYX_ERR(41, 452, __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_elem_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setElementType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 452, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setElementType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_80setElementType(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_elem_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_80setElementType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_elem_type) {
  DMDAElementType __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  DMDAElementType __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setElementType", 0);

  /* "PETSc/DMDA.pyx":453
 * 
 *     def setElementType(self, elem_type):
 *         cdef PetscDMDAElementType ival = daelementtype(elem_type)             # <<<<<<<<<<<<<<
 *         CHKERR( DMDASetElementType(self.dm, ival) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_daelementtype(__pyx_v_elem_type); if (unlikely(__pyx_t_1 == ((DMDAElementType)-1L))) __PYX_ERR(41, 453, __pyx_L1_error)
  __pyx_v_ival = __pyx_t_1;

  /* "PETSc/DMDA.pyx":454
 *     def setElementType(self, elem_type):
 *         cdef PetscDMDAElementType ival = daelementtype(elem_type)
 *         CHKERR( DMDASetElementType(self.dm, ival) )             # <<<<<<<<<<<<<<
 * 
 *     def getElementType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetElementType(__pyx_v_self->__pyx_base.dm, __pyx_v_ival)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(41, 454, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":452
 *     #
 * 
 *     def setElementType(self, elem_type):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAElementType ival = daelementtype(elem_type)
 *         CHKERR( DMDASetElementType(self.dm, ival) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.setElementType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":456
 *         CHKERR( DMDASetElementType(self.dm, ival) )
 * 
 *     def getElementType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAElementType ival = DMDA_ELEMENT_Q1
 *         CHKERR( DMDAGetElementType(self.dm, &ival) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_83getElementType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_82getElementType[] = "DMDA.getElementType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_83getElementType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getElementType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getElementType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getElementType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_82getElementType(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_82getElementType(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self) {
  DMDAElementType __pyx_v_ival;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getElementType", 0);

  /* "PETSc/DMDA.pyx":457
 * 
 *     def getElementType(self):
 *         cdef PetscDMDAElementType ival = DMDA_ELEMENT_Q1             # <<<<<<<<<<<<<<
 *         CHKERR( DMDAGetElementType(self.dm, &ival) )
 *         return <long>ival
 */
  __pyx_v_ival = DMDA_ELEMENT_Q1;

  /* "PETSc/DMDA.pyx":458
 *     def getElementType(self):
 *         cdef PetscDMDAElementType ival = DMDA_ELEMENT_Q1
 *         CHKERR( DMDAGetElementType(self.dm, &ival) )             # <<<<<<<<<<<<<<
 *         return <long>ival
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetElementType(__pyx_v_self->__pyx_base.dm, (&__pyx_v_ival))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 458, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":459
 *         cdef PetscDMDAElementType ival = DMDA_ELEMENT_Q1
 *         CHKERR( DMDAGetElementType(self.dm, &ival) )
 *         return <long>ival             # <<<<<<<<<<<<<<
 * 
 *     def getElements(self, elem_type=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(((long)__pyx_v_ival)); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":456
 *         CHKERR( DMDASetElementType(self.dm, ival) )
 * 
 *     def getElementType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAElementType ival = DMDA_ELEMENT_Q1
 *         CHKERR( DMDAGetElementType(self.dm, &ival) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getElementType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":461
 *         return <long>ival
 * 
 *     def getElements(self, elem_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim=0
 *         cdef PetscDMDAElementType etype
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_85getElements(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_4DMDA_84getElements[] = "DMDA.getElements(self, elem_type=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_85getElements(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_elem_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getElements (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elem_type,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elem_type);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getElements") < 0)) __PYX_ERR(41, 461, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_elem_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getElements", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(41, 461, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_84getElements(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self), __pyx_v_elem_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_84getElements(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__pyx_v_self, PyObject *__pyx_v_elem_type) {
  PetscInt __pyx_v_dim;
  DMDAElementType __pyx_v_etype;
  PetscInt __pyx_v_nel;
  PetscInt __pyx_v_nen;
  const PetscInt *__pyx_v_elems;
  PyObject *__pyx_v_elements = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  DMDAElementType __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  char const *__pyx_t_9;
  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;
  __Pyx_RefNannySetupContext("getElements", 0);

  /* "PETSc/DMDA.pyx":462
 * 
 *     def getElements(self, elem_type=None):
 *         cdef PetscInt dim=0             # <<<<<<<<<<<<<<
 *         cdef PetscDMDAElementType etype
 *         cdef PetscInt nel=0, nen=0
 */
  __pyx_v_dim = 0;

  /* "PETSc/DMDA.pyx":464
 *         cdef PetscInt dim=0
 *         cdef PetscDMDAElementType etype
 *         cdef PetscInt nel=0, nen=0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *elems=NULL
 *         cdef object elements
 */
  __pyx_v_nel = 0;
  __pyx_v_nen = 0;

  /* "PETSc/DMDA.pyx":465
 *         cdef PetscDMDAElementType etype
 *         cdef PetscInt nel=0, nen=0
 *         cdef const_PetscInt *elems=NULL             # <<<<<<<<<<<<<<
 *         cdef object elements
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 */
  __pyx_v_elems = NULL;

  /* "PETSc/DMDA.pyx":467
 *         cdef const_PetscInt *elems=NULL
 *         cdef object elements
 *         CHKERR( DMDAGetDim(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         if elem_type is not None:
 *             etype = daelementtype(elem_type)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_DMDAGetDim(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 467, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":468
 *         cdef object elements
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         if elem_type is not None:             # <<<<<<<<<<<<<<
 *             etype = daelementtype(elem_type)
 *             CHKERR( DMDASetElementType(self.dm, etype) )
 */
  __pyx_t_2 = (__pyx_v_elem_type != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/DMDA.pyx":469
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         if elem_type is not None:
 *             etype = daelementtype(elem_type)             # <<<<<<<<<<<<<<
 *             CHKERR( DMDASetElementType(self.dm, etype) )
 *         try:
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_daelementtype(__pyx_v_elem_type); if (unlikely(__pyx_t_4 == ((DMDAElementType)-1L))) __PYX_ERR(41, 469, __pyx_L1_error)
    __pyx_v_etype = __pyx_t_4;

    /* "PETSc/DMDA.pyx":470
 *         if elem_type is not None:
 *             etype = daelementtype(elem_type)
 *             CHKERR( DMDASetElementType(self.dm, etype) )             # <<<<<<<<<<<<<<
 *         try:
 *             CHKERR( DMDAGetElements(self.dm, &nel, &nen, &elems) )
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDASetElementType(__pyx_v_self->__pyx_base.dm, __pyx_v_etype)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 470, __pyx_L1_error)

    /* "PETSc/DMDA.pyx":468
 *         cdef object elements
 *         CHKERR( DMDAGetDim(self.dm, &dim) )
 *         if elem_type is not None:             # <<<<<<<<<<<<<<
 *             etype = daelementtype(elem_type)
 *             CHKERR( DMDASetElementType(self.dm, etype) )
 */
  }

  /* "PETSc/DMDA.pyx":471
 *             etype = daelementtype(elem_type)
 *             CHKERR( DMDASetElementType(self.dm, etype) )
 *         try:             # <<<<<<<<<<<<<<
 *             CHKERR( DMDAGetElements(self.dm, &nel, &nen, &elems) )
 *             elements = array_i(nel*nen, elems)
 */
  /*try:*/ {

    /* "PETSc/DMDA.pyx":472
 *             CHKERR( DMDASetElementType(self.dm, etype) )
 *         try:
 *             CHKERR( DMDAGetElements(self.dm, &nel, &nen, &elems) )             # <<<<<<<<<<<<<<
 *             elements = array_i(nel*nen, elems)
 *             elements.shape = (toInt(nel), toInt(nen))
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDAGetElements(__pyx_v_self->__pyx_base.dm, (&__pyx_v_nel), (&__pyx_v_nen), (&__pyx_v_elems))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 472, __pyx_L5_error)

    /* "PETSc/DMDA.pyx":473
 *         try:
 *             CHKERR( DMDAGetElements(self.dm, &nel, &nen, &elems) )
 *             elements = array_i(nel*nen, elems)             # <<<<<<<<<<<<<<
 *             elements.shape = (toInt(nel), toInt(nen))
 *         finally:
 */
    __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((__pyx_v_nel * __pyx_v_nen), __pyx_v_elems)); if (unlikely(!__pyx_t_5)) __PYX_ERR(41, 473, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_elements = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "PETSc/DMDA.pyx":474
 *             CHKERR( DMDAGetElements(self.dm, &nel, &nen, &elems) )
 *             elements = array_i(nel*nen, elems)
 *             elements.shape = (toInt(nel), toInt(nen))             # <<<<<<<<<<<<<<
 *         finally:
 *             CHKERR( DMDARestoreElements(self.dm, &nel, &nen, &elems) )
 */
    __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nel); if (unlikely(!__pyx_t_5)) __PYX_ERR(41, 474, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nen); if (unlikely(!__pyx_t_6)) __PYX_ERR(41, 474, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(41, 474, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_elements, __pyx_n_s_shape, __pyx_t_7) < 0) __PYX_ERR(41, 474, __pyx_L5_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }

  /* "PETSc/DMDA.pyx":476
 *             elements.shape = (toInt(nel), toInt(nen))
 *         finally:
 *             CHKERR( DMDARestoreElements(self.dm, &nel, &nen, &elems) )             # <<<<<<<<<<<<<<
 *         return elements
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDARestoreElements(__pyx_v_self->__pyx_base.dm, (&__pyx_v_nel), (&__pyx_v_nen), (&__pyx_v_elems))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(41, 476, __pyx_L1_error)
      goto __pyx_L6;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L5_error:;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_1 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __pyx_t_16 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMDARestoreElements(__pyx_v_self->__pyx_base.dm, (&__pyx_v_nel), (&__pyx_v_nen), (&__pyx_v_elems))); if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(41, 476, __pyx_L8_error)
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L8_error:;
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "PETSc/DMDA.pyx":477
 *         finally:
 *             CHKERR( DMDARestoreElements(self.dm, &nel, &nen, &elems) )
 *         return elements             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_elements);
  __pyx_r = __pyx_v_elements;
  goto __pyx_L0;

  /* "PETSc/DMDA.pyx":461
 *         return <long>ival
 * 
 *     def getElements(self, elem_type=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim=0
 *         cdef PetscDMDAElementType etype
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.getElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elements);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":482
 * 
 *     property dim:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getDim()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_3dim_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_3dim_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_3dim___get__(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_3dim___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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);

  /* "PETSc/DMDA.pyx":483
 *     property dim:
 *         def __get__(self):
 *             return self.getDim()             # <<<<<<<<<<<<<<
 * 
 *     property dof:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getDim); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 483, __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(41, 483, __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;

  /* "PETSc/DMDA.pyx":482
 * 
 *     property dim:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getDim()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.dim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":486
 * 
 *     property dof:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getDof()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_3dof_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_3dof_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_3dof___get__(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_3dof___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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);

  /* "PETSc/DMDA.pyx":487
 *     property dof:
 *         def __get__(self):
 *             return self.getDof()             # <<<<<<<<<<<<<<
 * 
 *     property sizes:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getDof); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 487, __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(41, 487, __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;

  /* "PETSc/DMDA.pyx":486
 * 
 *     property dof:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getDof()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.dof.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":490
 * 
 *     property sizes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSizes()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_5sizes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_5sizes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_5sizes___get__(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_5sizes___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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);

  /* "PETSc/DMDA.pyx":491
 *     property sizes:
 *         def __get__(self):
 *             return self.getSizes()             # <<<<<<<<<<<<<<
 * 
 *     property proc_sizes:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getSizes); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 491, __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(41, 491, __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;

  /* "PETSc/DMDA.pyx":490
 * 
 *     property sizes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getSizes()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.sizes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":494
 * 
 *     property proc_sizes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getProcSizes()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_10proc_sizes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_10proc_sizes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_10proc_sizes___get__(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_10proc_sizes___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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);

  /* "PETSc/DMDA.pyx":495
 *     property proc_sizes:
 *         def __get__(self):
 *             return self.getProcSizes()             # <<<<<<<<<<<<<<
 * 
 *     property boundary_type:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getProcSizes); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 495, __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(41, 495, __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;

  /* "PETSc/DMDA.pyx":494
 * 
 *     property proc_sizes:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getProcSizes()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.proc_sizes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":498
 * 
 *     property boundary_type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBoundaryType()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_13boundary_type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_13boundary_type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_13boundary_type___get__(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_13boundary_type___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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);

  /* "PETSc/DMDA.pyx":499
 *     property boundary_type:
 *         def __get__(self):
 *             return self.getBoundaryType()             # <<<<<<<<<<<<<<
 * 
 *     property stencil:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getBoundaryType); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 499, __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(41, 499, __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;

  /* "PETSc/DMDA.pyx":498
 * 
 *     property boundary_type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getBoundaryType()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.boundary_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":502
 * 
 *     property stencil:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getStencil()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_7stencil_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_7stencil_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_7stencil___get__(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_7stencil___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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);

  /* "PETSc/DMDA.pyx":503
 *     property stencil:
 *         def __get__(self):
 *             return self.getStencil()             # <<<<<<<<<<<<<<
 * 
 *     property stencil_type:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getStencil); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 503, __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(41, 503, __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;

  /* "PETSc/DMDA.pyx":502
 * 
 *     property stencil:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getStencil()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.stencil.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":506
 * 
 *     property stencil_type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getStencilType()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_12stencil_type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_12stencil_type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_12stencil_type___get__(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_12stencil_type___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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);

  /* "PETSc/DMDA.pyx":507
 *     property stencil_type:
 *         def __get__(self):
 *             return self.getStencilType()             # <<<<<<<<<<<<<<
 * 
 *     property stencil_width:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getStencilType); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 507, __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(41, 507, __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;

  /* "PETSc/DMDA.pyx":506
 * 
 *     property stencil_type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getStencilType()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.stencil_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":510
 * 
 *     property stencil_width:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getStencilWidth()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_13stencil_width_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_13stencil_width_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_13stencil_width___get__(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_13stencil_width___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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);

  /* "PETSc/DMDA.pyx":511
 *     property stencil_width:
 *         def __get__(self):
 *             return self.getStencilWidth()             # <<<<<<<<<<<<<<
 * 
 *     property ranges:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getStencilWidth); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 511, __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(41, 511, __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;

  /* "PETSc/DMDA.pyx":510
 * 
 *     property stencil_width:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getStencilWidth()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.stencil_width.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":514
 * 
 *     property ranges:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getRanges()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_6ranges_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_6ranges_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_6ranges___get__(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_6ranges___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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);

  /* "PETSc/DMDA.pyx":515
 *     property ranges:
 *         def __get__(self):
 *             return self.getRanges()             # <<<<<<<<<<<<<<
 * 
 *     property ghost_ranges:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getRanges); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 515, __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(41, 515, __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;

  /* "PETSc/DMDA.pyx":514
 * 
 *     property ranges:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getRanges()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.ranges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":518
 * 
 *     property ghost_ranges:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getGhostRanges()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_12ghost_ranges_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_12ghost_ranges_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_12ghost_ranges___get__(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_12ghost_ranges___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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);

  /* "PETSc/DMDA.pyx":519
 *     property ghost_ranges:
 *         def __get__(self):
 *             return self.getGhostRanges()             # <<<<<<<<<<<<<<
 * 
 *     property corners:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getGhostRanges); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 519, __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(41, 519, __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;

  /* "PETSc/DMDA.pyx":518
 * 
 *     property ghost_ranges:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getGhostRanges()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.ghost_ranges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":522
 * 
 *     property corners:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getCorners()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_7corners_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_7corners_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_7corners___get__(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_7corners___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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);

  /* "PETSc/DMDA.pyx":523
 *     property corners:
 *         def __get__(self):
 *             return self.getCorners()             # <<<<<<<<<<<<<<
 * 
 *     property ghost_corners:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getCorners); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 523, __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(41, 523, __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;

  /* "PETSc/DMDA.pyx":522
 * 
 *     property corners:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getCorners()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.corners.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMDA.pyx":526
 * 
 *     property ghost_corners:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getGhostCorners()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_13ghost_corners_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8petsc4py_5PETSc_4DMDA_13ghost_corners_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_4DMDA_13ghost_corners___get__(((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_4DMDA_13ghost_corners___get__(struct __pyx_obj_8petsc4py_5PETSc_DMDA *__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);

  /* "PETSc/DMDA.pyx":527
 *     property ghost_corners:
 *         def __get__(self):
 *             return self.getGhostCorners()             # <<<<<<<<<<<<<<
 * 
 *     # backward compatibility
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getGhostCorners); if (unlikely(!__pyx_t_2)) __PYX_ERR(41, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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(41, 527, __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(41, 527, __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;

  /* "PETSc/DMDA.pyx":526
 * 
 *     property ghost_corners:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.getGhostCorners()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMDA.ghost_corners.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":5
 * cdef class DMPlex(DM):
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_1create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_create[] = "DMPlex.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_1create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(42, 5, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 5, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_create(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_create(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  DM __pyx_v_newdm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/DMPlex.pyx":6
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMPlexCreate(ccomm, &newdm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 6, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":7
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreate(ccomm, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DMPlex.pyx":8
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMPlexCreate(ccomm, &newdm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreate(__pyx_v_ccomm, (&__pyx_v_newdm))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 8, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":9
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMPlexCreate(ccomm, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newdm;

  /* "PETSc/DMPlex.pyx":10
 *         CHKERR( DMPlexCreate(ccomm, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createFromCellList(self, dim, cells, coords, interpolate=True, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":5
 * cdef class DMPlex(DM):
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":12
 *         return self
 * 
 *     def createFromCellList(self, dim, cells, coords, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_3createFromCellList(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_2createFromCellList[] = "DMPlex.createFromCellList(self, dim, cells, coords, interpolate=True, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_3createFromCellList(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dim = 0;
  PyObject *__pyx_v_cells = 0;
  PyObject *__pyx_v_coords = 0;
  PyObject *__pyx_v_interpolate = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createFromCellList (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dim,&__pyx_n_s_cells,&__pyx_n_s_coords,&__pyx_n_s_interpolate,&__pyx_n_s_comm,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)Py_True);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_dim)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cells)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createFromCellList", 0, 3, 5, 1); __PYX_ERR(42, 12, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createFromCellList", 0, 3, 5, 2); __PYX_ERR(42, 12, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_interpolate);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createFromCellList") < 0)) __PYX_ERR(42, 12, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_dim = values[0];
    __pyx_v_cells = values[1];
    __pyx_v_coords = values[2];
    __pyx_v_interpolate = values[3];
    __pyx_v_comm = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createFromCellList", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 12, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createFromCellList", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_2createFromCellList(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_dim, __pyx_v_cells, __pyx_v_coords, __pyx_v_interpolate, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_2createFromCellList(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_dim, PyObject *__pyx_v_cells, PyObject *__pyx_v_coords, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscBool __pyx_v_interp;
  DM __pyx_v_newdm;
  PetscInt __pyx_v_cdim;
  PetscInt __pyx_v_numCells;
  PetscInt __pyx_v_numCorners;
  int *__pyx_v_cellVertices;
  PetscInt __pyx_v_numVertices;
  PetscInt __pyx_v_spaceDim;
  double *__pyx_v_vertexCoords;
  int __pyx_v_npy_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PetscBool __pyx_t_2;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("createFromCellList", 0);
  __Pyx_INCREF(__pyx_v_cells);
  __Pyx_INCREF(__pyx_v_coords);

  /* "PETSc/DMPlex.pyx":13
 * 
 *     def createFromCellList(self, dim, cells, coords, interpolate=True, comm=None):
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 13, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":14
 *     def createFromCellList(self, dim, cells, coords, interpolate=True, comm=None):
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate             # <<<<<<<<<<<<<<
 *         cdef PetscDM   newdm = NULL
 *         cdef PetscInt  cdim = asInt(dim)
 */
  __pyx_t_2 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_interpolate)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 14, __pyx_L1_error)
  __pyx_v_interp = __pyx_t_2;

  /* "PETSc/DMPlex.pyx":15
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt  cdim = asInt(dim)
 *         cdef PetscInt  numCells = 0
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DMPlex.pyx":16
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL
 *         cdef PetscInt  cdim = asInt(dim)             # <<<<<<<<<<<<<<
 *         cdef PetscInt  numCells = 0
 *         cdef PetscInt  numCorners = 0
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_dim); if (unlikely(__pyx_t_3 == -1L && PyErr_Occurred())) __PYX_ERR(42, 16, __pyx_L1_error)
  __pyx_v_cdim = __pyx_t_3;

  /* "PETSc/DMPlex.pyx":17
 *         cdef PetscDM   newdm = NULL
 *         cdef PetscInt  cdim = asInt(dim)
 *         cdef PetscInt  numCells = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt  numCorners = 0
 *         cdef int       *cellVertices = NULL
 */
  __pyx_v_numCells = 0;

  /* "PETSc/DMPlex.pyx":18
 *         cdef PetscInt  cdim = asInt(dim)
 *         cdef PetscInt  numCells = 0
 *         cdef PetscInt  numCorners = 0             # <<<<<<<<<<<<<<
 *         cdef int       *cellVertices = NULL
 *         cdef PetscInt  numVertices = 0
 */
  __pyx_v_numCorners = 0;

  /* "PETSc/DMPlex.pyx":19
 *         cdef PetscInt  numCells = 0
 *         cdef PetscInt  numCorners = 0
 *         cdef int       *cellVertices = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt  numVertices = 0
 *         cdef PetscInt  spaceDim= 0
 */
  __pyx_v_cellVertices = NULL;

  /* "PETSc/DMPlex.pyx":20
 *         cdef PetscInt  numCorners = 0
 *         cdef int       *cellVertices = NULL
 *         cdef PetscInt  numVertices = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt  spaceDim= 0
 *         cdef double    *vertexCoords = NULL
 */
  __pyx_v_numVertices = 0;

  /* "PETSc/DMPlex.pyx":21
 *         cdef int       *cellVertices = NULL
 *         cdef PetscInt  numVertices = 0
 *         cdef PetscInt  spaceDim= 0             # <<<<<<<<<<<<<<
 *         cdef double    *vertexCoords = NULL
 *         cdef int npy_flags = NPY_ARRAY_ALIGNED|NPY_ARRAY_NOTSWAPPED|NPY_ARRAY_CARRAY
 */
  __pyx_v_spaceDim = 0;

  /* "PETSc/DMPlex.pyx":22
 *         cdef PetscInt  numVertices = 0
 *         cdef PetscInt  spaceDim= 0
 *         cdef double    *vertexCoords = NULL             # <<<<<<<<<<<<<<
 *         cdef int npy_flags = NPY_ARRAY_ALIGNED|NPY_ARRAY_NOTSWAPPED|NPY_ARRAY_CARRAY
 *         cells  = PyArray_FROM_OTF(cells,  NPY_INT,    npy_flags)
 */
  __pyx_v_vertexCoords = NULL;

  /* "PETSc/DMPlex.pyx":23
 *         cdef PetscInt  spaceDim= 0
 *         cdef double    *vertexCoords = NULL
 *         cdef int npy_flags = NPY_ARRAY_ALIGNED|NPY_ARRAY_NOTSWAPPED|NPY_ARRAY_CARRAY             # <<<<<<<<<<<<<<
 *         cells  = PyArray_FROM_OTF(cells,  NPY_INT,    npy_flags)
 *         coords = PyArray_FROM_OTF(coords, NPY_DOUBLE, npy_flags)
 */
  __pyx_v_npy_flags = ((NPY_ARRAY_ALIGNED | NPY_ARRAY_NOTSWAPPED) | NPY_ARRAY_CARRAY);

  /* "PETSc/DMPlex.pyx":24
 *         cdef double    *vertexCoords = NULL
 *         cdef int npy_flags = NPY_ARRAY_ALIGNED|NPY_ARRAY_NOTSWAPPED|NPY_ARRAY_CARRAY
 *         cells  = PyArray_FROM_OTF(cells,  NPY_INT,    npy_flags)             # <<<<<<<<<<<<<<
 *         coords = PyArray_FROM_OTF(coords, NPY_DOUBLE, npy_flags)
 *         if PyArray_NDIM(cells) != 2: raise ValueError(
 */
  __pyx_t_4 = ((PyObject *)PyArray_FROM_OTF(__pyx_v_cells, NPY_INT, __pyx_v_npy_flags)); if (unlikely(!__pyx_t_4)) __PYX_ERR(42, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_cells, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/DMPlex.pyx":25
 *         cdef int npy_flags = NPY_ARRAY_ALIGNED|NPY_ARRAY_NOTSWAPPED|NPY_ARRAY_CARRAY
 *         cells  = PyArray_FROM_OTF(cells,  NPY_INT,    npy_flags)
 *         coords = PyArray_FROM_OTF(coords, NPY_DOUBLE, npy_flags)             # <<<<<<<<<<<<<<
 *         if PyArray_NDIM(cells) != 2: raise ValueError(
 *                 ("cell indices must have two dimensions: "
 */
  __pyx_t_4 = ((PyObject *)PyArray_FROM_OTF(__pyx_v_coords, NPY_DOUBLE, __pyx_v_npy_flags)); if (unlikely(!__pyx_t_4)) __PYX_ERR(42, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_coords, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "PETSc/DMPlex.pyx":26
 *         cells  = PyArray_FROM_OTF(cells,  NPY_INT,    npy_flags)
 *         coords = PyArray_FROM_OTF(coords, NPY_DOUBLE, npy_flags)
 *         if PyArray_NDIM(cells) != 2: raise ValueError(             # <<<<<<<<<<<<<<
 *                 ("cell indices must have two dimensions: "
 *                  "cells.ndim=%d") % (PyArray_NDIM(cells)) )
 */
  if (!(likely(((__pyx_v_cells) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_cells, __pyx_ptype_8petsc4py_5PETSc_ndarray))))) __PYX_ERR(42, 26, __pyx_L1_error)
  __pyx_t_5 = ((PyArray_NDIM(((PyArrayObject *)__pyx_v_cells)) != 2) != 0);
  if (__pyx_t_5) {

    /* "PETSc/DMPlex.pyx":28
 *         if PyArray_NDIM(cells) != 2: raise ValueError(
 *                 ("cell indices must have two dimensions: "
 *                  "cells.ndim=%d") % (PyArray_NDIM(cells)) )             # <<<<<<<<<<<<<<
 *         if PyArray_NDIM(coords) != 2: raise ValueError(
 *                 ("coords vertices must have two dimensions: "
 */
    if (!(likely(((__pyx_v_cells) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_cells, __pyx_ptype_8petsc4py_5PETSc_ndarray))))) __PYX_ERR(42, 28, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyInt_From_int(PyArray_NDIM(((PyArrayObject *)__pyx_v_cells))); if (unlikely(!__pyx_t_4)) __PYX_ERR(42, 28, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_cell_indices_must_have_two_dimen, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(42, 28, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "PETSc/DMPlex.pyx":26
 *         cells  = PyArray_FROM_OTF(cells,  NPY_INT,    npy_flags)
 *         coords = PyArray_FROM_OTF(coords, NPY_DOUBLE, npy_flags)
 *         if PyArray_NDIM(cells) != 2: raise ValueError(             # <<<<<<<<<<<<<<
 *                 ("cell indices must have two dimensions: "
 *                  "cells.ndim=%d") % (PyArray_NDIM(cells)) )
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(42, 26, __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 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(42, 26, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __PYX_ERR(42, 26, __pyx_L1_error)
  }

  /* "PETSc/DMPlex.pyx":29
 *                 ("cell indices must have two dimensions: "
 *                  "cells.ndim=%d") % (PyArray_NDIM(cells)) )
 *         if PyArray_NDIM(coords) != 2: raise ValueError(             # <<<<<<<<<<<<<<
 *                 ("coords vertices must have two dimensions: "
 *                  "coords.ndim=%d") % (PyArray_NDIM(coords)) )
 */
  if (!(likely(((__pyx_v_coords) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_coords, __pyx_ptype_8petsc4py_5PETSc_ndarray))))) __PYX_ERR(42, 29, __pyx_L1_error)
  __pyx_t_5 = ((PyArray_NDIM(((PyArrayObject *)__pyx_v_coords)) != 2) != 0);
  if (__pyx_t_5) {

    /* "PETSc/DMPlex.pyx":31
 *         if PyArray_NDIM(coords) != 2: raise ValueError(
 *                 ("coords vertices must have two dimensions: "
 *                  "coords.ndim=%d") % (PyArray_NDIM(coords)) )             # <<<<<<<<<<<<<<
 *         numCells     = <PetscInt> PyArray_DIM(cells,  0)
 *         numCorners   = <PetscInt> PyArray_DIM(cells,  1)
 */
    if (!(likely(((__pyx_v_coords) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_coords, __pyx_ptype_8petsc4py_5PETSc_ndarray))))) __PYX_ERR(42, 31, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyInt_From_int(PyArray_NDIM(((PyArrayObject *)__pyx_v_coords))); if (unlikely(!__pyx_t_6)) __PYX_ERR(42, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_coords_vertices_must_have_two_di, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(42, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "PETSc/DMPlex.pyx":29
 *                 ("cell indices must have two dimensions: "
 *                  "cells.ndim=%d") % (PyArray_NDIM(cells)) )
 *         if PyArray_NDIM(coords) != 2: raise ValueError(             # <<<<<<<<<<<<<<
 *                 ("coords vertices must have two dimensions: "
 *                  "coords.ndim=%d") % (PyArray_NDIM(coords)) )
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(42, 29, __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_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(42, 29, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(42, 29, __pyx_L1_error)
  }

  /* "PETSc/DMPlex.pyx":32
 *                 ("coords vertices must have two dimensions: "
 *                  "coords.ndim=%d") % (PyArray_NDIM(coords)) )
 *         numCells     = <PetscInt> PyArray_DIM(cells,  0)             # <<<<<<<<<<<<<<
 *         numCorners   = <PetscInt> PyArray_DIM(cells,  1)
 *         numVertices  = <PetscInt> PyArray_DIM(coords, 0)
 */
  if (!(likely(((__pyx_v_cells) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_cells, __pyx_ptype_8petsc4py_5PETSc_ndarray))))) __PYX_ERR(42, 32, __pyx_L1_error)
  __pyx_v_numCells = ((PetscInt)PyArray_DIM(((PyArrayObject *)__pyx_v_cells), 0));

  /* "PETSc/DMPlex.pyx":33
 *                  "coords.ndim=%d") % (PyArray_NDIM(coords)) )
 *         numCells     = <PetscInt> PyArray_DIM(cells,  0)
 *         numCorners   = <PetscInt> PyArray_DIM(cells,  1)             # <<<<<<<<<<<<<<
 *         numVertices  = <PetscInt> PyArray_DIM(coords, 0)
 *         spaceDim     = <PetscInt> PyArray_DIM(coords, 1)
 */
  if (!(likely(((__pyx_v_cells) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_cells, __pyx_ptype_8petsc4py_5PETSc_ndarray))))) __PYX_ERR(42, 33, __pyx_L1_error)
  __pyx_v_numCorners = ((PetscInt)PyArray_DIM(((PyArrayObject *)__pyx_v_cells), 1));

  /* "PETSc/DMPlex.pyx":34
 *         numCells     = <PetscInt> PyArray_DIM(cells,  0)
 *         numCorners   = <PetscInt> PyArray_DIM(cells,  1)
 *         numVertices  = <PetscInt> PyArray_DIM(coords, 0)             # <<<<<<<<<<<<<<
 *         spaceDim     = <PetscInt> PyArray_DIM(coords, 1)
 *         cellVertices = <int*>     PyArray_DATA(cells)
 */
  if (!(likely(((__pyx_v_coords) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_coords, __pyx_ptype_8petsc4py_5PETSc_ndarray))))) __PYX_ERR(42, 34, __pyx_L1_error)
  __pyx_v_numVertices = ((PetscInt)PyArray_DIM(((PyArrayObject *)__pyx_v_coords), 0));

  /* "PETSc/DMPlex.pyx":35
 *         numCorners   = <PetscInt> PyArray_DIM(cells,  1)
 *         numVertices  = <PetscInt> PyArray_DIM(coords, 0)
 *         spaceDim     = <PetscInt> PyArray_DIM(coords, 1)             # <<<<<<<<<<<<<<
 *         cellVertices = <int*>     PyArray_DATA(cells)
 *         vertexCoords = <double*>  PyArray_DATA(coords)
 */
  if (!(likely(((__pyx_v_coords) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_coords, __pyx_ptype_8petsc4py_5PETSc_ndarray))))) __PYX_ERR(42, 35, __pyx_L1_error)
  __pyx_v_spaceDim = ((PetscInt)PyArray_DIM(((PyArrayObject *)__pyx_v_coords), 1));

  /* "PETSc/DMPlex.pyx":36
 *         numVertices  = <PetscInt> PyArray_DIM(coords, 0)
 *         spaceDim     = <PetscInt> PyArray_DIM(coords, 1)
 *         cellVertices = <int*>     PyArray_DATA(cells)             # <<<<<<<<<<<<<<
 *         vertexCoords = <double*>  PyArray_DATA(coords)
 *         CHKERR( DMPlexCreateFromCellList(ccomm, cdim, numCells, numVertices,
 */
  if (!(likely(((__pyx_v_cells) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_cells, __pyx_ptype_8petsc4py_5PETSc_ndarray))))) __PYX_ERR(42, 36, __pyx_L1_error)
  __pyx_v_cellVertices = ((int *)PyArray_DATA(((PyArrayObject *)__pyx_v_cells)));

  /* "PETSc/DMPlex.pyx":37
 *         spaceDim     = <PetscInt> PyArray_DIM(coords, 1)
 *         cellVertices = <int*>     PyArray_DATA(cells)
 *         vertexCoords = <double*>  PyArray_DATA(coords)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateFromCellList(ccomm, cdim, numCells, numVertices,
 *                                          numCorners, interp, cellVertices,
 */
  if (!(likely(((__pyx_v_coords) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_coords, __pyx_ptype_8petsc4py_5PETSc_ndarray))))) __PYX_ERR(42, 37, __pyx_L1_error)
  __pyx_v_vertexCoords = ((double *)PyArray_DATA(((PyArrayObject *)__pyx_v_coords)));

  /* "PETSc/DMPlex.pyx":38
 *         cellVertices = <int*>     PyArray_DATA(cells)
 *         vertexCoords = <double*>  PyArray_DATA(coords)
 *         CHKERR( DMPlexCreateFromCellList(ccomm, cdim, numCells, numVertices,             # <<<<<<<<<<<<<<
 *                                          numCorners, interp, cellVertices,
 *                                          spaceDim, vertexCoords, &newdm) )
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateFromCellList(__pyx_v_ccomm, __pyx_v_cdim, __pyx_v_numCells, __pyx_v_numVertices, __pyx_v_numCorners, __pyx_v_interp, __pyx_v_cellVertices, __pyx_v_spaceDim, __pyx_v_vertexCoords, (&__pyx_v_newdm))); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(42, 38, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":41
 *                                          numCorners, interp, cellVertices,
 *                                          spaceDim, vertexCoords, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newdm;

  /* "PETSc/DMPlex.pyx":42
 *                                          spaceDim, vertexCoords, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createBoxMesh(self, dim, interpolate=True, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":12
 *         return self
 * 
 *     def createFromCellList(self, dim, cells, coords, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createFromCellList", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cells);
  __Pyx_XDECREF(__pyx_v_coords);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":44
 *         return self
 * 
 *     def createBoxMesh(self, dim, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  cdim = asInt(dim)
 *         cdef PetscBool interp = interpolate
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_5createBoxMesh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_4createBoxMesh[] = "DMPlex.createBoxMesh(self, dim, interpolate=True, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_5createBoxMesh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dim = 0;
  PyObject *__pyx_v_interpolate = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createBoxMesh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dim,&__pyx_n_s_interpolate,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_True);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_dim)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_interpolate);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createBoxMesh") < 0)) __PYX_ERR(42, 44, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_dim = values[0];
    __pyx_v_interpolate = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createBoxMesh", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 44, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createBoxMesh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_4createBoxMesh(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_dim, __pyx_v_interpolate, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_4createBoxMesh(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_dim, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm) {
  PetscInt __pyx_v_cdim;
  PetscBool __pyx_v_interp;
  MPI_Comm __pyx_v_ccomm;
  DM __pyx_v_newdm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PetscBool __pyx_t_2;
  MPI_Comm __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createBoxMesh", 0);

  /* "PETSc/DMPlex.pyx":45
 * 
 *     def createBoxMesh(self, dim, interpolate=True, comm=None):
 *         cdef PetscInt  cdim = asInt(dim)             # <<<<<<<<<<<<<<
 *         cdef PetscBool interp = interpolate
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_dim); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 45, __pyx_L1_error)
  __pyx_v_cdim = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":46
 *     def createBoxMesh(self, dim, interpolate=True, comm=None):
 *         cdef PetscInt  cdim = asInt(dim)
 *         cdef PetscBool interp = interpolate             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM   newdm = NULL
 */
  __pyx_t_2 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_interpolate)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 46, __pyx_L1_error)
  __pyx_v_interp = __pyx_t_2;

  /* "PETSc/DMPlex.pyx":47
 *         cdef PetscInt  cdim = asInt(dim)
 *         cdef PetscBool interp = interpolate
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscDM   newdm = NULL
 *         CHKERR( DMPlexCreateBoxMesh(ccomm,cdim, interp, &newdm) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 47, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_3;

  /* "PETSc/DMPlex.pyx":48
 *         cdef PetscBool interp = interpolate
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM   newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateBoxMesh(ccomm,cdim, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DMPlex.pyx":49
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM   newdm = NULL
 *         CHKERR( DMPlexCreateBoxMesh(ccomm,cdim, interp, &newdm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateBoxMesh(__pyx_v_ccomm, __pyx_v_cdim, __pyx_v_interp, (&__pyx_v_newdm))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 49, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":50
 *         cdef PetscDM   newdm = NULL
 *         CHKERR( DMPlexCreateBoxMesh(ccomm,cdim, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newdm;

  /* "PETSc/DMPlex.pyx":51
 *         CHKERR( DMPlexCreateBoxMesh(ccomm,cdim, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createHexBoxMesh(self, numcells, boundary_type=None, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":44
 *         return self
 * 
 *     def createBoxMesh(self, dim, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  cdim = asInt(dim)
 *         cdef PetscBool interp = interpolate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createBoxMesh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":53
 *         return self
 * 
 *     def createHexBoxMesh(self, numcells, boundary_type=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = 0, *icells = NULL
 *         cdef object tmp = iarray_i(numcells, &dim, &icells)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_7createHexBoxMesh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_6createHexBoxMesh[] = "DMPlex.createHexBoxMesh(self, numcells, boundary_type=None, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_7createHexBoxMesh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_numcells = 0;
  PyObject *__pyx_v_boundary_type = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createHexBoxMesh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_numcells,&__pyx_n_s_boundary_type,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_numcells)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boundary_type);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createHexBoxMesh") < 0)) __PYX_ERR(42, 53, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_numcells = values[0];
    __pyx_v_boundary_type = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createHexBoxMesh", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 53, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createHexBoxMesh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_6createHexBoxMesh(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_numcells, __pyx_v_boundary_type, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_6createHexBoxMesh(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_numcells, PyObject *__pyx_v_boundary_type, PyObject *__pyx_v_comm) {
  PetscInt __pyx_v_dim;
  PetscInt *__pyx_v_icells;
  CYTHON_UNUSED PyObject *__pyx_v_tmp = 0;
  DMBoundaryType __pyx_v_btx;
  DMBoundaryType __pyx_v_bty;
  DMBoundaryType __pyx_v_btz;
  MPI_Comm __pyx_v_ccomm;
  DM __pyx_v_newdm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PetscInt __pyx_t_4;
  MPI_Comm __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("createHexBoxMesh", 0);

  /* "PETSc/DMPlex.pyx":54
 * 
 *     def createHexBoxMesh(self, numcells, boundary_type=None, comm=None):
 *         cdef PetscInt dim = 0, *icells = NULL             # <<<<<<<<<<<<<<
 *         cdef object tmp = iarray_i(numcells, &dim, &icells)
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 */
  __pyx_v_dim = 0;
  __pyx_v_icells = NULL;

  /* "PETSc/DMPlex.pyx":55
 *     def createHexBoxMesh(self, numcells, boundary_type=None, comm=None):
 *         cdef PetscInt dim = 0, *icells = NULL
 *         cdef object tmp = iarray_i(numcells, &dim, &icells)             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_numcells, (&__pyx_v_dim), (&__pyx_v_icells))); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tmp = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":56
 *         cdef PetscInt dim = 0, *icells = NULL
 *         cdef object tmp = iarray_i(numcells, &dim, &icells)
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 */
  __pyx_v_btx = DM_BOUNDARY_NONE;

  /* "PETSc/DMPlex.pyx":57
 *         cdef object tmp = iarray_i(numcells, &dim, &icells)
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         if boundary_type is not None:
 */
  __pyx_v_bty = DM_BOUNDARY_NONE;

  /* "PETSc/DMPlex.pyx":58
 *         cdef PetscDMBoundaryType btx = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *         if boundary_type is not None:
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 */
  __pyx_v_btz = DM_BOUNDARY_NONE;

  /* "PETSc/DMPlex.pyx":59
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         if boundary_type is not None:             # <<<<<<<<<<<<<<
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_2 = (__pyx_v_boundary_type != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/DMPlex.pyx":60
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         if boundary_type is not None:
 *             asBoundary(boundary_type, &btx, &bty, &btz)             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM  newdm = NULL
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_asBoundary(__pyx_v_boundary_type, (&__pyx_v_btx), (&__pyx_v_bty), (&__pyx_v_btz)); if (unlikely(__pyx_t_4 == -1L && PyErr_Occurred())) __PYX_ERR(42, 60, __pyx_L1_error)

    /* "PETSc/DMPlex.pyx":59
 *         cdef PetscDMBoundaryType bty = DM_BOUNDARY_NONE
 *         cdef PetscDMBoundaryType btz = DM_BOUNDARY_NONE
 *         if boundary_type is not None:             # <<<<<<<<<<<<<<
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  }

  /* "PETSc/DMPlex.pyx":61
 *         if boundary_type is not None:
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscDM  newdm = NULL
 *         CHKERR( DMPlexCreateHexBoxMesh(ccomm, dim, icells, btx, bty, btz, &newdm) )
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 61, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_5;

  /* "PETSc/DMPlex.pyx":62
 *             asBoundary(boundary_type, &btx, &bty, &btz)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM  newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateHexBoxMesh(ccomm, dim, icells, btx, bty, btz, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DMPlex.pyx":63
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM  newdm = NULL
 *         CHKERR( DMPlexCreateHexBoxMesh(ccomm, dim, icells, btx, bty, btz, &newdm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self
 */
  __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateHexBoxMesh(__pyx_v_ccomm, __pyx_v_dim, __pyx_v_icells, __pyx_v_btx, __pyx_v_bty, __pyx_v_btz, (&__pyx_v_newdm))); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(42, 63, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":64
 *         cdef PetscDM  newdm = NULL
 *         CHKERR( DMPlexCreateHexBoxMesh(ccomm, dim, icells, btx, bty, btz, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newdm;

  /* "PETSc/DMPlex.pyx":65
 *         CHKERR( DMPlexCreateHexBoxMesh(ccomm, dim, icells, btx, bty, btz, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createCGNS(self, cgid, interpolate=True, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":53
 *         return self
 * 
 *     def createHexBoxMesh(self, numcells, boundary_type=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = 0, *icells = NULL
 *         cdef object tmp = iarray_i(numcells, &dim, &icells)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createHexBoxMesh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":67
 *         return self
 * 
 *     def createCGNS(self, cgid, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_9createCGNS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_8createCGNS[] = "DMPlex.createCGNS(self, cgid, interpolate=True, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_9createCGNS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cgid = 0;
  PyObject *__pyx_v_interpolate = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createCGNS (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cgid,&__pyx_n_s_interpolate,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_True);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_cgid)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_interpolate);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createCGNS") < 0)) __PYX_ERR(42, 67, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_cgid = values[0];
    __pyx_v_interpolate = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createCGNS", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 67, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createCGNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_8createCGNS(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_cgid, __pyx_v_interpolate, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_8createCGNS(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_cgid, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscBool __pyx_v_interp;
  DM __pyx_v_newdm;
  PetscInt __pyx_v_ccgid;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PetscBool __pyx_t_2;
  PetscInt __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createCGNS", 0);

  /* "PETSc/DMPlex.pyx":68
 * 
 *     def createCGNS(self, cgid, interpolate=True, comm=None):
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 68, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":69
 *     def createCGNS(self, cgid, interpolate=True, comm=None):
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate             # <<<<<<<<<<<<<<
 *         cdef PetscDM   newdm = NULL
 *         cdef PetscInt  ccgid = asInt(cgid)
 */
  __pyx_t_2 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_interpolate)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 69, __pyx_L1_error)
  __pyx_v_interp = __pyx_t_2;

  /* "PETSc/DMPlex.pyx":70
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt  ccgid = asInt(cgid)
 *         CHKERR( DMPlexCreateCGNS(ccomm, ccgid, interp, &newdm) )
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DMPlex.pyx":71
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL
 *         cdef PetscInt  ccgid = asInt(cgid)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateCGNS(ccomm, ccgid, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_cgid); if (unlikely(__pyx_t_3 == -1L && PyErr_Occurred())) __PYX_ERR(42, 71, __pyx_L1_error)
  __pyx_v_ccgid = __pyx_t_3;

  /* "PETSc/DMPlex.pyx":72
 *         cdef PetscDM   newdm = NULL
 *         cdef PetscInt  ccgid = asInt(cgid)
 *         CHKERR( DMPlexCreateCGNS(ccomm, ccgid, interp, &newdm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateCGNS(__pyx_v_ccomm, __pyx_v_ccgid, __pyx_v_interp, (&__pyx_v_newdm))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 72, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":73
 *         cdef PetscInt  ccgid = asInt(cgid)
 *         CHKERR( DMPlexCreateCGNS(ccomm, ccgid, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newdm;

  /* "PETSc/DMPlex.pyx":74
 *         CHKERR( DMPlexCreateCGNS(ccomm, ccgid, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createCGNSFromFile(self, filename, interpolate=True, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":67
 *         return self
 * 
 *     def createCGNS(self, cgid, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createCGNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":76
 *         return self
 * 
 *     def createCGNSFromFile(self, filename, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_11createCGNSFromFile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_10createCGNSFromFile[] = "DMPlex.createCGNSFromFile(self, filename, interpolate=True, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_11createCGNSFromFile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_interpolate = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createCGNSFromFile (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_interpolate,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_True);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_interpolate);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createCGNSFromFile") < 0)) __PYX_ERR(42, 76, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = values[0];
    __pyx_v_interpolate = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createCGNSFromFile", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 76, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createCGNSFromFile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_10createCGNSFromFile(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_filename, __pyx_v_interpolate, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_10createCGNSFromFile(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscBool __pyx_v_interp;
  DM __pyx_v_newdm;
  const char *__pyx_v_cfile;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PetscBool __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createCGNSFromFile", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "PETSc/DMPlex.pyx":77
 * 
 *     def createCGNSFromFile(self, filename, interpolate=True, comm=None):
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 77, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":78
 *     def createCGNSFromFile(self, filename, interpolate=True, comm=None):
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate             # <<<<<<<<<<<<<<
 *         cdef PetscDM   newdm = NULL
 *         cdef const_char *cfile = NULL
 */
  __pyx_t_2 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_interpolate)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 78, __pyx_L1_error)
  __pyx_v_interp = __pyx_t_2;

  /* "PETSc/DMPlex.pyx":79
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL             # <<<<<<<<<<<<<<
 *         cdef const_char *cfile = NULL
 *         filename = str2bytes(filename, &cfile)
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DMPlex.pyx":80
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL
 *         cdef const_char *cfile = NULL             # <<<<<<<<<<<<<<
 *         filename = str2bytes(filename, &cfile)
 *         CHKERR( DMPlexCreateCGNSFromFile(ccomm, cfile, interp, &newdm) )
 */
  __pyx_v_cfile = NULL;

  /* "PETSc/DMPlex.pyx":81
 *         cdef PetscDM   newdm = NULL
 *         cdef const_char *cfile = NULL
 *         filename = str2bytes(filename, &cfile)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateCGNSFromFile(ccomm, cfile, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_filename, (&__pyx_v_cfile)); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/DMPlex.pyx":82
 *         cdef const_char *cfile = NULL
 *         filename = str2bytes(filename, &cfile)
 *         CHKERR( DMPlexCreateCGNSFromFile(ccomm, cfile, interp, &newdm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateCGNSFromFile(__pyx_v_ccomm, __pyx_v_cfile, __pyx_v_interp, (&__pyx_v_newdm))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 82, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":83
 *         filename = str2bytes(filename, &cfile)
 *         CHKERR( DMPlexCreateCGNSFromFile(ccomm, cfile, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newdm;

  /* "PETSc/DMPlex.pyx":84
 *         CHKERR( DMPlexCreateCGNSFromFile(ccomm, cfile, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createExodusFromFile(self, filename, interpolate=True, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":76
 *         return self
 * 
 *     def createCGNSFromFile(self, filename, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createCGNSFromFile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":86
 *         return self
 * 
 *     def createExodusFromFile(self, filename, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_13createExodusFromFile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_12createExodusFromFile[] = "DMPlex.createExodusFromFile(self, filename, interpolate=True, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_13createExodusFromFile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_interpolate = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createExodusFromFile (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_interpolate,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_True);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_interpolate);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createExodusFromFile") < 0)) __PYX_ERR(42, 86, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = values[0];
    __pyx_v_interpolate = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createExodusFromFile", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 86, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createExodusFromFile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_12createExodusFromFile(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_filename, __pyx_v_interpolate, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_12createExodusFromFile(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscBool __pyx_v_interp;
  DM __pyx_v_newdm;
  const char *__pyx_v_cfile;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PetscBool __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createExodusFromFile", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "PETSc/DMPlex.pyx":87
 * 
 *     def createExodusFromFile(self, filename, interpolate=True, comm=None):
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 87, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":88
 *     def createExodusFromFile(self, filename, interpolate=True, comm=None):
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate             # <<<<<<<<<<<<<<
 *         cdef PetscDM   newdm = NULL
 *         cdef const_char *cfile = NULL
 */
  __pyx_t_2 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_interpolate)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 88, __pyx_L1_error)
  __pyx_v_interp = __pyx_t_2;

  /* "PETSc/DMPlex.pyx":89
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL             # <<<<<<<<<<<<<<
 *         cdef const_char *cfile = NULL
 *         filename = str2bytes(filename, &cfile)
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DMPlex.pyx":90
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL
 *         cdef const_char *cfile = NULL             # <<<<<<<<<<<<<<
 *         filename = str2bytes(filename, &cfile)
 *         CHKERR( DMPlexCreateExodusFromFile(ccomm, cfile, interp, &newdm) )
 */
  __pyx_v_cfile = NULL;

  /* "PETSc/DMPlex.pyx":91
 *         cdef PetscDM   newdm = NULL
 *         cdef const_char *cfile = NULL
 *         filename = str2bytes(filename, &cfile)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateExodusFromFile(ccomm, cfile, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_filename, (&__pyx_v_cfile)); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/DMPlex.pyx":92
 *         cdef const_char *cfile = NULL
 *         filename = str2bytes(filename, &cfile)
 *         CHKERR( DMPlexCreateExodusFromFile(ccomm, cfile, interp, &newdm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateExodusFromFile(__pyx_v_ccomm, __pyx_v_cfile, __pyx_v_interp, (&__pyx_v_newdm))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 92, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":93
 *         filename = str2bytes(filename, &cfile)
 *         CHKERR( DMPlexCreateExodusFromFile(ccomm, cfile, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newdm;

  /* "PETSc/DMPlex.pyx":94
 *         CHKERR( DMPlexCreateExodusFromFile(ccomm, cfile, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createExodus(self, exoid, interpolate=True, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":86
 *         return self
 * 
 *     def createExodusFromFile(self, filename, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createExodusFromFile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":96
 *         return self
 * 
 *     def createExodus(self, exoid, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_15createExodus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_14createExodus[] = "DMPlex.createExodus(self, exoid, interpolate=True, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_15createExodus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_exoid = 0;
  PyObject *__pyx_v_interpolate = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createExodus (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exoid,&__pyx_n_s_interpolate,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_True);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_exoid)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_interpolate);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createExodus") < 0)) __PYX_ERR(42, 96, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_exoid = values[0];
    __pyx_v_interpolate = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createExodus", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 96, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createExodus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_14createExodus(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_exoid, __pyx_v_interpolate, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_14createExodus(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_exoid, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscBool __pyx_v_interp;
  DM __pyx_v_newdm;
  PetscInt __pyx_v_cexoid;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PetscBool __pyx_t_2;
  PetscInt __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createExodus", 0);

  /* "PETSc/DMPlex.pyx":97
 * 
 *     def createExodus(self, exoid, interpolate=True, comm=None):
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 97, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":98
 *     def createExodus(self, exoid, interpolate=True, comm=None):
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate             # <<<<<<<<<<<<<<
 *         cdef PetscDM   newdm = NULL
 *         cdef PetscInt  cexoid = asInt(exoid)
 */
  __pyx_t_2 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_interpolate)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 98, __pyx_L1_error)
  __pyx_v_interp = __pyx_t_2;

  /* "PETSc/DMPlex.pyx":99
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt  cexoid = asInt(exoid)
 *         CHKERR( DMPlexCreateExodus(ccomm, cexoid, interp, &newdm) )
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DMPlex.pyx":100
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL
 *         cdef PetscInt  cexoid = asInt(exoid)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateExodus(ccomm, cexoid, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_exoid); if (unlikely(__pyx_t_3 == -1L && PyErr_Occurred())) __PYX_ERR(42, 100, __pyx_L1_error)
  __pyx_v_cexoid = __pyx_t_3;

  /* "PETSc/DMPlex.pyx":101
 *         cdef PetscDM   newdm = NULL
 *         cdef PetscInt  cexoid = asInt(exoid)
 *         CHKERR( DMPlexCreateExodus(ccomm, cexoid, interp, &newdm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateExodus(__pyx_v_ccomm, __pyx_v_cexoid, __pyx_v_interp, (&__pyx_v_newdm))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 101, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":102
 *         cdef PetscInt  cexoid = asInt(exoid)
 *         CHKERR( DMPlexCreateExodus(ccomm, cexoid, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newdm;

  /* "PETSc/DMPlex.pyx":103
 *         CHKERR( DMPlexCreateExodus(ccomm, cexoid, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createGmsh(self, Viewer viewer, interpolate=True, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":96
 *         return self
 * 
 *     def createExodus(self, exoid, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createExodus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":105
 *         return self
 * 
 *     def createGmsh(self, Viewer viewer, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_17createGmsh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_16createGmsh[] = "DMPlex.createGmsh(self, Viewer viewer, interpolate=True, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_17createGmsh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_v_interpolate = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createGmsh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,&__pyx_n_s_interpolate,&__pyx_n_s_comm,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_True);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_viewer)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_interpolate);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createGmsh") < 0)) __PYX_ERR(42, 105, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
    __pyx_v_interpolate = values[1];
    __pyx_v_comm = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createGmsh", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 105, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createGmsh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(42, 105, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_16createGmsh(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_viewer, __pyx_v_interpolate, __pyx_v_comm);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_16createGmsh(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer, PyObject *__pyx_v_interpolate, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscBool __pyx_v_interp;
  DM __pyx_v_newdm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  PetscBool __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("createGmsh", 0);

  /* "PETSc/DMPlex.pyx":106
 * 
 *     def createGmsh(self, Viewer viewer, interpolate=True, comm=None):
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 106, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":107
 *     def createGmsh(self, Viewer viewer, interpolate=True, comm=None):
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate             # <<<<<<<<<<<<<<
 *         cdef PetscDM   newdm = NULL
 *         CHKERR( DMPlexCreateGmsh(ccomm, viewer.vwr, interp, &newdm) )
 */
  __pyx_t_2 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_interpolate)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 107, __pyx_L1_error)
  __pyx_v_interp = __pyx_t_2;

  /* "PETSc/DMPlex.pyx":108
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateGmsh(ccomm, viewer.vwr, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DMPlex.pyx":109
 *         cdef PetscBool interp = interpolate
 *         cdef PetscDM   newdm = NULL
 *         CHKERR( DMPlexCreateGmsh(ccomm, viewer.vwr, interp, &newdm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateGmsh(__pyx_v_ccomm, __pyx_v_viewer->vwr, __pyx_v_interp, (&__pyx_v_newdm))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(42, 109, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":110
 *         cdef PetscDM   newdm = NULL
 *         CHKERR( DMPlexCreateGmsh(ccomm, viewer.vwr, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newdm;

  /* "PETSc/DMPlex.pyx":111
 *         CHKERR( DMPlexCreateGmsh(ccomm, viewer.vwr, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createCohesiveSubmesh(self, hasLagrange, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":105
 *         return self
 * 
 *     def createGmsh(self, Viewer viewer, interpolate=True, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm  ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscBool interp = interpolate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createGmsh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":113
 *         return self
 * 
 *     def createCohesiveSubmesh(self, hasLagrange, value):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = hasLagrange
 *         cdef PetscInt cvalue = asInt(value)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_19createCohesiveSubmesh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_18createCohesiveSubmesh[] = "DMPlex.createCohesiveSubmesh(self, hasLagrange, value)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_19createCohesiveSubmesh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_hasLagrange = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createCohesiveSubmesh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hasLagrange,&__pyx_n_s_value,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_hasLagrange)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createCohesiveSubmesh", 1, 2, 2, 1); __PYX_ERR(42, 113, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createCohesiveSubmesh") < 0)) __PYX_ERR(42, 113, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_hasLagrange = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createCohesiveSubmesh", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 113, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createCohesiveSubmesh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_18createCohesiveSubmesh(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_hasLagrange, __pyx_v_value);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_18createCohesiveSubmesh(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_hasLagrange, PyObject *__pyx_v_value) {
  PetscBool __pyx_v_flag;
  PetscInt __pyx_v_cvalue;
  struct PyPetscDMObject *__pyx_v_subdm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  PetscInt __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("createCohesiveSubmesh", 0);

  /* "PETSc/DMPlex.pyx":114
 * 
 *     def createCohesiveSubmesh(self, hasLagrange, value):
 *         cdef PetscBool flag = hasLagrange             # <<<<<<<<<<<<<<
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef DM subdm = DMPlex()
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_hasLagrange)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 114, __pyx_L1_error)
  __pyx_v_flag = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":115
 *     def createCohesiveSubmesh(self, hasLagrange, value):
 *         cdef PetscBool flag = hasLagrange
 *         cdef PetscInt cvalue = asInt(value)             # <<<<<<<<<<<<<<
 *         cdef DM subdm = DMPlex()
 *         CHKERR( DMPlexCreateCohesiveSubmesh(self.dm, flag, NULL, cvalue, &subdm.dm) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_value); if (unlikely(__pyx_t_2 == -1L && PyErr_Occurred())) __PYX_ERR(42, 115, __pyx_L1_error)
  __pyx_v_cvalue = __pyx_t_2;

  /* "PETSc/DMPlex.pyx":116
 *         cdef PetscBool flag = hasLagrange
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef DM subdm = DMPlex()             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateCohesiveSubmesh(self.dm, flag, NULL, cvalue, &subdm.dm) )
 *         return subdm
 */
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMPlex), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_subdm = ((struct PyPetscDMObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/DMPlex.pyx":117
 *         cdef PetscInt cvalue = asInt(value)
 *         cdef DM subdm = DMPlex()
 *         CHKERR( DMPlexCreateCohesiveSubmesh(self.dm, flag, NULL, cvalue, &subdm.dm) )             # <<<<<<<<<<<<<<
 *         return subdm
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateCohesiveSubmesh(__pyx_v_self->__pyx_base.dm, __pyx_v_flag, NULL, __pyx_v_cvalue, (&__pyx_v_subdm->dm))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 117, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":118
 *         cdef DM subdm = DMPlex()
 *         CHKERR( DMPlexCreateCohesiveSubmesh(self.dm, flag, NULL, cvalue, &subdm.dm) )
 *         return subdm             # <<<<<<<<<<<<<<
 * 
 *     def getChart(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_subdm));
  __pyx_r = ((PyObject *)__pyx_v_subdm);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":113
 *         return self
 * 
 *     def createCohesiveSubmesh(self, hasLagrange, value):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = hasLagrange
 *         cdef PetscInt cvalue = asInt(value)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createCohesiveSubmesh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_subdm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":120
 *         return subdm
 * 
 *     def getChart(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_21getChart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_20getChart[] = "DMPlex.getChart(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_21getChart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getChart (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getChart", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getChart", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_20getChart(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_20getChart(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  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;
  __Pyx_RefNannySetupContext("getChart", 0);

  /* "PETSc/DMPlex.pyx":121
 * 
 *     def getChart(self):
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         return toInt(pStart), toInt(pEnd)
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/DMPlex.pyx":122
 *     def getChart(self):
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         return toInt(pStart), toInt(pEnd)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetChart(__pyx_v_self->__pyx_base.dm, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(42, 122, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":123
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         return toInt(pStart), toInt(pEnd)             # <<<<<<<<<<<<<<
 * 
 *     def setChart(self, pStart, pEnd):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_pStart); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_pEnd); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(42, 123, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":120
 *         return subdm
 * 
 *     def getChart(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getChart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":125
 *         return toInt(pStart), toInt(pEnd)
 * 
 *     def setChart(self, pStart, pEnd):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cStart = asInt(pStart)
 *         cdef PetscInt cEnd   = asInt(pEnd)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_23setChart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_22setChart[] = "DMPlex.setChart(self, pStart, pEnd)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_23setChart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pStart = 0;
  PyObject *__pyx_v_pEnd = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setChart (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pStart,&__pyx_n_s_pEnd,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_pStart)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pEnd)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setChart", 1, 2, 2, 1); __PYX_ERR(42, 125, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setChart") < 0)) __PYX_ERR(42, 125, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pStart = values[0];
    __pyx_v_pEnd = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setChart", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 125, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setChart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_22setChart(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_pStart, __pyx_v_pEnd);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_22setChart(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_pStart, PyObject *__pyx_v_pEnd) {
  PetscInt __pyx_v_cStart;
  PetscInt __pyx_v_cEnd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setChart", 0);

  /* "PETSc/DMPlex.pyx":126
 * 
 *     def setChart(self, pStart, pEnd):
 *         cdef PetscInt cStart = asInt(pStart)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cEnd   = asInt(pEnd)
 *         CHKERR( DMPlexSetChart(self.dm, cStart, cEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_pStart); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 126, __pyx_L1_error)
  __pyx_v_cStart = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":127
 *     def setChart(self, pStart, pEnd):
 *         cdef PetscInt cStart = asInt(pStart)
 *         cdef PetscInt cEnd   = asInt(pEnd)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSetChart(self.dm, cStart, cEnd) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_pEnd); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 127, __pyx_L1_error)
  __pyx_v_cEnd = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":128
 *         cdef PetscInt cStart = asInt(pStart)
 *         cdef PetscInt cEnd   = asInt(pEnd)
 *         CHKERR( DMPlexSetChart(self.dm, cStart, cEnd) )             # <<<<<<<<<<<<<<
 * 
 *     def getConeSize(self, p):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetChart(__pyx_v_self->__pyx_base.dm, __pyx_v_cStart, __pyx_v_cEnd)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 128, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":125
 *         return toInt(pStart), toInt(pEnd)
 * 
 *     def setChart(self, pStart, pEnd):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cStart = asInt(pStart)
 *         cdef PetscInt cEnd   = asInt(pEnd)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setChart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":130
 *         CHKERR( DMPlexSetChart(self.dm, cStart, cEnd) )
 * 
 *     def getConeSize(self, p):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_25getConeSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_24getConeSize[] = "DMPlex.getConeSize(self, p)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_25getConeSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConeSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,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);
        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_p)) != 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, "getConeSize") < 0)) __PYX_ERR(42, 130, __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_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConeSize", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 130, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getConeSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_24getConeSize(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_24getConeSize(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  PetscInt __pyx_v_csize;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getConeSize", 0);

  /* "PETSc/DMPlex.pyx":131
 * 
 *     def getConeSize(self, p):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 131, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":132
 *     def getConeSize(self, p):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/DMPlex.pyx":133
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt csize = 0
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetChart(__pyx_v_self->__pyx_base.dm, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 133, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":134
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd             # <<<<<<<<<<<<<<
 *         cdef PetscInt csize = 0
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &csize) )
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = ((__pyx_v_cp >= __pyx_v_pStart) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_cp < __pyx_v_pEnd) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 134, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":135
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt csize = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &csize) )
 *         return toInt(csize)
 */
  __pyx_v_csize = 0;

  /* "PETSc/DMPlex.pyx":136
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt csize = 0
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &csize) )             # <<<<<<<<<<<<<<
 *         return toInt(csize)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetConeSize(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, (&__pyx_v_csize))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 136, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":137
 *         cdef PetscInt csize = 0
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &csize) )
 *         return toInt(csize)             # <<<<<<<<<<<<<<
 * 
 *     def setConeSize(self, p, size):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_csize); if (unlikely(!__pyx_t_5)) __PYX_ERR(42, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":130
 *         CHKERR( DMPlexSetChart(self.dm, cStart, cEnd) )
 * 
 *     def getConeSize(self, p):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getConeSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":139
 *         return toInt(csize)
 * 
 *     def setConeSize(self, p, size):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_27setConeSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_26setConeSize[] = "DMPlex.setConeSize(self, p, size)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_27setConeSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConeSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_size,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConeSize", 1, 2, 2, 1); __PYX_ERR(42, 139, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConeSize") < 0)) __PYX_ERR(42, 139, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_p = values[0];
    __pyx_v_size = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConeSize", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 139, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setConeSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_26setConeSize(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_26setConeSize(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_size) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  PetscInt __pyx_v_csize;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setConeSize", 0);

  /* "PETSc/DMPlex.pyx":140
 * 
 *     def setConeSize(self, p, size):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 140, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":141
 *     def setConeSize(self, p, size):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/DMPlex.pyx":142
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt csize = asInt(size)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetChart(__pyx_v_self->__pyx_base.dm, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 142, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":143
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd             # <<<<<<<<<<<<<<
 *         cdef PetscInt csize = asInt(size)
 *         CHKERR( DMPlexSetConeSize(self.dm, cp, csize) )
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = ((__pyx_v_cp >= __pyx_v_pStart) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_cp < __pyx_v_pEnd) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 143, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":144
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt csize = asInt(size)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSetConeSize(self.dm, cp, csize) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_size); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 144, __pyx_L1_error)
  __pyx_v_csize = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":145
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt csize = asInt(size)
 *         CHKERR( DMPlexSetConeSize(self.dm, cp, csize) )             # <<<<<<<<<<<<<<
 * 
 *     def getCone(self, p):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetConeSize(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_csize)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 145, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":139
 *         return toInt(csize)
 * 
 *     def setConeSize(self, p, size):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setConeSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":147
 *         CHKERR( DMPlexSetConeSize(self.dm, cp, csize) )
 * 
 *     def getCone(self, p):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_29getCone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_28getCone[] = "DMPlex.getCone(self, p)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_29getCone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCone (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,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);
        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_p)) != 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, "getCone") < 0)) __PYX_ERR(42, 147, __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_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getCone", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 147, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getCone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_28getCone(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_28getCone(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  PetscInt __pyx_v_ncone;
  const PetscInt *__pyx_v_icone;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getCone", 0);

  /* "PETSc/DMPlex.pyx":148
 * 
 *     def getCone(self, p):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 148, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":149
 *     def getCone(self, p):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/DMPlex.pyx":150
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt        ncone = 0
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetChart(__pyx_v_self->__pyx_base.dm, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 150, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":151
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd             # <<<<<<<<<<<<<<
 *         cdef PetscInt        ncone = 0
 *         cdef const_PetscInt *icone = NULL
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = ((__pyx_v_cp >= __pyx_v_pStart) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_cp < __pyx_v_pEnd) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 151, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":152
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt        ncone = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *icone = NULL
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &ncone) )
 */
  __pyx_v_ncone = 0;

  /* "PETSc/DMPlex.pyx":153
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt        ncone = 0
 *         cdef const_PetscInt *icone = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &ncone) )
 *         CHKERR( DMPlexGetCone(self.dm, cp, &icone) )
 */
  __pyx_v_icone = NULL;

  /* "PETSc/DMPlex.pyx":154
 *         cdef PetscInt        ncone = 0
 *         cdef const_PetscInt *icone = NULL
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &ncone) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetCone(self.dm, cp, &icone) )
 *         return array_i(ncone, icone)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetConeSize(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, (&__pyx_v_ncone))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 154, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":155
 *         cdef const_PetscInt *icone = NULL
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &ncone) )
 *         CHKERR( DMPlexGetCone(self.dm, cp, &icone) )             # <<<<<<<<<<<<<<
 *         return array_i(ncone, icone)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetCone(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, (&__pyx_v_icone))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 155, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":156
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &ncone) )
 *         CHKERR( DMPlexGetCone(self.dm, cp, &icone) )
 *         return array_i(ncone, icone)             # <<<<<<<<<<<<<<
 * 
 *     def setCone(self, p, cone, orientation=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_ncone, __pyx_v_icone)); if (unlikely(!__pyx_t_5)) __PYX_ERR(42, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":147
 *         CHKERR( DMPlexSetConeSize(self.dm, cp, csize) )
 * 
 *     def getCone(self, p):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getCone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":158
 *         return array_i(ncone, icone)
 * 
 *     def setCone(self, p, cone, orientation=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_31setCone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_30setCone[] = "DMPlex.setCone(self, p, cone, orientation=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_31setCone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_cone = 0;
  PyObject *__pyx_v_orientation = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCone (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_cone,&__pyx_n_s_orientation,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cone)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setCone", 0, 2, 3, 1); __PYX_ERR(42, 158, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_orientation);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setCone") < 0)) __PYX_ERR(42, 158, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_p = values[0];
    __pyx_v_cone = values[1];
    __pyx_v_orientation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCone", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 158, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setCone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_30setCone(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p, __pyx_v_cone, __pyx_v_orientation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_30setCone(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_cone, PyObject *__pyx_v_orientation) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  PetscInt __pyx_v_ncone;
  PetscInt *__pyx_v_icone;
  PetscInt __pyx_v_norie;
  PetscInt *__pyx_v_iorie;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("setCone", 0);
  __Pyx_INCREF(__pyx_v_cone);
  __Pyx_INCREF(__pyx_v_orientation);

  /* "PETSc/DMPlex.pyx":159
 * 
 *     def setCone(self, p, cone, orientation=None):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 159, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":160
 *     def setCone(self, p, cone, orientation=None):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/DMPlex.pyx":161
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         assert cp>=pStart and cp<pEnd
 *         #
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetChart(__pyx_v_self->__pyx_base.dm, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 161, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":162
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd             # <<<<<<<<<<<<<<
 *         #
 *         cdef PetscInt  ncone = 0
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = ((__pyx_v_cp >= __pyx_v_pStart) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_cp < __pyx_v_pEnd) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 162, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":164
 *         assert cp>=pStart and cp<pEnd
 *         #
 *         cdef PetscInt  ncone = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *icone = NULL
 *         cone = iarray_i(cone, &ncone, &icone)
 */
  __pyx_v_ncone = 0;

  /* "PETSc/DMPlex.pyx":165
 *         #
 *         cdef PetscInt  ncone = 0
 *         cdef PetscInt *icone = NULL             # <<<<<<<<<<<<<<
 *         cone = iarray_i(cone, &ncone, &icone)
 *         CHKERR( DMPlexSetConeSize(self.dm, cp, ncone) )
 */
  __pyx_v_icone = NULL;

  /* "PETSc/DMPlex.pyx":166
 *         cdef PetscInt  ncone = 0
 *         cdef PetscInt *icone = NULL
 *         cone = iarray_i(cone, &ncone, &icone)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSetConeSize(self.dm, cp, ncone) )
 *         CHKERR( DMPlexSetCone(self.dm, cp, icone) )
 */
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_cone, (&__pyx_v_ncone), (&__pyx_v_icone))); if (unlikely(!__pyx_t_5)) __PYX_ERR(42, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_cone, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "PETSc/DMPlex.pyx":167
 *         cdef PetscInt *icone = NULL
 *         cone = iarray_i(cone, &ncone, &icone)
 *         CHKERR( DMPlexSetConeSize(self.dm, cp, ncone) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSetCone(self.dm, cp, icone) )
 *         #
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetConeSize(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_ncone)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 167, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":168
 *         cone = iarray_i(cone, &ncone, &icone)
 *         CHKERR( DMPlexSetConeSize(self.dm, cp, ncone) )
 *         CHKERR( DMPlexSetCone(self.dm, cp, icone) )             # <<<<<<<<<<<<<<
 *         #
 *         cdef PetscInt  norie = 0
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetCone(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_icone)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 168, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":170
 *         CHKERR( DMPlexSetCone(self.dm, cp, icone) )
 *         #
 *         cdef PetscInt  norie = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *iorie = NULL
 *         if orientation is not None:
 */
  __pyx_v_norie = 0;

  /* "PETSc/DMPlex.pyx":171
 *         #
 *         cdef PetscInt  norie = 0
 *         cdef PetscInt *iorie = NULL             # <<<<<<<<<<<<<<
 *         if orientation is not None:
 *             orientation = iarray_i(orientation, &norie, &iorie)
 */
  __pyx_v_iorie = NULL;

  /* "PETSc/DMPlex.pyx":172
 *         cdef PetscInt  norie = 0
 *         cdef PetscInt *iorie = NULL
 *         if orientation is not None:             # <<<<<<<<<<<<<<
 *             orientation = iarray_i(orientation, &norie, &iorie)
 *             assert norie == ncone
 */
  __pyx_t_3 = (__pyx_v_orientation != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "PETSc/DMPlex.pyx":173
 *         cdef PetscInt *iorie = NULL
 *         if orientation is not None:
 *             orientation = iarray_i(orientation, &norie, &iorie)             # <<<<<<<<<<<<<<
 *             assert norie == ncone
 *             CHKERR( DMPlexSetConeOrientation(self.dm, cp, iorie) )
 */
    __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_orientation, (&__pyx_v_norie), (&__pyx_v_iorie))); if (unlikely(!__pyx_t_5)) __PYX_ERR(42, 173, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_orientation, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PETSc/DMPlex.pyx":174
 *         if orientation is not None:
 *             orientation = iarray_i(orientation, &norie, &iorie)
 *             assert norie == ncone             # <<<<<<<<<<<<<<
 *             CHKERR( DMPlexSetConeOrientation(self.dm, cp, iorie) )
 * 
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!((__pyx_v_norie == __pyx_v_ncone) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(42, 174, __pyx_L1_error)
      }
    }
    #endif

    /* "PETSc/DMPlex.pyx":175
 *             orientation = iarray_i(orientation, &norie, &iorie)
 *             assert norie == ncone
 *             CHKERR( DMPlexSetConeOrientation(self.dm, cp, iorie) )             # <<<<<<<<<<<<<<
 * 
 *     def insertCone(self, p, conePos, conePoint):
 */
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetConeOrientation(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_iorie)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 175, __pyx_L1_error)

    /* "PETSc/DMPlex.pyx":172
 *         cdef PetscInt  norie = 0
 *         cdef PetscInt *iorie = NULL
 *         if orientation is not None:             # <<<<<<<<<<<<<<
 *             orientation = iarray_i(orientation, &norie, &iorie)
 *             assert norie == ncone
 */
  }

  /* "PETSc/DMPlex.pyx":158
 *         return array_i(ncone, icone)
 * 
 *     def setCone(self, p, cone, orientation=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 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("petsc4py.PETSc.DMPlex.setCone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cone);
  __Pyx_XDECREF(__pyx_v_orientation);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":177
 *             CHKERR( DMPlexSetConeOrientation(self.dm, cp, iorie) )
 * 
 *     def insertCone(self, p, conePos, conePoint):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt cconePos = asInt(conePos)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_33insertCone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_32insertCone[] = "DMPlex.insertCone(self, p, conePos, conePoint)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_33insertCone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_conePos = 0;
  PyObject *__pyx_v_conePoint = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("insertCone (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_conePos,&__pyx_n_s_conePoint,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_conePos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("insertCone", 1, 3, 3, 1); __PYX_ERR(42, 177, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_conePoint)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("insertCone", 1, 3, 3, 2); __PYX_ERR(42, 177, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "insertCone") < 0)) __PYX_ERR(42, 177, __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_p = values[0];
    __pyx_v_conePos = values[1];
    __pyx_v_conePoint = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("insertCone", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 177, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.insertCone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_32insertCone(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p, __pyx_v_conePos, __pyx_v_conePoint);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_32insertCone(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_conePos, PyObject *__pyx_v_conePoint) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_cconePos;
  PetscInt __pyx_v_cconePoint;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("insertCone", 0);

  /* "PETSc/DMPlex.pyx":178
 * 
 *     def insertCone(self, p, conePos, conePoint):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cconePos = asInt(conePos)
 *         cdef PetscInt cconePoint = asInt(conePoint)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 178, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":179
 *     def insertCone(self, p, conePos, conePoint):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt cconePos = asInt(conePos)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cconePoint = asInt(conePoint)
 *         CHKERR( DMPlexInsertCone(self.dm,cp,cconePos,cconePoint) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_conePos); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 179, __pyx_L1_error)
  __pyx_v_cconePos = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":180
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt cconePos = asInt(conePos)
 *         cdef PetscInt cconePoint = asInt(conePoint)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexInsertCone(self.dm,cp,cconePos,cconePoint) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_conePoint); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 180, __pyx_L1_error)
  __pyx_v_cconePoint = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":181
 *         cdef PetscInt cconePos = asInt(conePos)
 *         cdef PetscInt cconePoint = asInt(conePoint)
 *         CHKERR( DMPlexInsertCone(self.dm,cp,cconePos,cconePoint) )             # <<<<<<<<<<<<<<
 * 
 *     def insertConeOrientation(self, p, conePos, coneOrientation):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexInsertCone(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_cconePos, __pyx_v_cconePoint)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 181, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":177
 *             CHKERR( DMPlexSetConeOrientation(self.dm, cp, iorie) )
 * 
 *     def insertCone(self, p, conePos, conePoint):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt cconePos = asInt(conePos)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.insertCone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":183
 *         CHKERR( DMPlexInsertCone(self.dm,cp,cconePos,cconePoint) )
 * 
 *     def insertConeOrientation(self, p, conePos, coneOrientation):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt cconePos = asInt(conePos)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_35insertConeOrientation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_34insertConeOrientation[] = "DMPlex.insertConeOrientation(self, p, conePos, coneOrientation)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_35insertConeOrientation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_conePos = 0;
  PyObject *__pyx_v_coneOrientation = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("insertConeOrientation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_conePos,&__pyx_n_s_coneOrientation,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_conePos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("insertConeOrientation", 1, 3, 3, 1); __PYX_ERR(42, 183, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coneOrientation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("insertConeOrientation", 1, 3, 3, 2); __PYX_ERR(42, 183, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "insertConeOrientation") < 0)) __PYX_ERR(42, 183, __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_p = values[0];
    __pyx_v_conePos = values[1];
    __pyx_v_coneOrientation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("insertConeOrientation", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 183, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.insertConeOrientation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_34insertConeOrientation(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p, __pyx_v_conePos, __pyx_v_coneOrientation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_34insertConeOrientation(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_conePos, PyObject *__pyx_v_coneOrientation) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_cconePos;
  PetscInt __pyx_v_cconeOrientation;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("insertConeOrientation", 0);

  /* "PETSc/DMPlex.pyx":184
 * 
 *     def insertConeOrientation(self, p, conePos, coneOrientation):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cconePos = asInt(conePos)
 *         cdef PetscInt cconeOrientation = asInt(coneOrientation)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 184, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":185
 *     def insertConeOrientation(self, p, conePos, coneOrientation):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt cconePos = asInt(conePos)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cconeOrientation = asInt(coneOrientation)
 *         CHKERR( DMPlexInsertConeOrientation(self.dm, cp, cconePos, cconeOrientation) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_conePos); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 185, __pyx_L1_error)
  __pyx_v_cconePos = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":186
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt cconePos = asInt(conePos)
 *         cdef PetscInt cconeOrientation = asInt(coneOrientation)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexInsertConeOrientation(self.dm, cp, cconePos, cconeOrientation) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_coneOrientation); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 186, __pyx_L1_error)
  __pyx_v_cconeOrientation = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":187
 *         cdef PetscInt cconePos = asInt(conePos)
 *         cdef PetscInt cconeOrientation = asInt(coneOrientation)
 *         CHKERR( DMPlexInsertConeOrientation(self.dm, cp, cconePos, cconeOrientation) )             # <<<<<<<<<<<<<<
 * 
 *     def getConeOrientation(self, p):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexInsertConeOrientation(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_cconePos, __pyx_v_cconeOrientation)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 187, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":183
 *         CHKERR( DMPlexInsertCone(self.dm,cp,cconePos,cconePoint) )
 * 
 *     def insertConeOrientation(self, p, conePos, coneOrientation):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt cconePos = asInt(conePos)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.insertConeOrientation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":189
 *         CHKERR( DMPlexInsertConeOrientation(self.dm, cp, cconePos, cconeOrientation) )
 * 
 *     def getConeOrientation(self, p):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_37getConeOrientation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_36getConeOrientation[] = "DMPlex.getConeOrientation(self, p)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_37getConeOrientation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConeOrientation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,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);
        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_p)) != 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, "getConeOrientation") < 0)) __PYX_ERR(42, 189, __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_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConeOrientation", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 189, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getConeOrientation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_36getConeOrientation(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_36getConeOrientation(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  PetscInt __pyx_v_norie;
  const PetscInt *__pyx_v_iorie;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getConeOrientation", 0);

  /* "PETSc/DMPlex.pyx":190
 * 
 *     def getConeOrientation(self, p):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 190, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":191
 *     def getConeOrientation(self, p):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/DMPlex.pyx":192
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt        norie = 0
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetChart(__pyx_v_self->__pyx_base.dm, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 192, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":193
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd             # <<<<<<<<<<<<<<
 *         cdef PetscInt        norie = 0
 *         cdef const_PetscInt *iorie = NULL
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = ((__pyx_v_cp >= __pyx_v_pStart) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_cp < __pyx_v_pEnd) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 193, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":194
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt        norie = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *iorie = NULL
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &norie) )
 */
  __pyx_v_norie = 0;

  /* "PETSc/DMPlex.pyx":195
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt        norie = 0
 *         cdef const_PetscInt *iorie = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &norie) )
 *         CHKERR( DMPlexGetConeOrientation(self.dm, cp, &iorie) )
 */
  __pyx_v_iorie = NULL;

  /* "PETSc/DMPlex.pyx":196
 *         cdef PetscInt        norie = 0
 *         cdef const_PetscInt *iorie = NULL
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &norie) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetConeOrientation(self.dm, cp, &iorie) )
 *         return array_i(norie, iorie)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetConeSize(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, (&__pyx_v_norie))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 196, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":197
 *         cdef const_PetscInt *iorie = NULL
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &norie) )
 *         CHKERR( DMPlexGetConeOrientation(self.dm, cp, &iorie) )             # <<<<<<<<<<<<<<
 *         return array_i(norie, iorie)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetConeOrientation(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, (&__pyx_v_iorie))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 197, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":198
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &norie) )
 *         CHKERR( DMPlexGetConeOrientation(self.dm, cp, &iorie) )
 *         return array_i(norie, iorie)             # <<<<<<<<<<<<<<
 * 
 *     def setConeOrientation(self, p, orientation):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_norie, __pyx_v_iorie)); if (unlikely(!__pyx_t_5)) __PYX_ERR(42, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":189
 *         CHKERR( DMPlexInsertConeOrientation(self.dm, cp, cconePos, cconeOrientation) )
 * 
 *     def getConeOrientation(self, p):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getConeOrientation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":200
 *         return array_i(norie, iorie)
 * 
 *     def setConeOrientation(self, p, orientation):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_39setConeOrientation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_38setConeOrientation[] = "DMPlex.setConeOrientation(self, p, orientation)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_39setConeOrientation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_orientation = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConeOrientation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_orientation,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_orientation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConeOrientation", 1, 2, 2, 1); __PYX_ERR(42, 200, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConeOrientation") < 0)) __PYX_ERR(42, 200, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_p = values[0];
    __pyx_v_orientation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConeOrientation", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 200, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setConeOrientation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_38setConeOrientation(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p, __pyx_v_orientation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_38setConeOrientation(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_orientation) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  PetscInt __pyx_v_ncone;
  PetscInt __pyx_v_norie;
  PetscInt *__pyx_v_iorie;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("setConeOrientation", 0);
  __Pyx_INCREF(__pyx_v_orientation);

  /* "PETSc/DMPlex.pyx":201
 * 
 *     def setConeOrientation(self, p, orientation):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 201, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":202
 *     def setConeOrientation(self, p, orientation):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/DMPlex.pyx":203
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt ncone = 0
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetChart(__pyx_v_self->__pyx_base.dm, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 203, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":204
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd             # <<<<<<<<<<<<<<
 *         cdef PetscInt ncone = 0
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &ncone) )
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = ((__pyx_v_cp >= __pyx_v_pStart) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_cp < __pyx_v_pEnd) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 204, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":205
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt ncone = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &ncone) )
 *         cdef PetscInt  norie = 0
 */
  __pyx_v_ncone = 0;

  /* "PETSc/DMPlex.pyx":206
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt ncone = 0
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &ncone) )             # <<<<<<<<<<<<<<
 *         cdef PetscInt  norie = 0
 *         cdef PetscInt *iorie = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetConeSize(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, (&__pyx_v_ncone))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 206, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":207
 *         cdef PetscInt ncone = 0
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &ncone) )
 *         cdef PetscInt  norie = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *iorie = NULL
 *         orientation = iarray_i(orientation, &norie, &iorie)
 */
  __pyx_v_norie = 0;

  /* "PETSc/DMPlex.pyx":208
 *         CHKERR( DMPlexGetConeSize(self.dm, cp, &ncone) )
 *         cdef PetscInt  norie = 0
 *         cdef PetscInt *iorie = NULL             # <<<<<<<<<<<<<<
 *         orientation = iarray_i(orientation, &norie, &iorie)
 *         assert norie == ncone
 */
  __pyx_v_iorie = NULL;

  /* "PETSc/DMPlex.pyx":209
 *         cdef PetscInt  norie = 0
 *         cdef PetscInt *iorie = NULL
 *         orientation = iarray_i(orientation, &norie, &iorie)             # <<<<<<<<<<<<<<
 *         assert norie == ncone
 *         CHKERR( DMPlexSetConeOrientation(self.dm, cp, iorie) )
 */
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_orientation, (&__pyx_v_norie), (&__pyx_v_iorie))); if (unlikely(!__pyx_t_5)) __PYX_ERR(42, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_orientation, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "PETSc/DMPlex.pyx":210
 *         cdef PetscInt *iorie = NULL
 *         orientation = iarray_i(orientation, &norie, &iorie)
 *         assert norie == ncone             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSetConeOrientation(self.dm, cp, iorie) )
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_norie == __pyx_v_ncone) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 210, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":211
 *         orientation = iarray_i(orientation, &norie, &iorie)
 *         assert norie == ncone
 *         CHKERR( DMPlexSetConeOrientation(self.dm, cp, iorie) )             # <<<<<<<<<<<<<<
 * 
 *     def getSupportSize(self, p):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetConeOrientation(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_iorie)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 211, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":200
 *         return array_i(norie, iorie)
 * 
 *     def setConeOrientation(self, p, orientation):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 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("petsc4py.PETSc.DMPlex.setConeOrientation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_orientation);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":213
 *         CHKERR( DMPlexSetConeOrientation(self.dm, cp, iorie) )
 * 
 *     def getSupportSize(self, p):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_41getSupportSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_40getSupportSize[] = "DMPlex.getSupportSize(self, p)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_41getSupportSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSupportSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,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);
        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_p)) != 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, "getSupportSize") < 0)) __PYX_ERR(42, 213, __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_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getSupportSize", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 213, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getSupportSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_40getSupportSize(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_40getSupportSize(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  PetscInt __pyx_v_ssize;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getSupportSize", 0);

  /* "PETSc/DMPlex.pyx":214
 * 
 *     def getSupportSize(self, p):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 214, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":215
 *     def getSupportSize(self, p):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/DMPlex.pyx":216
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt ssize = 0
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetChart(__pyx_v_self->__pyx_base.dm, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 216, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":217
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd             # <<<<<<<<<<<<<<
 *         cdef PetscInt ssize = 0
 *         CHKERR( DMPlexGetSupportSize(self.dm, cp, &ssize) )
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = ((__pyx_v_cp >= __pyx_v_pStart) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_cp < __pyx_v_pEnd) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 217, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":218
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt ssize = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetSupportSize(self.dm, cp, &ssize) )
 *         return toInt(ssize)
 */
  __pyx_v_ssize = 0;

  /* "PETSc/DMPlex.pyx":219
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt ssize = 0
 *         CHKERR( DMPlexGetSupportSize(self.dm, cp, &ssize) )             # <<<<<<<<<<<<<<
 *         return toInt(ssize)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetSupportSize(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, (&__pyx_v_ssize))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 219, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":220
 *         cdef PetscInt ssize = 0
 *         CHKERR( DMPlexGetSupportSize(self.dm, cp, &ssize) )
 *         return toInt(ssize)             # <<<<<<<<<<<<<<
 * 
 *     def setSupportSize(self, p, size):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_ssize); if (unlikely(!__pyx_t_5)) __PYX_ERR(42, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":213
 *         CHKERR( DMPlexSetConeOrientation(self.dm, cp, iorie) )
 * 
 *     def getSupportSize(self, p):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getSupportSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":222
 *         return toInt(ssize)
 * 
 *     def setSupportSize(self, p, size):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_43setSupportSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_42setSupportSize[] = "DMPlex.setSupportSize(self, p, size)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_43setSupportSize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setSupportSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_size,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setSupportSize", 1, 2, 2, 1); __PYX_ERR(42, 222, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSupportSize") < 0)) __PYX_ERR(42, 222, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_p = values[0];
    __pyx_v_size = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setSupportSize", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 222, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setSupportSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_42setSupportSize(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p, __pyx_v_size);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_42setSupportSize(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_size) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  PetscInt __pyx_v_ssize;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setSupportSize", 0);

  /* "PETSc/DMPlex.pyx":223
 * 
 *     def setSupportSize(self, p, size):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 223, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":224
 *     def setSupportSize(self, p, size):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/DMPlex.pyx":225
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt ssize = asInt(size)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetChart(__pyx_v_self->__pyx_base.dm, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 225, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":226
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd             # <<<<<<<<<<<<<<
 *         cdef PetscInt ssize = asInt(size)
 *         CHKERR( DMPlexSetSupportSize(self.dm, cp, ssize) )
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = ((__pyx_v_cp >= __pyx_v_pStart) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_cp < __pyx_v_pEnd) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 226, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":227
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt ssize = asInt(size)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSetSupportSize(self.dm, cp, ssize) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_size); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 227, __pyx_L1_error)
  __pyx_v_ssize = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":228
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt ssize = asInt(size)
 *         CHKERR( DMPlexSetSupportSize(self.dm, cp, ssize) )             # <<<<<<<<<<<<<<
 * 
 *     def getSupport(self, p):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetSupportSize(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_ssize)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 228, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":222
 *         return toInt(ssize)
 * 
 *     def setSupportSize(self, p, size):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setSupportSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":230
 *         CHKERR( DMPlexSetSupportSize(self.dm, cp, ssize) )
 * 
 *     def getSupport(self, p):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_45getSupport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_44getSupport[] = "DMPlex.getSupport(self, p)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_45getSupport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getSupport (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,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);
        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_p)) != 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, "getSupport") < 0)) __PYX_ERR(42, 230, __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_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getSupport", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 230, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getSupport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_44getSupport(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_44getSupport(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  PetscInt __pyx_v_nsupp;
  const PetscInt *__pyx_v_isupp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getSupport", 0);

  /* "PETSc/DMPlex.pyx":231
 * 
 *     def getSupport(self, p):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 231, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":232
 *     def getSupport(self, p):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/DMPlex.pyx":233
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt        nsupp = 0
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetChart(__pyx_v_self->__pyx_base.dm, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 233, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":234
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd             # <<<<<<<<<<<<<<
 *         cdef PetscInt        nsupp = 0
 *         cdef const_PetscInt *isupp = NULL
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = ((__pyx_v_cp >= __pyx_v_pStart) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_cp < __pyx_v_pEnd) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 234, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":235
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt        nsupp = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *isupp = NULL
 *         CHKERR( DMPlexGetSupportSize(self.dm, cp, &nsupp) )
 */
  __pyx_v_nsupp = 0;

  /* "PETSc/DMPlex.pyx":236
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt        nsupp = 0
 *         cdef const_PetscInt *isupp = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetSupportSize(self.dm, cp, &nsupp) )
 *         CHKERR( DMPlexGetSupport(self.dm, cp, &isupp) )
 */
  __pyx_v_isupp = NULL;

  /* "PETSc/DMPlex.pyx":237
 *         cdef PetscInt        nsupp = 0
 *         cdef const_PetscInt *isupp = NULL
 *         CHKERR( DMPlexGetSupportSize(self.dm, cp, &nsupp) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetSupport(self.dm, cp, &isupp) )
 *         return array_i(nsupp, isupp)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetSupportSize(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, (&__pyx_v_nsupp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 237, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":238
 *         cdef const_PetscInt *isupp = NULL
 *         CHKERR( DMPlexGetSupportSize(self.dm, cp, &nsupp) )
 *         CHKERR( DMPlexGetSupport(self.dm, cp, &isupp) )             # <<<<<<<<<<<<<<
 *         return array_i(nsupp, isupp)
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetSupport(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, (&__pyx_v_isupp))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 238, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":239
 *         CHKERR( DMPlexGetSupportSize(self.dm, cp, &nsupp) )
 *         CHKERR( DMPlexGetSupport(self.dm, cp, &isupp) )
 *         return array_i(nsupp, isupp)             # <<<<<<<<<<<<<<
 * 
 *     def setSupport(self, p, supp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_nsupp, __pyx_v_isupp)); if (unlikely(!__pyx_t_5)) __PYX_ERR(42, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":230
 *         CHKERR( DMPlexSetSupportSize(self.dm, cp, ssize) )
 * 
 *     def getSupport(self, p):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getSupport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":241
 *         return array_i(nsupp, isupp)
 * 
 *     def setSupport(self, p, supp):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_47setSupport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_46setSupport[] = "DMPlex.setSupport(self, p, supp)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_47setSupport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_supp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setSupport (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_supp,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_supp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setSupport", 1, 2, 2, 1); __PYX_ERR(42, 241, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSupport") < 0)) __PYX_ERR(42, 241, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_p = values[0];
    __pyx_v_supp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setSupport", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 241, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setSupport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_46setSupport(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p, __pyx_v_supp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_46setSupport(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_supp) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  PetscInt __pyx_v_nsupp;
  PetscInt *__pyx_v_isupp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("setSupport", 0);
  __Pyx_INCREF(__pyx_v_supp);

  /* "PETSc/DMPlex.pyx":242
 * 
 *     def setSupport(self, p, supp):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 242, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":243
 *     def setSupport(self, p, supp):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/DMPlex.pyx":244
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt  nsupp = 0
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetChart(__pyx_v_self->__pyx_base.dm, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 244, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":245
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd             # <<<<<<<<<<<<<<
 *         cdef PetscInt  nsupp = 0
 *         cdef PetscInt *isupp = NULL
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = ((__pyx_v_cp >= __pyx_v_pStart) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_cp < __pyx_v_pEnd) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 245, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":246
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt  nsupp = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *isupp = NULL
 *         supp = iarray_i(supp, &nsupp, &isupp)
 */
  __pyx_v_nsupp = 0;

  /* "PETSc/DMPlex.pyx":247
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscInt  nsupp = 0
 *         cdef PetscInt *isupp = NULL             # <<<<<<<<<<<<<<
 *         supp = iarray_i(supp, &nsupp, &isupp)
 *         CHKERR( DMPlexSetSupportSize(self.dm, cp, nsupp) )
 */
  __pyx_v_isupp = NULL;

  /* "PETSc/DMPlex.pyx":248
 *         cdef PetscInt  nsupp = 0
 *         cdef PetscInt *isupp = NULL
 *         supp = iarray_i(supp, &nsupp, &isupp)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSetSupportSize(self.dm, cp, nsupp) )
 *         CHKERR( DMPlexSetSupport(self.dm, cp, isupp) )
 */
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_supp, (&__pyx_v_nsupp), (&__pyx_v_isupp))); if (unlikely(!__pyx_t_5)) __PYX_ERR(42, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_supp, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "PETSc/DMPlex.pyx":249
 *         cdef PetscInt *isupp = NULL
 *         supp = iarray_i(supp, &nsupp, &isupp)
 *         CHKERR( DMPlexSetSupportSize(self.dm, cp, nsupp) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSetSupport(self.dm, cp, isupp) )
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetSupportSize(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_nsupp)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 249, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":250
 *         supp = iarray_i(supp, &nsupp, &isupp)
 *         CHKERR( DMPlexSetSupportSize(self.dm, cp, nsupp) )
 *         CHKERR( DMPlexSetSupport(self.dm, cp, isupp) )             # <<<<<<<<<<<<<<
 * 
 *     def getMaxSizes(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetSupport(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_isupp)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 250, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":241
 *         return array_i(nsupp, isupp)
 * 
 *     def setSupport(self, p, supp):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 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("petsc4py.PETSc.DMPlex.setSupport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_supp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":252
 *         CHKERR( DMPlexSetSupport(self.dm, cp, isupp) )
 * 
 *     def getMaxSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt maxConeSize = 0, maxSupportSize = 0
 *         CHKERR( DMPlexGetMaxSizes(self.dm, &maxConeSize, &maxSupportSize) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_49getMaxSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_48getMaxSizes[] = "DMPlex.getMaxSizes(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_49getMaxSizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMaxSizes (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMaxSizes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMaxSizes", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_48getMaxSizes(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_48getMaxSizes(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  PetscInt __pyx_v_maxConeSize;
  PetscInt __pyx_v_maxSupportSize;
  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;
  __Pyx_RefNannySetupContext("getMaxSizes", 0);

  /* "PETSc/DMPlex.pyx":253
 * 
 *     def getMaxSizes(self):
 *         cdef PetscInt maxConeSize = 0, maxSupportSize = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetMaxSizes(self.dm, &maxConeSize, &maxSupportSize) )
 *         return toInt(maxConeSize), toInt(maxSupportSize)
 */
  __pyx_v_maxConeSize = 0;
  __pyx_v_maxSupportSize = 0;

  /* "PETSc/DMPlex.pyx":254
 *     def getMaxSizes(self):
 *         cdef PetscInt maxConeSize = 0, maxSupportSize = 0
 *         CHKERR( DMPlexGetMaxSizes(self.dm, &maxConeSize, &maxSupportSize) )             # <<<<<<<<<<<<<<
 *         return toInt(maxConeSize), toInt(maxSupportSize)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetMaxSizes(__pyx_v_self->__pyx_base.dm, (&__pyx_v_maxConeSize), (&__pyx_v_maxSupportSize))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(42, 254, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":255
 *         cdef PetscInt maxConeSize = 0, maxSupportSize = 0
 *         CHKERR( DMPlexGetMaxSizes(self.dm, &maxConeSize, &maxSupportSize) )
 *         return toInt(maxConeSize), toInt(maxSupportSize)             # <<<<<<<<<<<<<<
 * 
 *     def symmetrize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_maxConeSize); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_maxSupportSize); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(42, 255, __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_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":252
 *         CHKERR( DMPlexSetSupport(self.dm, cp, isupp) )
 * 
 *     def getMaxSizes(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt maxConeSize = 0, maxSupportSize = 0
 *         CHKERR( DMPlexGetMaxSizes(self.dm, &maxConeSize, &maxSupportSize) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getMaxSizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":257
 *         return toInt(maxConeSize), toInt(maxSupportSize)
 * 
 *     def symmetrize(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSymmetrize(self.dm) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_51symmetrize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_50symmetrize[] = "DMPlex.symmetrize(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_51symmetrize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("symmetrize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("symmetrize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "symmetrize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_50symmetrize(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_50symmetrize(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("symmetrize", 0);

  /* "PETSc/DMPlex.pyx":258
 * 
 *     def symmetrize(self):
 *         CHKERR( DMPlexSymmetrize(self.dm) )             # <<<<<<<<<<<<<<
 * 
 *     def stratify(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSymmetrize(__pyx_v_self->__pyx_base.dm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(42, 258, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":257
 *         return toInt(maxConeSize), toInt(maxSupportSize)
 * 
 *     def symmetrize(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSymmetrize(self.dm) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.symmetrize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":260
 *         CHKERR( DMPlexSymmetrize(self.dm) )
 * 
 *     def stratify(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexStratify(self.dm) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_53stratify(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_52stratify[] = "DMPlex.stratify(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_53stratify(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stratify (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("stratify", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "stratify", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_52stratify(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_52stratify(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("stratify", 0);

  /* "PETSc/DMPlex.pyx":261
 * 
 *     def stratify(self):
 *         CHKERR( DMPlexStratify(self.dm) )             # <<<<<<<<<<<<<<
 * 
 *     def orient(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexStratify(__pyx_v_self->__pyx_base.dm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(42, 261, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":260
 *         CHKERR( DMPlexSymmetrize(self.dm) )
 * 
 *     def stratify(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexStratify(self.dm) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.stratify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":263
 *         CHKERR( DMPlexStratify(self.dm) )
 * 
 *     def orient(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexOrient(self.dm) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_55orient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_54orient[] = "DMPlex.orient(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_55orient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("orient (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("orient", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "orient", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_54orient(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_54orient(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("orient", 0);

  /* "PETSc/DMPlex.pyx":264
 * 
 *     def orient(self):
 *         CHKERR( DMPlexOrient(self.dm) )             # <<<<<<<<<<<<<<
 * 
 *     def getCellNumbering(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexOrient(__pyx_v_self->__pyx_base.dm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(42, 264, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":263
 *         CHKERR( DMPlexStratify(self.dm) )
 * 
 *     def orient(self):             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexOrient(self.dm) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.orient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":266
 *         CHKERR( DMPlexOrient(self.dm) )
 * 
 *     def getCellNumbering(self):             # <<<<<<<<<<<<<<
 *         cdef IS iset = IS()
 *         CHKERR( DMPlexGetCellNumbering(self.dm, &iset.iset) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_57getCellNumbering(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_56getCellNumbering[] = "DMPlex.getCellNumbering(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_57getCellNumbering(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCellNumbering (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getCellNumbering", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getCellNumbering", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_56getCellNumbering(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_56getCellNumbering(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getCellNumbering", 0);

  /* "PETSc/DMPlex.pyx":267
 * 
 *     def getCellNumbering(self):
 *         cdef IS iset = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetCellNumbering(self.dm, &iset.iset) )
 *         PetscINCREF(iset.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_iset = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":268
 *     def getCellNumbering(self):
 *         cdef IS iset = IS()
 *         CHKERR( DMPlexGetCellNumbering(self.dm, &iset.iset) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(iset.obj)
 *         return iset
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetCellNumbering(__pyx_v_self->__pyx_base.dm, (&__pyx_v_iset->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 268, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":269
 *         cdef IS iset = IS()
 *         CHKERR( DMPlexGetCellNumbering(self.dm, &iset.iset) )
 *         PetscINCREF(iset.obj)             # <<<<<<<<<<<<<<
 *         return iset
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_iset->__pyx_base.obj);

  /* "PETSc/DMPlex.pyx":270
 *         CHKERR( DMPlexGetCellNumbering(self.dm, &iset.iset) )
 *         PetscINCREF(iset.obj)
 *         return iset             # <<<<<<<<<<<<<<
 * 
 *     def getVertexNumbering(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_iset));
  __pyx_r = ((PyObject *)__pyx_v_iset);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":266
 *         CHKERR( DMPlexOrient(self.dm) )
 * 
 *     def getCellNumbering(self):             # <<<<<<<<<<<<<<
 *         cdef IS iset = IS()
 *         CHKERR( DMPlexGetCellNumbering(self.dm, &iset.iset) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getCellNumbering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_iset);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":272
 *         return iset
 * 
 *     def getVertexNumbering(self):             # <<<<<<<<<<<<<<
 *         cdef IS iset = IS()
 *         CHKERR( DMPlexGetVertexNumbering(self.dm, &iset.iset) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_59getVertexNumbering(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_58getVertexNumbering[] = "DMPlex.getVertexNumbering(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_59getVertexNumbering(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getVertexNumbering (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getVertexNumbering", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getVertexNumbering", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_58getVertexNumbering(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_58getVertexNumbering(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getVertexNumbering", 0);

  /* "PETSc/DMPlex.pyx":273
 * 
 *     def getVertexNumbering(self):
 *         cdef IS iset = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetVertexNumbering(self.dm, &iset.iset) )
 *         PetscINCREF(iset.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_iset = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":274
 *     def getVertexNumbering(self):
 *         cdef IS iset = IS()
 *         CHKERR( DMPlexGetVertexNumbering(self.dm, &iset.iset) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(iset.obj)
 *         return iset
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetVertexNumbering(__pyx_v_self->__pyx_base.dm, (&__pyx_v_iset->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 274, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":275
 *         cdef IS iset = IS()
 *         CHKERR( DMPlexGetVertexNumbering(self.dm, &iset.iset) )
 *         PetscINCREF(iset.obj)             # <<<<<<<<<<<<<<
 *         return iset
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_iset->__pyx_base.obj);

  /* "PETSc/DMPlex.pyx":276
 *         CHKERR( DMPlexGetVertexNumbering(self.dm, &iset.iset) )
 *         PetscINCREF(iset.obj)
 *         return iset             # <<<<<<<<<<<<<<
 * 
 *     def createPointNumbering(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_iset));
  __pyx_r = ((PyObject *)__pyx_v_iset);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":272
 *         return iset
 * 
 *     def getVertexNumbering(self):             # <<<<<<<<<<<<<<
 *         cdef IS iset = IS()
 *         CHKERR( DMPlexGetVertexNumbering(self.dm, &iset.iset) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getVertexNumbering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_iset);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":278
 *         return iset
 * 
 *     def createPointNumbering(self):             # <<<<<<<<<<<<<<
 *         cdef IS iset = IS()
 *         CHKERR( DMPlexCreatePointNumbering(self.dm, &iset.iset) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_61createPointNumbering(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_60createPointNumbering[] = "DMPlex.createPointNumbering(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_61createPointNumbering(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createPointNumbering (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("createPointNumbering", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "createPointNumbering", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_60createPointNumbering(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_60createPointNumbering(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  struct PyPetscISObject *__pyx_v_iset = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createPointNumbering", 0);

  /* "PETSc/DMPlex.pyx":279
 * 
 *     def createPointNumbering(self):
 *         cdef IS iset = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreatePointNumbering(self.dm, &iset.iset) )
 *         return iset
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_iset = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":280
 *     def createPointNumbering(self):
 *         cdef IS iset = IS()
 *         CHKERR( DMPlexCreatePointNumbering(self.dm, &iset.iset) )             # <<<<<<<<<<<<<<
 *         return iset
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreatePointNumbering(__pyx_v_self->__pyx_base.dm, (&__pyx_v_iset->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 280, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":281
 *         cdef IS iset = IS()
 *         CHKERR( DMPlexCreatePointNumbering(self.dm, &iset.iset) )
 *         return iset             # <<<<<<<<<<<<<<
 * 
 *     def getDepth(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_iset));
  __pyx_r = ((PyObject *)__pyx_v_iset);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":278
 *         return iset
 * 
 *     def createPointNumbering(self):             # <<<<<<<<<<<<<<
 *         cdef IS iset = IS()
 *         CHKERR( DMPlexCreatePointNumbering(self.dm, &iset.iset) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createPointNumbering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_iset);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":283
 *         return iset
 * 
 *     def getDepth(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt depth = 0
 *         CHKERR( DMPlexGetDepth(self.dm,&depth) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_63getDepth(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_62getDepth[] = "DMPlex.getDepth(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_63getDepth(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDepth (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getDepth", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getDepth", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_62getDepth(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_62getDepth(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  PetscInt __pyx_v_depth;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getDepth", 0);

  /* "PETSc/DMPlex.pyx":284
 * 
 *     def getDepth(self):
 *         cdef PetscInt depth = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetDepth(self.dm,&depth) )
 *         return toInt(depth)
 */
  __pyx_v_depth = 0;

  /* "PETSc/DMPlex.pyx":285
 *     def getDepth(self):
 *         cdef PetscInt depth = 0
 *         CHKERR( DMPlexGetDepth(self.dm,&depth) )             # <<<<<<<<<<<<<<
 *         return toInt(depth)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetDepth(__pyx_v_self->__pyx_base.dm, (&__pyx_v_depth))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(42, 285, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":286
 *         cdef PetscInt depth = 0
 *         CHKERR( DMPlexGetDepth(self.dm,&depth) )
 *         return toInt(depth)             # <<<<<<<<<<<<<<
 * 
 *     def getDepthStratum(self, svalue):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_depth); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":283
 *         return iset
 * 
 *     def getDepth(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt depth = 0
 *         CHKERR( DMPlexGetDepth(self.dm,&depth) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getDepth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":288
 *         return toInt(depth)
 * 
 *     def getDepthStratum(self, svalue):             # <<<<<<<<<<<<<<
 *         cdef PetscInt csvalue = asInt(svalue), sStart = 0, sEnd = 0
 *         CHKERR( DMPlexGetDepthStratum(self.dm, csvalue, &sStart, &sEnd) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_65getDepthStratum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_64getDepthStratum[] = "DMPlex.getDepthStratum(self, svalue)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_65getDepthStratum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_svalue = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDepthStratum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_svalue,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);
        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_svalue)) != 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, "getDepthStratum") < 0)) __PYX_ERR(42, 288, __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_svalue = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getDepthStratum", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 288, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getDepthStratum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_64getDepthStratum(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_svalue);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_64getDepthStratum(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_svalue) {
  PetscInt __pyx_v_csvalue;
  PetscInt __pyx_v_sStart;
  PetscInt __pyx_v_sEnd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getDepthStratum", 0);

  /* "PETSc/DMPlex.pyx":289
 * 
 *     def getDepthStratum(self, svalue):
 *         cdef PetscInt csvalue = asInt(svalue), sStart = 0, sEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetDepthStratum(self.dm, csvalue, &sStart, &sEnd) )
 *         return (toInt(sStart), toInt(sEnd))
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_svalue); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 289, __pyx_L1_error)
  __pyx_v_csvalue = __pyx_t_1;
  __pyx_v_sStart = 0;
  __pyx_v_sEnd = 0;

  /* "PETSc/DMPlex.pyx":290
 *     def getDepthStratum(self, svalue):
 *         cdef PetscInt csvalue = asInt(svalue), sStart = 0, sEnd = 0
 *         CHKERR( DMPlexGetDepthStratum(self.dm, csvalue, &sStart, &sEnd) )             # <<<<<<<<<<<<<<
 *         return (toInt(sStart), toInt(sEnd))
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetDepthStratum(__pyx_v_self->__pyx_base.dm, __pyx_v_csvalue, (&__pyx_v_sStart), (&__pyx_v_sEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 290, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":291
 *         cdef PetscInt csvalue = asInt(svalue), sStart = 0, sEnd = 0
 *         CHKERR( DMPlexGetDepthStratum(self.dm, csvalue, &sStart, &sEnd) )
 *         return (toInt(sStart), toInt(sEnd))             # <<<<<<<<<<<<<<
 * 
 *     def getHeightStratum(self, svalue):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_sStart); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_sEnd); if (unlikely(!__pyx_t_4)) __PYX_ERR(42, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(42, 291, __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_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":288
 *         return toInt(depth)
 * 
 *     def getDepthStratum(self, svalue):             # <<<<<<<<<<<<<<
 *         cdef PetscInt csvalue = asInt(svalue), sStart = 0, sEnd = 0
 *         CHKERR( DMPlexGetDepthStratum(self.dm, csvalue, &sStart, &sEnd) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getDepthStratum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":293
 *         return (toInt(sStart), toInt(sEnd))
 * 
 *     def getHeightStratum(self, svalue):             # <<<<<<<<<<<<<<
 *         cdef PetscInt csvalue = asInt(svalue), sStart = 0, sEnd = 0
 *         CHKERR( DMPlexGetHeightStratum(self.dm, csvalue, &sStart, &sEnd) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_67getHeightStratum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_66getHeightStratum[] = "DMPlex.getHeightStratum(self, svalue)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_67getHeightStratum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_svalue = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getHeightStratum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_svalue,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);
        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_svalue)) != 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, "getHeightStratum") < 0)) __PYX_ERR(42, 293, __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_svalue = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getHeightStratum", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 293, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getHeightStratum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_66getHeightStratum(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_svalue);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_66getHeightStratum(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_svalue) {
  PetscInt __pyx_v_csvalue;
  PetscInt __pyx_v_sStart;
  PetscInt __pyx_v_sEnd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getHeightStratum", 0);

  /* "PETSc/DMPlex.pyx":294
 * 
 *     def getHeightStratum(self, svalue):
 *         cdef PetscInt csvalue = asInt(svalue), sStart = 0, sEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetHeightStratum(self.dm, csvalue, &sStart, &sEnd) )
 *         return (toInt(sStart), toInt(sEnd))
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_svalue); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 294, __pyx_L1_error)
  __pyx_v_csvalue = __pyx_t_1;
  __pyx_v_sStart = 0;
  __pyx_v_sEnd = 0;

  /* "PETSc/DMPlex.pyx":295
 *     def getHeightStratum(self, svalue):
 *         cdef PetscInt csvalue = asInt(svalue), sStart = 0, sEnd = 0
 *         CHKERR( DMPlexGetHeightStratum(self.dm, csvalue, &sStart, &sEnd) )             # <<<<<<<<<<<<<<
 *         return (toInt(sStart), toInt(sEnd))
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetHeightStratum(__pyx_v_self->__pyx_base.dm, __pyx_v_csvalue, (&__pyx_v_sStart), (&__pyx_v_sEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 295, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":296
 *         cdef PetscInt csvalue = asInt(svalue), sStart = 0, sEnd = 0
 *         CHKERR( DMPlexGetHeightStratum(self.dm, csvalue, &sStart, &sEnd) )
 *         return (toInt(sStart), toInt(sEnd))             # <<<<<<<<<<<<<<
 * 
 *     def getMeet(self, points):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_sStart); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_sEnd); if (unlikely(!__pyx_t_4)) __PYX_ERR(42, 296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(42, 296, __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_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":293
 *         return (toInt(sStart), toInt(sEnd))
 * 
 *     def getHeightStratum(self, svalue):             # <<<<<<<<<<<<<<
 *         cdef PetscInt csvalue = asInt(svalue), sStart = 0, sEnd = 0
 *         CHKERR( DMPlexGetHeightStratum(self.dm, csvalue, &sStart, &sEnd) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getHeightStratum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":298
 *         return (toInt(sStart), toInt(sEnd))
 * 
 *     def getMeet(self, points):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  numPoints = 0
 *         cdef PetscInt *ipoints = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_69getMeet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_68getMeet[] = "DMPlex.getMeet(self, points)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_69getMeet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_points = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMeet (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,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);
        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_points)) != 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, "getMeet") < 0)) __PYX_ERR(42, 298, __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_points = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMeet", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 298, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getMeet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_68getMeet(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_points);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_68getMeet(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_points) {
  PetscInt __pyx_v_numPoints;
  PetscInt *__pyx_v_ipoints;
  PetscInt __pyx_v_numCoveringPoints;
  const PetscInt *__pyx_v_coveringPoints;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  char const *__pyx_t_4;
  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;
  __Pyx_RefNannySetupContext("getMeet", 0);
  __Pyx_INCREF(__pyx_v_points);

  /* "PETSc/DMPlex.pyx":299
 * 
 *     def getMeet(self, points):
 *         cdef PetscInt  numPoints = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *ipoints = NULL
 *         cdef PetscInt  numCoveringPoints = 0
 */
  __pyx_v_numPoints = 0;

  /* "PETSc/DMPlex.pyx":300
 *     def getMeet(self, points):
 *         cdef PetscInt  numPoints = 0
 *         cdef PetscInt *ipoints = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt  numCoveringPoints = 0
 *         cdef const_PetscInt *coveringPoints = NULL
 */
  __pyx_v_ipoints = NULL;

  /* "PETSc/DMPlex.pyx":301
 *         cdef PetscInt  numPoints = 0
 *         cdef PetscInt *ipoints = NULL
 *         cdef PetscInt  numCoveringPoints = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *coveringPoints = NULL
 *         points = iarray_i(points, &numPoints, &ipoints)
 */
  __pyx_v_numCoveringPoints = 0;

  /* "PETSc/DMPlex.pyx":302
 *         cdef PetscInt *ipoints = NULL
 *         cdef PetscInt  numCoveringPoints = 0
 *         cdef const_PetscInt *coveringPoints = NULL             # <<<<<<<<<<<<<<
 *         points = iarray_i(points, &numPoints, &ipoints)
 *         CHKERR( DMPlexGetMeet(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 */
  __pyx_v_coveringPoints = NULL;

  /* "PETSc/DMPlex.pyx":303
 *         cdef PetscInt  numCoveringPoints = 0
 *         cdef const_PetscInt *coveringPoints = NULL
 *         points = iarray_i(points, &numPoints, &ipoints)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetMeet(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 *         try:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_points, (&__pyx_v_numPoints), (&__pyx_v_ipoints))); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_points, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":304
 *         cdef const_PetscInt *coveringPoints = NULL
 *         points = iarray_i(points, &numPoints, &ipoints)
 *         CHKERR( DMPlexGetMeet(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )             # <<<<<<<<<<<<<<
 *         try:
 *             return array_i(numCoveringPoints, coveringPoints)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetMeet(__pyx_v_self->__pyx_base.dm, __pyx_v_numPoints, __pyx_v_ipoints, (&__pyx_v_numCoveringPoints), (&__pyx_v_coveringPoints))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 304, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":305
 *         points = iarray_i(points, &numPoints, &ipoints)
 *         CHKERR( DMPlexGetMeet(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 *         try:             # <<<<<<<<<<<<<<
 *             return array_i(numCoveringPoints, coveringPoints)
 *         finally:
 */
  /*try:*/ {

    /* "PETSc/DMPlex.pyx":306
 *         CHKERR( DMPlexGetMeet(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 *         try:
 *             return array_i(numCoveringPoints, coveringPoints)             # <<<<<<<<<<<<<<
 *         finally:
 *             CHKERR( DMPlexRestoreMeet(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_numCoveringPoints, __pyx_v_coveringPoints)); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 306, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L3_return;
  }

  /* "PETSc/DMPlex.pyx":308
 *             return array_i(numCoveringPoints, coveringPoints)
 *         finally:
 *             CHKERR( DMPlexRestoreMeet(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )             # <<<<<<<<<<<<<<
 * 
 *     def getJoin(self, points):
 */
  /*finally:*/ {
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L4_error:;
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __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_t_2 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_4 = __pyx_filename;
      {
        __pyx_t_11 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexRestoreMeet(__pyx_v_self->__pyx_base.dm, __pyx_v_numPoints, __pyx_v_ipoints, (&__pyx_v_numCoveringPoints), (&__pyx_v_coveringPoints))); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(42, 308, __pyx_L7_error)
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_4;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_10 = __pyx_r;
      __pyx_r = 0;
      __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexRestoreMeet(__pyx_v_self->__pyx_base.dm, __pyx_v_numPoints, __pyx_v_ipoints, (&__pyx_v_numCoveringPoints), (&__pyx_v_coveringPoints))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(42, 308, __pyx_L1_error)
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      goto __pyx_L0;
    }
  }

  /* "PETSc/DMPlex.pyx":298
 *         return (toInt(sStart), toInt(sEnd))
 * 
 *     def getMeet(self, points):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  numPoints = 0
 *         cdef PetscInt *ipoints = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getMeet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_points);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":310
 *             CHKERR( DMPlexRestoreMeet(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 * 
 *     def getJoin(self, points):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  numPoints = 0
 *         cdef PetscInt *ipoints = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_71getJoin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_70getJoin[] = "DMPlex.getJoin(self, points)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_71getJoin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_points = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getJoin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,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);
        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_points)) != 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, "getJoin") < 0)) __PYX_ERR(42, 310, __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_points = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getJoin", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 310, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getJoin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_70getJoin(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_points);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_70getJoin(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_points) {
  PetscInt __pyx_v_numPoints;
  PetscInt *__pyx_v_ipoints;
  PetscInt __pyx_v_numCoveringPoints;
  const PetscInt *__pyx_v_coveringPoints;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  char const *__pyx_t_4;
  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;
  __Pyx_RefNannySetupContext("getJoin", 0);
  __Pyx_INCREF(__pyx_v_points);

  /* "PETSc/DMPlex.pyx":311
 * 
 *     def getJoin(self, points):
 *         cdef PetscInt  numPoints = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *ipoints = NULL
 *         cdef PetscInt  numCoveringPoints = 0
 */
  __pyx_v_numPoints = 0;

  /* "PETSc/DMPlex.pyx":312
 *     def getJoin(self, points):
 *         cdef PetscInt  numPoints = 0
 *         cdef PetscInt *ipoints = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt  numCoveringPoints = 0
 *         cdef const_PetscInt *coveringPoints = NULL
 */
  __pyx_v_ipoints = NULL;

  /* "PETSc/DMPlex.pyx":313
 *         cdef PetscInt  numPoints = 0
 *         cdef PetscInt *ipoints = NULL
 *         cdef PetscInt  numCoveringPoints = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *coveringPoints = NULL
 *         points = iarray_i(points, &numPoints, &ipoints)
 */
  __pyx_v_numCoveringPoints = 0;

  /* "PETSc/DMPlex.pyx":314
 *         cdef PetscInt *ipoints = NULL
 *         cdef PetscInt  numCoveringPoints = 0
 *         cdef const_PetscInt *coveringPoints = NULL             # <<<<<<<<<<<<<<
 *         points = iarray_i(points, &numPoints, &ipoints)
 *         CHKERR( DMPlexGetJoin(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 */
  __pyx_v_coveringPoints = NULL;

  /* "PETSc/DMPlex.pyx":315
 *         cdef PetscInt  numCoveringPoints = 0
 *         cdef const_PetscInt *coveringPoints = NULL
 *         points = iarray_i(points, &numPoints, &ipoints)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetJoin(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 *         try:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_points, (&__pyx_v_numPoints), (&__pyx_v_ipoints))); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_points, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":316
 *         cdef const_PetscInt *coveringPoints = NULL
 *         points = iarray_i(points, &numPoints, &ipoints)
 *         CHKERR( DMPlexGetJoin(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )             # <<<<<<<<<<<<<<
 *         try:
 *             return array_i(numCoveringPoints, coveringPoints)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetJoin(__pyx_v_self->__pyx_base.dm, __pyx_v_numPoints, __pyx_v_ipoints, (&__pyx_v_numCoveringPoints), (&__pyx_v_coveringPoints))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 316, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":317
 *         points = iarray_i(points, &numPoints, &ipoints)
 *         CHKERR( DMPlexGetJoin(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 *         try:             # <<<<<<<<<<<<<<
 *             return array_i(numCoveringPoints, coveringPoints)
 *         finally:
 */
  /*try:*/ {

    /* "PETSc/DMPlex.pyx":318
 *         CHKERR( DMPlexGetJoin(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 *         try:
 *             return array_i(numCoveringPoints, coveringPoints)             # <<<<<<<<<<<<<<
 *         finally:
 *             CHKERR( DMPlexRestoreJoin(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_numCoveringPoints, __pyx_v_coveringPoints)); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 318, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L3_return;
  }

  /* "PETSc/DMPlex.pyx":320
 *             return array_i(numCoveringPoints, coveringPoints)
 *         finally:
 *             CHKERR( DMPlexRestoreJoin(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )             # <<<<<<<<<<<<<<
 * 
 *     def getTransitiveClosure(self, p, useCone=True):
 */
  /*finally:*/ {
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L4_error:;
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __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_t_2 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_4 = __pyx_filename;
      {
        __pyx_t_11 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexRestoreJoin(__pyx_v_self->__pyx_base.dm, __pyx_v_numPoints, __pyx_v_ipoints, (&__pyx_v_numCoveringPoints), (&__pyx_v_coveringPoints))); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(42, 320, __pyx_L7_error)
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_4;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_10 = __pyx_r;
      __pyx_r = 0;
      __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexRestoreJoin(__pyx_v_self->__pyx_base.dm, __pyx_v_numPoints, __pyx_v_ipoints, (&__pyx_v_numCoveringPoints), (&__pyx_v_coveringPoints))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(42, 320, __pyx_L1_error)
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      goto __pyx_L0;
    }
  }

  /* "PETSc/DMPlex.pyx":310
 *             CHKERR( DMPlexRestoreMeet(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 * 
 *     def getJoin(self, points):             # <<<<<<<<<<<<<<
 *         cdef PetscInt  numPoints = 0
 *         cdef PetscInt *ipoints = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getJoin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_points);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":322
 *             CHKERR( DMPlexRestoreJoin(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 * 
 *     def getTransitiveClosure(self, p, useCone=True):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_73getTransitiveClosure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_72getTransitiveClosure[] = "DMPlex.getTransitiveClosure(self, p, useCone=True)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_73getTransitiveClosure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_useCone = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTransitiveClosure (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_useCone,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_useCone);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getTransitiveClosure") < 0)) __PYX_ERR(42, 322, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
    __pyx_v_useCone = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getTransitiveClosure", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 322, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getTransitiveClosure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_72getTransitiveClosure(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_p, __pyx_v_useCone);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_72getTransitiveClosure(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_useCone) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_pStart;
  PetscInt __pyx_v_pEnd;
  PetscBool __pyx_v_cuseCone;
  PetscInt __pyx_v_numPoints;
  PetscInt *__pyx_v_points;
  PyArrayObject *__pyx_v_out = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PetscBool __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  char const *__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;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  __Pyx_RefNannySetupContext("getTransitiveClosure", 0);

  /* "PETSc/DMPlex.pyx":323
 * 
 *     def getTransitiveClosure(self, p, useCone=True):
 *         cdef PetscInt cp = asInt(p)             # <<<<<<<<<<<<<<
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 323, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":324
 *     def getTransitiveClosure(self, p, useCone=True):
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 */
  __pyx_v_pStart = 0;
  __pyx_v_pEnd = 0;

  /* "PETSc/DMPlex.pyx":325
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )             # <<<<<<<<<<<<<<
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscBool cuseCone = useCone
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetChart(__pyx_v_self->__pyx_base.dm, (&__pyx_v_pStart), (&__pyx_v_pEnd))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 325, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":326
 *         cdef PetscInt pStart = 0, pEnd = 0
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd             # <<<<<<<<<<<<<<
 *         cdef PetscBool cuseCone = useCone
 *         cdef PetscInt  numPoints = 0
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_4 = ((__pyx_v_cp >= __pyx_v_pStart) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_cp < __pyx_v_pEnd) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 326, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":327
 *         CHKERR( DMPlexGetChart(self.dm, &pStart, &pEnd) )
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscBool cuseCone = useCone             # <<<<<<<<<<<<<<
 *         cdef PetscInt  numPoints = 0
 *         cdef PetscInt *points = NULL
 */
  __pyx_t_5 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_useCone)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 327, __pyx_L1_error)
  __pyx_v_cuseCone = __pyx_t_5;

  /* "PETSc/DMPlex.pyx":328
 *         assert cp>=pStart and cp<pEnd
 *         cdef PetscBool cuseCone = useCone
 *         cdef PetscInt  numPoints = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *points = NULL
 *         CHKERR( DMPlexGetTransitiveClosure(self.dm, cp, cuseCone, &numPoints, &points) )
 */
  __pyx_v_numPoints = 0;

  /* "PETSc/DMPlex.pyx":329
 *         cdef PetscBool cuseCone = useCone
 *         cdef PetscInt  numPoints = 0
 *         cdef PetscInt *points = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetTransitiveClosure(self.dm, cp, cuseCone, &numPoints, &points) )
 *         try:
 */
  __pyx_v_points = NULL;

  /* "PETSc/DMPlex.pyx":330
 *         cdef PetscInt  numPoints = 0
 *         cdef PetscInt *points = NULL
 *         CHKERR( DMPlexGetTransitiveClosure(self.dm, cp, cuseCone, &numPoints, &points) )             # <<<<<<<<<<<<<<
 *         try:
 *             out = array_i(2*numPoints,points)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetTransitiveClosure(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_cuseCone, (&__pyx_v_numPoints), (&__pyx_v_points))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 330, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":331
 *         cdef PetscInt *points = NULL
 *         CHKERR( DMPlexGetTransitiveClosure(self.dm, cp, cuseCone, &numPoints, &points) )
 *         try:             # <<<<<<<<<<<<<<
 *             out = array_i(2*numPoints,points)
 *         finally:
 */
  /*try:*/ {

    /* "PETSc/DMPlex.pyx":332
 *         CHKERR( DMPlexGetTransitiveClosure(self.dm, cp, cuseCone, &numPoints, &points) )
 *         try:
 *             out = array_i(2*numPoints,points)             # <<<<<<<<<<<<<<
 *         finally:
 *             CHKERR( DMPlexRestoreTransitiveClosure(self.dm, cp, cuseCone, &numPoints, &points) )
 */
    __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i((2 * __pyx_v_numPoints), __pyx_v_points)); if (unlikely(!__pyx_t_6)) __PYX_ERR(42, 332, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_out = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
  }

  /* "PETSc/DMPlex.pyx":334
 *             out = array_i(2*numPoints,points)
 *         finally:
 *             CHKERR( DMPlexRestoreTransitiveClosure(self.dm, cp, cuseCone, &numPoints, &points) )             # <<<<<<<<<<<<<<
 *         return out[::2],out[1::2]
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexRestoreTransitiveClosure(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_cuseCone, (&__pyx_v_numPoints), (&__pyx_v_points))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 334, __pyx_L1_error)
      goto __pyx_L7;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L6_error:;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_2 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
      {
        __pyx_t_15 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexRestoreTransitiveClosure(__pyx_v_self->__pyx_base.dm, __pyx_v_cp, __pyx_v_cuseCone, (&__pyx_v_numPoints), (&__pyx_v_points))); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(42, 334, __pyx_L9_error)
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
      __pyx_L9_error:;
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "PETSc/DMPlex.pyx":335
 *         finally:
 *             CHKERR( DMPlexRestoreTransitiveClosure(self.dm, cp, cuseCone, &numPoints, &points) )
 *         return out[::2],out[1::2]             # <<<<<<<<<<<<<<
 * 
 *     def vecGetClosure(self, Section sec, Vec vec, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_out), __pyx_slice__63); if (unlikely(!__pyx_t_6)) __PYX_ERR(42, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_out), __pyx_slice__64); if (unlikely(!__pyx_t_16)) __PYX_ERR(42, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(42, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_16);
  __pyx_t_6 = 0;
  __pyx_t_16 = 0;
  __pyx_r = __pyx_t_17;
  __pyx_t_17 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":322
 *             CHKERR( DMPlexRestoreJoin(self.dm, numPoints, ipoints, &numCoveringPoints, &coveringPoints) )
 * 
 *     def getTransitiveClosure(self, p, useCone=True):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p)
 *         cdef PetscInt pStart = 0, pEnd = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getTransitiveClosure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":337
 *         return out[::2],out[1::2]
 * 
 *     def vecGetClosure(self, Section sec, Vec vec, p):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p), csize = 0
 *         cdef PetscScalar *cvals = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_75vecGetClosure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_74vecGetClosure[] = "DMPlex.vecGetClosure(self, Section sec, Vec vec, p)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_75vecGetClosure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscSectionObject *__pyx_v_sec = 0;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecGetClosure (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sec,&__pyx_n_s_vec,&__pyx_n_s_p,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_sec)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("vecGetClosure", 1, 3, 3, 1); __PYX_ERR(42, 337, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("vecGetClosure", 1, 3, 3, 2); __PYX_ERR(42, 337, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vecGetClosure") < 0)) __PYX_ERR(42, 337, __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_sec = ((struct PyPetscSectionObject *)values[0]);
    __pyx_v_vec = ((struct PyPetscVecObject *)values[1]);
    __pyx_v_p = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("vecGetClosure", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 337, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.vecGetClosure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sec), __pyx_ptype_8petsc4py_5PETSc_Section, 1, "sec", 0))) __PYX_ERR(42, 337, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "vec", 0))) __PYX_ERR(42, 337, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_74vecGetClosure(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_sec, __pyx_v_vec, __pyx_v_p);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_74vecGetClosure(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, struct PyPetscSectionObject *__pyx_v_sec, struct PyPetscVecObject *__pyx_v_vec, PyObject *__pyx_v_p) {
  PetscInt __pyx_v_cp;
  PetscInt __pyx_v_csize;
  PetscScalar *__pyx_v_cvals;
  PyArrayObject *__pyx_v_closure = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  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;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("vecGetClosure", 0);

  /* "PETSc/DMPlex.pyx":338
 * 
 *     def vecGetClosure(self, Section sec, Vec vec, p):
 *         cdef PetscInt cp = asInt(p), csize = 0             # <<<<<<<<<<<<<<
 *         cdef PetscScalar *cvals = NULL
 *         CHKERR( DMPlexVecGetClosure(self.dm, sec.sec, vec.vec, cp, &csize, &cvals) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_p); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 338, __pyx_L1_error)
  __pyx_v_cp = __pyx_t_1;
  __pyx_v_csize = 0;

  /* "PETSc/DMPlex.pyx":339
 *     def vecGetClosure(self, Section sec, Vec vec, p):
 *         cdef PetscInt cp = asInt(p), csize = 0
 *         cdef PetscScalar *cvals = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexVecGetClosure(self.dm, sec.sec, vec.vec, cp, &csize, &cvals) )
 *         try:
 */
  __pyx_v_cvals = NULL;

  /* "PETSc/DMPlex.pyx":340
 *         cdef PetscInt cp = asInt(p), csize = 0
 *         cdef PetscScalar *cvals = NULL
 *         CHKERR( DMPlexVecGetClosure(self.dm, sec.sec, vec.vec, cp, &csize, &cvals) )             # <<<<<<<<<<<<<<
 *         try:
 *             closure = array_s(csize, cvals)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexVecGetClosure(__pyx_v_self->__pyx_base.dm, __pyx_v_sec->sec, __pyx_v_vec->vec, __pyx_v_cp, (&__pyx_v_csize), (&__pyx_v_cvals))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 340, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":341
 *         cdef PetscScalar *cvals = NULL
 *         CHKERR( DMPlexVecGetClosure(self.dm, sec.sec, vec.vec, cp, &csize, &cvals) )
 *         try:             # <<<<<<<<<<<<<<
 *             closure = array_s(csize, cvals)
 *         finally:
 */
  /*try:*/ {

    /* "PETSc/DMPlex.pyx":342
 *         CHKERR( DMPlexVecGetClosure(self.dm, sec.sec, vec.vec, cp, &csize, &cvals) )
 *         try:
 *             closure = array_s(csize, cvals)             # <<<<<<<<<<<<<<
 *         finally:
 *             CHKERR( DMPlexVecRestoreClosure(self.dm, sec.sec, vec.vec, cp, &csize, &cvals) )
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_s(__pyx_v_csize, __pyx_v_cvals)); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 342, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_closure = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "PETSc/DMPlex.pyx":344
 *             closure = array_s(csize, cvals)
 *         finally:
 *             CHKERR( DMPlexVecRestoreClosure(self.dm, sec.sec, vec.vec, cp, &csize, &cvals) )             # <<<<<<<<<<<<<<
 *         return closure
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexVecRestoreClosure(__pyx_v_self->__pyx_base.dm, __pyx_v_sec->sec, __pyx_v_vec->vec, __pyx_v_cp, (&__pyx_v_csize), (&__pyx_v_cvals))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 344, __pyx_L1_error)
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L4_error:;
      __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_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 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_2 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
      {
        __pyx_t_12 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexVecRestoreClosure(__pyx_v_self->__pyx_base.dm, __pyx_v_sec->sec, __pyx_v_vec->vec, __pyx_v_cp, (&__pyx_v_csize), (&__pyx_v_cvals))); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(42, 344, __pyx_L7_error)
      }
      __Pyx_PyThreadState_assign
      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_2; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      __Pyx_PyThreadState_assign
      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_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "PETSc/DMPlex.pyx":345
 *         finally:
 *             CHKERR( DMPlexVecRestoreClosure(self.dm, sec.sec, vec.vec, cp, &csize, &cvals) )
 *         return closure             # <<<<<<<<<<<<<<
 * 
 *     def generate(self, DMPlex boundary, name=None, interpolate=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_closure));
  __pyx_r = ((PyObject *)__pyx_v_closure);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":337
 *         return out[::2],out[1::2]
 * 
 *     def vecGetClosure(self, Section sec, Vec vec, p):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cp = asInt(p), csize = 0
 *         cdef PetscScalar *cvals = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.vecGetClosure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_closure);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":347
 *         return closure
 * 
 *     def generate(self, DMPlex boundary, name=None, interpolate=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool interp = interpolate
 *         cdef const_char *cname = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_77generate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_76generate[] = "DMPlex.generate(self, DMPlex boundary, name=None, interpolate=True)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_77generate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_boundary = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_interpolate = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_boundary,&__pyx_n_s_name,&__pyx_n_s_interpolate,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_boundary)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_interpolate);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate") < 0)) __PYX_ERR(42, 347, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_boundary = ((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)values[0]);
    __pyx_v_name = values[1];
    __pyx_v_interpolate = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 347, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.generate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_boundary), __pyx_ptype_8petsc4py_5PETSc_DMPlex, 1, "boundary", 0))) __PYX_ERR(42, 347, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_76generate(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_boundary, __pyx_v_name, __pyx_v_interpolate);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_76generate(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_boundary, PyObject *__pyx_v_name, PyObject *__pyx_v_interpolate) {
  PetscBool __pyx_v_interp;
  const char *__pyx_v_cname;
  DM __pyx_v_newdm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("generate", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "PETSc/DMPlex.pyx":348
 * 
 *     def generate(self, DMPlex boundary, name=None, interpolate=True):
 *         cdef PetscBool interp = interpolate             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         if name: name = str2bytes(name, &cname)
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_interpolate)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 348, __pyx_L1_error)
  __pyx_v_interp = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":349
 *     def generate(self, DMPlex boundary, name=None, interpolate=True):
 *         cdef PetscBool interp = interpolate
 *         cdef const_char *cname = NULL             # <<<<<<<<<<<<<<
 *         if name: name = str2bytes(name, &cname)
 *         cdef PetscDM   newdm = NULL
 */
  __pyx_v_cname = NULL;

  /* "PETSc/DMPlex.pyx":350
 *         cdef PetscBool interp = interpolate
 *         cdef const_char *cname = NULL
 *         if name: name = str2bytes(name, &cname)             # <<<<<<<<<<<<<<
 *         cdef PetscDM   newdm = NULL
 *         CHKERR( DMPlexGenerate(boundary.dm, cname, interp, &newdm) )
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(42, 350, __pyx_L1_error)
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "PETSc/DMPlex.pyx":351
 *         cdef const_char *cname = NULL
 *         if name: name = str2bytes(name, &cname)
 *         cdef PetscDM   newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGenerate(boundary.dm, cname, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DMPlex.pyx":352
 *         if name: name = str2bytes(name, &cname)
 *         cdef PetscDM   newdm = NULL
 *         CHKERR( DMPlexGenerate(boundary.dm, cname, interp, &newdm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGenerate(__pyx_v_boundary->__pyx_base.dm, __pyx_v_cname, __pyx_v_interp, (&__pyx_v_newdm))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 352, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":353
 *         cdef PetscDM   newdm = NULL
 *         CHKERR( DMPlexGenerate(boundary.dm, cname, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newdm;

  /* "PETSc/DMPlex.pyx":354
 *         CHKERR( DMPlexGenerate(boundary.dm, cname, interp, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setTriangleOptions(self, opts):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":347
 *         return closure
 * 
 *     def generate(self, DMPlex boundary, name=None, interpolate=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool interp = interpolate
 *         cdef const_char *cname = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.generate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":356
 *         return self
 * 
 *     def setTriangleOptions(self, opts):             # <<<<<<<<<<<<<<
 *         cdef const_char *copts = NULL
 *         opts = str2bytes(opts, &copts)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_79setTriangleOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_78setTriangleOptions[] = "DMPlex.setTriangleOptions(self, opts)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_79setTriangleOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_opts = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTriangleOptions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_opts,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);
        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_opts)) != 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, "setTriangleOptions") < 0)) __PYX_ERR(42, 356, __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_opts = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTriangleOptions", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 356, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setTriangleOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_78setTriangleOptions(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_opts);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_78setTriangleOptions(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_opts) {
  const char *__pyx_v_copts;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setTriangleOptions", 0);
  __Pyx_INCREF(__pyx_v_opts);

  /* "PETSc/DMPlex.pyx":357
 * 
 *     def setTriangleOptions(self, opts):
 *         cdef const_char *copts = NULL             # <<<<<<<<<<<<<<
 *         opts = str2bytes(opts, &copts)
 *         CHKERR( DMPlexTriangleSetOptions(self.dm, copts) )
 */
  __pyx_v_copts = NULL;

  /* "PETSc/DMPlex.pyx":358
 *     def setTriangleOptions(self, opts):
 *         cdef const_char *copts = NULL
 *         opts = str2bytes(opts, &copts)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexTriangleSetOptions(self.dm, copts) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_opts, (&__pyx_v_copts)); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_opts, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":359
 *         cdef const_char *copts = NULL
 *         opts = str2bytes(opts, &copts)
 *         CHKERR( DMPlexTriangleSetOptions(self.dm, copts) )             # <<<<<<<<<<<<<<
 * 
 *     def setTetGenOptions(self, opts):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexTriangleSetOptions(__pyx_v_self->__pyx_base.dm, __pyx_v_copts)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 359, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":356
 *         return self
 * 
 *     def setTriangleOptions(self, opts):             # <<<<<<<<<<<<<<
 *         cdef const_char *copts = NULL
 *         opts = str2bytes(opts, &copts)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setTriangleOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_opts);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":361
 *         CHKERR( DMPlexTriangleSetOptions(self.dm, copts) )
 * 
 *     def setTetGenOptions(self, opts):             # <<<<<<<<<<<<<<
 *         cdef const_char *copts = NULL
 *         opts = str2bytes(opts, &copts)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_81setTetGenOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_80setTetGenOptions[] = "DMPlex.setTetGenOptions(self, opts)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_81setTetGenOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_opts = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTetGenOptions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_opts,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);
        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_opts)) != 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, "setTetGenOptions") < 0)) __PYX_ERR(42, 361, __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_opts = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTetGenOptions", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 361, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setTetGenOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_80setTetGenOptions(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_opts);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_80setTetGenOptions(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_opts) {
  const char *__pyx_v_copts;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setTetGenOptions", 0);
  __Pyx_INCREF(__pyx_v_opts);

  /* "PETSc/DMPlex.pyx":362
 * 
 *     def setTetGenOptions(self, opts):
 *         cdef const_char *copts = NULL             # <<<<<<<<<<<<<<
 *         opts = str2bytes(opts, &copts)
 *         CHKERR( DMPlexTetgenSetOptions(self.dm, copts) )
 */
  __pyx_v_copts = NULL;

  /* "PETSc/DMPlex.pyx":363
 *     def setTetGenOptions(self, opts):
 *         cdef const_char *copts = NULL
 *         opts = str2bytes(opts, &copts)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexTetgenSetOptions(self.dm, copts) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_opts, (&__pyx_v_copts)); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_opts, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":364
 *         cdef const_char *copts = NULL
 *         opts = str2bytes(opts, &copts)
 *         CHKERR( DMPlexTetgenSetOptions(self.dm, copts) )             # <<<<<<<<<<<<<<
 * 
 *     def createSquareBoundary(self, lower, upper, edges):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexTetgenSetOptions(__pyx_v_self->__pyx_base.dm, __pyx_v_copts)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 364, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":361
 *         CHKERR( DMPlexTriangleSetOptions(self.dm, copts) )
 * 
 *     def setTetGenOptions(self, opts):             # <<<<<<<<<<<<<<
 *         cdef const_char *copts = NULL
 *         opts = str2bytes(opts, &copts)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setTetGenOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_opts);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":366
 *         CHKERR( DMPlexTetgenSetOptions(self.dm, copts) )
 * 
 *     def createSquareBoundary(self, lower, upper, edges):             # <<<<<<<<<<<<<<
 *         cdef PetscInt nlow = 0, nup = 0, nedg = 0
 *         cdef PetscInt *iedg = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_83createSquareBoundary(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_82createSquareBoundary[] = "DMPlex.createSquareBoundary(self, lower, upper, edges)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_83createSquareBoundary(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lower = 0;
  PyObject *__pyx_v_upper = 0;
  PyObject *__pyx_v_edges = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createSquareBoundary (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lower,&__pyx_n_s_upper,&__pyx_n_s_edges,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_lower)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_upper)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createSquareBoundary", 1, 3, 3, 1); __PYX_ERR(42, 366, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_edges)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createSquareBoundary", 1, 3, 3, 2); __PYX_ERR(42, 366, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createSquareBoundary") < 0)) __PYX_ERR(42, 366, __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_lower = values[0];
    __pyx_v_upper = values[1];
    __pyx_v_edges = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createSquareBoundary", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 366, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createSquareBoundary", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_82createSquareBoundary(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_lower, __pyx_v_upper, __pyx_v_edges);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_82createSquareBoundary(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_lower, PyObject *__pyx_v_upper, PyObject *__pyx_v_edges) {
  PetscInt __pyx_v_nlow;
  PetscInt __pyx_v_nup;
  PetscInt __pyx_v_nedg;
  PetscInt *__pyx_v_iedg;
  PetscReal *__pyx_v_ilow;
  PetscReal *__pyx_v_iup;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createSquareBoundary", 0);
  __Pyx_INCREF(__pyx_v_lower);
  __Pyx_INCREF(__pyx_v_upper);
  __Pyx_INCREF(__pyx_v_edges);

  /* "PETSc/DMPlex.pyx":367
 * 
 *     def createSquareBoundary(self, lower, upper, edges):
 *         cdef PetscInt nlow = 0, nup = 0, nedg = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *iedg = NULL
 *         cdef PetscReal *ilow = NULL, *iup = NULL
 */
  __pyx_v_nlow = 0;
  __pyx_v_nup = 0;
  __pyx_v_nedg = 0;

  /* "PETSc/DMPlex.pyx":368
 *     def createSquareBoundary(self, lower, upper, edges):
 *         cdef PetscInt nlow = 0, nup = 0, nedg = 0
 *         cdef PetscInt *iedg = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscReal *ilow = NULL, *iup = NULL
 *         lower = iarray_r(lower, &nlow, &ilow)
 */
  __pyx_v_iedg = NULL;

  /* "PETSc/DMPlex.pyx":369
 *         cdef PetscInt nlow = 0, nup = 0, nedg = 0
 *         cdef PetscInt *iedg = NULL
 *         cdef PetscReal *ilow = NULL, *iup = NULL             # <<<<<<<<<<<<<<
 *         lower = iarray_r(lower, &nlow, &ilow)
 *         upper = iarray_r(upper, &nup,  &iup)
 */
  __pyx_v_ilow = NULL;
  __pyx_v_iup = NULL;

  /* "PETSc/DMPlex.pyx":370
 *         cdef PetscInt *iedg = NULL
 *         cdef PetscReal *ilow = NULL, *iup = NULL
 *         lower = iarray_r(lower, &nlow, &ilow)             # <<<<<<<<<<<<<<
 *         upper = iarray_r(upper, &nup,  &iup)
 *         edges = iarray_i(edges, &nedg, &iedg)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_r(__pyx_v_lower, (&__pyx_v_nlow), (&__pyx_v_ilow))); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lower, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":371
 *         cdef PetscReal *ilow = NULL, *iup = NULL
 *         lower = iarray_r(lower, &nlow, &ilow)
 *         upper = iarray_r(upper, &nup,  &iup)             # <<<<<<<<<<<<<<
 *         edges = iarray_i(edges, &nedg, &iedg)
 *         CHKERR( DMPlexCreateSquareBoundary(self.dm, ilow, iup, iedg) )
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_r(__pyx_v_upper, (&__pyx_v_nup), (&__pyx_v_iup))); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_upper, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":372
 *         lower = iarray_r(lower, &nlow, &ilow)
 *         upper = iarray_r(upper, &nup,  &iup)
 *         edges = iarray_i(edges, &nedg, &iedg)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateSquareBoundary(self.dm, ilow, iup, iedg) )
 *         return self
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_edges, (&__pyx_v_nedg), (&__pyx_v_iedg))); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_edges, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":373
 *         upper = iarray_r(upper, &nup,  &iup)
 *         edges = iarray_i(edges, &nedg, &iedg)
 *         CHKERR( DMPlexCreateSquareBoundary(self.dm, ilow, iup, iedg) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateSquareBoundary(__pyx_v_self->__pyx_base.dm, __pyx_v_ilow, __pyx_v_iup, __pyx_v_iedg)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 373, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":374
 *         edges = iarray_i(edges, &nedg, &iedg)
 *         CHKERR( DMPlexCreateSquareBoundary(self.dm, ilow, iup, iedg) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def createCubeBoundary(self, lower, upper, faces):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":366
 *         CHKERR( DMPlexTetgenSetOptions(self.dm, copts) )
 * 
 *     def createSquareBoundary(self, lower, upper, edges):             # <<<<<<<<<<<<<<
 *         cdef PetscInt nlow = 0, nup = 0, nedg = 0
 *         cdef PetscInt *iedg = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createSquareBoundary", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lower);
  __Pyx_XDECREF(__pyx_v_upper);
  __Pyx_XDECREF(__pyx_v_edges);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":376
 *         return self
 * 
 *     def createCubeBoundary(self, lower, upper, faces):             # <<<<<<<<<<<<<<
 *         cdef PetscInt nlow = 0, nup = 0, nfac = 0
 *         cdef PetscInt *ifac = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_85createCubeBoundary(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_84createCubeBoundary[] = "DMPlex.createCubeBoundary(self, lower, upper, faces)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_85createCubeBoundary(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lower = 0;
  PyObject *__pyx_v_upper = 0;
  PyObject *__pyx_v_faces = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createCubeBoundary (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lower,&__pyx_n_s_upper,&__pyx_n_s_faces,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_lower)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_upper)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createCubeBoundary", 1, 3, 3, 1); __PYX_ERR(42, 376, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_faces)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createCubeBoundary", 1, 3, 3, 2); __PYX_ERR(42, 376, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createCubeBoundary") < 0)) __PYX_ERR(42, 376, __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_lower = values[0];
    __pyx_v_upper = values[1];
    __pyx_v_faces = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createCubeBoundary", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 376, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createCubeBoundary", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_84createCubeBoundary(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_lower, __pyx_v_upper, __pyx_v_faces);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_84createCubeBoundary(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_lower, PyObject *__pyx_v_upper, PyObject *__pyx_v_faces) {
  PetscInt __pyx_v_nlow;
  PetscInt __pyx_v_nup;
  PetscInt __pyx_v_nfac;
  PetscInt *__pyx_v_ifac;
  PetscReal *__pyx_v_ilow;
  PetscReal *__pyx_v_iup;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createCubeBoundary", 0);
  __Pyx_INCREF(__pyx_v_lower);
  __Pyx_INCREF(__pyx_v_upper);
  __Pyx_INCREF(__pyx_v_faces);

  /* "PETSc/DMPlex.pyx":377
 * 
 *     def createCubeBoundary(self, lower, upper, faces):
 *         cdef PetscInt nlow = 0, nup = 0, nfac = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *ifac = NULL
 *         cdef PetscReal *ilow = NULL, *iup = NULL
 */
  __pyx_v_nlow = 0;
  __pyx_v_nup = 0;
  __pyx_v_nfac = 0;

  /* "PETSc/DMPlex.pyx":378
 *     def createCubeBoundary(self, lower, upper, faces):
 *         cdef PetscInt nlow = 0, nup = 0, nfac = 0
 *         cdef PetscInt *ifac = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscReal *ilow = NULL, *iup = NULL
 *         lower = iarray_r(lower, &nlow, &ilow)
 */
  __pyx_v_ifac = NULL;

  /* "PETSc/DMPlex.pyx":379
 *         cdef PetscInt nlow = 0, nup = 0, nfac = 0
 *         cdef PetscInt *ifac = NULL
 *         cdef PetscReal *ilow = NULL, *iup = NULL             # <<<<<<<<<<<<<<
 *         lower = iarray_r(lower, &nlow, &ilow)
 *         upper = iarray_r(upper, &nup,  &iup)
 */
  __pyx_v_ilow = NULL;
  __pyx_v_iup = NULL;

  /* "PETSc/DMPlex.pyx":380
 *         cdef PetscInt *ifac = NULL
 *         cdef PetscReal *ilow = NULL, *iup = NULL
 *         lower = iarray_r(lower, &nlow, &ilow)             # <<<<<<<<<<<<<<
 *         upper = iarray_r(upper, &nup,  &iup)
 *         faces = iarray_i(faces, &nfac, &ifac)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_r(__pyx_v_lower, (&__pyx_v_nlow), (&__pyx_v_ilow))); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lower, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":381
 *         cdef PetscReal *ilow = NULL, *iup = NULL
 *         lower = iarray_r(lower, &nlow, &ilow)
 *         upper = iarray_r(upper, &nup,  &iup)             # <<<<<<<<<<<<<<
 *         faces = iarray_i(faces, &nfac, &ifac)
 *         CHKERR( DMPlexCreateCubeBoundary(self.dm, ilow, iup, ifac) )
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_r(__pyx_v_upper, (&__pyx_v_nup), (&__pyx_v_iup))); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_upper, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":382
 *         lower = iarray_r(lower, &nlow, &ilow)
 *         upper = iarray_r(upper, &nup,  &iup)
 *         faces = iarray_i(faces, &nfac, &ifac)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateCubeBoundary(self.dm, ilow, iup, ifac) )
 *         return self
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_faces, (&__pyx_v_nfac), (&__pyx_v_ifac))); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_faces, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":383
 *         upper = iarray_r(upper, &nup,  &iup)
 *         faces = iarray_i(faces, &nfac, &ifac)
 *         CHKERR( DMPlexCreateCubeBoundary(self.dm, ilow, iup, ifac) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateCubeBoundary(__pyx_v_self->__pyx_base.dm, __pyx_v_ilow, __pyx_v_iup, __pyx_v_ifac)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 383, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":384
 *         faces = iarray_i(faces, &nfac, &ifac)
 *         CHKERR( DMPlexCreateCubeBoundary(self.dm, ilow, iup, ifac) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def markBoundaryFaces(self, label):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":376
 *         return self
 * 
 *     def createCubeBoundary(self, lower, upper, faces):             # <<<<<<<<<<<<<<
 *         cdef PetscInt nlow = 0, nup = 0, nfac = 0
 *         cdef PetscInt *ifac = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createCubeBoundary", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lower);
  __Pyx_XDECREF(__pyx_v_upper);
  __Pyx_XDECREF(__pyx_v_faces);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":386
 *         return self
 * 
 *     def markBoundaryFaces(self, label):             # <<<<<<<<<<<<<<
 *         if not self.hasLabel(label):
 *             self.createLabel(label)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_87markBoundaryFaces(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_86markBoundaryFaces[] = "DMPlex.markBoundaryFaces(self, label)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_87markBoundaryFaces(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_label = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("markBoundaryFaces (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_label,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);
        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_label)) != 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, "markBoundaryFaces") < 0)) __PYX_ERR(42, 386, __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_label = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("markBoundaryFaces", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 386, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.markBoundaryFaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_86markBoundaryFaces(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_label);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_86markBoundaryFaces(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_label) {
  const char *__pyx_v_cval;
  DMLabel __pyx_v_clbl;
  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;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("markBoundaryFaces", 0);
  __Pyx_INCREF(__pyx_v_label);

  /* "PETSc/DMPlex.pyx":387
 * 
 *     def markBoundaryFaces(self, label):
 *         if not self.hasLabel(label):             # <<<<<<<<<<<<<<
 *             self.createLabel(label)
 *         cdef const_char *cval = NULL
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_hasLabel); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_v_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(42, 387, __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_label);
    __Pyx_GIVEREF(__pyx_v_label);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_label);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 387, __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_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(42, 387, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (__pyx_t_6) {

    /* "PETSc/DMPlex.pyx":388
 *     def markBoundaryFaces(self, label):
 *         if not self.hasLabel(label):
 *             self.createLabel(label)             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         label = str2bytes(label, &cval)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_createLabel); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 388, __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(__pyx_v_label);
      __Pyx_GIVEREF(__pyx_v_label);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_label);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 388, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "PETSc/DMPlex.pyx":387
 * 
 *     def markBoundaryFaces(self, label):
 *         if not self.hasLabel(label):             # <<<<<<<<<<<<<<
 *             self.createLabel(label)
 *         cdef const_char *cval = NULL
 */
  }

  /* "PETSc/DMPlex.pyx":389
 *         if not self.hasLabel(label):
 *             self.createLabel(label)
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         label = str2bytes(label, &cval)
 *         cdef PetscDMLabel clbl = NULL
 */
  __pyx_v_cval = NULL;

  /* "PETSc/DMPlex.pyx":390
 *             self.createLabel(label)
 *         cdef const_char *cval = NULL
 *         label = str2bytes(label, &cval)             # <<<<<<<<<<<<<<
 *         cdef PetscDMLabel clbl = NULL
 *         CHKERR( DMGetLabel(self.dm, cval, &clbl) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_label, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_label, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":391
 *         cdef const_char *cval = NULL
 *         label = str2bytes(label, &cval)
 *         cdef PetscDMLabel clbl = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetLabel(self.dm, cval, &clbl) )
 *         CHKERR( DMPlexMarkBoundaryFaces(self.dm, clbl) )
 */
  __pyx_v_clbl = NULL;

  /* "PETSc/DMPlex.pyx":392
 *         label = str2bytes(label, &cval)
 *         cdef PetscDMLabel clbl = NULL
 *         CHKERR( DMGetLabel(self.dm, cval, &clbl) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexMarkBoundaryFaces(self.dm, clbl) )
 * 
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetLabel(__pyx_v_self->__pyx_base.dm, __pyx_v_cval, (&__pyx_v_clbl))); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(42, 392, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":393
 *         cdef PetscDMLabel clbl = NULL
 *         CHKERR( DMGetLabel(self.dm, cval, &clbl) )
 *         CHKERR( DMPlexMarkBoundaryFaces(self.dm, clbl) )             # <<<<<<<<<<<<<<
 * 
 *     def setAdjacencyUseCone(self, useCone=True):
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexMarkBoundaryFaces(__pyx_v_self->__pyx_base.dm, __pyx_v_clbl)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(42, 393, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":386
 *         return self
 * 
 *     def markBoundaryFaces(self, label):             # <<<<<<<<<<<<<<
 *         if not self.hasLabel(label):
 *             self.createLabel(label)
 */

  /* 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.markBoundaryFaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_label);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":395
 *         CHKERR( DMPlexMarkBoundaryFaces(self.dm, clbl) )
 * 
 *     def setAdjacencyUseCone(self, useCone=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = useCone
 *         CHKERR( DMPlexSetAdjacencyUseCone(self.dm, flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_89setAdjacencyUseCone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_88setAdjacencyUseCone[] = "DMPlex.setAdjacencyUseCone(self, useCone=True)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_89setAdjacencyUseCone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_useCone = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setAdjacencyUseCone (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_useCone,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_useCone);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setAdjacencyUseCone") < 0)) __PYX_ERR(42, 395, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_useCone = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setAdjacencyUseCone", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 395, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setAdjacencyUseCone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_88setAdjacencyUseCone(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_useCone);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_88setAdjacencyUseCone(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_useCone) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setAdjacencyUseCone", 0);

  /* "PETSc/DMPlex.pyx":396
 * 
 *     def setAdjacencyUseCone(self, useCone=True):
 *         cdef PetscBool flag = useCone             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSetAdjacencyUseCone(self.dm, flag) )
 * 
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_useCone)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 396, __pyx_L1_error)
  __pyx_v_flag = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":397
 *     def setAdjacencyUseCone(self, useCone=True):
 *         cdef PetscBool flag = useCone
 *         CHKERR( DMPlexSetAdjacencyUseCone(self.dm, flag) )             # <<<<<<<<<<<<<<
 * 
 *     def setAdjacencyUseClosure(self, useClosure=True):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetAdjacencyUseCone(__pyx_v_self->__pyx_base.dm, __pyx_v_flag)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 397, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":395
 *         CHKERR( DMPlexMarkBoundaryFaces(self.dm, clbl) )
 * 
 *     def setAdjacencyUseCone(self, useCone=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = useCone
 *         CHKERR( DMPlexSetAdjacencyUseCone(self.dm, flag) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setAdjacencyUseCone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":399
 *         CHKERR( DMPlexSetAdjacencyUseCone(self.dm, flag) )
 * 
 *     def setAdjacencyUseClosure(self, useClosure=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = useClosure
 *         CHKERR( DMPlexSetAdjacencyUseClosure(self.dm, flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_91setAdjacencyUseClosure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_90setAdjacencyUseClosure[] = "DMPlex.setAdjacencyUseClosure(self, useClosure=True)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_91setAdjacencyUseClosure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_useClosure = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setAdjacencyUseClosure (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_useClosure,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_useClosure);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setAdjacencyUseClosure") < 0)) __PYX_ERR(42, 399, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_useClosure = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setAdjacencyUseClosure", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 399, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setAdjacencyUseClosure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_90setAdjacencyUseClosure(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_useClosure);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_90setAdjacencyUseClosure(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_useClosure) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setAdjacencyUseClosure", 0);

  /* "PETSc/DMPlex.pyx":400
 * 
 *     def setAdjacencyUseClosure(self, useClosure=True):
 *         cdef PetscBool flag = useClosure             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSetAdjacencyUseClosure(self.dm, flag) )
 * 
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_useClosure)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 400, __pyx_L1_error)
  __pyx_v_flag = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":401
 *     def setAdjacencyUseClosure(self, useClosure=True):
 *         cdef PetscBool flag = useClosure
 *         CHKERR( DMPlexSetAdjacencyUseClosure(self.dm, flag) )             # <<<<<<<<<<<<<<
 * 
 *     def getPartitioner(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetAdjacencyUseClosure(__pyx_v_self->__pyx_base.dm, __pyx_v_flag)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 401, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":399
 *         CHKERR( DMPlexSetAdjacencyUseCone(self.dm, flag) )
 * 
 *     def setAdjacencyUseClosure(self, useClosure=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = useClosure
 *         CHKERR( DMPlexSetAdjacencyUseClosure(self.dm, flag) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setAdjacencyUseClosure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":403
 *         CHKERR( DMPlexSetAdjacencyUseClosure(self.dm, flag) )
 * 
 *     def getPartitioner(self):             # <<<<<<<<<<<<<<
 *         cdef Partitioner part = Partitioner()
 *         CHKERR( DMPlexGetPartitioner(self.dm, &part.part) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_93getPartitioner(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_92getPartitioner[] = "DMPlex.getPartitioner(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_93getPartitioner(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getPartitioner (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getPartitioner", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getPartitioner", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_92getPartitioner(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_92getPartitioner(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  struct PyPetscPartitionerObject *__pyx_v_part = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getPartitioner", 0);

  /* "PETSc/DMPlex.pyx":404
 * 
 *     def getPartitioner(self):
 *         cdef Partitioner part = Partitioner()             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetPartitioner(self.dm, &part.part) )
 *         PetscINCREF(part.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Partitioner), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_part = ((struct PyPetscPartitionerObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":405
 *     def getPartitioner(self):
 *         cdef Partitioner part = Partitioner()
 *         CHKERR( DMPlexGetPartitioner(self.dm, &part.part) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(part.obj)
 *         return part
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetPartitioner(__pyx_v_self->__pyx_base.dm, (&__pyx_v_part->part))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 405, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":406
 *         cdef Partitioner part = Partitioner()
 *         CHKERR( DMPlexGetPartitioner(self.dm, &part.part) )
 *         PetscINCREF(part.obj)             # <<<<<<<<<<<<<<
 *         return part
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_part->__pyx_base.obj);

  /* "PETSc/DMPlex.pyx":407
 *         CHKERR( DMPlexGetPartitioner(self.dm, &part.part) )
 *         PetscINCREF(part.obj)
 *         return part             # <<<<<<<<<<<<<<
 * 
 *     def distribute(self, overlap=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_part));
  __pyx_r = ((PyObject *)__pyx_v_part);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":403
 *         CHKERR( DMPlexSetAdjacencyUseClosure(self.dm, flag) )
 * 
 *     def getPartitioner(self):             # <<<<<<<<<<<<<<
 *         cdef Partitioner part = Partitioner()
 *         CHKERR( DMPlexGetPartitioner(self.dm, &part.part) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getPartitioner", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_part);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":409
 *         return part
 * 
 *     def distribute(self, overlap=0):             # <<<<<<<<<<<<<<
 *         cdef PetscDM dmParallel = NULL
 *         cdef PetscInt coverlap = asInt(overlap)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_95distribute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_94distribute[] = "DMPlex.distribute(self, overlap=0)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_95distribute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_overlap = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("distribute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_overlap,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_overlap);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "distribute") < 0)) __PYX_ERR(42, 409, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_overlap = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("distribute", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 409, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.distribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_94distribute(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_overlap);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_94distribute(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_overlap) {
  DM __pyx_v_dmParallel;
  PetscInt __pyx_v_coverlap;
  struct PyPetscSFObject *__pyx_v_sf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("distribute", 0);

  /* "PETSc/DMPlex.pyx":410
 * 
 *     def distribute(self, overlap=0):
 *         cdef PetscDM dmParallel = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt coverlap = asInt(overlap)
 *         cdef SF sf = SF()
 */
  __pyx_v_dmParallel = NULL;

  /* "PETSc/DMPlex.pyx":411
 *     def distribute(self, overlap=0):
 *         cdef PetscDM dmParallel = NULL
 *         cdef PetscInt coverlap = asInt(overlap)             # <<<<<<<<<<<<<<
 *         cdef SF sf = SF()
 *         CHKERR( DMPlexDistribute(self.dm, coverlap, &sf.sf, &dmParallel) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_overlap); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 411, __pyx_L1_error)
  __pyx_v_coverlap = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":412
 *         cdef PetscDM dmParallel = NULL
 *         cdef PetscInt coverlap = asInt(overlap)
 *         cdef SF sf = SF()             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexDistribute(self.dm, coverlap, &sf.sf, &dmParallel) )
 *         PetscCLEAR(self.obj); self.dm = dmParallel
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SF), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_sf = ((struct PyPetscSFObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DMPlex.pyx":413
 *         cdef PetscInt coverlap = asInt(overlap)
 *         cdef SF sf = SF()
 *         CHKERR( DMPlexDistribute(self.dm, coverlap, &sf.sf, &dmParallel) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = dmParallel
 *         return sf
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexDistribute(__pyx_v_self->__pyx_base.dm, __pyx_v_coverlap, (&__pyx_v_sf->sf), (&__pyx_v_dmParallel))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(42, 413, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":414
 *         cdef SF sf = SF()
 *         CHKERR( DMPlexDistribute(self.dm, coverlap, &sf.sf, &dmParallel) )
 *         PetscCLEAR(self.obj); self.dm = dmParallel             # <<<<<<<<<<<<<<
 *         return sf
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_dmParallel;

  /* "PETSc/DMPlex.pyx":415
 *         CHKERR( DMPlexDistribute(self.dm, coverlap, &sf.sf, &dmParallel) )
 *         PetscCLEAR(self.obj); self.dm = dmParallel
 *         return sf             # <<<<<<<<<<<<<<
 * 
 *     def distributeOverlap(self, overlap=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_sf));
  __pyx_r = ((PyObject *)__pyx_v_sf);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":409
 *         return part
 * 
 *     def distribute(self, overlap=0):             # <<<<<<<<<<<<<<
 *         cdef PetscDM dmParallel = NULL
 *         cdef PetscInt coverlap = asInt(overlap)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.distribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":417
 *         return sf
 * 
 *     def distributeOverlap(self, overlap=0):             # <<<<<<<<<<<<<<
 *         cdef PetscInt coverlap = asInt(overlap)
 *         cdef SF sf = SF()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_97distributeOverlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_96distributeOverlap[] = "DMPlex.distributeOverlap(self, overlap=0)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_97distributeOverlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_overlap = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("distributeOverlap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_overlap,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_overlap);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "distributeOverlap") < 0)) __PYX_ERR(42, 417, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_overlap = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("distributeOverlap", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 417, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.distributeOverlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_96distributeOverlap(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_overlap);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_96distributeOverlap(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_overlap) {
  PetscInt __pyx_v_coverlap;
  struct PyPetscSFObject *__pyx_v_sf = 0;
  DM __pyx_v_dmOverlap;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("distributeOverlap", 0);

  /* "PETSc/DMPlex.pyx":418
 * 
 *     def distributeOverlap(self, overlap=0):
 *         cdef PetscInt coverlap = asInt(overlap)             # <<<<<<<<<<<<<<
 *         cdef SF sf = SF()
 *         cdef PetscDM dmOverlap = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_overlap); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 418, __pyx_L1_error)
  __pyx_v_coverlap = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":419
 *     def distributeOverlap(self, overlap=0):
 *         cdef PetscInt coverlap = asInt(overlap)
 *         cdef SF sf = SF()             # <<<<<<<<<<<<<<
 *         cdef PetscDM dmOverlap = NULL
 *         CHKERR( DMPlexDistributeOverlap(self.dm, coverlap,
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SF), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_sf = ((struct PyPetscSFObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DMPlex.pyx":420
 *         cdef PetscInt coverlap = asInt(overlap)
 *         cdef SF sf = SF()
 *         cdef PetscDM dmOverlap = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexDistributeOverlap(self.dm, coverlap,
 *                                         &sf.sf, &dmOverlap) )
 */
  __pyx_v_dmOverlap = NULL;

  /* "PETSc/DMPlex.pyx":421
 *         cdef SF sf = SF()
 *         cdef PetscDM dmOverlap = NULL
 *         CHKERR( DMPlexDistributeOverlap(self.dm, coverlap,             # <<<<<<<<<<<<<<
 *                                         &sf.sf, &dmOverlap) )
 *         PetscCLEAR(self.obj); self.dm = dmOverlap
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexDistributeOverlap(__pyx_v_self->__pyx_base.dm, __pyx_v_coverlap, (&__pyx_v_sf->sf), (&__pyx_v_dmOverlap))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(42, 421, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":423
 *         CHKERR( DMPlexDistributeOverlap(self.dm, coverlap,
 *                                         &sf.sf, &dmOverlap) )
 *         PetscCLEAR(self.obj); self.dm = dmOverlap             # <<<<<<<<<<<<<<
 *         return sf
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_dmOverlap;

  /* "PETSc/DMPlex.pyx":424
 *                                         &sf.sf, &dmOverlap) )
 *         PetscCLEAR(self.obj); self.dm = dmOverlap
 *         return sf             # <<<<<<<<<<<<<<
 * 
 *     def distributeField(self, SF sf not None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_sf));
  __pyx_r = ((PyObject *)__pyx_v_sf);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":417
 *         return sf
 * 
 *     def distributeOverlap(self, overlap=0):             # <<<<<<<<<<<<<<
 *         cdef PetscInt coverlap = asInt(overlap)
 *         cdef SF sf = SF()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.distributeOverlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":426
 *         return sf
 * 
 *     def distributeField(self, SF sf not None,             # <<<<<<<<<<<<<<
 *                         Section sec not None, Vec vec not None,
 *                         Section newsec=None, Vec newvec=None):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_99distributeField(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_98distributeField[] = "DMPlex.distributeField(self, SF sf, Section sec, Vec vec, Section newsec=None, Vec newvec=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_99distributeField(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscSFObject *__pyx_v_sf = 0;
  struct PyPetscSectionObject *__pyx_v_sec = 0;
  struct PyPetscVecObject *__pyx_v_vec = 0;
  struct PyPetscSectionObject *__pyx_v_newsec = 0;
  struct PyPetscVecObject *__pyx_v_newvec = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("distributeField (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sf,&__pyx_n_s_sec,&__pyx_n_s_vec,&__pyx_n_s_newsec,&__pyx_n_s_newvec,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "PETSc/DMPlex.pyx":428
 *     def distributeField(self, SF sf not None,
 *                         Section sec not None, Vec vec not None,
 *                         Section newsec=None, Vec newvec=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = MPI_COMM_NULL
 *         if newsec is None: newsec = Section()
 */
    values[3] = (PyObject *)((struct PyPetscSectionObject *)Py_None);
    values[4] = (PyObject *)((struct PyPetscVecObject *)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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_sf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("distributeField", 0, 3, 5, 1); __PYX_ERR(42, 426, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("distributeField", 0, 3, 5, 2); __PYX_ERR(42, 426, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_newsec);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_newvec);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "distributeField") < 0)) __PYX_ERR(42, 426, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_sf = ((struct PyPetscSFObject *)values[0]);
    __pyx_v_sec = ((struct PyPetscSectionObject *)values[1]);
    __pyx_v_vec = ((struct PyPetscVecObject *)values[2]);
    __pyx_v_newsec = ((struct PyPetscSectionObject *)values[3]);
    __pyx_v_newvec = ((struct PyPetscVecObject *)values[4]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("distributeField", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 426, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.distributeField", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sf), __pyx_ptype_8petsc4py_5PETSc_SF, 0, "sf", 0))) __PYX_ERR(42, 426, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sec), __pyx_ptype_8petsc4py_5PETSc_Section, 0, "sec", 0))) __PYX_ERR(42, 427, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "vec", 0))) __PYX_ERR(42, 427, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_newsec), __pyx_ptype_8petsc4py_5PETSc_Section, 1, "newsec", 0))) __PYX_ERR(42, 428, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_newvec), __pyx_ptype_8petsc4py_5PETSc_Vec, 1, "newvec", 0))) __PYX_ERR(42, 428, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_98distributeField(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_sf, __pyx_v_sec, __pyx_v_vec, __pyx_v_newsec, __pyx_v_newvec);

  /* "PETSc/DMPlex.pyx":426
 *         return sf
 * 
 *     def distributeField(self, SF sf not None,             # <<<<<<<<<<<<<<
 *                         Section sec not None, Vec vec not None,
 *                         Section newsec=None, Vec newvec=None):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_98distributeField(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, struct PyPetscSFObject *__pyx_v_sf, struct PyPetscSectionObject *__pyx_v_sec, struct PyPetscVecObject *__pyx_v_vec, struct PyPetscSectionObject *__pyx_v_newsec, struct PyPetscVecObject *__pyx_v_newvec) {
  MPI_Comm __pyx_v_ccomm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("distributeField", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_newsec);
  __Pyx_INCREF((PyObject *)__pyx_v_newvec);

  /* "PETSc/DMPlex.pyx":429
 *                         Section sec not None, Vec vec not None,
 *                         Section newsec=None, Vec newvec=None):
 *         cdef MPI_Comm ccomm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *         if newsec is None: newsec = Section()
 *         if newvec is None: newvec = Vec()
 */
  __pyx_v_ccomm = MPI_COMM_NULL;

  /* "PETSc/DMPlex.pyx":430
 *                         Section newsec=None, Vec newvec=None):
 *         cdef MPI_Comm ccomm = MPI_COMM_NULL
 *         if newsec is None: newsec = Section()             # <<<<<<<<<<<<<<
 *         if newvec is None: newvec = Vec()
 *         if newsec.sec == NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_newsec) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Section), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 430, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_newsec, ((struct PyPetscSectionObject *)__pyx_t_3));
    __pyx_t_3 = 0;
  }

  /* "PETSc/DMPlex.pyx":431
 *         cdef MPI_Comm ccomm = MPI_COMM_NULL
 *         if newsec is None: newsec = Section()
 *         if newvec is None: newvec = Vec()             # <<<<<<<<<<<<<<
 *         if newsec.sec == NULL:
 *             CHKERR( PetscObjectGetComm(<PetscObject>sec.sec, &ccomm) )
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_newvec) == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 431, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_newvec, ((struct PyPetscVecObject *)__pyx_t_3));
    __pyx_t_3 = 0;
  }

  /* "PETSc/DMPlex.pyx":432
 *         if newsec is None: newsec = Section()
 *         if newvec is None: newvec = Vec()
 *         if newsec.sec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetComm(<PetscObject>sec.sec, &ccomm) )
 *             CHKERR( PetscSectionCreate(ccomm, &newsec.sec) )
 */
  __pyx_t_1 = ((__pyx_v_newsec->sec == NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/DMPlex.pyx":433
 *         if newvec is None: newvec = Vec()
 *         if newsec.sec == NULL:
 *             CHKERR( PetscObjectGetComm(<PetscObject>sec.sec, &ccomm) )             # <<<<<<<<<<<<<<
 *             CHKERR( PetscSectionCreate(ccomm, &newsec.sec) )
 *         if newvec.vec == NULL:
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetComm(((PetscObject)__pyx_v_sec->sec), (&__pyx_v_ccomm))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 433, __pyx_L1_error)

    /* "PETSc/DMPlex.pyx":434
 *         if newsec.sec == NULL:
 *             CHKERR( PetscObjectGetComm(<PetscObject>sec.sec, &ccomm) )
 *             CHKERR( PetscSectionCreate(ccomm, &newsec.sec) )             # <<<<<<<<<<<<<<
 *         if newvec.vec == NULL:
 *             CHKERR( PetscObjectGetComm(<PetscObject>vec.vec, &ccomm) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionCreate(__pyx_v_ccomm, (&__pyx_v_newsec->sec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 434, __pyx_L1_error)

    /* "PETSc/DMPlex.pyx":432
 *         if newsec is None: newsec = Section()
 *         if newvec is None: newvec = Vec()
 *         if newsec.sec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetComm(<PetscObject>sec.sec, &ccomm) )
 *             CHKERR( PetscSectionCreate(ccomm, &newsec.sec) )
 */
  }

  /* "PETSc/DMPlex.pyx":435
 *             CHKERR( PetscObjectGetComm(<PetscObject>sec.sec, &ccomm) )
 *             CHKERR( PetscSectionCreate(ccomm, &newsec.sec) )
 *         if newvec.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetComm(<PetscObject>vec.vec, &ccomm) )
 *             CHKERR( VecCreate(ccomm, &newvec.vec) )
 */
  __pyx_t_1 = ((__pyx_v_newvec->vec == NULL) != 0);
  if (__pyx_t_1) {

    /* "PETSc/DMPlex.pyx":436
 *             CHKERR( PetscSectionCreate(ccomm, &newsec.sec) )
 *         if newvec.vec == NULL:
 *             CHKERR( PetscObjectGetComm(<PetscObject>vec.vec, &ccomm) )             # <<<<<<<<<<<<<<
 *             CHKERR( VecCreate(ccomm, &newvec.vec) )
 *         CHKERR( DMPlexDistributeField(self.dm, sf.sf,
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetComm(((PetscObject)__pyx_v_vec->vec), (&__pyx_v_ccomm))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 436, __pyx_L1_error)

    /* "PETSc/DMPlex.pyx":437
 *         if newvec.vec == NULL:
 *             CHKERR( PetscObjectGetComm(<PetscObject>vec.vec, &ccomm) )
 *             CHKERR( VecCreate(ccomm, &newvec.vec) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexDistributeField(self.dm, sf.sf,
 *                                       sec.sec, vec.vec,
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(VecCreate(__pyx_v_ccomm, (&__pyx_v_newvec->vec))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 437, __pyx_L1_error)

    /* "PETSc/DMPlex.pyx":435
 *             CHKERR( PetscObjectGetComm(<PetscObject>sec.sec, &ccomm) )
 *             CHKERR( PetscSectionCreate(ccomm, &newsec.sec) )
 *         if newvec.vec == NULL:             # <<<<<<<<<<<<<<
 *             CHKERR( PetscObjectGetComm(<PetscObject>vec.vec, &ccomm) )
 *             CHKERR( VecCreate(ccomm, &newvec.vec) )
 */
  }

  /* "PETSc/DMPlex.pyx":438
 *             CHKERR( PetscObjectGetComm(<PetscObject>vec.vec, &ccomm) )
 *             CHKERR( VecCreate(ccomm, &newvec.vec) )
 *         CHKERR( DMPlexDistributeField(self.dm, sf.sf,             # <<<<<<<<<<<<<<
 *                                       sec.sec, vec.vec,
 *                                       newsec.sec, newvec.vec))
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexDistributeField(__pyx_v_self->__pyx_base.dm, __pyx_v_sf->sf, __pyx_v_sec->sec, __pyx_v_vec->vec, __pyx_v_newsec->sec, __pyx_v_newvec->vec)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 438, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":441
 *                                       sec.sec, vec.vec,
 *                                       newsec.sec, newvec.vec))
 *         return (newsec, newvec)             # <<<<<<<<<<<<<<
 * 
 *     def createCoarsePointIS(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_newsec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_newsec));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_newsec));
  __Pyx_INCREF(((PyObject *)__pyx_v_newvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_newvec));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_newvec));
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":426
 *         return sf
 * 
 *     def distributeField(self, SF sf not None,             # <<<<<<<<<<<<<<
 *                         Section sec not None, Vec vec not None,
 *                         Section newsec=None, Vec newvec=None):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.distributeField", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_newsec);
  __Pyx_XDECREF((PyObject *)__pyx_v_newvec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":443
 *         return (newsec, newvec)
 * 
 *     def createCoarsePointIS(self):             # <<<<<<<<<<<<<<
 *         cdef IS fpoint = IS()
 *         CHKERR( DMPlexCreateCoarsePointIS(self.dm, &fpoint.iset) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_101createCoarsePointIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_100createCoarsePointIS[] = "DMPlex.createCoarsePointIS(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_101createCoarsePointIS(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createCoarsePointIS (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("createCoarsePointIS", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "createCoarsePointIS", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_100createCoarsePointIS(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_100createCoarsePointIS(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  struct PyPetscISObject *__pyx_v_fpoint = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createCoarsePointIS", 0);

  /* "PETSc/DMPlex.pyx":444
 * 
 *     def createCoarsePointIS(self):
 *         cdef IS fpoint = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateCoarsePointIS(self.dm, &fpoint.iset) )
 *         return fpoint
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fpoint = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":445
 *     def createCoarsePointIS(self):
 *         cdef IS fpoint = IS()
 *         CHKERR( DMPlexCreateCoarsePointIS(self.dm, &fpoint.iset) )             # <<<<<<<<<<<<<<
 *         return fpoint
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateCoarsePointIS(__pyx_v_self->__pyx_base.dm, (&__pyx_v_fpoint->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 445, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":446
 *         cdef IS fpoint = IS()
 *         CHKERR( DMPlexCreateCoarsePointIS(self.dm, &fpoint.iset) )
 *         return fpoint             # <<<<<<<<<<<<<<
 * 
 *     def createSection(self, numComp, numDof,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_fpoint));
  __pyx_r = ((PyObject *)__pyx_v_fpoint);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":443
 *         return (newsec, newvec)
 * 
 *     def createCoarsePointIS(self):             # <<<<<<<<<<<<<<
 *         cdef IS fpoint = IS()
 *         CHKERR( DMPlexCreateCoarsePointIS(self.dm, &fpoint.iset) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createCoarsePointIS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_fpoint);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":448
 *         return fpoint
 * 
 *     def createSection(self, numComp, numDof,             # <<<<<<<<<<<<<<
 *                       bcField=None, bcComps=None, bcPoints=None,
 *                       IS perm=None):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_103createSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_102createSection[] = "DMPlex.createSection(self, numComp, numDof, bcField=None, bcComps=None, bcPoints=None, IS perm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_103createSection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_numComp = 0;
  PyObject *__pyx_v_numDof = 0;
  PyObject *__pyx_v_bcField = 0;
  PyObject *__pyx_v_bcComps = 0;
  PyObject *__pyx_v_bcPoints = 0;
  struct PyPetscISObject *__pyx_v_perm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createSection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_numComp,&__pyx_n_s_numDof,&__pyx_n_s_bcField,&__pyx_n_s_bcComps,&__pyx_n_s_bcPoints,&__pyx_n_s_perm,0};
    PyObject* values[6] = {0,0,0,0,0,0};

    /* "PETSc/DMPlex.pyx":449
 * 
 *     def createSection(self, numComp, numDof,
 *                       bcField=None, bcComps=None, bcPoints=None,             # <<<<<<<<<<<<<<
 *                       IS perm=None):
 *         # topological dimension
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);

    /* "PETSc/DMPlex.pyx":450
 *     def createSection(self, numComp, numDof,
 *                       bcField=None, bcComps=None, bcPoints=None,
 *                       IS perm=None):             # <<<<<<<<<<<<<<
 *         # topological dimension
 *         cdef PetscInt dim = 0
 */
    values[5] = (PyObject *)((struct PyPetscISObject *)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  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_numComp)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_numDof)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createSection", 0, 2, 6, 1); __PYX_ERR(42, 448, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bcField);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bcComps);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bcPoints);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_perm);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createSection") < 0)) __PYX_ERR(42, 448, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_numComp = values[0];
    __pyx_v_numDof = values[1];
    __pyx_v_bcField = values[2];
    __pyx_v_bcComps = values[3];
    __pyx_v_bcPoints = values[4];
    __pyx_v_perm = ((struct PyPetscISObject *)values[5]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createSection", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 448, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createSection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_perm), __pyx_ptype_8petsc4py_5PETSc_IS, 1, "perm", 0))) __PYX_ERR(42, 450, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_102createSection(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_numComp, __pyx_v_numDof, __pyx_v_bcField, __pyx_v_bcComps, __pyx_v_bcPoints, __pyx_v_perm);

  /* "PETSc/DMPlex.pyx":448
 *         return fpoint
 * 
 *     def createSection(self, numComp, numDof,             # <<<<<<<<<<<<<<
 *                       bcField=None, bcComps=None, bcPoints=None,
 *                       IS perm=None):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_102createSection(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_numComp, PyObject *__pyx_v_numDof, PyObject *__pyx_v_bcField, PyObject *__pyx_v_bcComps, PyObject *__pyx_v_bcPoints, struct PyPetscISObject *__pyx_v_perm) {
  PetscInt __pyx_v_dim;
  PetscInt __pyx_v_ncomp;
  PetscInt __pyx_v_ndof;
  PetscInt *__pyx_v_icomp;
  PetscInt *__pyx_v_idof;
  PetscInt __pyx_v_nbc;
  PetscInt __pyx_v_i;
  PetscInt *__pyx_v_bcfield;
  IS *__pyx_v_bccomps;
  IS *__pyx_v_bcpoints;
  CYTHON_UNUSED PyArrayObject *__pyx_v_tmp1 = NULL;
  CYTHON_UNUSED PyArrayObject *__pyx_v_tmp2 = NULL;
  IS __pyx_v_cperm;
  struct PyPetscSectionObject *__pyx_v_sec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PetscInt __pyx_t_7;
  IS __pyx_t_8;
  __Pyx_RefNannySetupContext("createSection", 0);
  __Pyx_INCREF(__pyx_v_numComp);
  __Pyx_INCREF(__pyx_v_numDof);
  __Pyx_INCREF(__pyx_v_bcField);
  __Pyx_INCREF(__pyx_v_bcComps);
  __Pyx_INCREF(__pyx_v_bcPoints);

  /* "PETSc/DMPlex.pyx":452
 *                       IS perm=None):
 *         # topological dimension
 *         cdef PetscInt dim = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetDimension(self.dm, &dim) )
 *         # components and DOFs
 */
  __pyx_v_dim = 0;

  /* "PETSc/DMPlex.pyx":453
 *         # topological dimension
 *         cdef PetscInt dim = 0
 *         CHKERR( DMGetDimension(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         # components and DOFs
 *         cdef PetscInt ncomp = 0, ndof = 0
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetDimension(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(42, 453, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":455
 *         CHKERR( DMGetDimension(self.dm, &dim) )
 *         # components and DOFs
 *         cdef PetscInt ncomp = 0, ndof = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *icomp = NULL, *idof = NULL
 *         numComp = iarray_i(numComp, &ncomp, &icomp)
 */
  __pyx_v_ncomp = 0;
  __pyx_v_ndof = 0;

  /* "PETSc/DMPlex.pyx":456
 *         # components and DOFs
 *         cdef PetscInt ncomp = 0, ndof = 0
 *         cdef PetscInt *icomp = NULL, *idof = NULL             # <<<<<<<<<<<<<<
 *         numComp = iarray_i(numComp, &ncomp, &icomp)
 *         numDof  = iarray_i(numDof, &ndof, &idof)
 */
  __pyx_v_icomp = NULL;
  __pyx_v_idof = NULL;

  /* "PETSc/DMPlex.pyx":457
 *         cdef PetscInt ncomp = 0, ndof = 0
 *         cdef PetscInt *icomp = NULL, *idof = NULL
 *         numComp = iarray_i(numComp, &ncomp, &icomp)             # <<<<<<<<<<<<<<
 *         numDof  = iarray_i(numDof, &ndof, &idof)
 *         assert ndof == ncomp*(dim+1)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_numComp, (&__pyx_v_ncomp), (&__pyx_v_icomp))); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_numComp, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DMPlex.pyx":458
 *         cdef PetscInt *icomp = NULL, *idof = NULL
 *         numComp = iarray_i(numComp, &ncomp, &icomp)
 *         numDof  = iarray_i(numDof, &ndof, &idof)             # <<<<<<<<<<<<<<
 *         assert ndof == ncomp*(dim+1)
 *         # boundary conditions
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_numDof, (&__pyx_v_ndof), (&__pyx_v_idof))); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_numDof, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DMPlex.pyx":459
 *         numComp = iarray_i(numComp, &ncomp, &icomp)
 *         numDof  = iarray_i(numDof, &ndof, &idof)
 *         assert ndof == ncomp*(dim+1)             # <<<<<<<<<<<<<<
 *         # boundary conditions
 *         cdef PetscInt nbc = 0, i = 0
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_ndof == (__pyx_v_ncomp * (__pyx_v_dim + 1))) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(42, 459, __pyx_L1_error)
    }
  }
  #endif

  /* "PETSc/DMPlex.pyx":461
 *         assert ndof == ncomp*(dim+1)
 *         # boundary conditions
 *         cdef PetscInt nbc = 0, i = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *bcfield = NULL
 *         cdef PetscIS *bccomps  = NULL
 */
  __pyx_v_nbc = 0;
  __pyx_v_i = 0;

  /* "PETSc/DMPlex.pyx":462
 *         # boundary conditions
 *         cdef PetscInt nbc = 0, i = 0
 *         cdef PetscInt *bcfield = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscIS *bccomps  = NULL
 *         cdef PetscIS *bcpoints = NULL
 */
  __pyx_v_bcfield = NULL;

  /* "PETSc/DMPlex.pyx":463
 *         cdef PetscInt nbc = 0, i = 0
 *         cdef PetscInt *bcfield = NULL
 *         cdef PetscIS *bccomps  = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscIS *bcpoints = NULL
 *         if bcField is not None:
 */
  __pyx_v_bccomps = NULL;

  /* "PETSc/DMPlex.pyx":464
 *         cdef PetscInt *bcfield = NULL
 *         cdef PetscIS *bccomps  = NULL
 *         cdef PetscIS *bcpoints = NULL             # <<<<<<<<<<<<<<
 *         if bcField is not None:
 *             bcField = iarray_i(bcField, &nbc, &bcfield)
 */
  __pyx_v_bcpoints = NULL;

  /* "PETSc/DMPlex.pyx":465
 *         cdef PetscIS *bccomps  = NULL
 *         cdef PetscIS *bcpoints = NULL
 *         if bcField is not None:             # <<<<<<<<<<<<<<
 *             bcField = iarray_i(bcField, &nbc, &bcfield)
 *             if bcComps is not None:
 */
  __pyx_t_3 = (__pyx_v_bcField != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "PETSc/DMPlex.pyx":466
 *         cdef PetscIS *bcpoints = NULL
 *         if bcField is not None:
 *             bcField = iarray_i(bcField, &nbc, &bcfield)             # <<<<<<<<<<<<<<
 *             if bcComps is not None:
 *                 bcComps = list(bcComps)
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_bcField, (&__pyx_v_nbc), (&__pyx_v_bcfield))); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_bcField, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PETSc/DMPlex.pyx":467
 *         if bcField is not None:
 *             bcField = iarray_i(bcField, &nbc, &bcfield)
 *             if bcComps is not None:             # <<<<<<<<<<<<<<
 *                 bcComps = list(bcComps)
 *                 assert len(bcComps) == nbc
 */
    __pyx_t_4 = (__pyx_v_bcComps != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {

      /* "PETSc/DMPlex.pyx":468
 *             bcField = iarray_i(bcField, &nbc, &bcfield)
 *             if bcComps is not None:
 *                 bcComps = list(bcComps)             # <<<<<<<<<<<<<<
 *                 assert len(bcComps) == nbc
 *                 tmp1 = oarray_p(empty_p(nbc), NULL, <void**>&bccomps)
 */
      __pyx_t_2 = PySequence_List(__pyx_v_bcComps); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 468, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_bcComps, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "PETSc/DMPlex.pyx":469
 *             if bcComps is not None:
 *                 bcComps = list(bcComps)
 *                 assert len(bcComps) == nbc             # <<<<<<<<<<<<<<
 *                 tmp1 = oarray_p(empty_p(nbc), NULL, <void**>&bccomps)
 *                 for i from 0 <= i < nbc:
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_5 = PyObject_Length(__pyx_v_bcComps); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(42, 469, __pyx_L1_error)
        if (unlikely(!((__pyx_t_5 == __pyx_v_nbc) != 0))) {
          PyErr_SetNone(PyExc_AssertionError);
          __PYX_ERR(42, 469, __pyx_L1_error)
        }
      }
      #endif

      /* "PETSc/DMPlex.pyx":470
 *                 bcComps = list(bcComps)
 *                 assert len(bcComps) == nbc
 *                 tmp1 = oarray_p(empty_p(nbc), NULL, <void**>&bccomps)             # <<<<<<<<<<<<<<
 *                 for i from 0 <= i < nbc:
 *                     bccomps[i] = (<IS?>bcComps[<Py_ssize_t>i]).iset
 */
      __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_nbc)); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 470, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_2, NULL, ((void **)(&__pyx_v_bccomps)))); if (unlikely(!__pyx_t_6)) __PYX_ERR(42, 470, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_tmp1 = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "PETSc/DMPlex.pyx":471
 *                 assert len(bcComps) == nbc
 *                 tmp1 = oarray_p(empty_p(nbc), NULL, <void**>&bccomps)
 *                 for i from 0 <= i < nbc:             # <<<<<<<<<<<<<<
 *                     bccomps[i] = (<IS?>bcComps[<Py_ssize_t>i]).iset
 *             if bcPoints is not None:
 */
      __pyx_t_7 = __pyx_v_nbc;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

        /* "PETSc/DMPlex.pyx":472
 *                 tmp1 = oarray_p(empty_p(nbc), NULL, <void**>&bccomps)
 *                 for i from 0 <= i < nbc:
 *                     bccomps[i] = (<IS?>bcComps[<Py_ssize_t>i]).iset             # <<<<<<<<<<<<<<
 *             if bcPoints is not None:
 *                 bcPoints = list(bcPoints)
 */
        __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_bcComps, ((Py_ssize_t)__pyx_v_i), Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(42, 472, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(42, 472, __pyx_L1_error)
        __pyx_t_8 = ((struct PyPetscISObject *)__pyx_t_6)->iset;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        (__pyx_v_bccomps[__pyx_v_i]) = __pyx_t_8;
      }

      /* "PETSc/DMPlex.pyx":467
 *         if bcField is not None:
 *             bcField = iarray_i(bcField, &nbc, &bcfield)
 *             if bcComps is not None:             # <<<<<<<<<<<<<<
 *                 bcComps = list(bcComps)
 *                 assert len(bcComps) == nbc
 */
    }

    /* "PETSc/DMPlex.pyx":473
 *                 for i from 0 <= i < nbc:
 *                     bccomps[i] = (<IS?>bcComps[<Py_ssize_t>i]).iset
 *             if bcPoints is not None:             # <<<<<<<<<<<<<<
 *                 bcPoints = list(bcPoints)
 *                 assert len(bcPoints) == nbc
 */
    __pyx_t_3 = (__pyx_v_bcPoints != Py_None);
    __pyx_t_4 = (__pyx_t_3 != 0);
    if (__pyx_t_4) {

      /* "PETSc/DMPlex.pyx":474
 *                     bccomps[i] = (<IS?>bcComps[<Py_ssize_t>i]).iset
 *             if bcPoints is not None:
 *                 bcPoints = list(bcPoints)             # <<<<<<<<<<<<<<
 *                 assert len(bcPoints) == nbc
 *                 tmp2 = oarray_p(empty_p(nbc), NULL, <void**>&bcpoints)
 */
      __pyx_t_6 = PySequence_List(__pyx_v_bcPoints); if (unlikely(!__pyx_t_6)) __PYX_ERR(42, 474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_bcPoints, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "PETSc/DMPlex.pyx":475
 *             if bcPoints is not None:
 *                 bcPoints = list(bcPoints)
 *                 assert len(bcPoints) == nbc             # <<<<<<<<<<<<<<
 *                 tmp2 = oarray_p(empty_p(nbc), NULL, <void**>&bcpoints)
 *                 for i from 0 <= i < nbc:
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_5 = PyObject_Length(__pyx_v_bcPoints); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(42, 475, __pyx_L1_error)
        if (unlikely(!((__pyx_t_5 == __pyx_v_nbc) != 0))) {
          PyErr_SetNone(PyExc_AssertionError);
          __PYX_ERR(42, 475, __pyx_L1_error)
        }
      }
      #endif

      /* "PETSc/DMPlex.pyx":476
 *                 bcPoints = list(bcPoints)
 *                 assert len(bcPoints) == nbc
 *                 tmp2 = oarray_p(empty_p(nbc), NULL, <void**>&bcpoints)             # <<<<<<<<<<<<<<
 *                 for i from 0 <= i < nbc:
 *                     bcpoints[i] = (<IS?>bcPoints[<Py_ssize_t>i]).iset
 */
      __pyx_t_6 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_nbc)); if (unlikely(!__pyx_t_6)) __PYX_ERR(42, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_6, NULL, ((void **)(&__pyx_v_bcpoints)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_tmp2 = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "PETSc/DMPlex.pyx":477
 *                 assert len(bcPoints) == nbc
 *                 tmp2 = oarray_p(empty_p(nbc), NULL, <void**>&bcpoints)
 *                 for i from 0 <= i < nbc:             # <<<<<<<<<<<<<<
 *                     bcpoints[i] = (<IS?>bcPoints[<Py_ssize_t>i]).iset
 *             else:
 */
      __pyx_t_7 = __pyx_v_nbc;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

        /* "PETSc/DMPlex.pyx":478
 *                 tmp2 = oarray_p(empty_p(nbc), NULL, <void**>&bcpoints)
 *                 for i from 0 <= i < nbc:
 *                     bcpoints[i] = (<IS?>bcPoints[<Py_ssize_t>i]).iset             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError("bcPoints is a required argument")
 */
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_bcPoints, ((Py_ssize_t)__pyx_v_i), Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 478, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(42, 478, __pyx_L1_error)
        __pyx_t_8 = ((struct PyPetscISObject *)__pyx_t_2)->iset;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        (__pyx_v_bcpoints[__pyx_v_i]) = __pyx_t_8;
      }

      /* "PETSc/DMPlex.pyx":473
 *                 for i from 0 <= i < nbc:
 *                     bccomps[i] = (<IS?>bcComps[<Py_ssize_t>i]).iset
 *             if bcPoints is not None:             # <<<<<<<<<<<<<<
 *                 bcPoints = list(bcPoints)
 *                 assert len(bcPoints) == nbc
 */
      goto __pyx_L7;
    }

    /* "PETSc/DMPlex.pyx":480
 *                     bcpoints[i] = (<IS?>bcPoints[<Py_ssize_t>i]).iset
 *             else:
 *                 raise ValueError("bcPoints is a required argument")             # <<<<<<<<<<<<<<
 *         else:
 *             assert bcComps  is None
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__65, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 480, __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(42, 480, __pyx_L1_error)
    }
    __pyx_L7:;

    /* "PETSc/DMPlex.pyx":465
 *         cdef PetscIS *bccomps  = NULL
 *         cdef PetscIS *bcpoints = NULL
 *         if bcField is not None:             # <<<<<<<<<<<<<<
 *             bcField = iarray_i(bcField, &nbc, &bcfield)
 *             if bcComps is not None:
 */
    goto __pyx_L3;
  }

  /* "PETSc/DMPlex.pyx":482
 *                 raise ValueError("bcPoints is a required argument")
 *         else:
 *             assert bcComps  is None             # <<<<<<<<<<<<<<
 *             assert bcPoints is None
 *         # optional chart permutations
 */
  /*else*/ {
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_4 = (__pyx_v_bcComps == Py_None);
      if (unlikely(!(__pyx_t_4 != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(42, 482, __pyx_L1_error)
      }
    }
    #endif

    /* "PETSc/DMPlex.pyx":483
 *         else:
 *             assert bcComps  is None
 *             assert bcPoints is None             # <<<<<<<<<<<<<<
 *         # optional chart permutations
 *         cdef PetscIS cperm = NULL
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_4 = (__pyx_v_bcPoints == Py_None);
      if (unlikely(!(__pyx_t_4 != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(42, 483, __pyx_L1_error)
      }
    }
    #endif
  }
  __pyx_L3:;

  /* "PETSc/DMPlex.pyx":485
 *             assert bcPoints is None
 *         # optional chart permutations
 *         cdef PetscIS cperm = NULL             # <<<<<<<<<<<<<<
 *         if perm is not None: cperm = perm.iset
 *         # create section
 */
  __pyx_v_cperm = NULL;

  /* "PETSc/DMPlex.pyx":486
 *         # optional chart permutations
 *         cdef PetscIS cperm = NULL
 *         if perm is not None: cperm = perm.iset             # <<<<<<<<<<<<<<
 *         # create section
 *         cdef Section sec = Section()
 */
  __pyx_t_4 = (((PyObject *)__pyx_v_perm) != Py_None);
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {
    __pyx_t_8 = __pyx_v_perm->iset;
    __pyx_v_cperm = __pyx_t_8;
  }

  /* "PETSc/DMPlex.pyx":488
 *         if perm is not None: cperm = perm.iset
 *         # create section
 *         cdef Section sec = Section()             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexCreateSection(self.dm, dim, ncomp, icomp, idof,
 *                                     nbc, bcfield, bccomps, bcpoints,
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Section), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_sec = ((struct PyPetscSectionObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DMPlex.pyx":489
 *         # create section
 *         cdef Section sec = Section()
 *         CHKERR( DMPlexCreateSection(self.dm, dim, ncomp, icomp, idof,             # <<<<<<<<<<<<<<
 *                                     nbc, bcfield, bccomps, bcpoints,
 *                                     cperm, &sec.sec) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexCreateSection(__pyx_v_self->__pyx_base.dm, __pyx_v_dim, __pyx_v_ncomp, __pyx_v_icomp, __pyx_v_idof, __pyx_v_nbc, __pyx_v_bcfield, __pyx_v_bccomps, __pyx_v_bcpoints, __pyx_v_cperm, (&__pyx_v_sec->sec))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(42, 489, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":492
 *                                     nbc, bcfield, bccomps, bcpoints,
 *                                     cperm, &sec.sec) )
 *         return sec             # <<<<<<<<<<<<<<
 * 
 *     def setRefinementUniform(self, refinementUniform=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_sec));
  __pyx_r = ((PyObject *)__pyx_v_sec);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":448
 *         return fpoint
 * 
 *     def createSection(self, numComp, numDof,             # <<<<<<<<<<<<<<
 *                       bcField=None, bcComps=None, bcPoints=None,
 *                       IS perm=None):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.createSection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tmp1);
  __Pyx_XDECREF((PyObject *)__pyx_v_tmp2);
  __Pyx_XDECREF((PyObject *)__pyx_v_sec);
  __Pyx_XDECREF(__pyx_v_numComp);
  __Pyx_XDECREF(__pyx_v_numDof);
  __Pyx_XDECREF(__pyx_v_bcField);
  __Pyx_XDECREF(__pyx_v_bcComps);
  __Pyx_XDECREF(__pyx_v_bcPoints);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":494
 *         return sec
 * 
 *     def setRefinementUniform(self, refinementUniform=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = refinementUniform
 *         CHKERR( DMPlexSetRefinementUniform(self.dm, flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_105setRefinementUniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_104setRefinementUniform[] = "DMPlex.setRefinementUniform(self, refinementUniform=True)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_105setRefinementUniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_refinementUniform = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRefinementUniform (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_refinementUniform,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refinementUniform);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setRefinementUniform") < 0)) __PYX_ERR(42, 494, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_refinementUniform = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRefinementUniform", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 494, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setRefinementUniform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_104setRefinementUniform(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_refinementUniform);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_104setRefinementUniform(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_refinementUniform) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setRefinementUniform", 0);

  /* "PETSc/DMPlex.pyx":495
 * 
 *     def setRefinementUniform(self, refinementUniform=True):
 *         cdef PetscBool flag = refinementUniform             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSetRefinementUniform(self.dm, flag) )
 * 
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_refinementUniform)); if (unlikely(PyErr_Occurred())) __PYX_ERR(42, 495, __pyx_L1_error)
  __pyx_v_flag = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":496
 *     def setRefinementUniform(self, refinementUniform=True):
 *         cdef PetscBool flag = refinementUniform
 *         CHKERR( DMPlexSetRefinementUniform(self.dm, flag) )             # <<<<<<<<<<<<<<
 * 
 *     def getRefinementUniform(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetRefinementUniform(__pyx_v_self->__pyx_base.dm, __pyx_v_flag)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 496, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":494
 *         return sec
 * 
 *     def setRefinementUniform(self, refinementUniform=True):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = refinementUniform
 *         CHKERR( DMPlexSetRefinementUniform(self.dm, flag) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setRefinementUniform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":498
 *         CHKERR( DMPlexSetRefinementUniform(self.dm, flag) )
 * 
 *     def getRefinementUniform(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( DMPlexGetRefinementUniform(self.dm, &flag) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_107getRefinementUniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_106getRefinementUniform[] = "DMPlex.getRefinementUniform(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_107getRefinementUniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRefinementUniform (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getRefinementUniform", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getRefinementUniform", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_106getRefinementUniform(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_106getRefinementUniform(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  PetscBool __pyx_v_flag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getRefinementUniform", 0);

  /* "PETSc/DMPlex.pyx":499
 * 
 *     def getRefinementUniform(self):
 *         cdef PetscBool flag = PETSC_FALSE             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetRefinementUniform(self.dm, &flag) )
 *         return <bint> flag
 */
  __pyx_v_flag = PETSC_FALSE;

  /* "PETSc/DMPlex.pyx":500
 *     def getRefinementUniform(self):
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( DMPlexGetRefinementUniform(self.dm, &flag) )             # <<<<<<<<<<<<<<
 *         return <bint> flag
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetRefinementUniform(__pyx_v_self->__pyx_base.dm, (&__pyx_v_flag))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(42, 500, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":501
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( DMPlexGetRefinementUniform(self.dm, &flag) )
 *         return <bint> flag             # <<<<<<<<<<<<<<
 * 
 *     def setRefinementLimit(self, refinementLimit):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_PetscBool(__pyx_v_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":498
 *         CHKERR( DMPlexSetRefinementUniform(self.dm, flag) )
 * 
 *     def getRefinementUniform(self):             # <<<<<<<<<<<<<<
 *         cdef PetscBool flag = PETSC_FALSE
 *         CHKERR( DMPlexGetRefinementUniform(self.dm, &flag) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getRefinementUniform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":503
 *         return <bint> flag
 * 
 *     def setRefinementLimit(self, refinementLimit):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(refinementLimit)
 *         CHKERR( DMPlexSetRefinementLimit(self.dm, rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_109setRefinementLimit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_108setRefinementLimit[] = "DMPlex.setRefinementLimit(self, refinementLimit)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_109setRefinementLimit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_refinementLimit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRefinementLimit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_refinementLimit,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);
        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_refinementLimit)) != 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, "setRefinementLimit") < 0)) __PYX_ERR(42, 503, __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_refinementLimit = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRefinementLimit", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 503, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setRefinementLimit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_108setRefinementLimit(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_refinementLimit);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_108setRefinementLimit(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_refinementLimit) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscReal __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setRefinementLimit", 0);

  /* "PETSc/DMPlex.pyx":504
 * 
 *     def setRefinementLimit(self, refinementLimit):
 *         cdef PetscReal rval = asReal(refinementLimit)             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexSetRefinementLimit(self.dm, rval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asReal(__pyx_v_refinementLimit); if (unlikely(__pyx_t_1 == -1.0 && PyErr_Occurred())) __PYX_ERR(42, 504, __pyx_L1_error)
  __pyx_v_rval = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":505
 *     def setRefinementLimit(self, refinementLimit):
 *         cdef PetscReal rval = asReal(refinementLimit)
 *         CHKERR( DMPlexSetRefinementLimit(self.dm, rval) )             # <<<<<<<<<<<<<<
 * 
 *     def getRefinementLimit(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexSetRefinementLimit(__pyx_v_self->__pyx_base.dm, __pyx_v_rval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 505, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":503
 *         return <bint> flag
 * 
 *     def setRefinementLimit(self, refinementLimit):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = asReal(refinementLimit)
 *         CHKERR( DMPlexSetRefinementLimit(self.dm, rval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.setRefinementLimit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":507
 *         CHKERR( DMPlexSetRefinementLimit(self.dm, rval) )
 * 
 *     def getRefinementLimit(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0.0
 *         CHKERR( DMPlexGetRefinementLimit(self.dm, &rval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_111getRefinementLimit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_110getRefinementLimit[] = "DMPlex.getRefinementLimit(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_111getRefinementLimit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRefinementLimit (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getRefinementLimit", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getRefinementLimit", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_110getRefinementLimit(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_110getRefinementLimit(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self) {
  PetscReal __pyx_v_rval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getRefinementLimit", 0);

  /* "PETSc/DMPlex.pyx":508
 * 
 *     def getRefinementLimit(self):
 *         cdef PetscReal rval = 0.0             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetRefinementLimit(self.dm, &rval) )
 *         return toReal(rval)
 */
  __pyx_v_rval = 0.0;

  /* "PETSc/DMPlex.pyx":509
 *     def getRefinementLimit(self):
 *         cdef PetscReal rval = 0.0
 *         CHKERR( DMPlexGetRefinementLimit(self.dm, &rval) )             # <<<<<<<<<<<<<<
 *         return toReal(rval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetRefinementLimit(__pyx_v_self->__pyx_base.dm, (&__pyx_v_rval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(42, 509, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":510
 *         cdef PetscReal rval = 0.0
 *         CHKERR( DMPlexGetRefinementLimit(self.dm, &rval) )
 *         return toReal(rval)             # <<<<<<<<<<<<<<
 * 
 *     def getOrdering(self, otype):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_rval); if (unlikely(!__pyx_t_2)) __PYX_ERR(42, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":507
 *         CHKERR( DMPlexSetRefinementLimit(self.dm, rval) )
 * 
 *     def getRefinementLimit(self):             # <<<<<<<<<<<<<<
 *         cdef PetscReal rval = 0.0
 *         CHKERR( DMPlexGetRefinementLimit(self.dm, &rval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getRefinementLimit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":512
 *         return toReal(rval)
 * 
 *     def getOrdering(self, otype):             # <<<<<<<<<<<<<<
 *         cdef PetscMatOrderingType cval = NULL
 *         cdef PetscDMLabel label = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_113getOrdering(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_112getOrdering[] = "DMPlex.getOrdering(self, otype)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_113getOrdering(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_otype = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOrdering (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_otype,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);
        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_otype)) != 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, "getOrdering") < 0)) __PYX_ERR(42, 512, __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_otype = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getOrdering", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 512, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getOrdering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_112getOrdering(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_otype);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_112getOrdering(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_otype) {
  const char* __pyx_v_cval;
  DMLabel __pyx_v_label;
  struct PyPetscISObject *__pyx_v_perm = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getOrdering", 0);
  __Pyx_INCREF(__pyx_v_otype);

  /* "PETSc/DMPlex.pyx":513
 * 
 *     def getOrdering(self, otype):
 *         cdef PetscMatOrderingType cval = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscDMLabel label = NULL
 *         otype = str2bytes(otype, &cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/DMPlex.pyx":514
 *     def getOrdering(self, otype):
 *         cdef PetscMatOrderingType cval = NULL
 *         cdef PetscDMLabel label = NULL             # <<<<<<<<<<<<<<
 *         otype = str2bytes(otype, &cval)
 *         cdef IS perm = IS()
 */
  __pyx_v_label = NULL;

  /* "PETSc/DMPlex.pyx":515
 *         cdef PetscMatOrderingType cval = NULL
 *         cdef PetscDMLabel label = NULL
 *         otype = str2bytes(otype, &cval)             # <<<<<<<<<<<<<<
 *         cdef IS perm = IS()
 *         CHKERR( DMPlexGetOrdering(self.dm, cval, label, &perm.iset) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_otype, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_otype, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":516
 *         cdef PetscDMLabel label = NULL
 *         otype = str2bytes(otype, &cval)
 *         cdef IS perm = IS()             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexGetOrdering(self.dm, cval, label, &perm.iset) )
 *         return perm
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_perm = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/DMPlex.pyx":517
 *         otype = str2bytes(otype, &cval)
 *         cdef IS perm = IS()
 *         CHKERR( DMPlexGetOrdering(self.dm, cval, label, &perm.iset) )             # <<<<<<<<<<<<<<
 *         return perm
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexGetOrdering(__pyx_v_self->__pyx_base.dm, __pyx_v_cval, __pyx_v_label, (&__pyx_v_perm->iset))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 517, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":518
 *         cdef IS perm = IS()
 *         CHKERR( DMPlexGetOrdering(self.dm, cval, label, &perm.iset) )
 *         return perm             # <<<<<<<<<<<<<<
 * 
 *     def permute(self, IS perm not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_perm));
  __pyx_r = ((PyObject *)__pyx_v_perm);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":512
 *         return toReal(rval)
 * 
 *     def getOrdering(self, otype):             # <<<<<<<<<<<<<<
 *         cdef PetscMatOrderingType cval = NULL
 *         cdef PetscDMLabel label = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.getOrdering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_perm);
  __Pyx_XDECREF(__pyx_v_otype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":520
 *         return perm
 * 
 *     def permute(self, IS perm not None):             # <<<<<<<<<<<<<<
 *         cdef DMPlex dm = <DMPlex>type(self)()
 *         CHKERR( DMPlexPermute(self.dm, perm.iset, &dm.dm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_115permute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_114permute[] = "DMPlex.permute(self, IS perm)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_115permute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscISObject *__pyx_v_perm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("permute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_perm,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);
        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_perm)) != 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, "permute") < 0)) __PYX_ERR(42, 520, __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_perm = ((struct PyPetscISObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("permute", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 520, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.permute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_perm), __pyx_ptype_8petsc4py_5PETSc_IS, 0, "perm", 0))) __PYX_ERR(42, 520, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_114permute(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_perm);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_114permute(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, struct PyPetscISObject *__pyx_v_perm) {
  struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_dm = 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;
  __Pyx_RefNannySetupContext("permute", 0);

  /* "PETSc/DMPlex.pyx":521
 * 
 *     def permute(self, IS perm not None):
 *         cdef DMPlex dm = <DMPlex>type(self)()             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexPermute(self.dm, perm.iset, &dm.dm) )
 *         return dm
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __pyx_t_2 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(42, 521, __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(42, 521, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dm = ((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/DMPlex.pyx":522
 *     def permute(self, IS perm not None):
 *         cdef DMPlex dm = <DMPlex>type(self)()
 *         CHKERR( DMPlexPermute(self.dm, perm.iset, &dm.dm) )             # <<<<<<<<<<<<<<
 *         return dm
 * 
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexPermute(__pyx_v_self->__pyx_base.dm, __pyx_v_perm->iset, (&__pyx_v_dm->__pyx_base.dm))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(42, 522, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":523
 *         cdef DMPlex dm = <DMPlex>type(self)()
 *         CHKERR( DMPlexPermute(self.dm, perm.iset, &dm.dm) )
 *         return dm             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dm));
  __pyx_r = ((PyObject *)__pyx_v_dm);
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":520
 *         return perm
 * 
 *     def permute(self, IS perm not None):             # <<<<<<<<<<<<<<
 *         cdef DMPlex dm = <DMPlex>type(self)()
 *         CHKERR( DMPlexPermute(self.dm, perm.iset, &dm.dm) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.permute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMPlex.pyx":527
 *     #
 * 
 *     def computeCellGeometryFVM(self, cell):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = 0
 *         cdef PetscInt ccell = asInt(cell)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_117computeCellGeometryFVM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_6DMPlex_116computeCellGeometryFVM[] = "DMPlex.computeCellGeometryFVM(self, cell)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_6DMPlex_117computeCellGeometryFVM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cell = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("computeCellGeometryFVM (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cell,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);
        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_cell)) != 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, "computeCellGeometryFVM") < 0)) __PYX_ERR(42, 527, __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_cell = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("computeCellGeometryFVM", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(42, 527, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMPlex.computeCellGeometryFVM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_6DMPlex_116computeCellGeometryFVM(((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)__pyx_v_self), __pyx_v_cell);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_6DMPlex_116computeCellGeometryFVM(struct __pyx_obj_8petsc4py_5PETSc_DMPlex *__pyx_v_self, PyObject *__pyx_v_cell) {
  PetscInt __pyx_v_dim;
  PetscInt __pyx_v_ccell;
  PetscReal __pyx_v_vol;
  PetscReal __pyx_v_centroid[3];
  PetscReal __pyx_v_normal[3];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __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;
  __Pyx_RefNannySetupContext("computeCellGeometryFVM", 0);

  /* "PETSc/DMPlex.pyx":528
 * 
 *     def computeCellGeometryFVM(self, cell):
 *         cdef PetscInt dim = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt ccell = asInt(cell)
 *         CHKERR( DMGetDimension(self.dm, &dim) )
 */
  __pyx_v_dim = 0;

  /* "PETSc/DMPlex.pyx":529
 *     def computeCellGeometryFVM(self, cell):
 *         cdef PetscInt dim = 0
 *         cdef PetscInt ccell = asInt(cell)             # <<<<<<<<<<<<<<
 *         CHKERR( DMGetDimension(self.dm, &dim) )
 *         cdef PetscReal vol = 0, centroid[3], normal[3]
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_cell); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(42, 529, __pyx_L1_error)
  __pyx_v_ccell = __pyx_t_1;

  /* "PETSc/DMPlex.pyx":530
 *         cdef PetscInt dim = 0
 *         cdef PetscInt ccell = asInt(cell)
 *         CHKERR( DMGetDimension(self.dm, &dim) )             # <<<<<<<<<<<<<<
 *         cdef PetscReal vol = 0, centroid[3], normal[3]
 *         CHKERR( DMPlexComputeCellGeometryFVM(self.dm, ccell, &vol, centroid, normal) )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMGetDimension(__pyx_v_self->__pyx_base.dm, (&__pyx_v_dim))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 530, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":531
 *         cdef PetscInt ccell = asInt(cell)
 *         CHKERR( DMGetDimension(self.dm, &dim) )
 *         cdef PetscReal vol = 0, centroid[3], normal[3]             # <<<<<<<<<<<<<<
 *         CHKERR( DMPlexComputeCellGeometryFVM(self.dm, ccell, &vol, centroid, normal) )
 *         return (toReal(vol), array_r(dim, centroid), array_r(dim, normal))
 */
  __pyx_v_vol = 0.0;

  /* "PETSc/DMPlex.pyx":532
 *         CHKERR( DMGetDimension(self.dm, &dim) )
 *         cdef PetscReal vol = 0, centroid[3], normal[3]
 *         CHKERR( DMPlexComputeCellGeometryFVM(self.dm, ccell, &vol, centroid, normal) )             # <<<<<<<<<<<<<<
 *         return (toReal(vol), array_r(dim, centroid), array_r(dim, normal))
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMPlexComputeCellGeometryFVM(__pyx_v_self->__pyx_base.dm, __pyx_v_ccell, (&__pyx_v_vol), __pyx_v_centroid, __pyx_v_normal)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(42, 532, __pyx_L1_error)

  /* "PETSc/DMPlex.pyx":533
 *         cdef PetscReal vol = 0, centroid[3], normal[3]
 *         CHKERR( DMPlexComputeCellGeometryFVM(self.dm, ccell, &vol, centroid, normal) )
 *         return (toReal(vol), array_r(dim, centroid), array_r(dim, normal))             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toReal(__pyx_v_vol); if (unlikely(!__pyx_t_3)) __PYX_ERR(42, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_r(__pyx_v_dim, __pyx_v_centroid)); if (unlikely(!__pyx_t_4)) __PYX_ERR(42, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_r(__pyx_v_dim, __pyx_v_normal)); if (unlikely(!__pyx_t_5)) __PYX_ERR(42, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(42, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "PETSc/DMPlex.pyx":527
 *     #
 * 
 *     def computeCellGeometryFVM(self, cell):             # <<<<<<<<<<<<<<
 *         cdef PetscInt dim = 0
 *         cdef PetscInt ccell = asInt(cell)
 */

  /* 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_AddTraceback("petsc4py.PETSc.DMPlex.computeCellGeometryFVM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMComposite.pyx":5
 * cdef class DMComposite(DM):
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_1create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11DMComposite_create[] = "DMComposite.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_1create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(43, 5, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(43, 5, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11DMComposite_create(((struct __pyx_obj_8petsc4py_5PETSc_DMComposite *)__pyx_v_self), __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_create(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  DM __pyx_v_newdm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/DMComposite.pyx":6
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMCompositeCreate(ccomm, &newdm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(43, 6, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/DMComposite.pyx":7
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeCreate(ccomm, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DMComposite.pyx":8
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMCompositeCreate(ccomm, &newdm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeCreate(__pyx_v_ccomm, (&__pyx_v_newdm))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(43, 8, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":9
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMCompositeCreate(ccomm, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newdm;

  /* "PETSc/DMComposite.pyx":10
 *         CHKERR( DMCompositeCreate(ccomm, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def addDM(self, DM dm not None, *args):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMComposite.pyx":5
 * cdef class DMComposite(DM):
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMComposite.pyx":12
 *         return self
 * 
 *     def addDM(self, DM dm not None, *args):             # <<<<<<<<<<<<<<
 *         """Add DM to composite"""
 *         CHKERR( DMCompositeAddDM(self.dm, dm.dm) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_3addDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11DMComposite_2addDM[] = "DMComposite.addDM(self, DM dm, *args)\nAdd DM to composite";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_3addDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscDMObject *__pyx_v_dm = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addDM (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dm,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) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "addDM") < 0)) __PYX_ERR(43, 12, __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_dm = ((struct PyPetscDMObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addDM", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(43, 12, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.addDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_8petsc4py_5PETSc_DM, 0, "dm", 0))) __PYX_ERR(43, 12, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11DMComposite_2addDM(((struct __pyx_obj_8petsc4py_5PETSc_DMComposite *)__pyx_v_self), __pyx_v_dm, __pyx_v_args);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_2addDM(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self, struct PyPetscDMObject *__pyx_v_dm, PyObject *__pyx_v_args) {
  PyObject *__pyx_v_item = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("addDM", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_dm);

  /* "PETSc/DMComposite.pyx":14
 *     def addDM(self, DM dm not None, *args):
 *         """Add DM to composite"""
 *         CHKERR( DMCompositeAddDM(self.dm, dm.dm) )             # <<<<<<<<<<<<<<
 *         cdef object item
 *         for item in args:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeAddDM(__pyx_v_self->__pyx_base.dm, __pyx_v_dm->dm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 14, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":16
 *         CHKERR( DMCompositeAddDM(self.dm, dm.dm) )
 *         cdef object item
 *         for item in args:             # <<<<<<<<<<<<<<
 *             dm = <DM?> item
 *             CHKERR( DMCompositeAddDM(self.dm, dm.dm) )
 */
  __pyx_t_2 = __pyx_v_args; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(43, 16, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(43, 16, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/DMComposite.pyx":17
 *         cdef object item
 *         for item in args:
 *             dm = <DM?> item             # <<<<<<<<<<<<<<
 *             CHKERR( DMCompositeAddDM(self.dm, dm.dm) )
 * 
 */
    if (!(likely(__Pyx_TypeTest(__pyx_v_item, __pyx_ptype_8petsc4py_5PETSc_DM)))) __PYX_ERR(43, 17, __pyx_L1_error)
    __pyx_t_4 = __pyx_v_item;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_dm, ((struct PyPetscDMObject *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "PETSc/DMComposite.pyx":18
 *         for item in args:
 *             dm = <DM?> item
 *             CHKERR( DMCompositeAddDM(self.dm, dm.dm) )             # <<<<<<<<<<<<<<
 * 
 *     def getNumber(self):
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeAddDM(__pyx_v_self->__pyx_base.dm, __pyx_v_dm->dm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 18, __pyx_L1_error)

    /* "PETSc/DMComposite.pyx":16
 *         CHKERR( DMCompositeAddDM(self.dm, dm.dm) )
 *         cdef object item
 *         for item in args:             # <<<<<<<<<<<<<<
 *             dm = <DM?> item
 *             CHKERR( DMCompositeAddDM(self.dm, dm.dm) )
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "PETSc/DMComposite.pyx":12
 *         return self
 * 
 *     def addDM(self, DM dm not None, *args):             # <<<<<<<<<<<<<<
 *         """Add DM to composite"""
 *         CHKERR( DMCompositeAddDM(self.dm, dm.dm) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.addDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF((PyObject *)__pyx_v_dm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMComposite.pyx":20
 *             CHKERR( DMCompositeAddDM(self.dm, dm.dm) )
 * 
 *     def getNumber(self):             # <<<<<<<<<<<<<<
 *         """Get number of sub-DMs contained in the DMComposite"""
 *         cdef PetscInt n = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_5getNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11DMComposite_4getNumber[] = "DMComposite.getNumber(self)\nGet number of sub-DMs contained in the DMComposite";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_5getNumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getNumber (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getNumber", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getNumber", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11DMComposite_4getNumber(((struct __pyx_obj_8petsc4py_5PETSc_DMComposite *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_4getNumber(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self) {
  PetscInt __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getNumber", 0);

  /* "PETSc/DMComposite.pyx":22
 *     def getNumber(self):
 *         """Get number of sub-DMs contained in the DMComposite"""
 *         cdef PetscInt n = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         return toInt(n)
 */
  __pyx_v_n = 0;

  /* "PETSc/DMComposite.pyx":23
 *         """Get number of sub-DMs contained in the DMComposite"""
 *         cdef PetscInt n = 0
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )             # <<<<<<<<<<<<<<
 *         return toInt(n)
 *     getNumberDM = getNumber
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetNumberDM(__pyx_v_self->__pyx_base.dm, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 23, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":24
 *         cdef PetscInt n = 0
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         return toInt(n)             # <<<<<<<<<<<<<<
 *     getNumberDM = getNumber
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(43, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMComposite.pyx":20
 *             CHKERR( DMCompositeAddDM(self.dm, dm.dm) )
 * 
 *     def getNumber(self):             # <<<<<<<<<<<<<<
 *         """Get number of sub-DMs contained in the DMComposite"""
 *         cdef PetscInt n = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.getNumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMComposite.pyx":27
 *     getNumberDM = getNumber
 * 
 *     def getEntries(self):             # <<<<<<<<<<<<<<
 *         """Get tuple of sub-DMs contained in the DMComposite"""
 *         cdef PetscInt i, n = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_7getEntries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11DMComposite_6getEntries[] = "DMComposite.getEntries(self)\nGet tuple of sub-DMs contained in the DMComposite";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_7getEntries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getEntries (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getEntries", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getEntries", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11DMComposite_6getEntries(((struct __pyx_obj_8petsc4py_5PETSc_DMComposite *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_6getEntries(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_n;
  DM *__pyx_v_cdms;
  CYTHON_UNUSED PyObject *__pyx_v_tmp = 0;
  struct PyPetscDMObject *__pyx_v_entry = 0;
  PyObject *__pyx_v_entries = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PetscInt __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("getEntries", 0);

  /* "PETSc/DMComposite.pyx":29
 *     def getEntries(self):
 *         """Get tuple of sub-DMs contained in the DMComposite"""
 *         cdef PetscInt i, n = 0             # <<<<<<<<<<<<<<
 *         cdef PetscDM *cdms = NULL
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 */
  __pyx_v_n = 0;

  /* "PETSc/DMComposite.pyx":30
 *         """Get tuple of sub-DMs contained in the DMComposite"""
 *         cdef PetscInt i, n = 0
 *         cdef PetscDM *cdms = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&cdms)
 */
  __pyx_v_cdms = NULL;

  /* "PETSc/DMComposite.pyx":31
 *         cdef PetscInt i, n = 0
 *         cdef PetscDM *cdms = NULL
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )             # <<<<<<<<<<<<<<
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&cdms)
 *         CHKERR( DMCompositeGetEntriesArray(self.dm, cdms) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetNumberDM(__pyx_v_self->__pyx_base.dm, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 31, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":32
 *         cdef PetscDM *cdms = NULL
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&cdms)             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGetEntriesArray(self.dm, cdms) )
 *         cdef DM entry = None
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(43, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_2, NULL, ((void **)(&__pyx_v_cdms)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(43, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_tmp = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/DMComposite.pyx":33
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&cdms)
 *         CHKERR( DMCompositeGetEntriesArray(self.dm, cdms) )             # <<<<<<<<<<<<<<
 *         cdef DM entry = None
 *         cdef list entries = []
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetEntriesArray(__pyx_v_self->__pyx_base.dm, __pyx_v_cdms)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 33, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":34
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&cdms)
 *         CHKERR( DMCompositeGetEntriesArray(self.dm, cdms) )
 *         cdef DM entry = None             # <<<<<<<<<<<<<<
 *         cdef list entries = []
 *         for i from 0 <= i < n:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_entry = ((struct PyPetscDMObject *)Py_None);

  /* "PETSc/DMComposite.pyx":35
 *         CHKERR( DMCompositeGetEntriesArray(self.dm, cdms) )
 *         cdef DM entry = None
 *         cdef list entries = []             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n:
 *             entry = subtype_DM(cdms[i])()
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(43, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_entries = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/DMComposite.pyx":36
 *         cdef DM entry = None
 *         cdef list entries = []
 *         for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *             entry = subtype_DM(cdms[i])()
 *             entry.dm = cdms[i]
 */
  __pyx_t_4 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {

    /* "PETSc/DMComposite.pyx":37
 *         cdef list entries = []
 *         for i from 0 <= i < n:
 *             entry = subtype_DM(cdms[i])()             # <<<<<<<<<<<<<<
 *             entry.dm = cdms[i]
 *             PetscINCREF(entry.obj)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM((__pyx_v_cdms[__pyx_v_i]))); if (unlikely(!__pyx_t_3)) __PYX_ERR(43, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(43, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(43, 37, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_entry, ((struct PyPetscDMObject *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "PETSc/DMComposite.pyx":38
 *         for i from 0 <= i < n:
 *             entry = subtype_DM(cdms[i])()
 *             entry.dm = cdms[i]             # <<<<<<<<<<<<<<
 *             PetscINCREF(entry.obj)
 *             entries.append(entry)
 */
    __pyx_v_entry->dm = (__pyx_v_cdms[__pyx_v_i]);

    /* "PETSc/DMComposite.pyx":39
 *             entry = subtype_DM(cdms[i])()
 *             entry.dm = cdms[i]
 *             PetscINCREF(entry.obj)             # <<<<<<<<<<<<<<
 *             entries.append(entry)
 *         return tuple(entries)
 */
    __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_entry->__pyx_base.obj);

    /* "PETSc/DMComposite.pyx":40
 *             entry.dm = cdms[i]
 *             PetscINCREF(entry.obj)
 *             entries.append(entry)             # <<<<<<<<<<<<<<
 *         return tuple(entries)
 * 
 */
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_entries, ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(43, 40, __pyx_L1_error)
  }

  /* "PETSc/DMComposite.pyx":41
 *             PetscINCREF(entry.obj)
 *             entries.append(entry)
 *         return tuple(entries)             # <<<<<<<<<<<<<<
 * 
 *     def scatter(self, Vec gvec not None, lvecs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_AsTuple(__pyx_v_entries); if (unlikely(!__pyx_t_2)) __PYX_ERR(43, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/DMComposite.pyx":27
 *     getNumberDM = getNumber
 * 
 *     def getEntries(self):             # <<<<<<<<<<<<<<
 *         """Get tuple of sub-DMs contained in the DMComposite"""
 *         cdef PetscInt i, n = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.getEntries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp);
  __Pyx_XDECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_entries);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMComposite.pyx":43
 *         return tuple(entries)
 * 
 *     def scatter(self, Vec gvec not None, lvecs):             # <<<<<<<<<<<<<<
 *         """Scatter coupled global vector into split local vectors"""
 *         cdef PetscInt i, n = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_9scatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11DMComposite_8scatter[] = "DMComposite.scatter(self, Vec gvec, lvecs)\nScatter coupled global vector into split local vectors";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_9scatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_gvec = 0;
  PyObject *__pyx_v_lvecs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scatter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gvec,&__pyx_n_s_lvecs,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_gvec)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lvecs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scatter", 1, 2, 2, 1); __PYX_ERR(43, 43, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scatter") < 0)) __PYX_ERR(43, 43, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_gvec = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_lvecs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scatter", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(43, 43, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.scatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gvec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "gvec", 0))) __PYX_ERR(43, 43, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11DMComposite_8scatter(((struct __pyx_obj_8petsc4py_5PETSc_DMComposite *)__pyx_v_self), __pyx_v_gvec, __pyx_v_lvecs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_8scatter(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self, struct PyPetscVecObject *__pyx_v_gvec, PyObject *__pyx_v_lvecs) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_n;
  Vec *__pyx_v_clvecs;
  CYTHON_UNUSED PyObject *__pyx_v_tmp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PetscInt __pyx_t_4;
  Vec __pyx_t_5;
  __Pyx_RefNannySetupContext("scatter", 0);

  /* "PETSc/DMComposite.pyx":45
 *     def scatter(self, Vec gvec not None, lvecs):
 *         """Scatter coupled global vector into split local vectors"""
 *         cdef PetscInt i, n = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         cdef PetscVec *clvecs = NULL
 */
  __pyx_v_n = 0;

  /* "PETSc/DMComposite.pyx":46
 *         """Scatter coupled global vector into split local vectors"""
 *         cdef PetscInt i, n = 0
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )             # <<<<<<<<<<<<<<
 *         cdef PetscVec *clvecs = NULL
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&clvecs)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetNumberDM(__pyx_v_self->__pyx_base.dm, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 46, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":47
 *         cdef PetscInt i, n = 0
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         cdef PetscVec *clvecs = NULL             # <<<<<<<<<<<<<<
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&clvecs)
 *         for i from 0 <= i < n:
 */
  __pyx_v_clvecs = NULL;

  /* "PETSc/DMComposite.pyx":48
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         cdef PetscVec *clvecs = NULL
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&clvecs)             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n:
 *             clvecs[i] = (<Vec?>lvecs[<Py_ssize_t>i]).vec
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(43, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_2, NULL, ((void **)(&__pyx_v_clvecs)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(43, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_tmp = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "PETSc/DMComposite.pyx":49
 *         cdef PetscVec *clvecs = NULL
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&clvecs)
 *         for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *             clvecs[i] = (<Vec?>lvecs[<Py_ssize_t>i]).vec
 *         CHKERR( DMCompositeScatterArray(self.dm, gvec.vec, clvecs) )
 */
  __pyx_t_4 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {

    /* "PETSc/DMComposite.pyx":50
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&clvecs)
 *         for i from 0 <= i < n:
 *             clvecs[i] = (<Vec?>lvecs[<Py_ssize_t>i]).vec             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeScatterArray(self.dm, gvec.vec, clvecs) )
 * 
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_lvecs, ((Py_ssize_t)__pyx_v_i), Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(43, 50, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8petsc4py_5PETSc_Vec)))) __PYX_ERR(43, 50, __pyx_L1_error)
    __pyx_t_5 = ((struct PyPetscVecObject *)__pyx_t_3)->vec;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    (__pyx_v_clvecs[__pyx_v_i]) = __pyx_t_5;
  }

  /* "PETSc/DMComposite.pyx":51
 *         for i from 0 <= i < n:
 *             clvecs[i] = (<Vec?>lvecs[<Py_ssize_t>i]).vec
 *         CHKERR( DMCompositeScatterArray(self.dm, gvec.vec, clvecs) )             # <<<<<<<<<<<<<<
 * 
 *     def gather(self, Vec gvec not None, imode, lvecs):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeScatterArray(__pyx_v_self->__pyx_base.dm, __pyx_v_gvec->vec, __pyx_v_clvecs)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 51, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":43
 *         return tuple(entries)
 * 
 *     def scatter(self, Vec gvec not None, lvecs):             # <<<<<<<<<<<<<<
 *         """Scatter coupled global vector into split local vectors"""
 *         cdef PetscInt i, n = 0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.scatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMComposite.pyx":53
 *         CHKERR( DMCompositeScatterArray(self.dm, gvec.vec, clvecs) )
 * 
 *     def gather(self, Vec gvec not None, imode, lvecs):             # <<<<<<<<<<<<<<
 *         """Gather split local vectors into coupled global vector"""
 *         cdef PetscInsertMode cimode = insertmode(imode)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_11gather(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11DMComposite_10gather[] = "DMComposite.gather(self, Vec gvec, imode, lvecs)\nGather split local vectors into coupled global vector";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_11gather(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_gvec = 0;
  PyObject *__pyx_v_imode = 0;
  PyObject *__pyx_v_lvecs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gather (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gvec,&__pyx_n_s_imode,&__pyx_n_s_lvecs,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_gvec)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_imode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gather", 1, 3, 3, 1); __PYX_ERR(43, 53, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lvecs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gather", 1, 3, 3, 2); __PYX_ERR(43, 53, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gather") < 0)) __PYX_ERR(43, 53, __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_gvec = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_imode = values[1];
    __pyx_v_lvecs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gather", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(43, 53, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.gather", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gvec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "gvec", 0))) __PYX_ERR(43, 53, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11DMComposite_10gather(((struct __pyx_obj_8petsc4py_5PETSc_DMComposite *)__pyx_v_self), __pyx_v_gvec, __pyx_v_imode, __pyx_v_lvecs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_10gather(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self, struct PyPetscVecObject *__pyx_v_gvec, PyObject *__pyx_v_imode, PyObject *__pyx_v_lvecs) {
  InsertMode __pyx_v_cimode;
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_n;
  Vec *__pyx_v_clvecs;
  CYTHON_UNUSED PyObject *__pyx_v_tmp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  InsertMode __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PetscInt __pyx_t_5;
  Vec __pyx_t_6;
  __Pyx_RefNannySetupContext("gather", 0);

  /* "PETSc/DMComposite.pyx":55
 *     def gather(self, Vec gvec not None, imode, lvecs):
 *         """Gather split local vectors into coupled global vector"""
 *         cdef PetscInsertMode cimode = insertmode(imode)             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, n = 0
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_insertmode(__pyx_v_imode); if (unlikely(__pyx_t_1 == ((InsertMode)-1L))) __PYX_ERR(43, 55, __pyx_L1_error)
  __pyx_v_cimode = __pyx_t_1;

  /* "PETSc/DMComposite.pyx":56
 *         """Gather split local vectors into coupled global vector"""
 *         cdef PetscInsertMode cimode = insertmode(imode)
 *         cdef PetscInt i, n = 0             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         cdef PetscVec *clvecs = NULL
 */
  __pyx_v_n = 0;

  /* "PETSc/DMComposite.pyx":57
 *         cdef PetscInsertMode cimode = insertmode(imode)
 *         cdef PetscInt i, n = 0
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )             # <<<<<<<<<<<<<<
 *         cdef PetscVec *clvecs = NULL
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&clvecs)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetNumberDM(__pyx_v_self->__pyx_base.dm, (&__pyx_v_n))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(43, 57, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":58
 *         cdef PetscInt i, n = 0
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         cdef PetscVec *clvecs = NULL             # <<<<<<<<<<<<<<
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&clvecs)
 *         for i from 0 <= i < n:
 */
  __pyx_v_clvecs = NULL;

  /* "PETSc/DMComposite.pyx":59
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         cdef PetscVec *clvecs = NULL
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&clvecs)             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n:
 *             clvecs[i] = (<Vec?>lvecs[<Py_ssize_t>i]).vec
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_empty_p(__pyx_v_n)); if (unlikely(!__pyx_t_3)) __PYX_ERR(43, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_oarray_p(__pyx_t_3, NULL, ((void **)(&__pyx_v_clvecs)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(43, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_tmp = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "PETSc/DMComposite.pyx":60
 *         cdef PetscVec *clvecs = NULL
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&clvecs)
 *         for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *             clvecs[i] = (<Vec?>lvecs[<Py_ssize_t>i]).vec
 *         CHKERR( DMCompositeGatherArray(self.dm, gvec.vec, cimode, clvecs) )
 */
  __pyx_t_5 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {

    /* "PETSc/DMComposite.pyx":61
 *         cdef object tmp = oarray_p(empty_p(n), NULL, <void**>&clvecs)
 *         for i from 0 <= i < n:
 *             clvecs[i] = (<Vec?>lvecs[<Py_ssize_t>i]).vec             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGatherArray(self.dm, gvec.vec, cimode, clvecs) )
 * 
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_lvecs, ((Py_ssize_t)__pyx_v_i), Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(43, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_8petsc4py_5PETSc_Vec)))) __PYX_ERR(43, 61, __pyx_L1_error)
    __pyx_t_6 = ((struct PyPetscVecObject *)__pyx_t_4)->vec;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    (__pyx_v_clvecs[__pyx_v_i]) = __pyx_t_6;
  }

  /* "PETSc/DMComposite.pyx":62
 *         for i from 0 <= i < n:
 *             clvecs[i] = (<Vec?>lvecs[<Py_ssize_t>i]).vec
 *         CHKERR( DMCompositeGatherArray(self.dm, gvec.vec, cimode, clvecs) )             # <<<<<<<<<<<<<<
 * 
 *     def getGlobalISs(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGatherArray(__pyx_v_self->__pyx_base.dm, __pyx_v_gvec->vec, __pyx_v_cimode, __pyx_v_clvecs)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(43, 62, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":53
 *         CHKERR( DMCompositeScatterArray(self.dm, gvec.vec, clvecs) )
 * 
 *     def gather(self, Vec gvec not None, imode, lvecs):             # <<<<<<<<<<<<<<
 *         """Gather split local vectors into coupled global vector"""
 *         cdef PetscInsertMode cimode = insertmode(imode)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.gather", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tmp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMComposite.pyx":64
 *         CHKERR( DMCompositeGatherArray(self.dm, gvec.vec, cimode, clvecs) )
 * 
 *     def getGlobalISs(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, n = 0
 *         cdef PetscIS *cis = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_13getGlobalISs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11DMComposite_12getGlobalISs[] = "DMComposite.getGlobalISs(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_13getGlobalISs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getGlobalISs (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getGlobalISs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getGlobalISs", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11DMComposite_12getGlobalISs(((struct __pyx_obj_8petsc4py_5PETSc_DMComposite *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_12getGlobalISs(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_n;
  IS *__pyx_v_cis;
  PyObject *__pyx_v_isets = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("getGlobalISs", 0);

  /* "PETSc/DMComposite.pyx":65
 * 
 *     def getGlobalISs(self):
 *         cdef PetscInt i, n = 0             # <<<<<<<<<<<<<<
 *         cdef PetscIS *cis = NULL
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 */
  __pyx_v_n = 0;

  /* "PETSc/DMComposite.pyx":66
 *     def getGlobalISs(self):
 *         cdef PetscInt i, n = 0
 *         cdef PetscIS *cis = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         CHKERR( DMCompositeGetGlobalISs(self.dm, &cis) )
 */
  __pyx_v_cis = NULL;

  /* "PETSc/DMComposite.pyx":67
 *         cdef PetscInt i, n = 0
 *         cdef PetscIS *cis = NULL
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGetGlobalISs(self.dm, &cis) )
 *         cdef object isets = [ref_IS(cis[i]) for i from 0 <= i < n]
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetNumberDM(__pyx_v_self->__pyx_base.dm, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 67, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":68
 *         cdef PetscIS *cis = NULL
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         CHKERR( DMCompositeGetGlobalISs(self.dm, &cis) )             # <<<<<<<<<<<<<<
 *         cdef object isets = [ref_IS(cis[i]) for i from 0 <= i < n]
 *         for i from 0 <= i < n:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetGlobalISs(__pyx_v_self->__pyx_base.dm, (&__pyx_v_cis))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 68, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":69
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         CHKERR( DMCompositeGetGlobalISs(self.dm, &cis) )
 *         cdef object isets = [ref_IS(cis[i]) for i from 0 <= i < n]             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n:
 *             CHKERR( ISDestroy(&cis[i]) )
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(43, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
    __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_IS((__pyx_v_cis[__pyx_v_i]))); if (unlikely(!__pyx_t_4)) __PYX_ERR(43, 69, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_4))) __PYX_ERR(43, 69, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_v_isets = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/DMComposite.pyx":70
 *         CHKERR( DMCompositeGetGlobalISs(self.dm, &cis) )
 *         cdef object isets = [ref_IS(cis[i]) for i from 0 <= i < n]
 *         for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *             CHKERR( ISDestroy(&cis[i]) )
 *         CHKERR( PetscFree(cis) )
 */
  __pyx_t_3 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

    /* "PETSc/DMComposite.pyx":71
 *         cdef object isets = [ref_IS(cis[i]) for i from 0 <= i < n]
 *         for i from 0 <= i < n:
 *             CHKERR( ISDestroy(&cis[i]) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscFree(cis) )
 *         return isets
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISDestroy((&(__pyx_v_cis[__pyx_v_i])))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 71, __pyx_L1_error)
  }

  /* "PETSc/DMComposite.pyx":72
 *         for i from 0 <= i < n:
 *             CHKERR( ISDestroy(&cis[i]) )
 *         CHKERR( PetscFree(cis) )             # <<<<<<<<<<<<<<
 *         return isets
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscFree(__pyx_v_cis)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 72, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":73
 *             CHKERR( ISDestroy(&cis[i]) )
 *         CHKERR( PetscFree(cis) )
 *         return isets             # <<<<<<<<<<<<<<
 * 
 *     def getLocalISs(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_isets);
  __pyx_r = __pyx_v_isets;
  goto __pyx_L0;

  /* "PETSc/DMComposite.pyx":64
 *         CHKERR( DMCompositeGatherArray(self.dm, gvec.vec, cimode, clvecs) )
 * 
 *     def getGlobalISs(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, n = 0
 *         cdef PetscIS *cis = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.getGlobalISs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_isets);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMComposite.pyx":75
 *         return isets
 * 
 *     def getLocalISs(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, n = 0
 *         cdef PetscIS *cis = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_15getLocalISs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11DMComposite_14getLocalISs[] = "DMComposite.getLocalISs(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_15getLocalISs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLocalISs (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getLocalISs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getLocalISs", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11DMComposite_14getLocalISs(((struct __pyx_obj_8petsc4py_5PETSc_DMComposite *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_14getLocalISs(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_n;
  IS *__pyx_v_cis;
  PyObject *__pyx_v_isets = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("getLocalISs", 0);

  /* "PETSc/DMComposite.pyx":76
 * 
 *     def getLocalISs(self):
 *         cdef PetscInt i, n = 0             # <<<<<<<<<<<<<<
 *         cdef PetscIS *cis = NULL
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 */
  __pyx_v_n = 0;

  /* "PETSc/DMComposite.pyx":77
 *     def getLocalISs(self):
 *         cdef PetscInt i, n = 0
 *         cdef PetscIS *cis = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         CHKERR( DMCompositeGetLocalISs(self.dm, &cis) )
 */
  __pyx_v_cis = NULL;

  /* "PETSc/DMComposite.pyx":78
 *         cdef PetscInt i, n = 0
 *         cdef PetscIS *cis = NULL
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGetLocalISs(self.dm, &cis) )
 *         cdef object isets = [ref_IS(cis[i]) for i from 0 <= i < n]
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetNumberDM(__pyx_v_self->__pyx_base.dm, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 78, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":79
 *         cdef PetscIS *cis = NULL
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         CHKERR( DMCompositeGetLocalISs(self.dm, &cis) )             # <<<<<<<<<<<<<<
 *         cdef object isets = [ref_IS(cis[i]) for i from 0 <= i < n]
 *         for i from 0 <= i < n:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetLocalISs(__pyx_v_self->__pyx_base.dm, (&__pyx_v_cis))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 79, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":80
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         CHKERR( DMCompositeGetLocalISs(self.dm, &cis) )
 *         cdef object isets = [ref_IS(cis[i]) for i from 0 <= i < n]             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n:
 *             CHKERR( ISDestroy(&cis[i]) )
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(43, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
    __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_IS((__pyx_v_cis[__pyx_v_i]))); if (unlikely(!__pyx_t_4)) __PYX_ERR(43, 80, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_4))) __PYX_ERR(43, 80, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_v_isets = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/DMComposite.pyx":81
 *         CHKERR( DMCompositeGetLocalISs(self.dm, &cis) )
 *         cdef object isets = [ref_IS(cis[i]) for i from 0 <= i < n]
 *         for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *             CHKERR( ISDestroy(&cis[i]) )
 *         CHKERR( PetscFree(cis) )
 */
  __pyx_t_3 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

    /* "PETSc/DMComposite.pyx":82
 *         cdef object isets = [ref_IS(cis[i]) for i from 0 <= i < n]
 *         for i from 0 <= i < n:
 *             CHKERR( ISDestroy(&cis[i]) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscFree(cis) )
 *         return isets
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISDestroy((&(__pyx_v_cis[__pyx_v_i])))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 82, __pyx_L1_error)
  }

  /* "PETSc/DMComposite.pyx":83
 *         for i from 0 <= i < n:
 *             CHKERR( ISDestroy(&cis[i]) )
 *         CHKERR( PetscFree(cis) )             # <<<<<<<<<<<<<<
 *         return isets
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscFree(__pyx_v_cis)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 83, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":84
 *             CHKERR( ISDestroy(&cis[i]) )
 *         CHKERR( PetscFree(cis) )
 *         return isets             # <<<<<<<<<<<<<<
 * 
 *     def getLGMaps(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_isets);
  __pyx_r = __pyx_v_isets;
  goto __pyx_L0;

  /* "PETSc/DMComposite.pyx":75
 *         return isets
 * 
 *     def getLocalISs(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, n = 0
 *         cdef PetscIS *cis = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.getLocalISs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_isets);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMComposite.pyx":86
 *         return isets
 * 
 *     def getLGMaps(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, n = 0
 *         cdef PetscLGMap *clgm = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_17getLGMaps(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11DMComposite_16getLGMaps[] = "DMComposite.getLGMaps(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_17getLGMaps(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getLGMaps (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getLGMaps", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getLGMaps", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11DMComposite_16getLGMaps(((struct __pyx_obj_8petsc4py_5PETSc_DMComposite *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_16getLGMaps(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self) {
  PetscInt __pyx_v_i;
  PetscInt __pyx_v_n;
  ISLocalToGlobalMapping *__pyx_v_clgm;
  PyObject *__pyx_v_lgms = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PetscInt __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("getLGMaps", 0);

  /* "PETSc/DMComposite.pyx":87
 * 
 *     def getLGMaps(self):
 *         cdef PetscInt i, n = 0             # <<<<<<<<<<<<<<
 *         cdef PetscLGMap *clgm = NULL
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 */
  __pyx_v_n = 0;

  /* "PETSc/DMComposite.pyx":88
 *     def getLGMaps(self):
 *         cdef PetscInt i, n = 0
 *         cdef PetscLGMap *clgm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         CHKERR( DMCompositeGetISLocalToGlobalMappings(self.dm, &clgm) )
 */
  __pyx_v_clgm = NULL;

  /* "PETSc/DMComposite.pyx":89
 *         cdef PetscInt i, n = 0
 *         cdef PetscLGMap *clgm = NULL
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )             # <<<<<<<<<<<<<<
 *         CHKERR( DMCompositeGetISLocalToGlobalMappings(self.dm, &clgm) )
 *         cdef object lgms = [ref_LGMap(clgm[i]) for i from 0 <= i < n]
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetNumberDM(__pyx_v_self->__pyx_base.dm, (&__pyx_v_n))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 89, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":90
 *         cdef PetscLGMap *clgm = NULL
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         CHKERR( DMCompositeGetISLocalToGlobalMappings(self.dm, &clgm) )             # <<<<<<<<<<<<<<
 *         cdef object lgms = [ref_LGMap(clgm[i]) for i from 0 <= i < n]
 *         for i from 0 <= i < n:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCompositeGetISLocalToGlobalMappings(__pyx_v_self->__pyx_base.dm, (&__pyx_v_clgm))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 90, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":91
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         CHKERR( DMCompositeGetISLocalToGlobalMappings(self.dm, &clgm) )
 *         cdef object lgms = [ref_LGMap(clgm[i]) for i from 0 <= i < n]             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < n:
 *             CHKERR( ISLocalToGlobalMappingDestroy(&clgm[i]) )
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(43, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
    __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_ref_LGMap((__pyx_v_clgm[__pyx_v_i]))); if (unlikely(!__pyx_t_4)) __PYX_ERR(43, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_4))) __PYX_ERR(43, 91, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_v_lgms = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "PETSc/DMComposite.pyx":92
 *         CHKERR( DMCompositeGetISLocalToGlobalMappings(self.dm, &clgm) )
 *         cdef object lgms = [ref_LGMap(clgm[i]) for i from 0 <= i < n]
 *         for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *             CHKERR( ISLocalToGlobalMappingDestroy(&clgm[i]) )
 *         CHKERR( PetscFree(clgm) )
 */
  __pyx_t_3 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

    /* "PETSc/DMComposite.pyx":93
 *         cdef object lgms = [ref_LGMap(clgm[i]) for i from 0 <= i < n]
 *         for i from 0 <= i < n:
 *             CHKERR( ISLocalToGlobalMappingDestroy(&clgm[i]) )             # <<<<<<<<<<<<<<
 *         CHKERR( PetscFree(clgm) )
 *         return lgms
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(ISLocalToGlobalMappingDestroy((&(__pyx_v_clgm[__pyx_v_i])))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 93, __pyx_L1_error)
  }

  /* "PETSc/DMComposite.pyx":94
 *         for i from 0 <= i < n:
 *             CHKERR( ISLocalToGlobalMappingDestroy(&clgm[i]) )
 *         CHKERR( PetscFree(clgm) )             # <<<<<<<<<<<<<<
 *         return lgms
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscFree(__pyx_v_clgm)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(43, 94, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":95
 *             CHKERR( ISLocalToGlobalMappingDestroy(&clgm[i]) )
 *         CHKERR( PetscFree(clgm) )
 *         return lgms             # <<<<<<<<<<<<<<
 * 
 *     def getAccess(self, Vec gvec not None, locs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_lgms);
  __pyx_r = __pyx_v_lgms;
  goto __pyx_L0;

  /* "PETSc/DMComposite.pyx":86
 *         return isets
 * 
 *     def getLGMaps(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt i, n = 0
 *         cdef PetscLGMap *clgm = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.getLGMaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lgms);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMComposite.pyx":97
 *         return lgms
 * 
 *     def getAccess(self, Vec gvec not None, locs=None):             # <<<<<<<<<<<<<<
 *         """Get access to specified parts of global vector.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_19getAccess(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11DMComposite_18getAccess[] = "DMComposite.getAccess(self, Vec gvec, locs=None)\nGet access to specified parts of global vector.\n\n        Use via 'with' context manager (PEP 343).\n        ";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11DMComposite_19getAccess(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_gvec = 0;
  PyObject *__pyx_v_locs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getAccess (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gvec,&__pyx_n_s_locs,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_gvec)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_locs);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getAccess") < 0)) __PYX_ERR(43, 97, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_gvec = ((struct PyPetscVecObject *)values[0]);
    __pyx_v_locs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getAccess", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(43, 97, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.getAccess", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gvec), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "gvec", 0))) __PYX_ERR(43, 97, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11DMComposite_18getAccess(((struct __pyx_obj_8petsc4py_5PETSc_DMComposite *)__pyx_v_self), __pyx_v_gvec, __pyx_v_locs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11DMComposite_18getAccess(struct __pyx_obj_8petsc4py_5PETSc_DMComposite *__pyx_v_self, struct PyPetscVecObject *__pyx_v_gvec, PyObject *__pyx_v_locs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getAccess", 0);

  /* "PETSc/DMComposite.pyx":102
 *         Use via 'with' context manager (PEP 343).
 *         """
 *         return _DMComposite_access(self, gvec, locs)             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(43, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_INCREF(((PyObject *)__pyx_v_gvec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_gvec));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_gvec));
  __Pyx_INCREF(__pyx_v_locs);
  __Pyx_GIVEREF(__pyx_v_locs);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_locs);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc__DMComposite_access), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(43, 102, __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;

  /* "PETSc/DMComposite.pyx":97
 *         return lgms
 * 
 *     def getAccess(self, Vec gvec not None, locs=None):             # <<<<<<<<<<<<<<
 *         """Get access to specified parts of global vector.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.DMComposite.getAccess", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":3
 * cdef class DMShell(DM):
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_1create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_create[] = "DMShell.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_1create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(44, 3, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 3, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_create(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_create(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  DM __pyx_v_newdm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/DMShell.pyx":4
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMShellCreate(ccomm, &newdm) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(44, 4, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/DMShell.pyx":5
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellCreate(ccomm, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 */
  __pyx_v_newdm = NULL;

  /* "PETSc/DMShell.pyx":6
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMShellCreate(ccomm, &newdm) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellCreate(__pyx_v_ccomm, (&__pyx_v_newdm))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(44, 6, __pyx_L1_error)

  /* "PETSc/DMShell.pyx":7
 *         cdef PetscDM newdm = NULL
 *         CHKERR( DMShellCreate(ccomm, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.__pyx_base.obj);
  __pyx_v_self->__pyx_base.dm = __pyx_v_newdm;

  /* "PETSc/DMShell.pyx":8
 *         CHKERR( DMShellCreate(ccomm, &newdm) )
 *         PetscCLEAR(self.obj); self.dm = newdm
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setMatrix(self, Mat mat not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/DMShell.pyx":3
 * cdef class DMShell(DM):
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscDM newdm = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":10
 *         return self
 * 
 *     def setMatrix(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetMatrix(self.dm, mat.mat) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_3setMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_2setMatrix[] = "DMShell.setMatrix(self, Mat mat)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_3setMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscMatObject *__pyx_v_mat = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,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);
        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_mat)) != 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, "setMatrix") < 0)) __PYX_ERR(44, 10, __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_mat = ((struct PyPetscMatObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setMatrix", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 10, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_8petsc4py_5PETSc_Mat, 0, "mat", 0))) __PYX_ERR(44, 10, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_2setMatrix(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_mat);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_2setMatrix(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, struct PyPetscMatObject *__pyx_v_mat) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setMatrix", 0);

  /* "PETSc/DMShell.pyx":11
 * 
 *     def setMatrix(self, Mat mat not None):
 *         CHKERR( DMShellSetMatrix(self.dm, mat.mat) )             # <<<<<<<<<<<<<<
 * 
 *     def setGlobalVector(self, Vec gv not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetMatrix(__pyx_v_self->__pyx_base.dm, __pyx_v_mat->mat)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(44, 11, __pyx_L1_error)

  /* "PETSc/DMShell.pyx":10
 *         return self
 * 
 *     def setMatrix(self, Mat mat not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetMatrix(self.dm, mat.mat) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":13
 *         CHKERR( DMShellSetMatrix(self.dm, mat.mat) )
 * 
 *     def setGlobalVector(self, Vec gv not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetGlobalVector(self.dm, gv.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_5setGlobalVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_4setGlobalVector[] = "DMShell.setGlobalVector(self, Vec gv)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_5setGlobalVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_gv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setGlobalVector (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gv,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);
        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_gv)) != 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, "setGlobalVector") < 0)) __PYX_ERR(44, 13, __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_gv = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setGlobalVector", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 13, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setGlobalVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gv), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "gv", 0))) __PYX_ERR(44, 13, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_4setGlobalVector(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_gv);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_4setGlobalVector(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, struct PyPetscVecObject *__pyx_v_gv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setGlobalVector", 0);

  /* "PETSc/DMShell.pyx":14
 * 
 *     def setGlobalVector(self, Vec gv not None):
 *         CHKERR( DMShellSetGlobalVector(self.dm, gv.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def setLocalVector(self, Vec lv not None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetGlobalVector(__pyx_v_self->__pyx_base.dm, __pyx_v_gv->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(44, 14, __pyx_L1_error)

  /* "PETSc/DMShell.pyx":13
 *         CHKERR( DMShellSetMatrix(self.dm, mat.mat) )
 * 
 *     def setGlobalVector(self, Vec gv not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetGlobalVector(self.dm, gv.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setGlobalVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":16
 *         CHKERR( DMShellSetGlobalVector(self.dm, gv.vec) )
 * 
 *     def setLocalVector(self, Vec lv not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetLocalVector(self.dm, lv.vec) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_7setLocalVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_6setLocalVector[] = "DMShell.setLocalVector(self, Vec lv)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_7setLocalVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscVecObject *__pyx_v_lv = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setLocalVector (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lv,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);
        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_lv)) != 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, "setLocalVector") < 0)) __PYX_ERR(44, 16, __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_lv = ((struct PyPetscVecObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setLocalVector", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 16, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setLocalVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lv), __pyx_ptype_8petsc4py_5PETSc_Vec, 0, "lv", 0))) __PYX_ERR(44, 16, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_6setLocalVector(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_lv);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_6setLocalVector(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, struct PyPetscVecObject *__pyx_v_lv) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setLocalVector", 0);

  /* "PETSc/DMShell.pyx":17
 * 
 *     def setLocalVector(self, Vec lv not None):
 *         CHKERR( DMShellSetLocalVector(self.dm, lv.vec) )             # <<<<<<<<<<<<<<
 * 
 *     def setCreateGlobalVector(self, create_gvec, args=None, kargs=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetLocalVector(__pyx_v_self->__pyx_base.dm, __pyx_v_lv->vec)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(44, 17, __pyx_L1_error)

  /* "PETSc/DMShell.pyx":16
 *         CHKERR( DMShellSetGlobalVector(self.dm, gv.vec) )
 * 
 *     def setLocalVector(self, Vec lv not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetLocalVector(self.dm, lv.vec) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setLocalVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":19
 *         CHKERR( DMShellSetLocalVector(self.dm, lv.vec) )
 * 
 *     def setCreateGlobalVector(self, create_gvec, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if create_gvec is not None:
 *             if args  is None: args = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_9setCreateGlobalVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_8setCreateGlobalVector[] = "DMShell.setCreateGlobalVector(self, create_gvec, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_9setCreateGlobalVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_create_gvec = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCreateGlobalVector (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_create_gvec,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_create_gvec)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setCreateGlobalVector") < 0)) __PYX_ERR(44, 19, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_create_gvec = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCreateGlobalVector", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 19, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateGlobalVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_8setCreateGlobalVector(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_create_gvec, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_8setCreateGlobalVector(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_create_gvec, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setCreateGlobalVector", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/DMShell.pyx":20
 * 
 *     def setCreateGlobalVector(self, create_gvec, args=None, kargs=None):
 *         if create_gvec is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_create_gvec != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMShell.pyx":21
 *     def setCreateGlobalVector(self, create_gvec, args=None, kargs=None):
 *         if create_gvec is not None:
 *             if args  is None: args = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (create_gvec, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":22
 *         if create_gvec is not None:
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (create_gvec, args, kargs)
 *             self.set_attr('__create_global_vector__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 22, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":23
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}
 *             context = (create_gvec, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__create_global_vector__', context)
 *             CHKERR( DMShellSetCreateGlobalVector(self.dm, DMSHELL_CreateGlobalVector) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_create_gvec);
    __Pyx_GIVEREF(__pyx_v_create_gvec);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_create_gvec);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":24
 *             if kargs is None: kargs = {}
 *             context = (create_gvec, args, kargs)
 *             self.set_attr('__create_global_vector__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( DMShellSetCreateGlobalVector(self.dm, DMSHELL_CreateGlobalVector) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__create_global_vector__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 24, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":25
 *             context = (create_gvec, args, kargs)
 *             self.set_attr('__create_global_vector__', context)
 *             CHKERR( DMShellSetCreateGlobalVector(self.dm, DMSHELL_CreateGlobalVector) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( DMShellSetCreateGlobalVector(self.dm, NULL) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateGlobalVector(__pyx_v_self->__pyx_base.dm, __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateGlobalVector)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 25, __pyx_L1_error)

    /* "PETSc/DMShell.pyx":20
 * 
 *     def setCreateGlobalVector(self, create_gvec, args=None, kargs=None):
 *         if create_gvec is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/DMShell.pyx":27
 *             CHKERR( DMShellSetCreateGlobalVector(self.dm, DMSHELL_CreateGlobalVector) )
 *         else:
 *             CHKERR( DMShellSetCreateGlobalVector(self.dm, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def setCreateLocalVector(self, create_lvec, args=None, kargs=None):
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateGlobalVector(__pyx_v_self->__pyx_base.dm, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 27, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/DMShell.pyx":19
 *         CHKERR( DMShellSetLocalVector(self.dm, lv.vec) )
 * 
 *     def setCreateGlobalVector(self, create_gvec, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if create_gvec is not None:
 *             if args  is None: args = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateGlobalVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":29
 *             CHKERR( DMShellSetCreateGlobalVector(self.dm, NULL) )
 * 
 *     def setCreateLocalVector(self, create_lvec, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if create_lvec is not None:
 *             if args  is None: args = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_11setCreateLocalVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_10setCreateLocalVector[] = "DMShell.setCreateLocalVector(self, create_lvec, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_11setCreateLocalVector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_create_lvec = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCreateLocalVector (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_create_lvec,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_create_lvec)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setCreateLocalVector") < 0)) __PYX_ERR(44, 29, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_create_lvec = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCreateLocalVector", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 29, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateLocalVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_10setCreateLocalVector(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_create_lvec, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_10setCreateLocalVector(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_create_lvec, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setCreateLocalVector", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/DMShell.pyx":30
 * 
 *     def setCreateLocalVector(self, create_lvec, args=None, kargs=None):
 *         if create_lvec is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_create_lvec != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMShell.pyx":31
 *     def setCreateLocalVector(self, create_lvec, args=None, kargs=None):
 *         if create_lvec is not None:
 *             if args  is None: args = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (create_lvec, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":32
 *         if create_lvec is not None:
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (create_lvec, args, kargs)
 *             self.set_attr('__create_local_vector__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 32, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":33
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}
 *             context = (create_lvec, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__create_local_vector__', context)
 *             CHKERR( DMShellSetCreateLocalVector(self.dm, DMSHELL_CreateLocalVector) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 33, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_create_lvec);
    __Pyx_GIVEREF(__pyx_v_create_lvec);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_create_lvec);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":34
 *             if kargs is None: kargs = {}
 *             context = (create_lvec, args, kargs)
 *             self.set_attr('__create_local_vector__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( DMShellSetCreateLocalVector(self.dm, DMSHELL_CreateLocalVector) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__create_local_vector__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":35
 *             context = (create_lvec, args, kargs)
 *             self.set_attr('__create_local_vector__', context)
 *             CHKERR( DMShellSetCreateLocalVector(self.dm, DMSHELL_CreateLocalVector) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( DMShellSetCreateLocalVector(self.dm, NULL) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateLocalVector(__pyx_v_self->__pyx_base.dm, __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateLocalVector)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 35, __pyx_L1_error)

    /* "PETSc/DMShell.pyx":30
 * 
 *     def setCreateLocalVector(self, create_lvec, args=None, kargs=None):
 *         if create_lvec is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/DMShell.pyx":37
 *             CHKERR( DMShellSetCreateLocalVector(self.dm, DMSHELL_CreateLocalVector) )
 *         else:
 *             CHKERR( DMShellSetCreateLocalVector(self.dm, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def setGlobalToLocal(self, begin, end, begin_args=None, begin_kargs=None,
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateLocalVector(__pyx_v_self->__pyx_base.dm, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 37, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/DMShell.pyx":29
 *             CHKERR( DMShellSetCreateGlobalVector(self.dm, NULL) )
 * 
 *     def setCreateLocalVector(self, create_lvec, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if create_lvec is not None:
 *             if args  is None: args = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateLocalVector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":39
 *             CHKERR( DMShellSetCreateLocalVector(self.dm, NULL) )
 * 
 *     def setGlobalToLocal(self, begin, end, begin_args=None, begin_kargs=None,             # <<<<<<<<<<<<<<
 *                          end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_13setGlobalToLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_12setGlobalToLocal[] = "DMShell.setGlobalToLocal(self, begin, end, begin_args=None, begin_kargs=None, end_args=None, end_kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_13setGlobalToLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_begin = 0;
  PyObject *__pyx_v_end = 0;
  PyObject *__pyx_v_begin_args = 0;
  PyObject *__pyx_v_begin_kargs = 0;
  PyObject *__pyx_v_end_args = 0;
  PyObject *__pyx_v_end_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setGlobalToLocal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_begin,&__pyx_n_s_end,&__pyx_n_s_begin_args,&__pyx_n_s_begin_kargs,&__pyx_n_s_end_args,&__pyx_n_s_end_kargs,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);

    /* "PETSc/DMShell.pyx":40
 * 
 *     def setGlobalToLocal(self, begin, end, begin_args=None, begin_kargs=None,
 *                          end_args=None, end_kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 *         if begin is not None:
 */
    values[4] = ((PyObject *)Py_None);
    values[5] = ((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  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_begin)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setGlobalToLocal", 0, 2, 6, 1); __PYX_ERR(44, 39, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_begin_args);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_begin_kargs);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_args);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_kargs);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setGlobalToLocal") < 0)) __PYX_ERR(44, 39, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_begin = values[0];
    __pyx_v_end = values[1];
    __pyx_v_begin_args = values[2];
    __pyx_v_begin_kargs = values[3];
    __pyx_v_end_args = values[4];
    __pyx_v_end_kargs = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setGlobalToLocal", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 39, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setGlobalToLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_12setGlobalToLocal(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_begin, __pyx_v_end, __pyx_v_begin_args, __pyx_v_begin_kargs, __pyx_v_end_args, __pyx_v_end_kargs);

  /* "PETSc/DMShell.pyx":39
 *             CHKERR( DMShellSetCreateLocalVector(self.dm, NULL) )
 * 
 *     def setGlobalToLocal(self, begin, end, begin_args=None, begin_kargs=None,             # <<<<<<<<<<<<<<
 *                          end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_12setGlobalToLocal(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_begin, PyObject *__pyx_v_end, PyObject *__pyx_v_begin_args, PyObject *__pyx_v_begin_kargs, PyObject *__pyx_v_end_args, PyObject *__pyx_v_end_kargs) {
  __pyx_t_8petsc4py_5PETSc_PetscDMShellXToYFunction __pyx_v_cbegin;
  __pyx_t_8petsc4py_5PETSc_PetscDMShellXToYFunction __pyx_v_cend;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setGlobalToLocal", 0);
  __Pyx_INCREF(__pyx_v_begin_args);
  __Pyx_INCREF(__pyx_v_begin_kargs);
  __Pyx_INCREF(__pyx_v_end_args);
  __Pyx_INCREF(__pyx_v_end_kargs);

  /* "PETSc/DMShell.pyx":41
 *     def setGlobalToLocal(self, begin, end, begin_args=None, begin_kargs=None,
 *                          end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL             # <<<<<<<<<<<<<<
 *         if begin is not None:
 *             if begin_args  is None: begin_args = ()
 */
  __pyx_v_cbegin = NULL;
  __pyx_v_cend = NULL;

  /* "PETSc/DMShell.pyx":42
 *                          end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 *         if begin is not None:             # <<<<<<<<<<<<<<
 *             if begin_args  is None: begin_args = ()
 *             if begin_kargs is None: begin_kargs = {}
 */
  __pyx_t_1 = (__pyx_v_begin != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMShell.pyx":43
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 *         if begin is not None:
 *             if begin_args  is None: begin_args = ()             # <<<<<<<<<<<<<<
 *             if begin_kargs is None: begin_kargs = {}
 *             context = (begin, begin_args, begin_kargs)
 */
    __pyx_t_2 = (__pyx_v_begin_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_begin_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":44
 *         if begin is not None:
 *             if begin_args  is None: begin_args = ()
 *             if begin_kargs is None: begin_kargs = {}             # <<<<<<<<<<<<<<
 *             context = (begin, begin_args, begin_kargs)
 *             self.set_attr('__g2l_begin__', context)
 */
    __pyx_t_1 = (__pyx_v_begin_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 44, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_begin_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":45
 *             if begin_args  is None: begin_args = ()
 *             if begin_kargs is None: begin_kargs = {}
 *             context = (begin, begin_args, begin_kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__g2l_begin__', context)
 *             cbegin = &DMSHELL_GlobalToLocalBegin
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 45, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_begin);
    __Pyx_GIVEREF(__pyx_v_begin);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_begin);
    __Pyx_INCREF(__pyx_v_begin_args);
    __Pyx_GIVEREF(__pyx_v_begin_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_begin_args);
    __Pyx_INCREF(__pyx_v_begin_kargs);
    __Pyx_GIVEREF(__pyx_v_begin_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_begin_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":46
 *             if begin_kargs is None: begin_kargs = {}
 *             context = (begin, begin_args, begin_kargs)
 *             self.set_attr('__g2l_begin__', context)             # <<<<<<<<<<<<<<
 *             cbegin = &DMSHELL_GlobalToLocalBegin
 *         if end is not None:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__g2l_begin__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":47
 *             context = (begin, begin_args, begin_kargs)
 *             self.set_attr('__g2l_begin__', context)
 *             cbegin = &DMSHELL_GlobalToLocalBegin             # <<<<<<<<<<<<<<
 *         if end is not None:
 *             if end_args  is None: end_args = ()
 */
    __pyx_v_cbegin = (&__pyx_f_8petsc4py_5PETSc_DMSHELL_GlobalToLocalBegin);

    /* "PETSc/DMShell.pyx":42
 *                          end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 *         if begin is not None:             # <<<<<<<<<<<<<<
 *             if begin_args  is None: begin_args = ()
 *             if begin_kargs is None: begin_kargs = {}
 */
  }

  /* "PETSc/DMShell.pyx":48
 *             self.set_attr('__g2l_begin__', context)
 *             cbegin = &DMSHELL_GlobalToLocalBegin
 *         if end is not None:             # <<<<<<<<<<<<<<
 *             if end_args  is None: end_args = ()
 *             if end_kargs is None: end_kargs = {}
 */
  __pyx_t_2 = (__pyx_v_end != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/DMShell.pyx":49
 *             cbegin = &DMSHELL_GlobalToLocalBegin
 *         if end is not None:
 *             if end_args  is None: end_args = ()             # <<<<<<<<<<<<<<
 *             if end_kargs is None: end_kargs = {}
 *             context = (end, end_args, end_kargs)
 */
    __pyx_t_1 = (__pyx_v_end_args == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_end_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":50
 *         if end is not None:
 *             if end_args  is None: end_args = ()
 *             if end_kargs is None: end_kargs = {}             # <<<<<<<<<<<<<<
 *             context = (end, end_args, end_kargs)
 *             self.set_attr('__g2l_end__', context)
 */
    __pyx_t_2 = (__pyx_v_end_kargs == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 50, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_end_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":51
 *             if end_args  is None: end_args = ()
 *             if end_kargs is None: end_kargs = {}
 *             context = (end, end_args, end_kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__g2l_end__', context)
 *             cend = &DMSHELL_GlobalToLocalEnd
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_end);
    __Pyx_GIVEREF(__pyx_v_end);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_end);
    __Pyx_INCREF(__pyx_v_end_args);
    __Pyx_GIVEREF(__pyx_v_end_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_end_args);
    __Pyx_INCREF(__pyx_v_end_kargs);
    __Pyx_GIVEREF(__pyx_v_end_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_end_kargs);
    __Pyx_XDECREF_SET(__pyx_v_context, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":52
 *             if end_kargs is None: end_kargs = {}
 *             context = (end, end_args, end_kargs)
 *             self.set_attr('__g2l_end__', context)             # <<<<<<<<<<<<<<
 *             cend = &DMSHELL_GlobalToLocalEnd
 *         CHKERR( DMShellSetGlobalToLocal(self.dm, cbegin, cend) )
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__g2l_end__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":53
 *             context = (end, end_args, end_kargs)
 *             self.set_attr('__g2l_end__', context)
 *             cend = &DMSHELL_GlobalToLocalEnd             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetGlobalToLocal(self.dm, cbegin, cend) )
 * 
 */
    __pyx_v_cend = (&__pyx_f_8petsc4py_5PETSc_DMSHELL_GlobalToLocalEnd);

    /* "PETSc/DMShell.pyx":48
 *             self.set_attr('__g2l_begin__', context)
 *             cbegin = &DMSHELL_GlobalToLocalBegin
 *         if end is not None:             # <<<<<<<<<<<<<<
 *             if end_args  is None: end_args = ()
 *             if end_kargs is None: end_kargs = {}
 */
  }

  /* "PETSc/DMShell.pyx":54
 *             self.set_attr('__g2l_end__', context)
 *             cend = &DMSHELL_GlobalToLocalEnd
 *         CHKERR( DMShellSetGlobalToLocal(self.dm, cbegin, cend) )             # <<<<<<<<<<<<<<
 * 
 *     def setGlobalToLocalVecScatter(self, Scatter gtol not None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetGlobalToLocal(__pyx_v_self->__pyx_base.dm, __pyx_v_cbegin, __pyx_v_cend)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 54, __pyx_L1_error)

  /* "PETSc/DMShell.pyx":39
 *             CHKERR( DMShellSetCreateLocalVector(self.dm, NULL) )
 * 
 *     def setGlobalToLocal(self, begin, end, begin_args=None, begin_kargs=None,             # <<<<<<<<<<<<<<
 *                          end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setGlobalToLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_begin_args);
  __Pyx_XDECREF(__pyx_v_begin_kargs);
  __Pyx_XDECREF(__pyx_v_end_args);
  __Pyx_XDECREF(__pyx_v_end_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":56
 *         CHKERR( DMShellSetGlobalToLocal(self.dm, cbegin, cend) )
 * 
 *     def setGlobalToLocalVecScatter(self, Scatter gtol not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetGlobalToLocalVecScatter(self.dm, gtol.sct) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_15setGlobalToLocalVecScatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_14setGlobalToLocalVecScatter[] = "DMShell.setGlobalToLocalVecScatter(self, Scatter gtol)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_15setGlobalToLocalVecScatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscScatterObject *__pyx_v_gtol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setGlobalToLocalVecScatter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gtol,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);
        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_gtol)) != 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, "setGlobalToLocalVecScatter") < 0)) __PYX_ERR(44, 56, __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_gtol = ((struct PyPetscScatterObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setGlobalToLocalVecScatter", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 56, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setGlobalToLocalVecScatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gtol), __pyx_ptype_8petsc4py_5PETSc_Scatter, 0, "gtol", 0))) __PYX_ERR(44, 56, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_14setGlobalToLocalVecScatter(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_gtol);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_14setGlobalToLocalVecScatter(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, struct PyPetscScatterObject *__pyx_v_gtol) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setGlobalToLocalVecScatter", 0);

  /* "PETSc/DMShell.pyx":57
 * 
 *     def setGlobalToLocalVecScatter(self, Scatter gtol not None):
 *         CHKERR( DMShellSetGlobalToLocalVecScatter(self.dm, gtol.sct) )             # <<<<<<<<<<<<<<
 * 
 *     def setLocalToGlobal(self, begin, end, begin_args=None, begin_kargs=None,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetGlobalToLocalVecScatter(__pyx_v_self->__pyx_base.dm, __pyx_v_gtol->sct)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(44, 57, __pyx_L1_error)

  /* "PETSc/DMShell.pyx":56
 *         CHKERR( DMShellSetGlobalToLocal(self.dm, cbegin, cend) )
 * 
 *     def setGlobalToLocalVecScatter(self, Scatter gtol not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetGlobalToLocalVecScatter(self.dm, gtol.sct) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setGlobalToLocalVecScatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":59
 *         CHKERR( DMShellSetGlobalToLocalVecScatter(self.dm, gtol.sct) )
 * 
 *     def setLocalToGlobal(self, begin, end, begin_args=None, begin_kargs=None,             # <<<<<<<<<<<<<<
 *                          end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_17setLocalToGlobal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_16setLocalToGlobal[] = "DMShell.setLocalToGlobal(self, begin, end, begin_args=None, begin_kargs=None, end_args=None, end_kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_17setLocalToGlobal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_begin = 0;
  PyObject *__pyx_v_end = 0;
  PyObject *__pyx_v_begin_args = 0;
  PyObject *__pyx_v_begin_kargs = 0;
  PyObject *__pyx_v_end_args = 0;
  PyObject *__pyx_v_end_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setLocalToGlobal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_begin,&__pyx_n_s_end,&__pyx_n_s_begin_args,&__pyx_n_s_begin_kargs,&__pyx_n_s_end_args,&__pyx_n_s_end_kargs,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);

    /* "PETSc/DMShell.pyx":60
 * 
 *     def setLocalToGlobal(self, begin, end, begin_args=None, begin_kargs=None,
 *                          end_args=None, end_kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 *         if begin is not None:
 */
    values[4] = ((PyObject *)Py_None);
    values[5] = ((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  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_begin)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setLocalToGlobal", 0, 2, 6, 1); __PYX_ERR(44, 59, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_begin_args);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_begin_kargs);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_args);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_kargs);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setLocalToGlobal") < 0)) __PYX_ERR(44, 59, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_begin = values[0];
    __pyx_v_end = values[1];
    __pyx_v_begin_args = values[2];
    __pyx_v_begin_kargs = values[3];
    __pyx_v_end_args = values[4];
    __pyx_v_end_kargs = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setLocalToGlobal", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 59, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setLocalToGlobal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_16setLocalToGlobal(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_begin, __pyx_v_end, __pyx_v_begin_args, __pyx_v_begin_kargs, __pyx_v_end_args, __pyx_v_end_kargs);

  /* "PETSc/DMShell.pyx":59
 *         CHKERR( DMShellSetGlobalToLocalVecScatter(self.dm, gtol.sct) )
 * 
 *     def setLocalToGlobal(self, begin, end, begin_args=None, begin_kargs=None,             # <<<<<<<<<<<<<<
 *                          end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_16setLocalToGlobal(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_begin, PyObject *__pyx_v_end, PyObject *__pyx_v_begin_args, PyObject *__pyx_v_begin_kargs, PyObject *__pyx_v_end_args, PyObject *__pyx_v_end_kargs) {
  __pyx_t_8petsc4py_5PETSc_PetscDMShellXToYFunction __pyx_v_cbegin;
  __pyx_t_8petsc4py_5PETSc_PetscDMShellXToYFunction __pyx_v_cend;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setLocalToGlobal", 0);
  __Pyx_INCREF(__pyx_v_begin_args);
  __Pyx_INCREF(__pyx_v_begin_kargs);
  __Pyx_INCREF(__pyx_v_end_args);
  __Pyx_INCREF(__pyx_v_end_kargs);

  /* "PETSc/DMShell.pyx":61
 *     def setLocalToGlobal(self, begin, end, begin_args=None, begin_kargs=None,
 *                          end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL             # <<<<<<<<<<<<<<
 *         if begin is not None:
 *             if begin_args  is None: begin_args = ()
 */
  __pyx_v_cbegin = NULL;
  __pyx_v_cend = NULL;

  /* "PETSc/DMShell.pyx":62
 *                          end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 *         if begin is not None:             # <<<<<<<<<<<<<<
 *             if begin_args  is None: begin_args = ()
 *             if begin_kargs is None: begin_kargs = {}
 */
  __pyx_t_1 = (__pyx_v_begin != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMShell.pyx":63
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 *         if begin is not None:
 *             if begin_args  is None: begin_args = ()             # <<<<<<<<<<<<<<
 *             if begin_kargs is None: begin_kargs = {}
 *             context = (begin, begin_args, begin_kargs)
 */
    __pyx_t_2 = (__pyx_v_begin_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_begin_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":64
 *         if begin is not None:
 *             if begin_args  is None: begin_args = ()
 *             if begin_kargs is None: begin_kargs = {}             # <<<<<<<<<<<<<<
 *             context = (begin, begin_args, begin_kargs)
 *             self.set_attr('__l2g_begin__', context)
 */
    __pyx_t_1 = (__pyx_v_begin_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_begin_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":65
 *             if begin_args  is None: begin_args = ()
 *             if begin_kargs is None: begin_kargs = {}
 *             context = (begin, begin_args, begin_kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__l2g_begin__', context)
 *             cbegin = &DMSHELL_LocalToGlobalBegin
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_begin);
    __Pyx_GIVEREF(__pyx_v_begin);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_begin);
    __Pyx_INCREF(__pyx_v_begin_args);
    __Pyx_GIVEREF(__pyx_v_begin_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_begin_args);
    __Pyx_INCREF(__pyx_v_begin_kargs);
    __Pyx_GIVEREF(__pyx_v_begin_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_begin_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":66
 *             if begin_kargs is None: begin_kargs = {}
 *             context = (begin, begin_args, begin_kargs)
 *             self.set_attr('__l2g_begin__', context)             # <<<<<<<<<<<<<<
 *             cbegin = &DMSHELL_LocalToGlobalBegin
 *         if end is not None:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__l2g_begin__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 66, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":67
 *             context = (begin, begin_args, begin_kargs)
 *             self.set_attr('__l2g_begin__', context)
 *             cbegin = &DMSHELL_LocalToGlobalBegin             # <<<<<<<<<<<<<<
 *         if end is not None:
 *             if end_args  is None: end_args = ()
 */
    __pyx_v_cbegin = (&__pyx_f_8petsc4py_5PETSc_DMSHELL_LocalToGlobalBegin);

    /* "PETSc/DMShell.pyx":62
 *                          end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 *         if begin is not None:             # <<<<<<<<<<<<<<
 *             if begin_args  is None: begin_args = ()
 *             if begin_kargs is None: begin_kargs = {}
 */
  }

  /* "PETSc/DMShell.pyx":68
 *             self.set_attr('__l2g_begin__', context)
 *             cbegin = &DMSHELL_LocalToGlobalBegin
 *         if end is not None:             # <<<<<<<<<<<<<<
 *             if end_args  is None: end_args = ()
 *             if end_kargs is None: end_kargs = {}
 */
  __pyx_t_2 = (__pyx_v_end != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/DMShell.pyx":69
 *             cbegin = &DMSHELL_LocalToGlobalBegin
 *         if end is not None:
 *             if end_args  is None: end_args = ()             # <<<<<<<<<<<<<<
 *             if end_kargs is None: end_kargs = {}
 *             context = (end, end_args, end_kargs)
 */
    __pyx_t_1 = (__pyx_v_end_args == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_end_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":70
 *         if end is not None:
 *             if end_args  is None: end_args = ()
 *             if end_kargs is None: end_kargs = {}             # <<<<<<<<<<<<<<
 *             context = (end, end_args, end_kargs)
 *             self.set_attr('__l2g_end__', context)
 */
    __pyx_t_2 = (__pyx_v_end_kargs == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_end_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":71
 *             if end_args  is None: end_args = ()
 *             if end_kargs is None: end_kargs = {}
 *             context = (end, end_args, end_kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__l2g_end__', context)
 *             cend = &DMSHELL_LocalToGlobalEnd
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 71, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_end);
    __Pyx_GIVEREF(__pyx_v_end);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_end);
    __Pyx_INCREF(__pyx_v_end_args);
    __Pyx_GIVEREF(__pyx_v_end_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_end_args);
    __Pyx_INCREF(__pyx_v_end_kargs);
    __Pyx_GIVEREF(__pyx_v_end_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_end_kargs);
    __Pyx_XDECREF_SET(__pyx_v_context, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":72
 *             if end_kargs is None: end_kargs = {}
 *             context = (end, end_args, end_kargs)
 *             self.set_attr('__l2g_end__', context)             # <<<<<<<<<<<<<<
 *             cend = &DMSHELL_LocalToGlobalEnd
 *         CHKERR( DMShellSetLocalToGlobal(self.dm, cbegin, cend) )
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__l2g_end__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 72, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":73
 *             context = (end, end_args, end_kargs)
 *             self.set_attr('__l2g_end__', context)
 *             cend = &DMSHELL_LocalToGlobalEnd             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetLocalToGlobal(self.dm, cbegin, cend) )
 * 
 */
    __pyx_v_cend = (&__pyx_f_8petsc4py_5PETSc_DMSHELL_LocalToGlobalEnd);

    /* "PETSc/DMShell.pyx":68
 *             self.set_attr('__l2g_begin__', context)
 *             cbegin = &DMSHELL_LocalToGlobalBegin
 *         if end is not None:             # <<<<<<<<<<<<<<
 *             if end_args  is None: end_args = ()
 *             if end_kargs is None: end_kargs = {}
 */
  }

  /* "PETSc/DMShell.pyx":74
 *             self.set_attr('__l2g_end__', context)
 *             cend = &DMSHELL_LocalToGlobalEnd
 *         CHKERR( DMShellSetLocalToGlobal(self.dm, cbegin, cend) )             # <<<<<<<<<<<<<<
 * 
 *     def setLocalToGlobalVecScatter(self, Scatter ltog not None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetLocalToGlobal(__pyx_v_self->__pyx_base.dm, __pyx_v_cbegin, __pyx_v_cend)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 74, __pyx_L1_error)

  /* "PETSc/DMShell.pyx":59
 *         CHKERR( DMShellSetGlobalToLocalVecScatter(self.dm, gtol.sct) )
 * 
 *     def setLocalToGlobal(self, begin, end, begin_args=None, begin_kargs=None,             # <<<<<<<<<<<<<<
 *                          end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setLocalToGlobal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_begin_args);
  __Pyx_XDECREF(__pyx_v_begin_kargs);
  __Pyx_XDECREF(__pyx_v_end_args);
  __Pyx_XDECREF(__pyx_v_end_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":76
 *         CHKERR( DMShellSetLocalToGlobal(self.dm, cbegin, cend) )
 * 
 *     def setLocalToGlobalVecScatter(self, Scatter ltog not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetLocalToGlobalVecScatter(self.dm, ltog.sct) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_19setLocalToGlobalVecScatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_18setLocalToGlobalVecScatter[] = "DMShell.setLocalToGlobalVecScatter(self, Scatter ltog)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_19setLocalToGlobalVecScatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscScatterObject *__pyx_v_ltog = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setLocalToGlobalVecScatter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ltog,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);
        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_ltog)) != 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, "setLocalToGlobalVecScatter") < 0)) __PYX_ERR(44, 76, __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_ltog = ((struct PyPetscScatterObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setLocalToGlobalVecScatter", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 76, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setLocalToGlobalVecScatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ltog), __pyx_ptype_8petsc4py_5PETSc_Scatter, 0, "ltog", 0))) __PYX_ERR(44, 76, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_18setLocalToGlobalVecScatter(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_ltog);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_18setLocalToGlobalVecScatter(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, struct PyPetscScatterObject *__pyx_v_ltog) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setLocalToGlobalVecScatter", 0);

  /* "PETSc/DMShell.pyx":77
 * 
 *     def setLocalToGlobalVecScatter(self, Scatter ltog not None):
 *         CHKERR( DMShellSetLocalToGlobalVecScatter(self.dm, ltog.sct) )             # <<<<<<<<<<<<<<
 * 
 *     def setLocalToLocal(self, begin, end, begin_args=None, begin_kargs=None,
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetLocalToGlobalVecScatter(__pyx_v_self->__pyx_base.dm, __pyx_v_ltog->sct)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(44, 77, __pyx_L1_error)

  /* "PETSc/DMShell.pyx":76
 *         CHKERR( DMShellSetLocalToGlobal(self.dm, cbegin, cend) )
 * 
 *     def setLocalToGlobalVecScatter(self, Scatter ltog not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetLocalToGlobalVecScatter(self.dm, ltog.sct) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setLocalToGlobalVecScatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":79
 *         CHKERR( DMShellSetLocalToGlobalVecScatter(self.dm, ltog.sct) )
 * 
 *     def setLocalToLocal(self, begin, end, begin_args=None, begin_kargs=None,             # <<<<<<<<<<<<<<
 *                         end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_21setLocalToLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_20setLocalToLocal[] = "DMShell.setLocalToLocal(self, begin, end, begin_args=None, begin_kargs=None, end_args=None, end_kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_21setLocalToLocal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_begin = 0;
  PyObject *__pyx_v_end = 0;
  PyObject *__pyx_v_begin_args = 0;
  PyObject *__pyx_v_begin_kargs = 0;
  PyObject *__pyx_v_end_args = 0;
  PyObject *__pyx_v_end_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setLocalToLocal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_begin,&__pyx_n_s_end,&__pyx_n_s_begin_args,&__pyx_n_s_begin_kargs,&__pyx_n_s_end_args,&__pyx_n_s_end_kargs,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);

    /* "PETSc/DMShell.pyx":80
 * 
 *     def setLocalToLocal(self, begin, end, begin_args=None, begin_kargs=None,
 *                         end_args=None, end_kargs=None):             # <<<<<<<<<<<<<<
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 *         cbegin = NULL
 */
    values[4] = ((PyObject *)Py_None);
    values[5] = ((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  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_begin)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setLocalToLocal", 0, 2, 6, 1); __PYX_ERR(44, 79, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_begin_args);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_begin_kargs);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_args);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_kargs);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setLocalToLocal") < 0)) __PYX_ERR(44, 79, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_begin = values[0];
    __pyx_v_end = values[1];
    __pyx_v_begin_args = values[2];
    __pyx_v_begin_kargs = values[3];
    __pyx_v_end_args = values[4];
    __pyx_v_end_kargs = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setLocalToLocal", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 79, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setLocalToLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_20setLocalToLocal(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_begin, __pyx_v_end, __pyx_v_begin_args, __pyx_v_begin_kargs, __pyx_v_end_args, __pyx_v_end_kargs);

  /* "PETSc/DMShell.pyx":79
 *         CHKERR( DMShellSetLocalToGlobalVecScatter(self.dm, ltog.sct) )
 * 
 *     def setLocalToLocal(self, begin, end, begin_args=None, begin_kargs=None,             # <<<<<<<<<<<<<<
 *                         end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_20setLocalToLocal(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_begin, PyObject *__pyx_v_end, PyObject *__pyx_v_begin_args, PyObject *__pyx_v_begin_kargs, PyObject *__pyx_v_end_args, PyObject *__pyx_v_end_kargs) {
  __pyx_t_8petsc4py_5PETSc_PetscDMShellXToYFunction __pyx_v_cbegin;
  __pyx_t_8petsc4py_5PETSc_PetscDMShellXToYFunction __pyx_v_cend;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setLocalToLocal", 0);
  __Pyx_INCREF(__pyx_v_begin_args);
  __Pyx_INCREF(__pyx_v_begin_kargs);
  __Pyx_INCREF(__pyx_v_end_args);
  __Pyx_INCREF(__pyx_v_end_kargs);

  /* "PETSc/DMShell.pyx":81
 *     def setLocalToLocal(self, begin, end, begin_args=None, begin_kargs=None,
 *                         end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL             # <<<<<<<<<<<<<<
 *         cbegin = NULL
 *         cend = NULL
 */
  __pyx_v_cbegin = NULL;
  __pyx_v_cend = NULL;

  /* "PETSc/DMShell.pyx":82
 *                         end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 *         cbegin = NULL             # <<<<<<<<<<<<<<
 *         cend = NULL
 *         if begin is not None:
 */
  __pyx_v_cbegin = NULL;

  /* "PETSc/DMShell.pyx":83
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 *         cbegin = NULL
 *         cend = NULL             # <<<<<<<<<<<<<<
 *         if begin is not None:
 *             if begin_args  is None: begin_args = ()
 */
  __pyx_v_cend = NULL;

  /* "PETSc/DMShell.pyx":84
 *         cbegin = NULL
 *         cend = NULL
 *         if begin is not None:             # <<<<<<<<<<<<<<
 *             if begin_args  is None: begin_args = ()
 *             if begin_kargs is None: begin_kargs = {}
 */
  __pyx_t_1 = (__pyx_v_begin != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMShell.pyx":85
 *         cend = NULL
 *         if begin is not None:
 *             if begin_args  is None: begin_args = ()             # <<<<<<<<<<<<<<
 *             if begin_kargs is None: begin_kargs = {}
 *             context = (begin, begin_args, begin_kargs)
 */
    __pyx_t_2 = (__pyx_v_begin_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_begin_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":86
 *         if begin is not None:
 *             if begin_args  is None: begin_args = ()
 *             if begin_kargs is None: begin_kargs = {}             # <<<<<<<<<<<<<<
 *             context = (begin, begin_args, begin_kargs)
 *             self.set_attr('__l2l_begin__', context)
 */
    __pyx_t_1 = (__pyx_v_begin_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_begin_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":87
 *             if begin_args  is None: begin_args = ()
 *             if begin_kargs is None: begin_kargs = {}
 *             context = (begin, begin_args, begin_kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__l2l_begin__', context)
 *             cbegin = &DMSHELL_LocalToLocalBegin
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_begin);
    __Pyx_GIVEREF(__pyx_v_begin);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_begin);
    __Pyx_INCREF(__pyx_v_begin_args);
    __Pyx_GIVEREF(__pyx_v_begin_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_begin_args);
    __Pyx_INCREF(__pyx_v_begin_kargs);
    __Pyx_GIVEREF(__pyx_v_begin_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_begin_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":88
 *             if begin_kargs is None: begin_kargs = {}
 *             context = (begin, begin_args, begin_kargs)
 *             self.set_attr('__l2l_begin__', context)             # <<<<<<<<<<<<<<
 *             cbegin = &DMSHELL_LocalToLocalBegin
 *         if end is not None:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__l2l_begin__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":89
 *             context = (begin, begin_args, begin_kargs)
 *             self.set_attr('__l2l_begin__', context)
 *             cbegin = &DMSHELL_LocalToLocalBegin             # <<<<<<<<<<<<<<
 *         if end is not None:
 *             if end_args  is None: end_args = ()
 */
    __pyx_v_cbegin = (&__pyx_f_8petsc4py_5PETSc_DMSHELL_LocalToLocalBegin);

    /* "PETSc/DMShell.pyx":84
 *         cbegin = NULL
 *         cend = NULL
 *         if begin is not None:             # <<<<<<<<<<<<<<
 *             if begin_args  is None: begin_args = ()
 *             if begin_kargs is None: begin_kargs = {}
 */
  }

  /* "PETSc/DMShell.pyx":90
 *             self.set_attr('__l2l_begin__', context)
 *             cbegin = &DMSHELL_LocalToLocalBegin
 *         if end is not None:             # <<<<<<<<<<<<<<
 *             if end_args  is None: end_args = ()
 *             if end_kargs is None: end_kargs = {}
 */
  __pyx_t_2 = (__pyx_v_end != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "PETSc/DMShell.pyx":91
 *             cbegin = &DMSHELL_LocalToLocalBegin
 *         if end is not None:
 *             if end_args  is None: end_args = ()             # <<<<<<<<<<<<<<
 *             if end_kargs is None: end_kargs = {}
 *             context = (end, end_args, end_kargs)
 */
    __pyx_t_1 = (__pyx_v_end_args == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_end_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":92
 *         if end is not None:
 *             if end_args  is None: end_args = ()
 *             if end_kargs is None: end_kargs = {}             # <<<<<<<<<<<<<<
 *             context = (end, end_args, end_kargs)
 *             self.set_attr('__l2l_end__', context)
 */
    __pyx_t_2 = (__pyx_v_end_kargs == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 92, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_end_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":93
 *             if end_args  is None: end_args = ()
 *             if end_kargs is None: end_kargs = {}
 *             context = (end, end_args, end_kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__l2l_end__', context)
 *             cend = &DMSHELL_LocalToLocalEnd
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_end);
    __Pyx_GIVEREF(__pyx_v_end);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_end);
    __Pyx_INCREF(__pyx_v_end_args);
    __Pyx_GIVEREF(__pyx_v_end_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_end_args);
    __Pyx_INCREF(__pyx_v_end_kargs);
    __Pyx_GIVEREF(__pyx_v_end_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_end_kargs);
    __Pyx_XDECREF_SET(__pyx_v_context, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":94
 *             if end_kargs is None: end_kargs = {}
 *             context = (end, end_args, end_kargs)
 *             self.set_attr('__l2l_end__', context)             # <<<<<<<<<<<<<<
 *             cend = &DMSHELL_LocalToLocalEnd
 *         CHKERR( DMShellSetLocalToLocal(self.dm, cbegin, cend) )
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__l2l_end__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 94, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":95
 *             context = (end, end_args, end_kargs)
 *             self.set_attr('__l2l_end__', context)
 *             cend = &DMSHELL_LocalToLocalEnd             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetLocalToLocal(self.dm, cbegin, cend) )
 * 
 */
    __pyx_v_cend = (&__pyx_f_8petsc4py_5PETSc_DMSHELL_LocalToLocalEnd);

    /* "PETSc/DMShell.pyx":90
 *             self.set_attr('__l2l_begin__', context)
 *             cbegin = &DMSHELL_LocalToLocalBegin
 *         if end is not None:             # <<<<<<<<<<<<<<
 *             if end_args  is None: end_args = ()
 *             if end_kargs is None: end_kargs = {}
 */
  }

  /* "PETSc/DMShell.pyx":96
 *             self.set_attr('__l2l_end__', context)
 *             cend = &DMSHELL_LocalToLocalEnd
 *         CHKERR( DMShellSetLocalToLocal(self.dm, cbegin, cend) )             # <<<<<<<<<<<<<<
 * 
 *     def setLocalToLocalVecScatter(self, Scatter ltol not None):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetLocalToLocal(__pyx_v_self->__pyx_base.dm, __pyx_v_cbegin, __pyx_v_cend)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 96, __pyx_L1_error)

  /* "PETSc/DMShell.pyx":79
 *         CHKERR( DMShellSetLocalToGlobalVecScatter(self.dm, ltog.sct) )
 * 
 *     def setLocalToLocal(self, begin, end, begin_args=None, begin_kargs=None,             # <<<<<<<<<<<<<<
 *                         end_args=None, end_kargs=None):
 *         cdef PetscDMShellXToYFunction cbegin = NULL, cend = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setLocalToLocal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_begin_args);
  __Pyx_XDECREF(__pyx_v_begin_kargs);
  __Pyx_XDECREF(__pyx_v_end_args);
  __Pyx_XDECREF(__pyx_v_end_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":98
 *         CHKERR( DMShellSetLocalToLocal(self.dm, cbegin, cend) )
 * 
 *     def setLocalToLocalVecScatter(self, Scatter ltol not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetLocalToLocalVecScatter(self.dm, ltol.sct) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_23setLocalToLocalVecScatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_22setLocalToLocalVecScatter[] = "DMShell.setLocalToLocalVecScatter(self, Scatter ltol)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_23setLocalToLocalVecScatter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscScatterObject *__pyx_v_ltol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setLocalToLocalVecScatter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ltol,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);
        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_ltol)) != 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, "setLocalToLocalVecScatter") < 0)) __PYX_ERR(44, 98, __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_ltol = ((struct PyPetscScatterObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setLocalToLocalVecScatter", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 98, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setLocalToLocalVecScatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ltol), __pyx_ptype_8petsc4py_5PETSc_Scatter, 0, "ltol", 0))) __PYX_ERR(44, 98, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_22setLocalToLocalVecScatter(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_ltol);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_22setLocalToLocalVecScatter(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, struct PyPetscScatterObject *__pyx_v_ltol) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setLocalToLocalVecScatter", 0);

  /* "PETSc/DMShell.pyx":99
 * 
 *     def setLocalToLocalVecScatter(self, Scatter ltol not None):
 *         CHKERR( DMShellSetLocalToLocalVecScatter(self.dm, ltol.sct) )             # <<<<<<<<<<<<<<
 * 
 *     def setCreateMatrix(self, create_matrix, args=None, kargs=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetLocalToLocalVecScatter(__pyx_v_self->__pyx_base.dm, __pyx_v_ltol->sct)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(44, 99, __pyx_L1_error)

  /* "PETSc/DMShell.pyx":98
 *         CHKERR( DMShellSetLocalToLocal(self.dm, cbegin, cend) )
 * 
 *     def setLocalToLocalVecScatter(self, Scatter ltol not None):             # <<<<<<<<<<<<<<
 *         CHKERR( DMShellSetLocalToLocalVecScatter(self.dm, ltol.sct) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setLocalToLocalVecScatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":101
 *         CHKERR( DMShellSetLocalToLocalVecScatter(self.dm, ltol.sct) )
 * 
 *     def setCreateMatrix(self, create_matrix, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if create_matrix is not None:
 *             if args  is None: args  = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_25setCreateMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_24setCreateMatrix[] = "DMShell.setCreateMatrix(self, create_matrix, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_25setCreateMatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_create_matrix = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCreateMatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_create_matrix,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_create_matrix)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setCreateMatrix") < 0)) __PYX_ERR(44, 101, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_create_matrix = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCreateMatrix", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 101, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_24setCreateMatrix(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_create_matrix, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_24setCreateMatrix(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_create_matrix, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setCreateMatrix", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/DMShell.pyx":102
 * 
 *     def setCreateMatrix(self, create_matrix, args=None, kargs=None):
 *         if create_matrix is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_create_matrix != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMShell.pyx":103
 *     def setCreateMatrix(self, create_matrix, args=None, kargs=None):
 *         if create_matrix is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (create_matrix, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":104
 *         if create_matrix is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (create_matrix, args, kargs)
 *             self.set_attr('__create_matrix__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":105
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (create_matrix, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__create_matrix__', context)
 *             CHKERR( DMShellSetCreateMatrix(self.dm, DMSHELL_CreateMatrix) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_create_matrix);
    __Pyx_GIVEREF(__pyx_v_create_matrix);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_create_matrix);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":106
 *             if kargs is None: kargs = {}
 *             context = (create_matrix, args, kargs)
 *             self.set_attr('__create_matrix__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( DMShellSetCreateMatrix(self.dm, DMSHELL_CreateMatrix) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__create_matrix__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":107
 *             context = (create_matrix, args, kargs)
 *             self.set_attr('__create_matrix__', context)
 *             CHKERR( DMShellSetCreateMatrix(self.dm, DMSHELL_CreateMatrix) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( DMShellSetCreateMatrix(self.dm, NULL) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateMatrix(__pyx_v_self->__pyx_base.dm, __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateMatrix)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 107, __pyx_L1_error)

    /* "PETSc/DMShell.pyx":102
 * 
 *     def setCreateMatrix(self, create_matrix, args=None, kargs=None):
 *         if create_matrix is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/DMShell.pyx":109
 *             CHKERR( DMShellSetCreateMatrix(self.dm, DMSHELL_CreateMatrix) )
 *         else:
 *             CHKERR( DMShellSetCreateMatrix(self.dm, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def setCoarsen(self, coarsen, args=None, kargs=None):
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateMatrix(__pyx_v_self->__pyx_base.dm, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 109, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/DMShell.pyx":101
 *         CHKERR( DMShellSetLocalToLocalVecScatter(self.dm, ltol.sct) )
 * 
 *     def setCreateMatrix(self, create_matrix, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if create_matrix is not None:
 *             if args  is None: args  = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":111
 *             CHKERR( DMShellSetCreateMatrix(self.dm, NULL) )
 * 
 *     def setCoarsen(self, coarsen, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if coarsen is not None:
 *             if args  is None: args  = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_27setCoarsen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_26setCoarsen[] = "DMShell.setCoarsen(self, coarsen, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_27setCoarsen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_coarsen = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCoarsen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coarsen,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_coarsen)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setCoarsen") < 0)) __PYX_ERR(44, 111, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_coarsen = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCoarsen", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 111, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCoarsen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_26setCoarsen(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_coarsen, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_26setCoarsen(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_coarsen, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setCoarsen", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/DMShell.pyx":112
 * 
 *     def setCoarsen(self, coarsen, args=None, kargs=None):
 *         if coarsen is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_coarsen != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMShell.pyx":113
 *     def setCoarsen(self, coarsen, args=None, kargs=None):
 *         if coarsen is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (coarsen, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":114
 *         if coarsen is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (coarsen, args, kargs)
 *             self.set_attr('__coarsen__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":115
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (coarsen, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__coarsen__', context)
 *             CHKERR( DMShellSetCoarsen(self.dm, DMSHELL_Coarsen) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_coarsen);
    __Pyx_GIVEREF(__pyx_v_coarsen);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_coarsen);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":116
 *             if kargs is None: kargs = {}
 *             context = (coarsen, args, kargs)
 *             self.set_attr('__coarsen__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( DMShellSetCoarsen(self.dm, DMSHELL_Coarsen) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__coarsen__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":117
 *             context = (coarsen, args, kargs)
 *             self.set_attr('__coarsen__', context)
 *             CHKERR( DMShellSetCoarsen(self.dm, DMSHELL_Coarsen) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( DMShellSetCoarsen(self.dm, NULL) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCoarsen(__pyx_v_self->__pyx_base.dm, __pyx_f_8petsc4py_5PETSc_DMSHELL_Coarsen)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 117, __pyx_L1_error)

    /* "PETSc/DMShell.pyx":112
 * 
 *     def setCoarsen(self, coarsen, args=None, kargs=None):
 *         if coarsen is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/DMShell.pyx":119
 *             CHKERR( DMShellSetCoarsen(self.dm, DMSHELL_Coarsen) )
 *         else:
 *             CHKERR( DMShellSetCoarsen(self.dm, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def setRefine(self, refine, args=None, kargs=None):
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCoarsen(__pyx_v_self->__pyx_base.dm, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 119, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/DMShell.pyx":111
 *             CHKERR( DMShellSetCreateMatrix(self.dm, NULL) )
 * 
 *     def setCoarsen(self, coarsen, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if coarsen is not None:
 *             if args  is None: args  = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCoarsen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":121
 *             CHKERR( DMShellSetCoarsen(self.dm, NULL) )
 * 
 *     def setRefine(self, refine, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if refine is not None:
 *             if args  is None: args  = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_29setRefine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_28setRefine[] = "DMShell.setRefine(self, refine, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_29setRefine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_refine = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRefine (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_refine,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_refine)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setRefine") < 0)) __PYX_ERR(44, 121, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_refine = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRefine", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 121, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setRefine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_28setRefine(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_refine, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_28setRefine(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_refine, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setRefine", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/DMShell.pyx":122
 * 
 *     def setRefine(self, refine, args=None, kargs=None):
 *         if refine is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_refine != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMShell.pyx":123
 *     def setRefine(self, refine, args=None, kargs=None):
 *         if refine is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (refine, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":124
 *         if refine is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (refine, args, kargs)
 *             self.set_attr('__refine__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":125
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (refine, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__refine__', context)
 *             CHKERR( DMShellSetRefine(self.dm, DMSHELL_Refine) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_refine);
    __Pyx_GIVEREF(__pyx_v_refine);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_refine);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":126
 *             if kargs is None: kargs = {}
 *             context = (refine, args, kargs)
 *             self.set_attr('__refine__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( DMShellSetRefine(self.dm, DMSHELL_Refine) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__refine__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":127
 *             context = (refine, args, kargs)
 *             self.set_attr('__refine__', context)
 *             CHKERR( DMShellSetRefine(self.dm, DMSHELL_Refine) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( DMShellSetRefine(self.dm, NULL) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetRefine(__pyx_v_self->__pyx_base.dm, __pyx_f_8petsc4py_5PETSc_DMSHELL_Refine)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 127, __pyx_L1_error)

    /* "PETSc/DMShell.pyx":122
 * 
 *     def setRefine(self, refine, args=None, kargs=None):
 *         if refine is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/DMShell.pyx":129
 *             CHKERR( DMShellSetRefine(self.dm, DMSHELL_Refine) )
 *         else:
 *             CHKERR( DMShellSetRefine(self.dm, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def setCreateInterpolation(self, create_interpolation, args=None, kargs=None):
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetRefine(__pyx_v_self->__pyx_base.dm, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 129, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/DMShell.pyx":121
 *             CHKERR( DMShellSetCoarsen(self.dm, NULL) )
 * 
 *     def setRefine(self, refine, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if refine is not None:
 *             if args  is None: args  = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setRefine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":131
 *             CHKERR( DMShellSetRefine(self.dm, NULL) )
 * 
 *     def setCreateInterpolation(self, create_interpolation, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if create_interpolation is not None:
 *             if args  is None: args  = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_31setCreateInterpolation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_30setCreateInterpolation[] = "DMShell.setCreateInterpolation(self, create_interpolation, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_31setCreateInterpolation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_create_interpolation = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCreateInterpolation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_create_interpolation,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_create_interpolation)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setCreateInterpolation") < 0)) __PYX_ERR(44, 131, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_create_interpolation = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCreateInterpolation", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 131, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_30setCreateInterpolation(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_create_interpolation, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_30setCreateInterpolation(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_create_interpolation, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setCreateInterpolation", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/DMShell.pyx":132
 * 
 *     def setCreateInterpolation(self, create_interpolation, args=None, kargs=None):
 *         if create_interpolation is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_create_interpolation != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMShell.pyx":133
 *     def setCreateInterpolation(self, create_interpolation, args=None, kargs=None):
 *         if create_interpolation is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (create_interpolation, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":134
 *         if create_interpolation is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (create_interpolation, args, kargs)
 *             self.set_attr('__create_interpolation__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":135
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (create_interpolation, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__create_interpolation__', context)
 *             CHKERR( DMShellSetCreateInterpolation(self.dm, DMSHELL_CreateInterpolation) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_create_interpolation);
    __Pyx_GIVEREF(__pyx_v_create_interpolation);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_create_interpolation);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":136
 *             if kargs is None: kargs = {}
 *             context = (create_interpolation, args, kargs)
 *             self.set_attr('__create_interpolation__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( DMShellSetCreateInterpolation(self.dm, DMSHELL_CreateInterpolation) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__create_interpolation__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":137
 *             context = (create_interpolation, args, kargs)
 *             self.set_attr('__create_interpolation__', context)
 *             CHKERR( DMShellSetCreateInterpolation(self.dm, DMSHELL_CreateInterpolation) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( DMShellSetCreateInterpolation(self.dm, NULL) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateInterpolation(__pyx_v_self->__pyx_base.dm, __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateInterpolation)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 137, __pyx_L1_error)

    /* "PETSc/DMShell.pyx":132
 * 
 *     def setCreateInterpolation(self, create_interpolation, args=None, kargs=None):
 *         if create_interpolation is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/DMShell.pyx":139
 *             CHKERR( DMShellSetCreateInterpolation(self.dm, DMSHELL_CreateInterpolation) )
 *         else:
 *             CHKERR( DMShellSetCreateInterpolation(self.dm, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def setCreateInjection(self, create_injection, args=None, kargs=None):
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateInterpolation(__pyx_v_self->__pyx_base.dm, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 139, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/DMShell.pyx":131
 *             CHKERR( DMShellSetRefine(self.dm, NULL) )
 * 
 *     def setCreateInterpolation(self, create_interpolation, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if create_interpolation is not None:
 *             if args  is None: args  = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateInterpolation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":141
 *             CHKERR( DMShellSetCreateInterpolation(self.dm, NULL) )
 * 
 *     def setCreateInjection(self, create_injection, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if create_injection is not None:
 *             if args  is None: args  = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_33setCreateInjection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_32setCreateInjection[] = "DMShell.setCreateInjection(self, create_injection, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_33setCreateInjection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_create_injection = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCreateInjection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_create_injection,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_create_injection)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setCreateInjection") < 0)) __PYX_ERR(44, 141, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_create_injection = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCreateInjection", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 141, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateInjection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_32setCreateInjection(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_create_injection, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_32setCreateInjection(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_create_injection, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setCreateInjection", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/DMShell.pyx":142
 * 
 *     def setCreateInjection(self, create_injection, args=None, kargs=None):
 *         if create_injection is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_create_injection != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMShell.pyx":143
 *     def setCreateInjection(self, create_injection, args=None, kargs=None):
 *         if create_injection is not None:
 *             if args  is None: args  = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (create_injection, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":144
 *         if create_injection is not None:
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (create_injection, args, kargs)
 *             self.set_attr('__create_injection__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":145
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 *             context = (create_injection, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__create_injection__', context)
 *             CHKERR( DMShellSetCreateInjection(self.dm, DMSHELL_CreateInjection) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_create_injection);
    __Pyx_GIVEREF(__pyx_v_create_injection);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_create_injection);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":146
 *             if kargs is None: kargs = {}
 *             context = (create_injection, args, kargs)
 *             self.set_attr('__create_injection__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( DMShellSetCreateInjection(self.dm, DMSHELL_CreateInjection) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__create_injection__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":147
 *             context = (create_injection, args, kargs)
 *             self.set_attr('__create_injection__', context)
 *             CHKERR( DMShellSetCreateInjection(self.dm, DMSHELL_CreateInjection) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( DMShellSetCreateInjection(self.dm, NULL) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateInjection(__pyx_v_self->__pyx_base.dm, __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateInjection)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 147, __pyx_L1_error)

    /* "PETSc/DMShell.pyx":142
 * 
 *     def setCreateInjection(self, create_injection, args=None, kargs=None):
 *         if create_injection is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args  = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/DMShell.pyx":149
 *             CHKERR( DMShellSetCreateInjection(self.dm, DMSHELL_CreateInjection) )
 *         else:
 *             CHKERR( DMShellSetCreateInjection(self.dm, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def setCreateFieldDecomposition(self, decomp, args=None, kargs=None):
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateInjection(__pyx_v_self->__pyx_base.dm, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 149, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/DMShell.pyx":141
 *             CHKERR( DMShellSetCreateInterpolation(self.dm, NULL) )
 * 
 *     def setCreateInjection(self, create_injection, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if create_injection is not None:
 *             if args  is None: args  = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateInjection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":151
 *             CHKERR( DMShellSetCreateInjection(self.dm, NULL) )
 * 
 *     def setCreateFieldDecomposition(self, decomp, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if decomp is not None:
 *             if args  is None: args = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_35setCreateFieldDecomposition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_34setCreateFieldDecomposition[] = "DMShell.setCreateFieldDecomposition(self, decomp, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_35setCreateFieldDecomposition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_decomp = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCreateFieldDecomposition (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_decomp,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_decomp)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setCreateFieldDecomposition") < 0)) __PYX_ERR(44, 151, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_decomp = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCreateFieldDecomposition", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 151, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateFieldDecomposition", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_34setCreateFieldDecomposition(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_decomp, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_34setCreateFieldDecomposition(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_decomp, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setCreateFieldDecomposition", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/DMShell.pyx":152
 * 
 *     def setCreateFieldDecomposition(self, decomp, args=None, kargs=None):
 *         if decomp is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_decomp != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMShell.pyx":153
 *     def setCreateFieldDecomposition(self, decomp, args=None, kargs=None):
 *         if decomp is not None:
 *             if args  is None: args = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (decomp, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":154
 *         if decomp is not None:
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (decomp, args, kargs)
 *             self.set_attr('__create_field_decomp__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":155
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}
 *             context = (decomp, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__create_field_decomp__', context)
 *             CHKERR( DMShellSetCreateFieldDecomposition(self.dm, DMSHELL_CreateFieldDecomposition) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_decomp);
    __Pyx_GIVEREF(__pyx_v_decomp);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_decomp);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":156
 *             if kargs is None: kargs = {}
 *             context = (decomp, args, kargs)
 *             self.set_attr('__create_field_decomp__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( DMShellSetCreateFieldDecomposition(self.dm, DMSHELL_CreateFieldDecomposition) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__create_field_decomp__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":157
 *             context = (decomp, args, kargs)
 *             self.set_attr('__create_field_decomp__', context)
 *             CHKERR( DMShellSetCreateFieldDecomposition(self.dm, DMSHELL_CreateFieldDecomposition) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( DMShellSetCreateFieldDecomposition(self.dm, NULL) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateFieldDecomposition(__pyx_v_self->__pyx_base.dm, __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateFieldDecomposition)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 157, __pyx_L1_error)

    /* "PETSc/DMShell.pyx":152
 * 
 *     def setCreateFieldDecomposition(self, decomp, args=None, kargs=None):
 *         if decomp is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/DMShell.pyx":159
 *             CHKERR( DMShellSetCreateFieldDecomposition(self.dm, DMSHELL_CreateFieldDecomposition) )
 *         else:
 *             CHKERR( DMShellSetCreateFieldDecomposition(self.dm, NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def setCreateSubDM(self, create_subdm, args=None, kargs=None):
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateFieldDecomposition(__pyx_v_self->__pyx_base.dm, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 159, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/DMShell.pyx":151
 *             CHKERR( DMShellSetCreateInjection(self.dm, NULL) )
 * 
 *     def setCreateFieldDecomposition(self, decomp, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if decomp is not None:
 *             if args  is None: args = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateFieldDecomposition", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/DMShell.pyx":161
 *             CHKERR( DMShellSetCreateFieldDecomposition(self.dm, NULL) )
 * 
 *     def setCreateSubDM(self, create_subdm, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if create_subdm is not None:
 *             if args  is None: args = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_37setCreateSubDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_7DMShell_36setCreateSubDM[] = "DMShell.setCreateSubDM(self, create_subdm, args=None, kargs=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_7DMShell_37setCreateSubDM(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_create_subdm = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCreateSubDM (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_create_subdm,&__pyx_n_s_args,&__pyx_n_s_kargs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_create_subdm)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kargs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setCreateSubDM") < 0)) __PYX_ERR(44, 161, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_create_subdm = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kargs = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCreateSubDM", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(44, 161, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateSubDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_7DMShell_36setCreateSubDM(((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)__pyx_v_self), __pyx_v_create_subdm, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_7DMShell_36setCreateSubDM(struct __pyx_obj_8petsc4py_5PETSc_DMShell *__pyx_v_self, PyObject *__pyx_v_create_subdm, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setCreateSubDM", 0);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_INCREF(__pyx_v_kargs);

  /* "PETSc/DMShell.pyx":162
 * 
 *     def setCreateSubDM(self, create_subdm, args=None, kargs=None):
 *         if create_subdm is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}
 */
  __pyx_t_1 = (__pyx_v_create_subdm != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "PETSc/DMShell.pyx":163
 *     def setCreateSubDM(self, create_subdm, args=None, kargs=None):
 *         if create_subdm is not None:
 *             if args  is None: args = ()             # <<<<<<<<<<<<<<
 *             if kargs is None: kargs = {}
 *             context = (create_subdm, args, kargs)
 */
    __pyx_t_2 = (__pyx_v_args == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_empty_tuple);
    }

    /* "PETSc/DMShell.pyx":164
 *         if create_subdm is not None:
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}             # <<<<<<<<<<<<<<
 *             context = (create_subdm, args, kargs)
 *             self.set_attr('__create_subdm__', context)
 */
    __pyx_t_1 = (__pyx_v_kargs == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 164, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_kargs, __pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "PETSc/DMShell.pyx":165
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}
 *             context = (create_subdm, args, kargs)             # <<<<<<<<<<<<<<
 *             self.set_attr('__create_subdm__', context)
 *             CHKERR( DMShellSetCreateSubDM(self.dm, DMSHELL_CreateSubDM) )
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_create_subdm);
    __Pyx_GIVEREF(__pyx_v_create_subdm);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_create_subdm);
    __Pyx_INCREF(__pyx_v_args);
    __Pyx_GIVEREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
    __Pyx_INCREF(__pyx_v_kargs);
    __Pyx_GIVEREF(__pyx_v_kargs);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kargs);
    __pyx_v_context = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":166
 *             if kargs is None: kargs = {}
 *             context = (create_subdm, args, kargs)
 *             self.set_attr('__create_subdm__', context)             # <<<<<<<<<<<<<<
 *             CHKERR( DMShellSetCreateSubDM(self.dm, DMSHELL_CreateSubDM) )
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8petsc4py_5PETSc_DMShell *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.set_attr(((struct PyPetscObjectObject *)__pyx_v_self), ((char *)"__create_subdm__"), __pyx_v_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(44, 166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/DMShell.pyx":167
 *             context = (create_subdm, args, kargs)
 *             self.set_attr('__create_subdm__', context)
 *             CHKERR( DMShellSetCreateSubDM(self.dm, DMSHELL_CreateSubDM) )             # <<<<<<<<<<<<<<
 *         else:
 *             CHKERR( DMShellSetCreateSubDM(self.dm, NULL) )
 */
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateSubDM(__pyx_v_self->__pyx_base.dm, __pyx_f_8petsc4py_5PETSc_DMSHELL_CreateSubDM)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 167, __pyx_L1_error)

    /* "PETSc/DMShell.pyx":162
 * 
 *     def setCreateSubDM(self, create_subdm, args=None, kargs=None):
 *         if create_subdm is not None:             # <<<<<<<<<<<<<<
 *             if args  is None: args = ()
 *             if kargs is None: kargs = {}
 */
    goto __pyx_L3;
  }

  /* "PETSc/DMShell.pyx":169
 *             CHKERR( DMShellSetCreateSubDM(self.dm, DMSHELL_CreateSubDM) )
 *         else:
 *             CHKERR( DMShellSetCreateSubDM(self.dm, NULL) )             # <<<<<<<<<<<<<<
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMShellSetCreateSubDM(__pyx_v_self->__pyx_base.dm, NULL)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(44, 169, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "PETSc/DMShell.pyx":161
 *             CHKERR( DMShellSetCreateFieldDecomposition(self.dm, NULL) )
 * 
 *     def setCreateSubDM(self, create_subdm, args=None, kargs=None):             # <<<<<<<<<<<<<<
 *         if create_subdm is not None:
 *             if args  is None: args = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("petsc4py.PETSc.DMShell.setCreateSubDM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":13
 *     Type = SFType
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.sf
 *         self.sf  = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_2SF_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_2SF_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF___cinit__(((struct PyPetscSFObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_2SF___cinit__(struct PyPetscSFObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/SF.pyx":14
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.sf             # <<<<<<<<<<<<<<
 *         self.sf  = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->sf));

  /* "PETSc/SF.pyx":15
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.sf
 *         self.sf  = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->sf = NULL;

  /* "PETSc/SF.pyx":13
 *     Type = SFType
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.sf
 *         self.sf  = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":17
 *         self.sf  = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFDestroy(&self.sf) )
 *         self.sf = NULL
 */

/* Python wrapper */
static void __pyx_pw_8petsc4py_5PETSc_2SF_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8petsc4py_5PETSc_2SF_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8petsc4py_5PETSc_2SF_2__dealloc__(((struct PyPetscSFObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_8petsc4py_5PETSc_2SF_2__dealloc__(struct PyPetscSFObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "PETSc/SF.pyx":18
 * 
 *     def __dealloc__(self):
 *         CHKERR( PetscSFDestroy(&self.sf) )             # <<<<<<<<<<<<<<
 *         self.sf = NULL
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFDestroy((&__pyx_v_self->sf))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(45, 18, __pyx_L1_error)

  /* "PETSc/SF.pyx":19
 *     def __dealloc__(self):
 *         CHKERR( PetscSFDestroy(&self.sf) )
 *         self.sf = NULL             # <<<<<<<<<<<<<<
 * 
 *     def view(self, Viewer viewer=None):
 */
  __pyx_v_self->sf = NULL;

  /* "PETSc/SF.pyx":17
 *         self.sf  = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFDestroy(&self.sf) )
 *         self.sf = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("petsc4py.PETSc.SF.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "PETSc/SF.pyx":21
 *         self.sf = NULL
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_4view[] = "SF.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_5view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(45, 21, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(45, 21, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SF.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(45, 21, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_4view(((struct PyPetscSFObject *)__pyx_v_self), __pyx_v_viewer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_4view(struct PyPetscSFObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/SF.pyx":22
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PetscSFView(self.sf, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/SF.pyx":23
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFView(self.sf, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/SF.pyx":24
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PetscSFView(self.sf, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFView(__pyx_v_self->sf, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(45, 24, __pyx_L1_error)

  /* "PETSc/SF.pyx":21
 *         self.sf = NULL
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SF.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":26
 *         CHKERR( PetscSFView(self.sf, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFDestroy(&self.sf) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_6destroy[] = "SF.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_7destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_6destroy(((struct PyPetscSFObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_6destroy(struct PyPetscSFObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/SF.pyx":27
 * 
 *     def destroy(self):
 *         CHKERR( PetscSFDestroy(&self.sf) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFDestroy((&__pyx_v_self->sf))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(45, 27, __pyx_L1_error)

  /* "PETSc/SF.pyx":28
 *     def destroy(self):
 *         CHKERR( PetscSFDestroy(&self.sf) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/SF.pyx":26
 *         CHKERR( PetscSFView(self.sf, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFDestroy(&self.sf) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SF.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":30
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSF newsf = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_8create[] = "SF.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_9create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(45, 30, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(45, 30, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SF.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_8create(((struct PyPetscSFObject *)__pyx_v_self), __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_8create(struct PyPetscSFObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscSF __pyx_v_newsf;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/SF.pyx":31
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscSF newsf = NULL
 *         CHKERR( PetscSFCreate(ccomm, &newsf) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(45, 31, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/SF.pyx":32
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSF newsf = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFCreate(ccomm, &newsf) )
 *         PetscCLEAR(self.obj); self.sf = newsf
 */
  __pyx_v_newsf = NULL;

  /* "PETSc/SF.pyx":33
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSF newsf = NULL
 *         CHKERR( PetscSFCreate(ccomm, &newsf) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.sf = newsf
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFCreate(__pyx_v_ccomm, (&__pyx_v_newsf))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(45, 33, __pyx_L1_error)

  /* "PETSc/SF.pyx":34
 *         cdef PetscSF newsf = NULL
 *         CHKERR( PetscSFCreate(ccomm, &newsf) )
 *         PetscCLEAR(self.obj); self.sf = newsf             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->sf = __pyx_v_newsf;

  /* "PETSc/SF.pyx":35
 *         CHKERR( PetscSFCreate(ccomm, &newsf) )
 *         PetscCLEAR(self.obj); self.sf = newsf
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, sf_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/SF.pyx":30
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscSF newsf = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SF.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":37
 *         return self
 * 
 *     def setType(self, sf_type):             # <<<<<<<<<<<<<<
 *         cdef PetscSFType cval = NULL
 *         sf_type = str2bytes(sf_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_11setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_10setType[] = "SF.setType(self, sf_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_11setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sf_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sf_type,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);
        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_sf_type)) != 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, "setType") < 0)) __PYX_ERR(45, 37, __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_sf_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(45, 37, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SF.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_10setType(((struct PyPetscSFObject *)__pyx_v_self), __pyx_v_sf_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_10setType(struct PyPetscSFObject *__pyx_v_self, PyObject *__pyx_v_sf_type) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_sf_type);

  /* "PETSc/SF.pyx":38
 * 
 *     def setType(self, sf_type):
 *         cdef PetscSFType cval = NULL             # <<<<<<<<<<<<<<
 *         sf_type = str2bytes(sf_type, &cval)
 *         CHKERR( PetscSFSetType(self.sf, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/SF.pyx":39
 *     def setType(self, sf_type):
 *         cdef PetscSFType cval = NULL
 *         sf_type = str2bytes(sf_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFSetType(self.sf, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_sf_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(45, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_sf_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SF.pyx":40
 *         cdef PetscSFType cval = NULL
 *         sf_type = str2bytes(sf_type, &cval)
 *         CHKERR( PetscSFSetType(self.sf, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFSetType(__pyx_v_self->sf, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(45, 40, __pyx_L1_error)

  /* "PETSc/SF.pyx":37
 *         return self
 * 
 *     def setType(self, sf_type):             # <<<<<<<<<<<<<<
 *         cdef PetscSFType cval = NULL
 *         sf_type = str2bytes(sf_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SF.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sf_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":42
 *         CHKERR( PetscSFSetType(self.sf, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscSFType cval = NULL
 *         CHKERR( PetscObjectGetType(<PetscObject>self.sf, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_13getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_12getType[] = "SF.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_13getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_12getType(((struct PyPetscSFObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_12getType(struct PyPetscSFObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/SF.pyx":43
 * 
 *     def getType(self):
 *         cdef PetscSFType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscObjectGetType(<PetscObject>self.sf, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/SF.pyx":44
 *     def getType(self):
 *         cdef PetscSFType cval = NULL
 *         CHKERR( PetscObjectGetType(<PetscObject>self.sf, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscObjectGetType(((PetscObject)__pyx_v_self->sf), (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(45, 44, __pyx_L1_error)

  /* "PETSc/SF.pyx":45
 *         cdef PetscSFType cval = NULL
 *         CHKERR( PetscObjectGetType(<PetscObject>self.sf, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(45, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/SF.pyx":42
 *         CHKERR( PetscSFSetType(self.sf, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscSFType cval = NULL
 *         CHKERR( PetscObjectGetType(<PetscObject>self.sf, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.SF.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":47
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFSetFromOptions(self.sf) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_15setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_14setFromOptions[] = "SF.setFromOptions(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_15setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_14setFromOptions(((struct PyPetscSFObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_14setFromOptions(struct PyPetscSFObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/SF.pyx":48
 * 
 *     def setFromOptions(self):
 *         CHKERR( PetscSFSetFromOptions(self.sf) )             # <<<<<<<<<<<<<<
 * 
 *     def setUp(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFSetFromOptions(__pyx_v_self->sf)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(45, 48, __pyx_L1_error)

  /* "PETSc/SF.pyx":47
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFSetFromOptions(self.sf) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SF.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":50
 *         CHKERR( PetscSFSetFromOptions(self.sf) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFSetUp(self.sf) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_17setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_16setUp[] = "SF.setUp(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_17setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUp (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUp", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUp", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_16setUp(((struct PyPetscSFObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_16setUp(struct PyPetscSFObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUp", 0);

  /* "PETSc/SF.pyx":51
 * 
 *     def setUp(self):
 *         CHKERR( PetscSFSetUp(self.sf) )             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFSetUp(__pyx_v_self->sf)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(45, 51, __pyx_L1_error)

  /* "PETSc/SF.pyx":50
 *         CHKERR( PetscSFSetFromOptions(self.sf) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFSetUp(self.sf) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SF.setUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":53
 *         CHKERR( PetscSFSetUp(self.sf) )
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFReset(self.sf) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_19reset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_18reset[] = "SF.reset(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_19reset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("reset", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "reset", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_18reset(((struct PyPetscSFObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_18reset(struct PyPetscSFObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "PETSc/SF.pyx":54
 * 
 *     def reset(self):
 *         CHKERR( PetscSFReset(self.sf) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFReset(__pyx_v_self->sf)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(45, 54, __pyx_L1_error)

  /* "PETSc/SF.pyx":53
 *         CHKERR( PetscSFSetUp(self.sf) )
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFReset(self.sf) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SF.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":58
 *     #
 * 
 *     def getGraph(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt nroots = 0, nleaves = 0
 *         cdef const_PetscInt *ilocal = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_21getGraph(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_20getGraph[] = "SF.getGraph(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_21getGraph(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getGraph (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getGraph", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getGraph", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_20getGraph(((struct PyPetscSFObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_20getGraph(struct PyPetscSFObject *__pyx_v_self) {
  PetscInt __pyx_v_nroots;
  PetscInt __pyx_v_nleaves;
  const PetscInt *__pyx_v_ilocal;
  const PetscSFNode *__pyx_v_iremote;
  PyArrayObject *__pyx_v_local = NULL;
  PyObject *__pyx_v_remote = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_sfnode = NULL;
  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;
  PyObject *(*__pyx_t_5)(PyObject *);
  PetscInt __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("getGraph", 0);

  /* "PETSc/SF.pyx":59
 * 
 *     def getGraph(self):
 *         cdef PetscInt nroots = 0, nleaves = 0             # <<<<<<<<<<<<<<
 *         cdef const_PetscInt *ilocal = NULL
 *         cdef const_PetscSFNode *iremote = NULL
 */
  __pyx_v_nroots = 0;
  __pyx_v_nleaves = 0;

  /* "PETSc/SF.pyx":60
 *     def getGraph(self):
 *         cdef PetscInt nroots = 0, nleaves = 0
 *         cdef const_PetscInt *ilocal = NULL             # <<<<<<<<<<<<<<
 *         cdef const_PetscSFNode *iremote = NULL
 *         CHKERR( PetscSFGetGraph(self.sf, &nroots, &nleaves, &ilocal, &iremote) )
 */
  __pyx_v_ilocal = NULL;

  /* "PETSc/SF.pyx":61
 *         cdef PetscInt nroots = 0, nleaves = 0
 *         cdef const_PetscInt *ilocal = NULL
 *         cdef const_PetscSFNode *iremote = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFGetGraph(self.sf, &nroots, &nleaves, &ilocal, &iremote) )
 *         local = array_i(nleaves, ilocal)
 */
  __pyx_v_iremote = NULL;

  /* "PETSc/SF.pyx":62
 *         cdef const_PetscInt *ilocal = NULL
 *         cdef const_PetscSFNode *iremote = NULL
 *         CHKERR( PetscSFGetGraph(self.sf, &nroots, &nleaves, &ilocal, &iremote) )             # <<<<<<<<<<<<<<
 *         local = array_i(nleaves, ilocal)
 *         remote = []
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFGetGraph(__pyx_v_self->sf, (&__pyx_v_nroots), (&__pyx_v_nleaves), (&__pyx_v_ilocal), (&__pyx_v_iremote))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(45, 62, __pyx_L1_error)

  /* "PETSc/SF.pyx":63
 *         cdef const_PetscSFNode *iremote = NULL
 *         CHKERR( PetscSFGetGraph(self.sf, &nroots, &nleaves, &ilocal, &iremote) )
 *         local = array_i(nleaves, ilocal)             # <<<<<<<<<<<<<<
 *         remote = []
 *         for i in range(toInt(nleaves)):
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_array_i(__pyx_v_nleaves, __pyx_v_ilocal)); if (unlikely(!__pyx_t_2)) __PYX_ERR(45, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_local = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/SF.pyx":64
 *         CHKERR( PetscSFGetGraph(self.sf, &nroots, &nleaves, &ilocal, &iremote) )
 *         local = array_i(nleaves, ilocal)
 *         remote = []             # <<<<<<<<<<<<<<
 *         for i in range(toInt(nleaves)):
 *             sfnode = (toInt(iremote[asInt(i)].rank), toInt(iremote[asInt(i)].index))
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(45, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_remote = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/SF.pyx":65
 *         local = array_i(nleaves, ilocal)
 *         remote = []
 *         for i in range(toInt(nleaves)):             # <<<<<<<<<<<<<<
 *             sfnode = (toInt(iremote[asInt(i)].rank), toInt(iremote[asInt(i)].index))
 *             remote.append( sfnode )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nleaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(45, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(45, 65, __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_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(45, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(45, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(45, 65, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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(45, 65, __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(45, 65, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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(45, 65, __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(45, 65, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_5(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(45, 65, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "PETSc/SF.pyx":66
 *         remote = []
 *         for i in range(toInt(nleaves)):
 *             sfnode = (toInt(iremote[asInt(i)].rank), toInt(iremote[asInt(i)].index))             # <<<<<<<<<<<<<<
 *             remote.append( sfnode )
 *         return toInt(nroots), toInt(nleaves), local, remote
 */
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_i); if (unlikely(__pyx_t_6 == -1L && PyErr_Occurred())) __PYX_ERR(45, 66, __pyx_L1_error)
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_iremote[__pyx_t_6]).rank); if (unlikely(!__pyx_t_2)) __PYX_ERR(45, 66, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_i); if (unlikely(__pyx_t_6 == -1L && PyErr_Occurred())) __PYX_ERR(45, 66, __pyx_L1_error)
    __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_toInt((__pyx_v_iremote[__pyx_t_6]).index); if (unlikely(!__pyx_t_7)) __PYX_ERR(45, 66, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(45, 66, __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_7);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
    __pyx_t_2 = 0;
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sfnode, ((PyObject*)__pyx_t_8));
    __pyx_t_8 = 0;

    /* "PETSc/SF.pyx":67
 *         for i in range(toInt(nleaves)):
 *             sfnode = (toInt(iremote[asInt(i)].rank), toInt(iremote[asInt(i)].index))
 *             remote.append( sfnode )             # <<<<<<<<<<<<<<
 *         return toInt(nroots), toInt(nleaves), local, remote
 * 
 */
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_remote, __pyx_v_sfnode); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(45, 67, __pyx_L1_error)

    /* "PETSc/SF.pyx":65
 *         local = array_i(nleaves, ilocal)
 *         remote = []
 *         for i in range(toInt(nleaves)):             # <<<<<<<<<<<<<<
 *             sfnode = (toInt(iremote[asInt(i)].rank), toInt(iremote[asInt(i)].index))
 *             remote.append( sfnode )
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/SF.pyx":68
 *             sfnode = (toInt(iremote[asInt(i)].rank), toInt(iremote[asInt(i)].index))
 *             remote.append( sfnode )
 *         return toInt(nroots), toInt(nleaves), local, remote             # <<<<<<<<<<<<<<
 * 
 *     def setGraph(self, nroots, nleaves, local, remote):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nroots); if (unlikely(!__pyx_t_3)) __PYX_ERR(45, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nleaves); if (unlikely(!__pyx_t_8)) __PYX_ERR(45, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(45, 68, __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_8);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8);
  __Pyx_INCREF(((PyObject *)__pyx_v_local));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_local));
  PyTuple_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_v_local));
  __Pyx_INCREF(__pyx_v_remote);
  __Pyx_GIVEREF(__pyx_v_remote);
  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_v_remote);
  __pyx_t_3 = 0;
  __pyx_t_8 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "PETSc/SF.pyx":58
 *     #
 * 
 *     def getGraph(self):             # <<<<<<<<<<<<<<
 *         cdef PetscInt nroots = 0, nleaves = 0
 *         cdef const_PetscInt *ilocal = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("petsc4py.PETSc.SF.getGraph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_local);
  __Pyx_XDECREF(__pyx_v_remote);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_sfnode);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":70
 *         return toInt(nroots), toInt(nleaves), local, remote
 * 
 *     def setGraph(self, nroots, nleaves, local, remote):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnroots = asInt(nroots)
 *         cdef PetscInt cnleaves = asInt(nleaves)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_23setGraph(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_22setGraph[] = "SF.setGraph(self, nroots, nleaves, local, remote)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_23setGraph(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nroots = 0;
  PyObject *__pyx_v_nleaves = 0;
  PyObject *__pyx_v_local = 0;
  PyObject *__pyx_v_remote = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setGraph (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nroots,&__pyx_n_s_nleaves,&__pyx_n_s_local,&__pyx_n_s_remote,0};
    PyObject* values[4] = {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  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_nroots)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nleaves)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setGraph", 1, 4, 4, 1); __PYX_ERR(45, 70, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_local)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setGraph", 1, 4, 4, 2); __PYX_ERR(45, 70, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_remote)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setGraph", 1, 4, 4, 3); __PYX_ERR(45, 70, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setGraph") < 0)) __PYX_ERR(45, 70, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      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);
    }
    __pyx_v_nroots = values[0];
    __pyx_v_nleaves = values[1];
    __pyx_v_local = values[2];
    __pyx_v_remote = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setGraph", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(45, 70, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SF.setGraph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_22setGraph(((struct PyPetscSFObject *)__pyx_v_self), __pyx_v_nroots, __pyx_v_nleaves, __pyx_v_local, __pyx_v_remote);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_22setGraph(struct PyPetscSFObject *__pyx_v_self, PyObject *__pyx_v_nroots, PyObject *__pyx_v_nleaves, PyObject *__pyx_v_local, PyObject *__pyx_v_remote) {
  PetscInt __pyx_v_cnroots;
  PetscInt __pyx_v_cnleaves;
  PetscInt __pyx_v_nlocal;
  PetscInt *__pyx_v_ilocal;
  PetscSFNode *__pyx_v_iremote;
  int __pyx_v_i;
  PyObject *__pyx_v_rank = NULL;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __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;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  __Pyx_RefNannySetupContext("setGraph", 0);
  __Pyx_INCREF(__pyx_v_local);

  /* "PETSc/SF.pyx":71
 * 
 *     def setGraph(self, nroots, nleaves, local, remote):
 *         cdef PetscInt cnroots = asInt(nroots)             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnleaves = asInt(nleaves)
 *         cdef PetscInt nlocal = 0
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_nroots); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(45, 71, __pyx_L1_error)
  __pyx_v_cnroots = __pyx_t_1;

  /* "PETSc/SF.pyx":72
 *     def setGraph(self, nroots, nleaves, local, remote):
 *         cdef PetscInt cnroots = asInt(nroots)
 *         cdef PetscInt cnleaves = asInt(nleaves)             # <<<<<<<<<<<<<<
 *         cdef PetscInt nlocal = 0
 *         cdef PetscInt *ilocal = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_nleaves); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(45, 72, __pyx_L1_error)
  __pyx_v_cnleaves = __pyx_t_1;

  /* "PETSc/SF.pyx":73
 *         cdef PetscInt cnroots = asInt(nroots)
 *         cdef PetscInt cnleaves = asInt(nleaves)
 *         cdef PetscInt nlocal = 0             # <<<<<<<<<<<<<<
 *         cdef PetscInt *ilocal = NULL
 *         local = iarray_i(local, &nlocal, &ilocal)
 */
  __pyx_v_nlocal = 0;

  /* "PETSc/SF.pyx":74
 *         cdef PetscInt cnleaves = asInt(nleaves)
 *         cdef PetscInt nlocal = 0
 *         cdef PetscInt *ilocal = NULL             # <<<<<<<<<<<<<<
 *         local = iarray_i(local, &nlocal, &ilocal)
 *         cdef PetscSFNode* iremote = NULL
 */
  __pyx_v_ilocal = NULL;

  /* "PETSc/SF.pyx":75
 *         cdef PetscInt nlocal = 0
 *         cdef PetscInt *ilocal = NULL
 *         local = iarray_i(local, &nlocal, &ilocal)             # <<<<<<<<<<<<<<
 *         cdef PetscSFNode* iremote = NULL
 *         CHKERR( PetscMalloc(nleaves*sizeof(PetscSFNode), &iremote) )
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_local, (&__pyx_v_nlocal), (&__pyx_v_ilocal))); if (unlikely(!__pyx_t_2)) __PYX_ERR(45, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_local, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/SF.pyx":76
 *         cdef PetscInt *ilocal = NULL
 *         local = iarray_i(local, &nlocal, &ilocal)
 *         cdef PetscSFNode* iremote = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscMalloc(nleaves*sizeof(PetscSFNode), &iremote) )
 *         cdef int i = 0
 */
  __pyx_v_iremote = NULL;

  /* "PETSc/SF.pyx":77
 *         local = iarray_i(local, &nlocal, &ilocal)
 *         cdef PetscSFNode* iremote = NULL
 *         CHKERR( PetscMalloc(nleaves*sizeof(PetscSFNode), &iremote) )             # <<<<<<<<<<<<<<
 *         cdef int i = 0
 *         for rank, index in remote:
 */
  __pyx_t_2 = __Pyx_PyInt_FromSize_t((sizeof(PetscSFNode))); if (unlikely(!__pyx_t_2)) __PYX_ERR(45, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_v_nleaves, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(45, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(45, 77, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscMalloc(__pyx_t_4, (&__pyx_v_iremote))); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(45, 77, __pyx_L1_error)

  /* "PETSc/SF.pyx":78
 *         cdef PetscSFNode* iremote = NULL
 *         CHKERR( PetscMalloc(nleaves*sizeof(PetscSFNode), &iremote) )
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         for rank, index in remote:
 *             iremote[i].rank  = asInt(rank)
 */
  __pyx_v_i = 0;

  /* "PETSc/SF.pyx":79
 *         CHKERR( PetscMalloc(nleaves*sizeof(PetscSFNode), &iremote) )
 *         cdef int i = 0
 *         for rank, index in remote:             # <<<<<<<<<<<<<<
 *             iremote[i].rank  = asInt(rank)
 *             iremote[i].index = asInt(index)
 */
  if (likely(PyList_CheckExact(__pyx_v_remote)) || PyTuple_CheckExact(__pyx_v_remote)) {
    __pyx_t_3 = __pyx_v_remote; __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_remote); if (unlikely(!__pyx_t_3)) __PYX_ERR(45, 79, __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(45, 79, __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_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(45, 79, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(45, 79, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(45, 79, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(45, 79, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_7(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(45, 79, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if CYTHON_COMPILING_IN_CPYTHON
      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(45, 79, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(45, 79, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(45, 79, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(45, 79, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(45, 79, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(45, 79, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_rank, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "PETSc/SF.pyx":80
 *         cdef int i = 0
 *         for rank, index in remote:
 *             iremote[i].rank  = asInt(rank)             # <<<<<<<<<<<<<<
 *             iremote[i].index = asInt(index)
 *             i += 1
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_rank); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(45, 80, __pyx_L1_error)
    (__pyx_v_iremote[__pyx_v_i]).rank = __pyx_t_1;

    /* "PETSc/SF.pyx":81
 *         for rank, index in remote:
 *             iremote[i].rank  = asInt(rank)
 *             iremote[i].index = asInt(index)             # <<<<<<<<<<<<<<
 *             i += 1
 *         CHKERR( PetscSFSetGraph(self.sf, cnroots, cnleaves, ilocal, PETSC_COPY_VALUES, iremote, PETSC_OWN_POINTER) )
 */
    __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_index); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(45, 81, __pyx_L1_error)
    (__pyx_v_iremote[__pyx_v_i]).index = __pyx_t_1;

    /* "PETSc/SF.pyx":82
 *             iremote[i].rank  = asInt(rank)
 *             iremote[i].index = asInt(index)
 *             i += 1             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFSetGraph(self.sf, cnroots, cnleaves, ilocal, PETSC_COPY_VALUES, iremote, PETSC_OWN_POINTER) )
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "PETSc/SF.pyx":79
 *         CHKERR( PetscMalloc(nleaves*sizeof(PetscSFNode), &iremote) )
 *         cdef int i = 0
 *         for rank, index in remote:             # <<<<<<<<<<<<<<
 *             iremote[i].rank  = asInt(rank)
 *             iremote[i].index = asInt(index)
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/SF.pyx":83
 *             iremote[i].index = asInt(index)
 *             i += 1
 *         CHKERR( PetscSFSetGraph(self.sf, cnroots, cnleaves, ilocal, PETSC_COPY_VALUES, iremote, PETSC_OWN_POINTER) )             # <<<<<<<<<<<<<<
 * 
 *     def setRankOrder(self, flag):
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFSetGraph(__pyx_v_self->sf, __pyx_v_cnroots, __pyx_v_cnleaves, __pyx_v_ilocal, PETSC_COPY_VALUES, __pyx_v_iremote, PETSC_OWN_POINTER)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(45, 83, __pyx_L1_error)

  /* "PETSc/SF.pyx":70
 *         return toInt(nroots), toInt(nleaves), local, remote
 * 
 *     def setGraph(self, nroots, nleaves, local, remote):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnroots = asInt(nroots)
 *         cdef PetscInt cnleaves = asInt(nleaves)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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_10);
  __Pyx_AddTraceback("petsc4py.PETSc.SF.setGraph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rank);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_local);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":85
 *         CHKERR( PetscSFSetGraph(self.sf, cnroots, cnleaves, ilocal, PETSC_COPY_VALUES, iremote, PETSC_OWN_POINTER) )
 * 
 *     def setRankOrder(self, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = flag
 *         CHKERR( PetscSFSetRankOrder(self.sf, bval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_25setRankOrder(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_24setRankOrder[] = "SF.setRankOrder(self, flag)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_25setRankOrder(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRankOrder (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,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);
        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_flag)) != 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, "setRankOrder") < 0)) __PYX_ERR(45, 85, __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_flag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRankOrder", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(45, 85, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SF.setRankOrder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_24setRankOrder(((struct PyPetscSFObject *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_24setRankOrder(struct PyPetscSFObject *__pyx_v_self, PyObject *__pyx_v_flag) {
  PetscBool __pyx_v_bval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscBool __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setRankOrder", 0);

  /* "PETSc/SF.pyx":86
 * 
 *     def setRankOrder(self, flag):
 *         cdef PetscBool bval = flag             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFSetRankOrder(self.sf, bval) )
 * 
 */
  __pyx_t_1 = ((PetscBool)__Pyx_PyInt_As_PetscBool(__pyx_v_flag)); if (unlikely(PyErr_Occurred())) __PYX_ERR(45, 86, __pyx_L1_error)
  __pyx_v_bval = __pyx_t_1;

  /* "PETSc/SF.pyx":87
 *     def setRankOrder(self, flag):
 *         cdef PetscBool bval = flag
 *         CHKERR( PetscSFSetRankOrder(self.sf, bval) )             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFSetRankOrder(__pyx_v_self->sf, __pyx_v_bval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(45, 87, __pyx_L1_error)

  /* "PETSc/SF.pyx":85
 *         CHKERR( PetscSFSetGraph(self.sf, cnroots, cnleaves, ilocal, PETSC_COPY_VALUES, iremote, PETSC_OWN_POINTER) )
 * 
 *     def setRankOrder(self, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool bval = flag
 *         CHKERR( PetscSFSetRankOrder(self.sf, bval) )
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.SF.setRankOrder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":91
 *     #
 * 
 *     def getMulti(self):             # <<<<<<<<<<<<<<
 *         cdef SF sf = SF()
 *         CHKERR( PetscSFGetMultiSF(self.sf, &sf.sf) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_27getMulti(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_26getMulti[] = "SF.getMulti(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_27getMulti(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMulti (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getMulti", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getMulti", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_26getMulti(((struct PyPetscSFObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_26getMulti(struct PyPetscSFObject *__pyx_v_self) {
  struct PyPetscSFObject *__pyx_v_sf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getMulti", 0);

  /* "PETSc/SF.pyx":92
 * 
 *     def getMulti(self):
 *         cdef SF sf = SF()             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFGetMultiSF(self.sf, &sf.sf) )
 *         PetscINCREF(sf.obj)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SF), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(45, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sf = ((struct PyPetscSFObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SF.pyx":93
 *     def getMulti(self):
 *         cdef SF sf = SF()
 *         CHKERR( PetscSFGetMultiSF(self.sf, &sf.sf) )             # <<<<<<<<<<<<<<
 *         PetscINCREF(sf.obj)
 *         return sf
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFGetMultiSF(__pyx_v_self->sf, (&__pyx_v_sf->sf))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(45, 93, __pyx_L1_error)

  /* "PETSc/SF.pyx":94
 *         cdef SF sf = SF()
 *         CHKERR( PetscSFGetMultiSF(self.sf, &sf.sf) )
 *         PetscINCREF(sf.obj)             # <<<<<<<<<<<<<<
 *         return sf
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscINCREF(__pyx_v_sf->__pyx_base.obj);

  /* "PETSc/SF.pyx":95
 *         CHKERR( PetscSFGetMultiSF(self.sf, &sf.sf) )
 *         PetscINCREF(sf.obj)
 *         return sf             # <<<<<<<<<<<<<<
 * 
 *     def createInverse(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_sf));
  __pyx_r = ((PyObject *)__pyx_v_sf);
  goto __pyx_L0;

  /* "PETSc/SF.pyx":91
 *     #
 * 
 *     def getMulti(self):             # <<<<<<<<<<<<<<
 *         cdef SF sf = SF()
 *         CHKERR( PetscSFGetMultiSF(self.sf, &sf.sf) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SF.getMulti", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/SF.pyx":97
 *         return sf
 * 
 *     def createInverse(self):             # <<<<<<<<<<<<<<
 *         cdef SF sf = SF()
 *         CHKERR( PetscSFCreateInverseSF(self.sf, &sf.sf) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_29createInverse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2SF_28createInverse[] = "SF.createInverse(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_2SF_29createInverse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createInverse (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("createInverse", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "createInverse", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2SF_28createInverse(((struct PyPetscSFObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2SF_28createInverse(struct PyPetscSFObject *__pyx_v_self) {
  struct PyPetscSFObject *__pyx_v_sf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("createInverse", 0);

  /* "PETSc/SF.pyx":98
 * 
 *     def createInverse(self):
 *         cdef SF sf = SF()             # <<<<<<<<<<<<<<
 *         CHKERR( PetscSFCreateInverseSF(self.sf, &sf.sf) )
 *         return sf
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SF), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(45, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sf = ((struct PyPetscSFObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/SF.pyx":99
 *     def createInverse(self):
 *         cdef SF sf = SF()
 *         CHKERR( PetscSFCreateInverseSF(self.sf, &sf.sf) )             # <<<<<<<<<<<<<<
 *         return sf
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSFCreateInverseSF(__pyx_v_self->sf, (&__pyx_v_sf->sf))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(45, 99, __pyx_L1_error)

  /* "PETSc/SF.pyx":100
 *         cdef SF sf = SF()
 *         CHKERR( PetscSFCreateInverseSF(self.sf, &sf.sf) )
 *         return sf             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_sf));
  __pyx_r = ((PyObject *)__pyx_v_sf);
  goto __pyx_L0;

  /* "PETSc/SF.pyx":97
 *         return sf
 * 
 *     def createInverse(self):             # <<<<<<<<<<<<<<
 *         cdef SF sf = SF()
 *         CHKERR( PetscSFCreateInverseSF(self.sf, &sf.sf) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.SF.createInverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Partitioner.pyx":14
 *     Type = PartitionerType
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.part
 *         self.part = NULL
 */

/* Python wrapper */
static int __pyx_pw_8petsc4py_5PETSc_11Partitioner_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8petsc4py_5PETSc_11Partitioner_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11Partitioner___cinit__(((struct PyPetscPartitionerObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8petsc4py_5PETSc_11Partitioner___cinit__(struct PyPetscPartitionerObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "PETSc/Partitioner.pyx":15
 * 
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.part             # <<<<<<<<<<<<<<
 *         self.part = NULL
 * 
 */
  __pyx_v_self->__pyx_base.obj = ((PetscObject *)(&__pyx_v_self->part));

  /* "PETSc/Partitioner.pyx":16
 *     def __cinit__(self):
 *         self.obj = <PetscObject*> &self.part
 *         self.part = NULL             # <<<<<<<<<<<<<<
 * 
 *     def view(self, Viewer viewer=None):
 */
  __pyx_v_self->part = NULL;

  /* "PETSc/Partitioner.pyx":14
 *     Type = PartitionerType
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.obj = <PetscObject*> &self.part
 *         self.part = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Partitioner.pyx":18
 *         self.part = NULL
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_3view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11Partitioner_2view[] = "Partitioner.view(self, Viewer viewer=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_3view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct PyPetscViewerObject *__pyx_v_viewer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewer,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct PyPetscViewerObject *)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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_viewer);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view") < 0)) __PYX_ERR(46, 18, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_viewer = ((struct PyPetscViewerObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(46, 18, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Partitioner.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_viewer), __pyx_ptype_8petsc4py_5PETSc_Viewer, 1, "viewer", 0))) __PYX_ERR(46, 18, __pyx_L1_error)
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11Partitioner_2view(((struct PyPetscPartitionerObject *)__pyx_v_self), __pyx_v_viewer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_2view(struct PyPetscPartitionerObject *__pyx_v_self, struct PyPetscViewerObject *__pyx_v_viewer) {
  PetscViewer __pyx_v_vwr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PetscViewer __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("view", 0);

  /* "PETSc/Partitioner.pyx":19
 * 
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL             # <<<<<<<<<<<<<<
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PetscPartitionerView(self.part, vwr) )
 */
  __pyx_v_vwr = NULL;

  /* "PETSc/Partitioner.pyx":20
 *     def view(self, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPartitionerView(self.part, vwr) )
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_viewer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_v_viewer->vwr;
    __pyx_v_vwr = __pyx_t_3;
  }

  /* "PETSc/Partitioner.pyx":21
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 *         CHKERR( PetscPartitionerView(self.part, vwr) )             # <<<<<<<<<<<<<<
 * 
 *     def destroy(self):
 */
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPartitionerView(__pyx_v_self->part, __pyx_v_vwr)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(46, 21, __pyx_L1_error)

  /* "PETSc/Partitioner.pyx":18
 *         self.part = NULL
 * 
 *     def view(self, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Partitioner.view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Partitioner.pyx":23
 *         CHKERR( PetscPartitionerView(self.part, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPartitionerDestroy(&self.part) )
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_5destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11Partitioner_4destroy[] = "Partitioner.destroy(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_5destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("destroy", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "destroy", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11Partitioner_4destroy(((struct PyPetscPartitionerObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_4destroy(struct PyPetscPartitionerObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "PETSc/Partitioner.pyx":24
 * 
 *     def destroy(self):
 *         CHKERR( PetscPartitionerDestroy(&self.part) )             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPartitionerDestroy((&__pyx_v_self->part))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(46, 24, __pyx_L1_error)

  /* "PETSc/Partitioner.pyx":25
 *     def destroy(self):
 *         CHKERR( PetscPartitionerDestroy(&self.part) )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def create(self, comm=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Partitioner.pyx":23
 *         CHKERR( PetscPartitionerView(self.part, vwr) )
 * 
 *     def destroy(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPartitionerDestroy(&self.part) )
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Partitioner.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Partitioner.pyx":27
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscPartitioner newpart = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_7create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11Partitioner_6create[] = "Partitioner.create(self, comm=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_7create(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_comm,0};
    PyObject* values[1] = {0};
    values[0] = ((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  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(46, 27, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_comm = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(46, 27, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Partitioner.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11Partitioner_6create(((struct PyPetscPartitionerObject *)__pyx_v_self), __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_6create(struct PyPetscPartitionerObject *__pyx_v_self, PyObject *__pyx_v_comm) {
  MPI_Comm __pyx_v_ccomm;
  PetscPartitioner __pyx_v_newpart;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  MPI_Comm __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("create", 0);

  /* "PETSc/Partitioner.pyx":28
 * 
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)             # <<<<<<<<<<<<<<
 *         cdef PetscPartitioner newpart = NULL
 *         CHKERR( PetscPartitionerCreate(ccomm, &newpart) )
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT); if (unlikely(PyErr_Occurred())) __PYX_ERR(46, 28, __pyx_L1_error)
  __pyx_v_ccomm = __pyx_t_1;

  /* "PETSc/Partitioner.pyx":29
 *     def create(self, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscPartitioner newpart = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPartitionerCreate(ccomm, &newpart) )
 *         PetscCLEAR(self.obj); self.part = newpart
 */
  __pyx_v_newpart = NULL;

  /* "PETSc/Partitioner.pyx":30
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscPartitioner newpart = NULL
 *         CHKERR( PetscPartitionerCreate(ccomm, &newpart) )             # <<<<<<<<<<<<<<
 *         PetscCLEAR(self.obj); self.part = newpart
 *         return self
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPartitionerCreate(__pyx_v_ccomm, (&__pyx_v_newpart))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(46, 30, __pyx_L1_error)

  /* "PETSc/Partitioner.pyx":31
 *         cdef PetscPartitioner newpart = NULL
 *         CHKERR( PetscPartitionerCreate(ccomm, &newpart) )
 *         PetscCLEAR(self.obj); self.part = newpart             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_f_8petsc4py_5PETSc_PetscCLEAR(__pyx_v_self->__pyx_base.obj);
  __pyx_v_self->part = __pyx_v_newpart;

  /* "PETSc/Partitioner.pyx":32
 *         CHKERR( PetscPartitionerCreate(ccomm, &newpart) )
 *         PetscCLEAR(self.obj); self.part = newpart
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def setType(self, part_type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "PETSc/Partitioner.pyx":27
 *         return self
 * 
 *     def create(self, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscPartitioner newpart = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Partitioner.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Partitioner.pyx":34
 *         return self
 * 
 *     def setType(self, part_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         part_type = str2bytes(part_type, &cval)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_9setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11Partitioner_8setType[] = "Partitioner.setType(self, part_type)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_9setType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_part_type = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_part_type,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);
        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_part_type)) != 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, "setType") < 0)) __PYX_ERR(46, 34, __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_part_type = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setType", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(46, 34, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Partitioner.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11Partitioner_8setType(((struct PyPetscPartitionerObject *)__pyx_v_self), __pyx_v_part_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_8setType(struct PyPetscPartitionerObject *__pyx_v_self, PyObject *__pyx_v_part_type) {
  const char *__pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setType", 0);
  __Pyx_INCREF(__pyx_v_part_type);

  /* "PETSc/Partitioner.pyx":35
 * 
 *     def setType(self, part_type):
 *         cdef const_char *cval = NULL             # <<<<<<<<<<<<<<
 *         part_type = str2bytes(part_type, &cval)
 *         CHKERR( PetscPartitionerSetType(self.part, cval) )
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Partitioner.pyx":36
 *     def setType(self, part_type):
 *         cdef const_char *cval = NULL
 *         part_type = str2bytes(part_type, &cval)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPartitionerSetType(self.part, cval) )
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_str2bytes(__pyx_v_part_type, (&__pyx_v_cval)); if (unlikely(!__pyx_t_1)) __PYX_ERR(46, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_part_type, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Partitioner.pyx":37
 *         cdef const_char *cval = NULL
 *         part_type = str2bytes(part_type, &cval)
 *         CHKERR( PetscPartitionerSetType(self.part, cval) )             # <<<<<<<<<<<<<<
 * 
 *     def getType(self):
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPartitionerSetType(__pyx_v_self->part, __pyx_v_cval)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(46, 37, __pyx_L1_error)

  /* "PETSc/Partitioner.pyx":34
 *         return self
 * 
 *     def setType(self, part_type):             # <<<<<<<<<<<<<<
 *         cdef const_char *cval = NULL
 *         part_type = str2bytes(part_type, &cval)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.Partitioner.setType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_part_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Partitioner.pyx":39
 *         CHKERR( PetscPartitionerSetType(self.part, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscPartitionerType cval = NULL
 *         CHKERR( PetscPartitionerGetType(self.part, &cval) )
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_11getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11Partitioner_10getType[] = "Partitioner.getType(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_11getType(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getType (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("getType", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "getType", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11Partitioner_10getType(((struct PyPetscPartitionerObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_10getType(struct PyPetscPartitionerObject *__pyx_v_self) {
  const char* __pyx_v_cval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getType", 0);

  /* "PETSc/Partitioner.pyx":40
 * 
 *     def getType(self):
 *         cdef PetscPartitionerType cval = NULL             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPartitionerGetType(self.part, &cval) )
 *         return bytes2str(cval)
 */
  __pyx_v_cval = NULL;

  /* "PETSc/Partitioner.pyx":41
 *     def getType(self):
 *         cdef PetscPartitionerType cval = NULL
 *         CHKERR( PetscPartitionerGetType(self.part, &cval) )             # <<<<<<<<<<<<<<
 *         return bytes2str(cval)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPartitionerGetType(__pyx_v_self->part, (&__pyx_v_cval))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(46, 41, __pyx_L1_error)

  /* "PETSc/Partitioner.pyx":42
 *         cdef PetscPartitionerType cval = NULL
 *         CHKERR( PetscPartitionerGetType(self.part, &cval) )
 *         return bytes2str(cval)             # <<<<<<<<<<<<<<
 * 
 *     def setFromOptions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cval); if (unlikely(!__pyx_t_2)) __PYX_ERR(46, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "PETSc/Partitioner.pyx":39
 *         CHKERR( PetscPartitionerSetType(self.part, cval) )
 * 
 *     def getType(self):             # <<<<<<<<<<<<<<
 *         cdef PetscPartitionerType cval = NULL
 *         CHKERR( PetscPartitionerGetType(self.part, &cval) )
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.Partitioner.getType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Partitioner.pyx":44
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPartitionerSetFromOptions(self.part) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_13setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11Partitioner_12setFromOptions[] = "Partitioner.setFromOptions(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_13setFromOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFromOptions (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setFromOptions", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setFromOptions", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11Partitioner_12setFromOptions(((struct PyPetscPartitionerObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_12setFromOptions(struct PyPetscPartitionerObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setFromOptions", 0);

  /* "PETSc/Partitioner.pyx":45
 * 
 *     def setFromOptions(self):
 *         CHKERR( PetscPartitionerSetFromOptions(self.part) )             # <<<<<<<<<<<<<<
 * 
 *     def setUp(self):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPartitionerSetFromOptions(__pyx_v_self->part)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(46, 45, __pyx_L1_error)

  /* "PETSc/Partitioner.pyx":44
 *         return bytes2str(cval)
 * 
 *     def setFromOptions(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPartitionerSetFromOptions(self.part) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Partitioner.setFromOptions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Partitioner.pyx":47
 *         CHKERR( PetscPartitionerSetFromOptions(self.part) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPartitionerSetUp(self.part) )
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_15setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11Partitioner_14setUp[] = "Partitioner.setUp(self)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_15setUp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setUp (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("setUp", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "setUp", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11Partitioner_14setUp(((struct PyPetscPartitionerObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_14setUp(struct PyPetscPartitionerObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setUp", 0);

  /* "PETSc/Partitioner.pyx":48
 * 
 *     def setUp(self):
 *         CHKERR( PetscPartitionerSetUp(self.part) )             # <<<<<<<<<<<<<<
 * 
 *     def setShellPartition(self, numProcs, sizes=None, points=None):
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPartitionerSetUp(__pyx_v_self->part)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(46, 48, __pyx_L1_error)

  /* "PETSc/Partitioner.pyx":47
 *         CHKERR( PetscPartitionerSetFromOptions(self.part) )
 * 
 *     def setUp(self):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPartitionerSetUp(self.part) )
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Partitioner.setUp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/Partitioner.pyx":50
 *         CHKERR( PetscPartitionerSetUp(self.part) )
 * 
 *     def setShellPartition(self, numProcs, sizes=None, points=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumProcs = asInt(numProcs)
 *         cdef PetscInt *csizes = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_17setShellPartition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_11Partitioner_16setShellPartition[] = "Partitioner.setShellPartition(self, numProcs, sizes=None, points=None)";
static PyObject *__pyx_pw_8petsc4py_5PETSc_11Partitioner_17setShellPartition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_numProcs = 0;
  PyObject *__pyx_v_sizes = 0;
  PyObject *__pyx_v_points = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setShellPartition (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_numProcs,&__pyx_n_s_sizes,&__pyx_n_s_points,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_numProcs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sizes);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_points);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setShellPartition") < 0)) __PYX_ERR(46, 50, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_numProcs = values[0];
    __pyx_v_sizes = values[1];
    __pyx_v_points = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setShellPartition", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(46, 50, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.Partitioner.setShellPartition", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_11Partitioner_16setShellPartition(((struct PyPetscPartitionerObject *)__pyx_v_self), __pyx_v_numProcs, __pyx_v_sizes, __pyx_v_points);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_11Partitioner_16setShellPartition(struct PyPetscPartitionerObject *__pyx_v_self, PyObject *__pyx_v_numProcs, PyObject *__pyx_v_sizes, PyObject *__pyx_v_points) {
  PetscInt __pyx_v_cnumProcs;
  PetscInt *__pyx_v_csizes;
  PetscInt *__pyx_v_cpoints;
  PetscInt __pyx_v_nsize;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PetscInt __pyx_t_1;
  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;
  __Pyx_RefNannySetupContext("setShellPartition", 0);
  __Pyx_INCREF(__pyx_v_sizes);
  __Pyx_INCREF(__pyx_v_points);

  /* "PETSc/Partitioner.pyx":51
 * 
 *     def setShellPartition(self, numProcs, sizes=None, points=None):
 *         cdef PetscInt cnumProcs = asInt(numProcs)             # <<<<<<<<<<<<<<
 *         cdef PetscInt *csizes = NULL
 *         cdef PetscInt *cpoints = NULL
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_asInt(__pyx_v_numProcs); if (unlikely(__pyx_t_1 == -1L && PyErr_Occurred())) __PYX_ERR(46, 51, __pyx_L1_error)
  __pyx_v_cnumProcs = __pyx_t_1;

  /* "PETSc/Partitioner.pyx":52
 *     def setShellPartition(self, numProcs, sizes=None, points=None):
 *         cdef PetscInt cnumProcs = asInt(numProcs)
 *         cdef PetscInt *csizes = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt *cpoints = NULL
 *         cdef PetscInt nsize = 0
 */
  __pyx_v_csizes = NULL;

  /* "PETSc/Partitioner.pyx":53
 *         cdef PetscInt cnumProcs = asInt(numProcs)
 *         cdef PetscInt *csizes = NULL
 *         cdef PetscInt *cpoints = NULL             # <<<<<<<<<<<<<<
 *         cdef PetscInt nsize = 0
 *         if sizes is not None:
 */
  __pyx_v_cpoints = NULL;

  /* "PETSc/Partitioner.pyx":54
 *         cdef PetscInt *csizes = NULL
 *         cdef PetscInt *cpoints = NULL
 *         cdef PetscInt nsize = 0             # <<<<<<<<<<<<<<
 *         if sizes is not None:
 *             sizes = iarray_i(sizes, &nsize, &csizes)
 */
  __pyx_v_nsize = 0;

  /* "PETSc/Partitioner.pyx":55
 *         cdef PetscInt *cpoints = NULL
 *         cdef PetscInt nsize = 0
 *         if sizes is not None:             # <<<<<<<<<<<<<<
 *             sizes = iarray_i(sizes, &nsize, &csizes)
 *             if nsize != cnumProcs:
 */
  __pyx_t_2 = (__pyx_v_sizes != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Partitioner.pyx":56
 *         cdef PetscInt nsize = 0
 *         if sizes is not None:
 *             sizes = iarray_i(sizes, &nsize, &csizes)             # <<<<<<<<<<<<<<
 *             if nsize != cnumProcs:
 *                 raise ValueError("sizes array should have %d entries (has %d)" %
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_sizes, (&__pyx_v_nsize), (&__pyx_v_csizes))); if (unlikely(!__pyx_t_4)) __PYX_ERR(46, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_sizes, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "PETSc/Partitioner.pyx":57
 *         if sizes is not None:
 *             sizes = iarray_i(sizes, &nsize, &csizes)
 *             if nsize != cnumProcs:             # <<<<<<<<<<<<<<
 *                 raise ValueError("sizes array should have %d entries (has %d)" %
 *                                  numProcs, toInt(nsize))
 */
    __pyx_t_3 = ((__pyx_v_nsize != __pyx_v_cnumProcs) != 0);
    if (__pyx_t_3) {

      /* "PETSc/Partitioner.pyx":58
 *             sizes = iarray_i(sizes, &nsize, &csizes)
 *             if nsize != cnumProcs:
 *                 raise ValueError("sizes array should have %d entries (has %d)" %             # <<<<<<<<<<<<<<
 *                                  numProcs, toInt(nsize))
 *             if points is None:
 */
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_sizes_array_should_have_d_entrie, __pyx_v_numProcs); if (unlikely(!__pyx_t_4)) __PYX_ERR(46, 58, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "PETSc/Partitioner.pyx":59
 *             if nsize != cnumProcs:
 *                 raise ValueError("sizes array should have %d entries (has %d)" %
 *                                  numProcs, toInt(nsize))             # <<<<<<<<<<<<<<
 *             if points is None:
 *                 raise ValueError("Must provide both sizes and points arrays")
 */
      __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_toInt(__pyx_v_nsize); if (unlikely(!__pyx_t_5)) __PYX_ERR(46, 59, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);

      /* "PETSc/Partitioner.pyx":58
 *             sizes = iarray_i(sizes, &nsize, &csizes)
 *             if nsize != cnumProcs:
 *                 raise ValueError("sizes array should have %d entries (has %d)" %             # <<<<<<<<<<<<<<
 *                                  numProcs, toInt(nsize))
 *             if points is None:
 */
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(46, 58, __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_5);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(46, 58, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(46, 58, __pyx_L1_error)

      /* "PETSc/Partitioner.pyx":57
 *         if sizes is not None:
 *             sizes = iarray_i(sizes, &nsize, &csizes)
 *             if nsize != cnumProcs:             # <<<<<<<<<<<<<<
 *                 raise ValueError("sizes array should have %d entries (has %d)" %
 *                                  numProcs, toInt(nsize))
 */
    }

    /* "PETSc/Partitioner.pyx":60
 *                 raise ValueError("sizes array should have %d entries (has %d)" %
 *                                  numProcs, toInt(nsize))
 *             if points is None:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Must provide both sizes and points arrays")
 *         if points is not None:
 */
    __pyx_t_3 = (__pyx_v_points == Py_None);
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "PETSc/Partitioner.pyx":61
 *                                  numProcs, toInt(nsize))
 *             if points is None:
 *                 raise ValueError("Must provide both sizes and points arrays")             # <<<<<<<<<<<<<<
 *         if points is not None:
 *             points = iarray_i(points, NULL, &cpoints)
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__66, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(46, 61, __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(46, 61, __pyx_L1_error)

      /* "PETSc/Partitioner.pyx":60
 *                 raise ValueError("sizes array should have %d entries (has %d)" %
 *                                  numProcs, toInt(nsize))
 *             if points is None:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Must provide both sizes and points arrays")
 *         if points is not None:
 */
    }

    /* "PETSc/Partitioner.pyx":55
 *         cdef PetscInt *cpoints = NULL
 *         cdef PetscInt nsize = 0
 *         if sizes is not None:             # <<<<<<<<<<<<<<
 *             sizes = iarray_i(sizes, &nsize, &csizes)
 *             if nsize != cnumProcs:
 */
  }

  /* "PETSc/Partitioner.pyx":62
 *             if points is None:
 *                 raise ValueError("Must provide both sizes and points arrays")
 *         if points is not None:             # <<<<<<<<<<<<<<
 *             points = iarray_i(points, NULL, &cpoints)
 *         CHKERR( PetscPartitionerShellSetPartition(self.part, cnumProcs,
 */
  __pyx_t_2 = (__pyx_v_points != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "PETSc/Partitioner.pyx":63
 *                 raise ValueError("Must provide both sizes and points arrays")
 *         if points is not None:
 *             points = iarray_i(points, NULL, &cpoints)             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPartitionerShellSetPartition(self.part, cnumProcs,
 *                                                   csizes, cpoints) )
 */
    __pyx_t_5 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_iarray_i(__pyx_v_points, NULL, (&__pyx_v_cpoints))); if (unlikely(!__pyx_t_5)) __PYX_ERR(46, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_points, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "PETSc/Partitioner.pyx":62
 *             if points is None:
 *                 raise ValueError("Must provide both sizes and points arrays")
 *         if points is not None:             # <<<<<<<<<<<<<<
 *             points = iarray_i(points, NULL, &cpoints)
 *         CHKERR( PetscPartitionerShellSetPartition(self.part, cnumProcs,
 */
  }

  /* "PETSc/Partitioner.pyx":64
 *         if points is not None:
 *             points = iarray_i(points, NULL, &cpoints)
 *         CHKERR( PetscPartitionerShellSetPartition(self.part, cnumProcs,             # <<<<<<<<<<<<<<
 *                                                   csizes, cpoints) )
 */
  __pyx_t_7 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPartitionerShellSetPartition(__pyx_v_self->part, __pyx_v_cnumProcs, __pyx_v_csizes, __pyx_v_cpoints)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(46, 64, __pyx_L1_error)

  /* "PETSc/Partitioner.pyx":50
 *         CHKERR( PetscPartitionerSetUp(self.part) )
 * 
 *     def setShellPartition(self, numProcs, sizes=None, points=None):             # <<<<<<<<<<<<<<
 *         cdef PetscInt cnumProcs = asInt(numProcs)
 *         cdef PetscInt *csizes = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("petsc4py.PETSc.Partitioner.setShellPartition", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sizes);
  __Pyx_XDECREF(__pyx_v_points);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":3
 * #---------------------------------------------------------------------
 * 
 * cdef inline int setref(void *d, void *s) except -1:             # <<<<<<<<<<<<<<
 *     cdef PetscObject *dest  = <PetscObject*> d
 *     cdef PetscObject source = <PetscObject>  s
 */

static CYTHON_INLINE int __pyx_f_8petsc4py_5PETSc_setref(void *__pyx_v_d, void *__pyx_v_s) {
  PetscObject *__pyx_v_dest;
  PetscObject __pyx_v_source;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setref", 0);

  /* "PETSc/CAPI.pyx":4
 * 
 * cdef inline int setref(void *d, void *s) except -1:
 *     cdef PetscObject *dest  = <PetscObject*> d             # <<<<<<<<<<<<<<
 *     cdef PetscObject source = <PetscObject>  s
 *     CHKERR( PetscINCREF(&source) )
 */
  __pyx_v_dest = ((PetscObject *)__pyx_v_d);

  /* "PETSc/CAPI.pyx":5
 * cdef inline int setref(void *d, void *s) except -1:
 *     cdef PetscObject *dest  = <PetscObject*> d
 *     cdef PetscObject source = <PetscObject>  s             # <<<<<<<<<<<<<<
 *     CHKERR( PetscINCREF(&source) )
 *     dest[0] = source
 */
  __pyx_v_source = ((PetscObject)__pyx_v_s);

  /* "PETSc/CAPI.pyx":6
 *     cdef PetscObject *dest  = <PetscObject*> d
 *     cdef PetscObject source = <PetscObject>  s
 *     CHKERR( PetscINCREF(&source) )             # <<<<<<<<<<<<<<
 *     dest[0] = source
 *     return 0
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_CHKERR(__pyx_f_8petsc4py_5PETSc_PetscINCREF((&__pyx_v_source))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(47, 6, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":7
 *     cdef PetscObject source = <PetscObject>  s
 *     CHKERR( PetscINCREF(&source) )
 *     dest[0] = source             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  (__pyx_v_dest[0]) = __pyx_v_source;

  /* "PETSc/CAPI.pyx":8
 *     CHKERR( PetscINCREF(&source) )
 *     dest[0] = source
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * #---------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":3
 * #---------------------------------------------------------------------
 * 
 * cdef inline int setref(void *d, void *s) except -1:             # <<<<<<<<<<<<<<
 *     cdef PetscObject *dest  = <PetscObject*> d
 *     cdef PetscObject source = <PetscObject>  s
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.setref", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":14
 * # -- Error --
 * 
 * cdef api int PyPetscError_Set(int ierr):             # <<<<<<<<<<<<<<
 *     return SETERR(ierr)
 * 
 */

static int __pyx_f_8petsc4py_5PETSc_PyPetscError_Set(int __pyx_v_ierr) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("PyPetscError_Set", 0);

  /* "PETSc/CAPI.pyx":15
 * 
 * cdef api int PyPetscError_Set(int ierr):
 *     return SETERR(ierr)             # <<<<<<<<<<<<<<
 * 
 * # -- Comm --
 */
  __pyx_r = __pyx_f_8petsc4py_5PETSc_SETERR(__pyx_v_ierr);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":14
 * # -- Error --
 * 
 * cdef api int PyPetscError_Set(int ierr):             # <<<<<<<<<<<<<<
 *     return SETERR(ierr)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":19
 * # -- Comm --
 * 
 * cdef api object PyPetscComm_New(MPI_Comm arg):             # <<<<<<<<<<<<<<
 *     cdef Comm retv = Comm()
 *     retv.comm = arg
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscComm_New(MPI_Comm __pyx_v_arg) {
  struct PyPetscCommObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyPetscComm_New", 0);

  /* "PETSc/CAPI.pyx":20
 * 
 * cdef api object PyPetscComm_New(MPI_Comm arg):
 *     cdef Comm retv = Comm()             # <<<<<<<<<<<<<<
 *     retv.comm = arg
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscCommObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":21
 * cdef api object PyPetscComm_New(MPI_Comm arg):
 *     cdef Comm retv = Comm()
 *     retv.comm = arg             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_v_retv->comm = __pyx_v_arg;

  /* "PETSc/CAPI.pyx":22
 *     cdef Comm retv = Comm()
 *     retv.comm = arg
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api MPI_Comm PyPetscComm_Get(object arg) except *:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":19
 * # -- Comm --
 * 
 * cdef api object PyPetscComm_New(MPI_Comm arg):             # <<<<<<<<<<<<<<
 *     cdef Comm retv = Comm()
 *     retv.comm = arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscComm_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":24
 *     return retv
 * 
 * cdef api MPI_Comm PyPetscComm_Get(object arg) except *:             # <<<<<<<<<<<<<<
 *     cdef MPI_Comm retv = MPI_COMM_NULL
 *     cdef Comm ob = <Comm?> arg
 */

static MPI_Comm __pyx_f_8petsc4py_5PETSc_PyPetscComm_Get(PyObject *__pyx_v_arg) {
  MPI_Comm __pyx_v_retv;
  struct PyPetscCommObject *__pyx_v_ob = 0;
  MPI_Comm __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  MPI_Comm __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscComm_Get", 0);

  /* "PETSc/CAPI.pyx":25
 * 
 * cdef api MPI_Comm PyPetscComm_Get(object arg) except *:
 *     cdef MPI_Comm retv = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *     cdef Comm ob = <Comm?> arg
 *     retv = ob.comm
 */
  __pyx_v_retv = MPI_COMM_NULL;

  /* "PETSc/CAPI.pyx":26
 * cdef api MPI_Comm PyPetscComm_Get(object arg) except *:
 *     cdef MPI_Comm retv = MPI_COMM_NULL
 *     cdef Comm ob = <Comm?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.comm
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_Comm)))) __PYX_ERR(47, 26, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscCommObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":27
 *     cdef MPI_Comm retv = MPI_COMM_NULL
 *     cdef Comm ob = <Comm?> arg
 *     retv = ob.comm             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->comm;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":28
 *     cdef Comm ob = <Comm?> arg
 *     retv = ob.comm
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api MPI_Comm* PyPetscComm_GetPtr(object arg) except NULL:
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":24
 *     return retv
 * 
 * cdef api MPI_Comm PyPetscComm_Get(object arg) except *:             # <<<<<<<<<<<<<<
 *     cdef MPI_Comm retv = MPI_COMM_NULL
 *     cdef Comm ob = <Comm?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscComm_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":30
 *     return retv
 * 
 * cdef api MPI_Comm* PyPetscComm_GetPtr(object arg) except NULL:             # <<<<<<<<<<<<<<
 *     cdef MPI_Comm *retv = NULL
 *     cdef Comm ob = <Comm?> arg
 */

static MPI_Comm *__pyx_f_8petsc4py_5PETSc_PyPetscComm_GetPtr(PyObject *__pyx_v_arg) {
  MPI_Comm *__pyx_v_retv;
  struct PyPetscCommObject *__pyx_v_ob = 0;
  MPI_Comm *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyPetscComm_GetPtr", 0);

  /* "PETSc/CAPI.pyx":31
 * 
 * cdef api MPI_Comm* PyPetscComm_GetPtr(object arg) except NULL:
 *     cdef MPI_Comm *retv = NULL             # <<<<<<<<<<<<<<
 *     cdef Comm ob = <Comm?> arg
 *     retv = &ob.comm
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":32
 * cdef api MPI_Comm* PyPetscComm_GetPtr(object arg) except NULL:
 *     cdef MPI_Comm *retv = NULL
 *     cdef Comm ob = <Comm?> arg             # <<<<<<<<<<<<<<
 *     retv = &ob.comm
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_Comm)))) __PYX_ERR(47, 32, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscCommObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":33
 *     cdef MPI_Comm *retv = NULL
 *     cdef Comm ob = <Comm?> arg
 *     retv = &ob.comm             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_v_retv = (&__pyx_v_ob->comm);

  /* "PETSc/CAPI.pyx":34
 *     cdef Comm ob = <Comm?> arg
 *     retv = &ob.comm
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- Object --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":30
 *     return retv
 * 
 * cdef api MPI_Comm* PyPetscComm_GetPtr(object arg) except NULL:             # <<<<<<<<<<<<<<
 *     cdef MPI_Comm *retv = NULL
 *     cdef Comm ob = <Comm?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscComm_GetPtr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":38
 * # -- Object --
 * 
 * cdef api object PyPetscObject_New(PetscObject arg):             # <<<<<<<<<<<<<<
 *     cdef Object retv = subtype_Object(arg)()
 *     setref(&retv.obj[0], arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscObject_New(PetscObject __pyx_v_arg) {
  struct PyPetscObjectObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("PyPetscObject_New", 0);

  /* "PETSc/CAPI.pyx":39
 * 
 * cdef api object PyPetscObject_New(PetscObject arg):
 *     cdef Object retv = subtype_Object(arg)()             # <<<<<<<<<<<<<<
 *     setref(&retv.obj[0], arg)
 *     return retv
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_Object(__pyx_v_arg)); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(47, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_Object))))) __PYX_ERR(47, 39, __pyx_L1_error)
  __pyx_v_retv = ((struct PyPetscObjectObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/CAPI.pyx":40
 * cdef api object PyPetscObject_New(PetscObject arg):
 *     cdef Object retv = subtype_Object(arg)()
 *     setref(&retv.obj[0], arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_setref((&(__pyx_v_retv->obj[0])), __pyx_v_arg); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(47, 40, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":41
 *     cdef Object retv = subtype_Object(arg)()
 *     setref(&retv.obj[0], arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscObject PyPetscObject_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":38
 * # -- Object --
 * 
 * cdef api object PyPetscObject_New(PetscObject arg):             # <<<<<<<<<<<<<<
 *     cdef Object retv = subtype_Object(arg)()
 *     setref(&retv.obj[0], arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscObject_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":43
 *     return retv
 * 
 * cdef api PetscObject PyPetscObject_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscObject retv = NULL
 *     cdef Object ob = <Object?> arg
 */

static PetscObject __pyx_f_8petsc4py_5PETSc_PyPetscObject_Get(PyObject *__pyx_v_arg) {
  PetscObject __pyx_v_retv;
  struct PyPetscObjectObject *__pyx_v_ob = 0;
  PetscObject __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyPetscObject_Get", 0);

  /* "PETSc/CAPI.pyx":44
 * 
 * cdef api PetscObject PyPetscObject_Get(object arg) except ? NULL:
 *     cdef PetscObject retv = NULL             # <<<<<<<<<<<<<<
 *     cdef Object ob = <Object?> arg
 *     retv = ob.obj[0]
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":45
 * cdef api PetscObject PyPetscObject_Get(object arg) except ? NULL:
 *     cdef PetscObject retv = NULL
 *     cdef Object ob = <Object?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.obj[0]
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_Object)))) __PYX_ERR(47, 45, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscObjectObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":46
 *     cdef PetscObject retv = NULL
 *     cdef Object ob = <Object?> arg
 *     retv = ob.obj[0]             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_v_retv = (__pyx_v_ob->obj[0]);

  /* "PETSc/CAPI.pyx":47
 *     cdef Object ob = <Object?> arg
 *     retv = ob.obj[0]
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscObject* PyPetscObject_GetPtr(object arg) except NULL:
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":43
 *     return retv
 * 
 * cdef api PetscObject PyPetscObject_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscObject retv = NULL
 *     cdef Object ob = <Object?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscObject_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":49
 *     return retv
 * 
 * cdef api PetscObject* PyPetscObject_GetPtr(object arg) except NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscObject *retv = NULL
 *     cdef Object ob = <Object?> arg
 */

static PetscObject *__pyx_f_8petsc4py_5PETSc_PyPetscObject_GetPtr(PyObject *__pyx_v_arg) {
  PetscObject *__pyx_v_retv;
  struct PyPetscObjectObject *__pyx_v_ob = 0;
  PetscObject *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PetscObject *__pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscObject_GetPtr", 0);

  /* "PETSc/CAPI.pyx":50
 * 
 * cdef api PetscObject* PyPetscObject_GetPtr(object arg) except NULL:
 *     cdef PetscObject *retv = NULL             # <<<<<<<<<<<<<<
 *     cdef Object ob = <Object?> arg
 *     retv = ob.obj
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":51
 * cdef api PetscObject* PyPetscObject_GetPtr(object arg) except NULL:
 *     cdef PetscObject *retv = NULL
 *     cdef Object ob = <Object?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.obj
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_Object)))) __PYX_ERR(47, 51, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscObjectObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":52
 *     cdef PetscObject *retv = NULL
 *     cdef Object ob = <Object?> arg
 *     retv = ob.obj             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->obj;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":53
 *     cdef Object ob = <Object?> arg
 *     retv = ob.obj
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- Viewer --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":49
 *     return retv
 * 
 * cdef api PetscObject* PyPetscObject_GetPtr(object arg) except NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscObject *retv = NULL
 *     cdef Object ob = <Object?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscObject_GetPtr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":57
 * # -- Viewer --
 * 
 * cdef api object PyPetscViewer_New(PetscViewer arg):             # <<<<<<<<<<<<<<
 *     cdef Viewer retv = Viewer()
 *     setref(&retv.vwr, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscViewer_New(PetscViewer __pyx_v_arg) {
  struct PyPetscViewerObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscViewer_New", 0);

  /* "PETSc/CAPI.pyx":58
 * 
 * cdef api object PyPetscViewer_New(PetscViewer arg):
 *     cdef Viewer retv = Viewer()             # <<<<<<<<<<<<<<
 *     setref(&retv.vwr, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscViewerObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":59
 * cdef api object PyPetscViewer_New(PetscViewer arg):
 *     cdef Viewer retv = Viewer()
 *     setref(&retv.vwr, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->vwr), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 59, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":60
 *     cdef Viewer retv = Viewer()
 *     setref(&retv.vwr, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscViewer PyPetscViewer_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":57
 * # -- Viewer --
 * 
 * cdef api object PyPetscViewer_New(PetscViewer arg):             # <<<<<<<<<<<<<<
 *     cdef Viewer retv = Viewer()
 *     setref(&retv.vwr, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscViewer_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":62
 *     return retv
 * 
 * cdef api PetscViewer PyPetscViewer_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscViewer retv = NULL
 *     cdef Viewer ob = <Viewer?> arg
 */

static PetscViewer __pyx_f_8petsc4py_5PETSc_PyPetscViewer_Get(PyObject *__pyx_v_arg) {
  PetscViewer __pyx_v_retv;
  struct PyPetscViewerObject *__pyx_v_ob = 0;
  PetscViewer __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PetscViewer __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscViewer_Get", 0);

  /* "PETSc/CAPI.pyx":63
 * 
 * cdef api PetscViewer PyPetscViewer_Get(object arg) except ? NULL:
 *     cdef PetscViewer retv = NULL             # <<<<<<<<<<<<<<
 *     cdef Viewer ob = <Viewer?> arg
 *     retv = ob.vwr
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":64
 * cdef api PetscViewer PyPetscViewer_Get(object arg) except ? NULL:
 *     cdef PetscViewer retv = NULL
 *     cdef Viewer ob = <Viewer?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.vwr
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_Viewer)))) __PYX_ERR(47, 64, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscViewerObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":65
 *     cdef PetscViewer retv = NULL
 *     cdef Viewer ob = <Viewer?> arg
 *     retv = ob.vwr             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->vwr;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":66
 *     cdef Viewer ob = <Viewer?> arg
 *     retv = ob.vwr
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- Random --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":62
 *     return retv
 * 
 * cdef api PetscViewer PyPetscViewer_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscViewer retv = NULL
 *     cdef Viewer ob = <Viewer?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscViewer_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":70
 * # -- Random --
 * 
 * cdef api object PyPetscRandom_New(PetscRandom arg):             # <<<<<<<<<<<<<<
 *     cdef Random retv = Random()
 *     setref(&retv.rnd, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscRandom_New(PetscRandom __pyx_v_arg) {
  struct PyPetscRandomObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscRandom_New", 0);

  /* "PETSc/CAPI.pyx":71
 * 
 * cdef api object PyPetscRandom_New(PetscRandom arg):
 *     cdef Random retv = Random()             # <<<<<<<<<<<<<<
 *     setref(&retv.rnd, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Random), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscRandomObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":72
 * cdef api object PyPetscRandom_New(PetscRandom arg):
 *     cdef Random retv = Random()
 *     setref(&retv.rnd, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->rnd), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 72, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":73
 *     cdef Random retv = Random()
 *     setref(&retv.rnd, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscRandom PyPetscRandom_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":70
 * # -- Random --
 * 
 * cdef api object PyPetscRandom_New(PetscRandom arg):             # <<<<<<<<<<<<<<
 *     cdef Random retv = Random()
 *     setref(&retv.rnd, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscRandom_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":75
 *     return retv
 * 
 * cdef api PetscRandom PyPetscRandom_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscRandom retv = NULL
 *     cdef Random ob = <Random?> arg
 */

static PetscRandom __pyx_f_8petsc4py_5PETSc_PyPetscRandom_Get(PyObject *__pyx_v_arg) {
  PetscRandom __pyx_v_retv;
  struct PyPetscRandomObject *__pyx_v_ob = 0;
  PetscRandom __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PetscRandom __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscRandom_Get", 0);

  /* "PETSc/CAPI.pyx":76
 * 
 * cdef api PetscRandom PyPetscRandom_Get(object arg) except ? NULL:
 *     cdef PetscRandom retv = NULL             # <<<<<<<<<<<<<<
 *     cdef Random ob = <Random?> arg
 *     retv = ob.rnd
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":77
 * cdef api PetscRandom PyPetscRandom_Get(object arg) except ? NULL:
 *     cdef PetscRandom retv = NULL
 *     cdef Random ob = <Random?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.rnd
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_Random)))) __PYX_ERR(47, 77, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscRandomObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":78
 *     cdef PetscRandom retv = NULL
 *     cdef Random ob = <Random?> arg
 *     retv = ob.rnd             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->rnd;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":79
 *     cdef Random ob = <Random?> arg
 *     retv = ob.rnd
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- IS --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":75
 *     return retv
 * 
 * cdef api PetscRandom PyPetscRandom_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscRandom retv = NULL
 *     cdef Random ob = <Random?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscRandom_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":83
 * # -- IS --
 * 
 * cdef api object PyPetscIS_New(PetscIS arg):             # <<<<<<<<<<<<<<
 *     cdef IS retv = IS()
 *     setref(&retv.iset, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscIS_New(IS __pyx_v_arg) {
  struct PyPetscISObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscIS_New", 0);

  /* "PETSc/CAPI.pyx":84
 * 
 * cdef api object PyPetscIS_New(PetscIS arg):
 *     cdef IS retv = IS()             # <<<<<<<<<<<<<<
 *     setref(&retv.iset, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":85
 * cdef api object PyPetscIS_New(PetscIS arg):
 *     cdef IS retv = IS()
 *     setref(&retv.iset, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->iset), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 85, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":86
 *     cdef IS retv = IS()
 *     setref(&retv.iset, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscIS PyPetscIS_Get(object arg) except? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":83
 * # -- IS --
 * 
 * cdef api object PyPetscIS_New(PetscIS arg):             # <<<<<<<<<<<<<<
 *     cdef IS retv = IS()
 *     setref(&retv.iset, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscIS_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":88
 *     return retv
 * 
 * cdef api PetscIS PyPetscIS_Get(object arg) except? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscIS retv = NULL
 *     cdef IS ob = <IS?> arg
 */

static IS __pyx_f_8petsc4py_5PETSc_PyPetscIS_Get(PyObject *__pyx_v_arg) {
  IS __pyx_v_retv;
  struct PyPetscISObject *__pyx_v_ob = 0;
  IS __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  IS __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscIS_Get", 0);

  /* "PETSc/CAPI.pyx":89
 * 
 * cdef api PetscIS PyPetscIS_Get(object arg) except? NULL:
 *     cdef PetscIS retv = NULL             # <<<<<<<<<<<<<<
 *     cdef IS ob = <IS?> arg
 *     retv = ob.iset
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":90
 * cdef api PetscIS PyPetscIS_Get(object arg) except? NULL:
 *     cdef PetscIS retv = NULL
 *     cdef IS ob = <IS?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.iset
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_IS)))) __PYX_ERR(47, 90, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscISObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":91
 *     cdef PetscIS retv = NULL
 *     cdef IS ob = <IS?> arg
 *     retv = ob.iset             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->iset;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":92
 *     cdef IS ob = <IS?> arg
 *     retv = ob.iset
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- LGMap --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":88
 *     return retv
 * 
 * cdef api PetscIS PyPetscIS_Get(object arg) except? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscIS retv = NULL
 *     cdef IS ob = <IS?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscIS_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":96
 * # -- LGMap --
 * 
 * cdef api object PyPetscLGMap_New(PetscLGMap arg):             # <<<<<<<<<<<<<<
 *     cdef LGMap retv = LGMap()
 *     setref(&retv.lgm, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscLGMap_New(ISLocalToGlobalMapping __pyx_v_arg) {
  struct PyPetscLGMapObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscLGMap_New", 0);

  /* "PETSc/CAPI.pyx":97
 * 
 * cdef api object PyPetscLGMap_New(PetscLGMap arg):
 *     cdef LGMap retv = LGMap()             # <<<<<<<<<<<<<<
 *     setref(&retv.lgm, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_LGMap), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscLGMapObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":98
 * cdef api object PyPetscLGMap_New(PetscLGMap arg):
 *     cdef LGMap retv = LGMap()
 *     setref(&retv.lgm, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->lgm), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 98, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":99
 *     cdef LGMap retv = LGMap()
 *     setref(&retv.lgm, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscLGMap PyPetscLGMap_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":96
 * # -- LGMap --
 * 
 * cdef api object PyPetscLGMap_New(PetscLGMap arg):             # <<<<<<<<<<<<<<
 *     cdef LGMap retv = LGMap()
 *     setref(&retv.lgm, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscLGMap_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":101
 *     return retv
 * 
 * cdef api PetscLGMap PyPetscLGMap_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscLGMap retv = NULL
 *     cdef LGMap ob = <LGMap?> arg
 */

static ISLocalToGlobalMapping __pyx_f_8petsc4py_5PETSc_PyPetscLGMap_Get(PyObject *__pyx_v_arg) {
  ISLocalToGlobalMapping __pyx_v_retv;
  struct PyPetscLGMapObject *__pyx_v_ob = 0;
  ISLocalToGlobalMapping __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  ISLocalToGlobalMapping __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscLGMap_Get", 0);

  /* "PETSc/CAPI.pyx":102
 * 
 * cdef api PetscLGMap PyPetscLGMap_Get(object arg) except ? NULL:
 *     cdef PetscLGMap retv = NULL             # <<<<<<<<<<<<<<
 *     cdef LGMap ob = <LGMap?> arg
 *     retv = ob.lgm
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":103
 * cdef api PetscLGMap PyPetscLGMap_Get(object arg) except ? NULL:
 *     cdef PetscLGMap retv = NULL
 *     cdef LGMap ob = <LGMap?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.lgm
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_LGMap)))) __PYX_ERR(47, 103, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscLGMapObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":104
 *     cdef PetscLGMap retv = NULL
 *     cdef LGMap ob = <LGMap?> arg
 *     retv = ob.lgm             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->lgm;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":105
 *     cdef LGMap ob = <LGMap?> arg
 *     retv = ob.lgm
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- SF --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":101
 *     return retv
 * 
 * cdef api PetscLGMap PyPetscLGMap_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscLGMap retv = NULL
 *     cdef LGMap ob = <LGMap?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscLGMap_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":109
 * # -- SF --
 * 
 * cdef api object PyPetscSF_New(PetscSF arg):             # <<<<<<<<<<<<<<
 *     cdef SF retv = SF()
 *     setref(&retv.sf, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscSF_New(PetscSF __pyx_v_arg) {
  struct PyPetscSFObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscSF_New", 0);

  /* "PETSc/CAPI.pyx":110
 * 
 * cdef api object PyPetscSF_New(PetscSF arg):
 *     cdef SF retv = SF()             # <<<<<<<<<<<<<<
 *     setref(&retv.sf, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SF), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscSFObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":111
 * cdef api object PyPetscSF_New(PetscSF arg):
 *     cdef SF retv = SF()
 *     setref(&retv.sf, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->sf), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 111, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":112
 *     cdef SF retv = SF()
 *     setref(&retv.sf, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscSF PyPetscSF_Get(object arg) except? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":109
 * # -- SF --
 * 
 * cdef api object PyPetscSF_New(PetscSF arg):             # <<<<<<<<<<<<<<
 *     cdef SF retv = SF()
 *     setref(&retv.sf, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscSF_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":114
 *     return retv
 * 
 * cdef api PetscSF PyPetscSF_Get(object arg) except? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscSF retv = NULL
 *     cdef SF ob = <SF?> arg
 */

static PetscSF __pyx_f_8petsc4py_5PETSc_PyPetscSF_Get(PyObject *__pyx_v_arg) {
  PetscSF __pyx_v_retv;
  struct PyPetscSFObject *__pyx_v_ob = 0;
  PetscSF __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PetscSF __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscSF_Get", 0);

  /* "PETSc/CAPI.pyx":115
 * 
 * cdef api PetscSF PyPetscSF_Get(object arg) except? NULL:
 *     cdef PetscSF retv = NULL             # <<<<<<<<<<<<<<
 *     cdef SF ob = <SF?> arg
 *     retv = ob.sf
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":116
 * cdef api PetscSF PyPetscSF_Get(object arg) except? NULL:
 *     cdef PetscSF retv = NULL
 *     cdef SF ob = <SF?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.sf
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_SF)))) __PYX_ERR(47, 116, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscSFObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":117
 *     cdef PetscSF retv = NULL
 *     cdef SF ob = <SF?> arg
 *     retv = ob.sf             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->sf;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":118
 *     cdef SF ob = <SF?> arg
 *     retv = ob.sf
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- Vec --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":114
 *     return retv
 * 
 * cdef api PetscSF PyPetscSF_Get(object arg) except? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscSF retv = NULL
 *     cdef SF ob = <SF?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscSF_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":122
 * # -- Vec --
 * 
 * cdef api object PyPetscVec_New(PetscVec arg):             # <<<<<<<<<<<<<<
 *     cdef Vec retv = Vec()
 *     setref(&retv.vec, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscVec_New(Vec __pyx_v_arg) {
  struct PyPetscVecObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscVec_New", 0);

  /* "PETSc/CAPI.pyx":123
 * 
 * cdef api object PyPetscVec_New(PetscVec arg):
 *     cdef Vec retv = Vec()             # <<<<<<<<<<<<<<
 *     setref(&retv.vec, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":124
 * cdef api object PyPetscVec_New(PetscVec arg):
 *     cdef Vec retv = Vec()
 *     setref(&retv.vec, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->vec), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 124, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":125
 *     cdef Vec retv = Vec()
 *     setref(&retv.vec, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscVec PyPetscVec_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":122
 * # -- Vec --
 * 
 * cdef api object PyPetscVec_New(PetscVec arg):             # <<<<<<<<<<<<<<
 *     cdef Vec retv = Vec()
 *     setref(&retv.vec, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscVec_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":127
 *     return retv
 * 
 * cdef api PetscVec PyPetscVec_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscVec retv = NULL
 *     cdef Vec ob = <Vec?> arg
 */

static Vec __pyx_f_8petsc4py_5PETSc_PyPetscVec_Get(PyObject *__pyx_v_arg) {
  Vec __pyx_v_retv;
  struct PyPetscVecObject *__pyx_v_ob = 0;
  Vec __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Vec __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscVec_Get", 0);

  /* "PETSc/CAPI.pyx":128
 * 
 * cdef api PetscVec PyPetscVec_Get(object arg) except ? NULL:
 *     cdef PetscVec retv = NULL             # <<<<<<<<<<<<<<
 *     cdef Vec ob = <Vec?> arg
 *     retv = ob.vec
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":129
 * cdef api PetscVec PyPetscVec_Get(object arg) except ? NULL:
 *     cdef PetscVec retv = NULL
 *     cdef Vec ob = <Vec?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.vec
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_Vec)))) __PYX_ERR(47, 129, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscVecObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":130
 *     cdef PetscVec retv = NULL
 *     cdef Vec ob = <Vec?> arg
 *     retv = ob.vec             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->vec;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":131
 *     cdef Vec ob = <Vec?> arg
 *     retv = ob.vec
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- Scatter --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":127
 *     return retv
 * 
 * cdef api PetscVec PyPetscVec_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscVec retv = NULL
 *     cdef Vec ob = <Vec?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscVec_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":135
 * # -- Scatter --
 * 
 * cdef api object PyPetscScatter_New(PetscScatter arg):             # <<<<<<<<<<<<<<
 *     cdef Scatter retv = Scatter()
 *     setref(&retv.sct, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscScatter_New(VecScatter __pyx_v_arg) {
  struct PyPetscScatterObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscScatter_New", 0);

  /* "PETSc/CAPI.pyx":136
 * 
 * cdef api object PyPetscScatter_New(PetscScatter arg):
 *     cdef Scatter retv = Scatter()             # <<<<<<<<<<<<<<
 *     setref(&retv.sct, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Scatter), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscScatterObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":137
 * cdef api object PyPetscScatter_New(PetscScatter arg):
 *     cdef Scatter retv = Scatter()
 *     setref(&retv.sct, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->sct), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 137, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":138
 *     cdef Scatter retv = Scatter()
 *     setref(&retv.sct, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscScatter PyPetscScatter_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":135
 * # -- Scatter --
 * 
 * cdef api object PyPetscScatter_New(PetscScatter arg):             # <<<<<<<<<<<<<<
 *     cdef Scatter retv = Scatter()
 *     setref(&retv.sct, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscScatter_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":140
 *     return retv
 * 
 * cdef api PetscScatter PyPetscScatter_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscScatter retv = NULL
 *     cdef Scatter ob = <Scatter?> arg
 */

static VecScatter __pyx_f_8petsc4py_5PETSc_PyPetscScatter_Get(PyObject *__pyx_v_arg) {
  VecScatter __pyx_v_retv;
  struct PyPetscScatterObject *__pyx_v_ob = 0;
  VecScatter __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  VecScatter __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscScatter_Get", 0);

  /* "PETSc/CAPI.pyx":141
 * 
 * cdef api PetscScatter PyPetscScatter_Get(object arg) except ? NULL:
 *     cdef PetscScatter retv = NULL             # <<<<<<<<<<<<<<
 *     cdef Scatter ob = <Scatter?> arg
 *     retv = ob.sct
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":142
 * cdef api PetscScatter PyPetscScatter_Get(object arg) except ? NULL:
 *     cdef PetscScatter retv = NULL
 *     cdef Scatter ob = <Scatter?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.sct
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_Scatter)))) __PYX_ERR(47, 142, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscScatterObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":143
 *     cdef PetscScatter retv = NULL
 *     cdef Scatter ob = <Scatter?> arg
 *     retv = ob.sct             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->sct;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":144
 *     cdef Scatter ob = <Scatter?> arg
 *     retv = ob.sct
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- Section --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":140
 *     return retv
 * 
 * cdef api PetscScatter PyPetscScatter_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscScatter retv = NULL
 *     cdef Scatter ob = <Scatter?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscScatter_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":148
 * # -- Section --
 * 
 * cdef api object PyPetscSection_New(PetscSection arg):             # <<<<<<<<<<<<<<
 *     cdef Section retv = Section()
 *     setref(&retv.sec, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscSection_New(PetscSection __pyx_v_arg) {
  struct PyPetscSectionObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscSection_New", 0);

  /* "PETSc/CAPI.pyx":149
 * 
 * cdef api object PyPetscSection_New(PetscSection arg):
 *     cdef Section retv = Section()             # <<<<<<<<<<<<<<
 *     setref(&retv.sec, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Section), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscSectionObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":150
 * cdef api object PyPetscSection_New(PetscSection arg):
 *     cdef Section retv = Section()
 *     setref(&retv.sec, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->sec), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 150, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":151
 *     cdef Section retv = Section()
 *     setref(&retv.sec, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscSection PyPetscSection_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":148
 * # -- Section --
 * 
 * cdef api object PyPetscSection_New(PetscSection arg):             # <<<<<<<<<<<<<<
 *     cdef Section retv = Section()
 *     setref(&retv.sec, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscSection_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":153
 *     return retv
 * 
 * cdef api PetscSection PyPetscSection_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscSection retv = NULL
 *     cdef Section ob = <Section?> arg
 */

static PetscSection __pyx_f_8petsc4py_5PETSc_PyPetscSection_Get(PyObject *__pyx_v_arg) {
  PetscSection __pyx_v_retv;
  struct PyPetscSectionObject *__pyx_v_ob = 0;
  PetscSection __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PetscSection __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscSection_Get", 0);

  /* "PETSc/CAPI.pyx":154
 * 
 * cdef api PetscSection PyPetscSection_Get(object arg) except ? NULL:
 *     cdef PetscSection retv = NULL             # <<<<<<<<<<<<<<
 *     cdef Section ob = <Section?> arg
 *     retv = ob.sec
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":155
 * cdef api PetscSection PyPetscSection_Get(object arg) except ? NULL:
 *     cdef PetscSection retv = NULL
 *     cdef Section ob = <Section?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.sec
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_Section)))) __PYX_ERR(47, 155, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscSectionObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":156
 *     cdef PetscSection retv = NULL
 *     cdef Section ob = <Section?> arg
 *     retv = ob.sec             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->sec;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":157
 *     cdef Section ob = <Section?> arg
 *     retv = ob.sec
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- Mat --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":153
 *     return retv
 * 
 * cdef api PetscSection PyPetscSection_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscSection retv = NULL
 *     cdef Section ob = <Section?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscSection_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":161
 * # -- Mat --
 * 
 * cdef api object PyPetscMat_New(PetscMat arg):             # <<<<<<<<<<<<<<
 *     cdef Mat retv = Mat()
 *     setref(&retv.mat, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscMat_New(Mat __pyx_v_arg) {
  struct PyPetscMatObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscMat_New", 0);

  /* "PETSc/CAPI.pyx":162
 * 
 * cdef api object PyPetscMat_New(PetscMat arg):
 *     cdef Mat retv = Mat()             # <<<<<<<<<<<<<<
 *     setref(&retv.mat, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":163
 * cdef api object PyPetscMat_New(PetscMat arg):
 *     cdef Mat retv = Mat()
 *     setref(&retv.mat, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->mat), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 163, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":164
 *     cdef Mat retv = Mat()
 *     setref(&retv.mat, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscMat PyPetscMat_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":161
 * # -- Mat --
 * 
 * cdef api object PyPetscMat_New(PetscMat arg):             # <<<<<<<<<<<<<<
 *     cdef Mat retv = Mat()
 *     setref(&retv.mat, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscMat_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":166
 *     return retv
 * 
 * cdef api PetscMat PyPetscMat_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscMat retv = NULL
 *     cdef Mat ob = <Mat?> arg
 */

static Mat __pyx_f_8petsc4py_5PETSc_PyPetscMat_Get(PyObject *__pyx_v_arg) {
  Mat __pyx_v_retv;
  struct PyPetscMatObject *__pyx_v_ob = 0;
  Mat __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Mat __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscMat_Get", 0);

  /* "PETSc/CAPI.pyx":167
 * 
 * cdef api PetscMat PyPetscMat_Get(object arg) except ? NULL:
 *     cdef PetscMat retv = NULL             # <<<<<<<<<<<<<<
 *     cdef Mat ob = <Mat?> arg
 *     retv = ob.mat
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":168
 * cdef api PetscMat PyPetscMat_Get(object arg) except ? NULL:
 *     cdef PetscMat retv = NULL
 *     cdef Mat ob = <Mat?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.mat
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_Mat)))) __PYX_ERR(47, 168, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscMatObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":169
 *     cdef PetscMat retv = NULL
 *     cdef Mat ob = <Mat?> arg
 *     retv = ob.mat             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->mat;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":170
 *     cdef Mat ob = <Mat?> arg
 *     retv = ob.mat
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- PC --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":166
 *     return retv
 * 
 * cdef api PetscMat PyPetscMat_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscMat retv = NULL
 *     cdef Mat ob = <Mat?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscMat_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":174
 * # -- PC --
 * 
 * cdef api object PyPetscPC_New(PetscPC arg):             # <<<<<<<<<<<<<<
 *     cdef PC retv = PC()
 *     setref(&retv.pc, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscPC_New(PC __pyx_v_arg) {
  struct PyPetscPCObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscPC_New", 0);

  /* "PETSc/CAPI.pyx":175
 * 
 * cdef api object PyPetscPC_New(PetscPC arg):
 *     cdef PC retv = PC()             # <<<<<<<<<<<<<<
 *     setref(&retv.pc, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_PC), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscPCObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":176
 * cdef api object PyPetscPC_New(PetscPC arg):
 *     cdef PC retv = PC()
 *     setref(&retv.pc, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->pc), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 176, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":177
 *     cdef PC retv = PC()
 *     setref(&retv.pc, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscPC PyPetscPC_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":174
 * # -- PC --
 * 
 * cdef api object PyPetscPC_New(PetscPC arg):             # <<<<<<<<<<<<<<
 *     cdef PC retv = PC()
 *     setref(&retv.pc, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscPC_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":179
 *     return retv
 * 
 * cdef api PetscPC PyPetscPC_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscPC retv = NULL
 *     cdef PC ob = <PC?> arg
 */

static PC __pyx_f_8petsc4py_5PETSc_PyPetscPC_Get(PyObject *__pyx_v_arg) {
  PC __pyx_v_retv;
  struct PyPetscPCObject *__pyx_v_ob = 0;
  PC __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PC __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscPC_Get", 0);

  /* "PETSc/CAPI.pyx":180
 * 
 * cdef api PetscPC PyPetscPC_Get(object arg) except ? NULL:
 *     cdef PetscPC retv = NULL             # <<<<<<<<<<<<<<
 *     cdef PC ob = <PC?> arg
 *     retv = ob.pc
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":181
 * cdef api PetscPC PyPetscPC_Get(object arg) except ? NULL:
 *     cdef PetscPC retv = NULL
 *     cdef PC ob = <PC?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.pc
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_PC)))) __PYX_ERR(47, 181, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscPCObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":182
 *     cdef PetscPC retv = NULL
 *     cdef PC ob = <PC?> arg
 *     retv = ob.pc             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->pc;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":183
 *     cdef PC ob = <PC?> arg
 *     retv = ob.pc
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- KSP --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":179
 *     return retv
 * 
 * cdef api PetscPC PyPetscPC_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscPC retv = NULL
 *     cdef PC ob = <PC?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscPC_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":187
 * # -- KSP --
 * 
 * cdef api object PyPetscKSP_New(PetscKSP arg):             # <<<<<<<<<<<<<<
 *     cdef KSP retv = KSP()
 *     setref(&retv.ksp, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscKSP_New(KSP __pyx_v_arg) {
  struct PyPetscKSPObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscKSP_New", 0);

  /* "PETSc/CAPI.pyx":188
 * 
 * cdef api object PyPetscKSP_New(PetscKSP arg):
 *     cdef KSP retv = KSP()             # <<<<<<<<<<<<<<
 *     setref(&retv.ksp, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscKSPObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":189
 * cdef api object PyPetscKSP_New(PetscKSP arg):
 *     cdef KSP retv = KSP()
 *     setref(&retv.ksp, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->ksp), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 189, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":190
 *     cdef KSP retv = KSP()
 *     setref(&retv.ksp, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscKSP PyPetscKSP_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":187
 * # -- KSP --
 * 
 * cdef api object PyPetscKSP_New(PetscKSP arg):             # <<<<<<<<<<<<<<
 *     cdef KSP retv = KSP()
 *     setref(&retv.ksp, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscKSP_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":192
 *     return retv
 * 
 * cdef api PetscKSP PyPetscKSP_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscKSP retv = NULL
 *     cdef KSP ob = <KSP?> arg
 */

static KSP __pyx_f_8petsc4py_5PETSc_PyPetscKSP_Get(PyObject *__pyx_v_arg) {
  KSP __pyx_v_retv;
  struct PyPetscKSPObject *__pyx_v_ob = 0;
  KSP __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  KSP __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscKSP_Get", 0);

  /* "PETSc/CAPI.pyx":193
 * 
 * cdef api PetscKSP PyPetscKSP_Get(object arg) except ? NULL:
 *     cdef PetscKSP retv = NULL             # <<<<<<<<<<<<<<
 *     cdef KSP ob = <KSP?> arg
 *     retv = ob.ksp
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":194
 * cdef api PetscKSP PyPetscKSP_Get(object arg) except ? NULL:
 *     cdef PetscKSP retv = NULL
 *     cdef KSP ob = <KSP?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.ksp
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_KSP)))) __PYX_ERR(47, 194, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscKSPObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":195
 *     cdef PetscKSP retv = NULL
 *     cdef KSP ob = <KSP?> arg
 *     retv = ob.ksp             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->ksp;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":196
 *     cdef KSP ob = <KSP?> arg
 *     retv = ob.ksp
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- SNES --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":192
 *     return retv
 * 
 * cdef api PetscKSP PyPetscKSP_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscKSP retv = NULL
 *     cdef KSP ob = <KSP?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscKSP_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":200
 * # -- SNES --
 * 
 * cdef api object PyPetscSNES_New(PetscSNES arg):             # <<<<<<<<<<<<<<
 *     cdef SNES retv = SNES()
 *     setref(&retv.snes, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscSNES_New(SNES __pyx_v_arg) {
  struct PyPetscSNESObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscSNES_New", 0);

  /* "PETSc/CAPI.pyx":201
 * 
 * cdef api object PyPetscSNES_New(PetscSNES arg):
 *     cdef SNES retv = SNES()             # <<<<<<<<<<<<<<
 *     setref(&retv.snes, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":202
 * cdef api object PyPetscSNES_New(PetscSNES arg):
 *     cdef SNES retv = SNES()
 *     setref(&retv.snes, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->snes), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 202, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":203
 *     cdef SNES retv = SNES()
 *     setref(&retv.snes, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscSNES PyPetscSNES_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":200
 * # -- SNES --
 * 
 * cdef api object PyPetscSNES_New(PetscSNES arg):             # <<<<<<<<<<<<<<
 *     cdef SNES retv = SNES()
 *     setref(&retv.snes, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscSNES_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":205
 *     return retv
 * 
 * cdef api PetscSNES PyPetscSNES_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscSNES retv = NULL
 *     cdef SNES ob = <SNES?> arg
 */

static SNES __pyx_f_8petsc4py_5PETSc_PyPetscSNES_Get(PyObject *__pyx_v_arg) {
  SNES __pyx_v_retv;
  struct PyPetscSNESObject *__pyx_v_ob = 0;
  SNES __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  SNES __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscSNES_Get", 0);

  /* "PETSc/CAPI.pyx":206
 * 
 * cdef api PetscSNES PyPetscSNES_Get(object arg) except ? NULL:
 *     cdef PetscSNES retv = NULL             # <<<<<<<<<<<<<<
 *     cdef SNES ob = <SNES?> arg
 *     retv = ob.snes
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":207
 * cdef api PetscSNES PyPetscSNES_Get(object arg) except ? NULL:
 *     cdef PetscSNES retv = NULL
 *     cdef SNES ob = <SNES?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.snes
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_SNES)))) __PYX_ERR(47, 207, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscSNESObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":208
 *     cdef PetscSNES retv = NULL
 *     cdef SNES ob = <SNES?> arg
 *     retv = ob.snes             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->snes;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":209
 *     cdef SNES ob = <SNES?> arg
 *     retv = ob.snes
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- TS --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":205
 *     return retv
 * 
 * cdef api PetscSNES PyPetscSNES_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscSNES retv = NULL
 *     cdef SNES ob = <SNES?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscSNES_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":213
 * # -- TS --
 * 
 * cdef api object PyPetscTS_New(PetscTS arg):             # <<<<<<<<<<<<<<
 *     cdef TS retv = TS()
 *     setref(&retv.ts, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscTS_New(TS __pyx_v_arg) {
  struct PyPetscTSObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscTS_New", 0);

  /* "PETSc/CAPI.pyx":214
 * 
 * cdef api object PyPetscTS_New(PetscTS arg):
 *     cdef TS retv = TS()             # <<<<<<<<<<<<<<
 *     setref(&retv.ts, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TS), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscTSObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":215
 * cdef api object PyPetscTS_New(PetscTS arg):
 *     cdef TS retv = TS()
 *     setref(&retv.ts, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->ts), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 215, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":216
 *     cdef TS retv = TS()
 *     setref(&retv.ts, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscTS PyPetscTS_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":213
 * # -- TS --
 * 
 * cdef api object PyPetscTS_New(PetscTS arg):             # <<<<<<<<<<<<<<
 *     cdef TS retv = TS()
 *     setref(&retv.ts, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscTS_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":218
 *     return retv
 * 
 * cdef api PetscTS PyPetscTS_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscTS retv = NULL
 *     cdef TS ob = <TS?> arg
 */

static TS __pyx_f_8petsc4py_5PETSc_PyPetscTS_Get(PyObject *__pyx_v_arg) {
  TS __pyx_v_retv;
  struct PyPetscTSObject *__pyx_v_ob = 0;
  TS __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  TS __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscTS_Get", 0);

  /* "PETSc/CAPI.pyx":219
 * 
 * cdef api PetscTS PyPetscTS_Get(object arg) except ? NULL:
 *     cdef PetscTS retv = NULL             # <<<<<<<<<<<<<<
 *     cdef TS ob = <TS?> arg
 *     retv = ob.ts
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":220
 * cdef api PetscTS PyPetscTS_Get(object arg) except ? NULL:
 *     cdef PetscTS retv = NULL
 *     cdef TS ob = <TS?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.ts
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_TS)))) __PYX_ERR(47, 220, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscTSObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":221
 *     cdef PetscTS retv = NULL
 *     cdef TS ob = <TS?> arg
 *     retv = ob.ts             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->ts;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":222
 *     cdef TS ob = <TS?> arg
 *     retv = ob.ts
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- TAO --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":218
 *     return retv
 * 
 * cdef api PetscTS PyPetscTS_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscTS retv = NULL
 *     cdef TS ob = <TS?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscTS_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":226
 * # -- TAO --
 * 
 * cdef api object PyPetscTAO_New(PetscTAO arg):             # <<<<<<<<<<<<<<
 *     cdef TAO retv = TAO()
 *     setref(&retv.tao, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscTAO_New(Tao __pyx_v_arg) {
  struct PyPetscTAOObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscTAO_New", 0);

  /* "PETSc/CAPI.pyx":227
 * 
 * cdef api object PyPetscTAO_New(PetscTAO arg):
 *     cdef TAO retv = TAO()             # <<<<<<<<<<<<<<
 *     setref(&retv.tao, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TAO), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":228
 * cdef api object PyPetscTAO_New(PetscTAO arg):
 *     cdef TAO retv = TAO()
 *     setref(&retv.tao, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->tao), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 228, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":229
 *     cdef TAO retv = TAO()
 *     setref(&retv.tao, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscTAO PyPetscTAO_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":226
 * # -- TAO --
 * 
 * cdef api object PyPetscTAO_New(PetscTAO arg):             # <<<<<<<<<<<<<<
 *     cdef TAO retv = TAO()
 *     setref(&retv.tao, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscTAO_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":231
 *     return retv
 * 
 * cdef api PetscTAO PyPetscTAO_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscTAO retv = NULL
 *     cdef TAO ob = <TAO?> arg
 */

static Tao __pyx_f_8petsc4py_5PETSc_PyPetscTAO_Get(PyObject *__pyx_v_arg) {
  Tao __pyx_v_retv;
  struct PyPetscTAOObject *__pyx_v_ob = 0;
  Tao __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Tao __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscTAO_Get", 0);

  /* "PETSc/CAPI.pyx":232
 * 
 * cdef api PetscTAO PyPetscTAO_Get(object arg) except ? NULL:
 *     cdef PetscTAO retv = NULL             # <<<<<<<<<<<<<<
 *     cdef TAO ob = <TAO?> arg
 *     retv = ob.tao
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":233
 * cdef api PetscTAO PyPetscTAO_Get(object arg) except ? NULL:
 *     cdef PetscTAO retv = NULL
 *     cdef TAO ob = <TAO?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.tao
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_TAO)))) __PYX_ERR(47, 233, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscTAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":234
 *     cdef PetscTAO retv = NULL
 *     cdef TAO ob = <TAO?> arg
 *     retv = ob.tao             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->tao;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":235
 *     cdef TAO ob = <TAO?> arg
 *     retv = ob.tao
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- AO --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":231
 *     return retv
 * 
 * cdef api PetscTAO PyPetscTAO_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscTAO retv = NULL
 *     cdef TAO ob = <TAO?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscTAO_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":239
 * # -- AO --
 * 
 * cdef api object PyPetscAO_New(PetscAO arg):             # <<<<<<<<<<<<<<
 *     cdef AO retv = AO()
 *     setref(&retv.ao, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscAO_New(AO __pyx_v_arg) {
  struct PyPetscAOObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscAO_New", 0);

  /* "PETSc/CAPI.pyx":240
 * 
 * cdef api object PyPetscAO_New(PetscAO arg):
 *     cdef AO retv = AO()             # <<<<<<<<<<<<<<
 *     setref(&retv.ao, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_AO), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":241
 * cdef api object PyPetscAO_New(PetscAO arg):
 *     cdef AO retv = AO()
 *     setref(&retv.ao, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->ao), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 241, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":242
 *     cdef AO retv = AO()
 *     setref(&retv.ao, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscAO PyPetscAO_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":239
 * # -- AO --
 * 
 * cdef api object PyPetscAO_New(PetscAO arg):             # <<<<<<<<<<<<<<
 *     cdef AO retv = AO()
 *     setref(&retv.ao, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscAO_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":244
 *     return retv
 * 
 * cdef api PetscAO PyPetscAO_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscAO retv = NULL
 *     cdef AO ob = <AO?> arg
 */

static AO __pyx_f_8petsc4py_5PETSc_PyPetscAO_Get(PyObject *__pyx_v_arg) {
  AO __pyx_v_retv;
  struct PyPetscAOObject *__pyx_v_ob = 0;
  AO __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  AO __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscAO_Get", 0);

  /* "PETSc/CAPI.pyx":245
 * 
 * cdef api PetscAO PyPetscAO_Get(object arg) except ? NULL:
 *     cdef PetscAO retv = NULL             # <<<<<<<<<<<<<<
 *     cdef AO ob = <AO?> arg
 *     retv = ob.ao
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":246
 * cdef api PetscAO PyPetscAO_Get(object arg) except ? NULL:
 *     cdef PetscAO retv = NULL
 *     cdef AO ob = <AO?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.ao
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_AO)))) __PYX_ERR(47, 246, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscAOObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":247
 *     cdef PetscAO retv = NULL
 *     cdef AO ob = <AO?> arg
 *     retv = ob.ao             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->ao;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":248
 *     cdef AO ob = <AO?> arg
 *     retv = ob.ao
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- DM --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":244
 *     return retv
 * 
 * cdef api PetscAO PyPetscAO_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscAO retv = NULL
 *     cdef AO ob = <AO?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscAO_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":252
 * # -- DM --
 * 
 * cdef api object PyPetscDM_New(PetscDM arg):             # <<<<<<<<<<<<<<
 *     cdef DM retv = subtype_DM(arg)()
 *     setref(&retv.dm, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscDM_New(DM __pyx_v_arg) {
  struct PyPetscDMObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("PyPetscDM_New", 0);

  /* "PETSc/CAPI.pyx":253
 * 
 * cdef api object PyPetscDM_New(PetscDM arg):
 *     cdef DM retv = subtype_DM(arg)()             # <<<<<<<<<<<<<<
 *     setref(&retv.dm, arg)
 *     return retv
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8petsc4py_5PETSc_subtype_DM(__pyx_v_arg)); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(47, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8petsc4py_5PETSc_DM))))) __PYX_ERR(47, 253, __pyx_L1_error)
  __pyx_v_retv = ((struct PyPetscDMObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "PETSc/CAPI.pyx":254
 * cdef api object PyPetscDM_New(PetscDM arg):
 *     cdef DM retv = subtype_DM(arg)()
 *     setref(&retv.dm, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->dm), __pyx_v_arg); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(47, 254, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":255
 *     cdef DM retv = subtype_DM(arg)()
 *     setref(&retv.dm, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscDM PyPetscDM_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":252
 * # -- DM --
 * 
 * cdef api object PyPetscDM_New(PetscDM arg):             # <<<<<<<<<<<<<<
 *     cdef DM retv = subtype_DM(arg)()
 *     setref(&retv.dm, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscDM_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":257
 *     return retv
 * 
 * cdef api PetscDM PyPetscDM_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscDM retv = NULL
 *     cdef DM ob = <DM?> arg
 */

static DM __pyx_f_8petsc4py_5PETSc_PyPetscDM_Get(PyObject *__pyx_v_arg) {
  DM __pyx_v_retv;
  struct PyPetscDMObject *__pyx_v_ob = 0;
  DM __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  DM __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscDM_Get", 0);

  /* "PETSc/CAPI.pyx":258
 * 
 * cdef api PetscDM PyPetscDM_Get(object arg) except ? NULL:
 *     cdef PetscDM retv = NULL             # <<<<<<<<<<<<<<
 *     cdef DM ob = <DM?> arg
 *     retv = ob.dm
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":259
 * cdef api PetscDM PyPetscDM_Get(object arg) except ? NULL:
 *     cdef PetscDM retv = NULL
 *     cdef DM ob = <DM?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.dm
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_DM)))) __PYX_ERR(47, 259, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscDMObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":260
 *     cdef PetscDM retv = NULL
 *     cdef DM ob = <DM?> arg
 *     retv = ob.dm             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->dm;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":261
 *     cdef DM ob = <DM?> arg
 *     retv = ob.dm
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * # -- Partitioner --
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":257
 *     return retv
 * 
 * cdef api PetscDM PyPetscDM_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscDM retv = NULL
 *     cdef DM ob = <DM?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscDM_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":265
 * # -- Partitioner --
 * 
 * cdef api object PyPetscPartitioner_New(PetscPartitioner arg):             # <<<<<<<<<<<<<<
 *     cdef Partitioner retv = Partitioner()
 *     setref(&retv.part, arg)
 */

static PyObject *__pyx_f_8petsc4py_5PETSc_PyPetscPartitioner_New(PetscPartitioner __pyx_v_arg) {
  struct PyPetscPartitionerObject *__pyx_v_retv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscPartitioner_New", 0);

  /* "PETSc/CAPI.pyx":266
 * 
 * cdef api object PyPetscPartitioner_New(PetscPartitioner arg):
 *     cdef Partitioner retv = Partitioner()             # <<<<<<<<<<<<<<
 *     setref(&retv.part, arg)
 *     return retv
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Partitioner), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(47, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_retv = ((struct PyPetscPartitionerObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":267
 * cdef api object PyPetscPartitioner_New(PetscPartitioner arg):
 *     cdef Partitioner retv = Partitioner()
 *     setref(&retv.part, arg)             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_setref((&__pyx_v_retv->part), __pyx_v_arg); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(47, 267, __pyx_L1_error)

  /* "PETSc/CAPI.pyx":268
 *     cdef Partitioner retv = Partitioner()
 *     setref(&retv.part, arg)
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * cdef api PetscPartitioner PyPetscPartitioner_Get(object arg) except ? NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_retv));
  __pyx_r = ((PyObject *)__pyx_v_retv);
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":265
 * # -- Partitioner --
 * 
 * cdef api object PyPetscPartitioner_New(PetscPartitioner arg):             # <<<<<<<<<<<<<<
 *     cdef Partitioner retv = Partitioner()
 *     setref(&retv.part, arg)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscPartitioner_New", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_retv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/CAPI.pyx":270
 *     return retv
 * 
 * cdef api PetscPartitioner PyPetscPartitioner_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscPartitioner retv = NULL
 *     cdef Partitioner ob = <Partitioner?> arg
 */

static PetscPartitioner __pyx_f_8petsc4py_5PETSc_PyPetscPartitioner_Get(PyObject *__pyx_v_arg) {
  PetscPartitioner __pyx_v_retv;
  struct PyPetscPartitionerObject *__pyx_v_ob = 0;
  PetscPartitioner __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PetscPartitioner __pyx_t_2;
  __Pyx_RefNannySetupContext("PyPetscPartitioner_Get", 0);

  /* "PETSc/CAPI.pyx":271
 * 
 * cdef api PetscPartitioner PyPetscPartitioner_Get(object arg) except ? NULL:
 *     cdef PetscPartitioner retv = NULL             # <<<<<<<<<<<<<<
 *     cdef Partitioner ob = <Partitioner?> arg
 *     retv = ob.part
 */
  __pyx_v_retv = NULL;

  /* "PETSc/CAPI.pyx":272
 * cdef api PetscPartitioner PyPetscPartitioner_Get(object arg) except ? NULL:
 *     cdef PetscPartitioner retv = NULL
 *     cdef Partitioner ob = <Partitioner?> arg             # <<<<<<<<<<<<<<
 *     retv = ob.part
 *     return retv
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_ptype_8petsc4py_5PETSc_Partitioner)))) __PYX_ERR(47, 272, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_arg;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ob = ((struct PyPetscPartitionerObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/CAPI.pyx":273
 *     cdef PetscPartitioner retv = NULL
 *     cdef Partitioner ob = <Partitioner?> arg
 *     retv = ob.part             # <<<<<<<<<<<<<<
 *     return retv
 * 
 */
  __pyx_t_2 = __pyx_v_ob->part;
  __pyx_v_retv = __pyx_t_2;

  /* "PETSc/CAPI.pyx":274
 *     cdef Partitioner ob = <Partitioner?> arg
 *     retv = ob.part
 *     return retv             # <<<<<<<<<<<<<<
 * 
 * #---------------------------------------------------------------------
 */
  __pyx_r = __pyx_v_retv;
  goto __pyx_L0;

  /* "PETSc/CAPI.pyx":270
 *     return retv
 * 
 * cdef api PetscPartitioner PyPetscPartitioner_Get(object arg) except ? NULL:             # <<<<<<<<<<<<<<
 *     cdef PetscPartitioner retv = NULL
 *     cdef Partitioner ob = <Partitioner?> arg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc.PyPetscPartitioner_Get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ob);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":192
 * cdef object tracebacklist = []
 * 
 * cdef int traceback(MPI_Comm       comm,             # <<<<<<<<<<<<<<
 *                    int            line,
 *                    const_char    *cfun,
 */

static int __pyx_f_8petsc4py_5PETSc_traceback(MPI_Comm __pyx_v_comm, int __pyx_v_line, const char *__pyx_v_cfun, const char *__pyx_v_cfile, int __pyx_v_n, PetscErrorType __pyx_v_p, const char *__pyx_v_mess, void *__pyx_v_ctx) {
  PetscLogDouble __pyx_v_mem;
  PetscLogDouble __pyx_v_rss;
  const char *__pyx_v_text;
  PyObject *__pyx_v_tbl = 0;
  PyObject *__pyx_v_fun = NULL;
  PyObject *__pyx_v_fnm = NULL;
  PyObject *__pyx_v_m = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("traceback", 0);

  /* "PETSc/PETSc.pyx":200
 *                    const_char    *mess,
 *                    void          *ctx) with gil:
 *     cdef PetscLogDouble mem=0             # <<<<<<<<<<<<<<
 *     cdef PetscLogDouble rss=0
 *     cdef const_char    *text=NULL
 */
  __pyx_v_mem = 0.0;

  /* "PETSc/PETSc.pyx":201
 *                    void          *ctx) with gil:
 *     cdef PetscLogDouble mem=0
 *     cdef PetscLogDouble rss=0             # <<<<<<<<<<<<<<
 *     cdef const_char    *text=NULL
 *     global tracebacklist
 */
  __pyx_v_rss = 0.0;

  /* "PETSc/PETSc.pyx":202
 *     cdef PetscLogDouble mem=0
 *     cdef PetscLogDouble rss=0
 *     cdef const_char    *text=NULL             # <<<<<<<<<<<<<<
 *     global tracebacklist
 *     cdef object tbl = tracebacklist
 */
  __pyx_v_text = NULL;

  /* "PETSc/PETSc.pyx":204
 *     cdef const_char    *text=NULL
 *     global tracebacklist
 *     cdef object tbl = tracebacklist             # <<<<<<<<<<<<<<
 *     fun = bytes2str(cfun)
 *     fnm = bytes2str(cfile)
 */
  __Pyx_INCREF(__pyx_v_8petsc4py_5PETSc_tracebacklist);
  __pyx_v_tbl = __pyx_v_8petsc4py_5PETSc_tracebacklist;

  /* "PETSc/PETSc.pyx":205
 *     global tracebacklist
 *     cdef object tbl = tracebacklist
 *     fun = bytes2str(cfun)             # <<<<<<<<<<<<<<
 *     fnm = bytes2str(cfile)
 *     m = "%s() line %d in %s" % (fun, line, fnm)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cfun); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fun = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/PETSc.pyx":206
 *     cdef object tbl = tracebacklist
 *     fun = bytes2str(cfun)
 *     fnm = bytes2str(cfile)             # <<<<<<<<<<<<<<
 *     m = "%s() line %d in %s" % (fun, line, fnm)
 *     tbl.insert(0, m)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_cfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fnm = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "PETSc/PETSc.pyx":207
 *     fun = bytes2str(cfun)
 *     fnm = bytes2str(cfile)
 *     m = "%s() line %d in %s" % (fun, line, fnm)             # <<<<<<<<<<<<<<
 *     tbl.insert(0, m)
 *     if p != PETSC_ERROR_INITIAL:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_fun);
  __Pyx_GIVEREF(__pyx_v_fun);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fun);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_fnm);
  __Pyx_GIVEREF(__pyx_v_fnm);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_fnm);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_line_d_in_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_m = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PETSc.pyx":208
 *     fnm = bytes2str(cfile)
 *     m = "%s() line %d in %s" % (fun, line, fnm)
 *     tbl.insert(0, m)             # <<<<<<<<<<<<<<
 *     if p != PETSC_ERROR_INITIAL:
 *         return n
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tbl, __pyx_n_s_insert); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && 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);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_int_0);
  __Pyx_INCREF(__pyx_v_m);
  __Pyx_GIVEREF(__pyx_v_m);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_m);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/PETSc.pyx":209
 *     m = "%s() line %d in %s" % (fun, line, fnm)
 *     tbl.insert(0, m)
 *     if p != PETSC_ERROR_INITIAL:             # <<<<<<<<<<<<<<
 *         return n
 *     #
 */
  __pyx_t_6 = ((__pyx_v_p != PETSC_ERROR_INITIAL) != 0);
  if (__pyx_t_6) {

    /* "PETSc/PETSc.pyx":210
 *     tbl.insert(0, m)
 *     if p != PETSC_ERROR_INITIAL:
 *         return n             # <<<<<<<<<<<<<<
 *     #
 *     del tbl[1:] # clear any previous stuff
 */
    __pyx_r = __pyx_v_n;
    goto __pyx_L0;

    /* "PETSc/PETSc.pyx":209
 *     m = "%s() line %d in %s" % (fun, line, fnm)
 *     tbl.insert(0, m)
 *     if p != PETSC_ERROR_INITIAL:             # <<<<<<<<<<<<<<
 *         return n
 *     #
 */
  }

  /* "PETSc/PETSc.pyx":212
 *         return n
 *     #
 *     del tbl[1:] # clear any previous stuff             # <<<<<<<<<<<<<<
 *     if n == PETSC_ERR_MEM: # special case
 *         PetscMallocGetCurrentUsage(&mem)
 */
  if (__Pyx_PyObject_DelSlice(__pyx_v_tbl, 1, 0, NULL, NULL, &__pyx_slice__67, 1, 0, 1) < 0) __PYX_ERR(11, 212, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":213
 *     #
 *     del tbl[1:] # clear any previous stuff
 *     if n == PETSC_ERR_MEM: # special case             # <<<<<<<<<<<<<<
 *         PetscMallocGetCurrentUsage(&mem)
 *         PetscMemoryGetCurrentUsage(&rss)
 */
  __pyx_t_6 = ((__pyx_v_n == PETSC_ERR_MEM) != 0);
  if (__pyx_t_6) {

    /* "PETSc/PETSc.pyx":214
 *     del tbl[1:] # clear any previous stuff
 *     if n == PETSC_ERR_MEM: # special case
 *         PetscMallocGetCurrentUsage(&mem)             # <<<<<<<<<<<<<<
 *         PetscMemoryGetCurrentUsage(&rss)
 *         m = ("Out of memory. "
 */
    PetscMallocGetCurrentUsage((&__pyx_v_mem));

    /* "PETSc/PETSc.pyx":215
 *     if n == PETSC_ERR_MEM: # special case
 *         PetscMallocGetCurrentUsage(&mem)
 *         PetscMemoryGetCurrentUsage(&rss)             # <<<<<<<<<<<<<<
 *         m = ("Out of memory. "
 *              "Allocated: %d, "
 */
    PetscMemoryGetCurrentUsage((&__pyx_v_rss));

    /* "PETSc/PETSc.pyx":218
 *         m = ("Out of memory. "
 *              "Allocated: %d, "
 *              "Used by process: %d") % (mem, rss)             # <<<<<<<<<<<<<<
 *         tbl.append(m)
 *     else:
 */
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_mem); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_rss); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(11, 218, __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_2);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_memory_Allocated_d_Used_b, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_m, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "PETSc/PETSc.pyx":219
 *              "Allocated: %d, "
 *              "Used by process: %d") % (mem, rss)
 *         tbl.append(m)             # <<<<<<<<<<<<<<
 *     else:
 *         PetscErrorMessage(n, &text, NULL)
 */
    __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_tbl, __pyx_v_m); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(11, 219, __pyx_L1_error)

    /* "PETSc/PETSc.pyx":213
 *     #
 *     del tbl[1:] # clear any previous stuff
 *     if n == PETSC_ERR_MEM: # special case             # <<<<<<<<<<<<<<
 *         PetscMallocGetCurrentUsage(&mem)
 *         PetscMemoryGetCurrentUsage(&rss)
 */
    goto __pyx_L4;
  }

  /* "PETSc/PETSc.pyx":221
 *         tbl.append(m)
 *     else:
 *         PetscErrorMessage(n, &text, NULL)             # <<<<<<<<<<<<<<
 *     if text != NULL: tbl.append(bytes2str(text))
 *     if mess != NULL: tbl.append(bytes2str(mess))
 */
  /*else*/ {
    PetscErrorMessage(__pyx_v_n, (&__pyx_v_text), NULL);
  }
  __pyx_L4:;

  /* "PETSc/PETSc.pyx":222
 *     else:
 *         PetscErrorMessage(n, &text, NULL)
 *     if text != NULL: tbl.append(bytes2str(text))             # <<<<<<<<<<<<<<
 *     if mess != NULL: tbl.append(bytes2str(mess))
 *     <void>comm; <void>ctx; # unused
 */
  __pyx_t_6 = ((__pyx_v_text != NULL) != 0);
  if (__pyx_t_6) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_tbl, __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(11, 222, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }

  /* "PETSc/PETSc.pyx":223
 *         PetscErrorMessage(n, &text, NULL)
 *     if text != NULL: tbl.append(bytes2str(text))
 *     if mess != NULL: tbl.append(bytes2str(mess))             # <<<<<<<<<<<<<<
 *     <void>comm; <void>ctx; # unused
 *     return n
 */
  __pyx_t_6 = ((__pyx_v_mess != NULL) != 0);
  if (__pyx_t_6) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_bytes2str(__pyx_v_mess); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_tbl, __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(11, 223, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }

  /* "PETSc/PETSc.pyx":224
 *     if text != NULL: tbl.append(bytes2str(text))
 *     if mess != NULL: tbl.append(bytes2str(mess))
 *     <void>comm; <void>ctx; # unused             # <<<<<<<<<<<<<<
 *     return n
 * 
 */
  ((void)__pyx_v_comm);
  ((void)__pyx_v_ctx);

  /* "PETSc/PETSc.pyx":225
 *     if mess != NULL: tbl.append(bytes2str(mess))
 *     <void>comm; <void>ctx; # unused
 *     return n             # <<<<<<<<<<<<<<
 * 
 * cdef int PetscPythonErrorHandler(
 */
  __pyx_r = __pyx_v_n;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":192
 * cdef object tracebacklist = []
 * 
 * cdef int traceback(MPI_Comm       comm,             # <<<<<<<<<<<<<<
 *                    int            line,
 *                    const_char    *cfun,
 */

  /* 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_5);
  __Pyx_WriteUnraisable("petsc4py.PETSc.traceback", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tbl);
  __Pyx_XDECREF(__pyx_v_fun);
  __Pyx_XDECREF(__pyx_v_fnm);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":227
 *     return n
 * 
 * cdef int PetscPythonErrorHandler(             # <<<<<<<<<<<<<<
 *     MPI_Comm       comm,
 *     int            line,
 */

static int __pyx_f_8petsc4py_5PETSc_PetscPythonErrorHandler(MPI_Comm __pyx_v_comm, int __pyx_v_line, const char *__pyx_v_cfun, const char *__pyx_v_cfile, int __pyx_v_n, PetscErrorType __pyx_v_p, const char *__pyx_v_mess, void *__pyx_v_ctx) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "PETSc/PETSc.pyx":237
 *     void          *ctx) nogil:
 *     global tracebacklist
 *     if Py_IsInitialized() and (<void*>tracebacklist) != NULL:             # <<<<<<<<<<<<<<
 *         return traceback(comm, line, cfun, cfile, n, p, mess, ctx)
 *     else:
 */
  __pyx_t_2 = (Py_IsInitialized() != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((((void *)__pyx_v_8petsc4py_5PETSc_tracebacklist) != NULL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PETSc/PETSc.pyx":238
 *     global tracebacklist
 *     if Py_IsInitialized() and (<void*>tracebacklist) != NULL:
 *         return traceback(comm, line, cfun, cfile, n, p, mess, ctx)             # <<<<<<<<<<<<<<
 *     else:
 *         return PetscTBEH(comm, line, cfun, cfile, n, p, mess, ctx)
 */
    __pyx_r = __pyx_f_8petsc4py_5PETSc_traceback(__pyx_v_comm, __pyx_v_line, __pyx_v_cfun, __pyx_v_cfile, __pyx_v_n, __pyx_v_p, __pyx_v_mess, __pyx_v_ctx);
    goto __pyx_L0;

    /* "PETSc/PETSc.pyx":237
 *     void          *ctx) nogil:
 *     global tracebacklist
 *     if Py_IsInitialized() and (<void*>tracebacklist) != NULL:             # <<<<<<<<<<<<<<
 *         return traceback(comm, line, cfun, cfile, n, p, mess, ctx)
 *     else:
 */
  }

  /* "PETSc/PETSc.pyx":240
 *         return traceback(comm, line, cfun, cfile, n, p, mess, ctx)
 *     else:
 *         return PetscTBEH(comm, line, cfun, cfile, n, p, mess, ctx)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  /*else*/ {
    __pyx_r = PetscTBEH(__pyx_v_comm, __pyx_v_line, __pyx_v_cfun, __pyx_v_cfile, __pyx_v_n, __pyx_v_p, __pyx_v_mess, __pyx_v_ctx);
    goto __pyx_L0;
  }

  /* "PETSc/PETSc.pyx":227
 *     return n
 * 
 * cdef int PetscPythonErrorHandler(             # <<<<<<<<<<<<<<
 *     MPI_Comm       comm,
 *     int            line,
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":273
 * cdef char** PyPetsc_Argv = NULL
 * 
 * cdef int getinitargs(object args, int *argc, char **argv[]) except -1:             # <<<<<<<<<<<<<<
 *     # allocate command line arguments
 *     cdef int i, c = 0
 */

static int __pyx_f_8petsc4py_5PETSc_getinitargs(PyObject *__pyx_v_args, int *__pyx_v_argc, char ***__pyx_v_argv) {
  int __pyx_v_i;
  int __pyx_v_c;
  char **__pyx_v_v;
  PyObject *__pyx_v_a = NULL;
  int __pyx_r;
  __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;
  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;
  int __pyx_t_13;
  char *__pyx_t_14;
  __Pyx_RefNannySetupContext("getinitargs", 0);
  __Pyx_INCREF(__pyx_v_args);

  /* "PETSc/PETSc.pyx":275
 * cdef int getinitargs(object args, int *argc, char **argv[]) except -1:
 *     # allocate command line arguments
 *     cdef int i, c = 0             # <<<<<<<<<<<<<<
 *     cdef char **v = NULL
 *     if args is None: args = []
 */
  __pyx_v_c = 0;

  /* "PETSc/PETSc.pyx":276
 *     # allocate command line arguments
 *     cdef int i, c = 0
 *     cdef char **v = NULL             # <<<<<<<<<<<<<<
 *     if args is None: args = []
 *     args = [str(a).encode() for a in args]
 */
  __pyx_v_v = NULL;

  /* "PETSc/PETSc.pyx":277
 *     cdef int i, c = 0
 *     cdef char **v = NULL
 *     if args is None: args = []             # <<<<<<<<<<<<<<
 *     args = [str(a).encode() for a in args]
 *     args = [a for a in args if a]
 */
  __pyx_t_1 = (__pyx_v_args == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_3);
    __pyx_t_3 = 0;
  }

  /* "PETSc/PETSc.pyx":278
 *     cdef char **v = NULL
 *     if args is None: args = []
 *     args = [str(a).encode() for a in args]             # <<<<<<<<<<<<<<
 *     args = [a for a in args if a]
 *     c = <int> len(args)
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(PyList_CheckExact(__pyx_v_args)) || PyTuple_CheckExact(__pyx_v_args)) {
    __pyx_t_4 = __pyx_v_args; __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_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 278, __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(11, 278, __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_COMPILING_IN_CPYTHON
        __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(11, 278, __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(11, 278, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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(11, 278, __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(11, 278, __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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(11, 278, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(11, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_a);
    __Pyx_GIVEREF(__pyx_v_a);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_a);
    __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(11, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(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_7 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 278, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else {
      __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(11, 278, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(11, 278, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/PETSc.pyx":279
 *     if args is None: args = []
 *     args = [str(a).encode() for a in args]
 *     args = [a for a in args if a]             # <<<<<<<<<<<<<<
 *     c = <int> len(args)
 *     v = <char**> malloc(<size_t>(c+1)*sizeof(char*))
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(PyList_CheckExact(__pyx_v_args)) || PyTuple_CheckExact(__pyx_v_args)) {
    __pyx_t_4 = __pyx_v_args; __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_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(11, 279, __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(11, 279, __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_COMPILING_IN_CPYTHON
        __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(11, 279, __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(11, 279, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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(11, 279, __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(11, 279, __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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(11, 279, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(11, 279, __pyx_L1_error)
    if (__pyx_t_2) {
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_v_a))) __PYX_ERR(11, 279, __pyx_L1_error)
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/PETSc.pyx":280
 *     args = [str(a).encode() for a in args]
 *     args = [a for a in args if a]
 *     c = <int> len(args)             # <<<<<<<<<<<<<<
 *     v = <char**> malloc(<size_t>(c+1)*sizeof(char*))
 *     if v == NULL: raise MemoryError
 */
  __pyx_t_5 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(11, 280, __pyx_L1_error)
  __pyx_v_c = ((int)__pyx_t_5);

  /* "PETSc/PETSc.pyx":281
 *     args = [a for a in args if a]
 *     c = <int> len(args)
 *     v = <char**> malloc(<size_t>(c+1)*sizeof(char*))             # <<<<<<<<<<<<<<
 *     if v == NULL: raise MemoryError
 *     memset(v, 0, <size_t>(c+1)*sizeof(char*))
 */
  __pyx_v_v = ((char **)malloc((((size_t)(__pyx_v_c + 1)) * (sizeof(char *)))));

  /* "PETSc/PETSc.pyx":282
 *     c = <int> len(args)
 *     v = <char**> malloc(<size_t>(c+1)*sizeof(char*))
 *     if v == NULL: raise MemoryError             # <<<<<<<<<<<<<<
 *     memset(v, 0, <size_t>(c+1)*sizeof(char*))
 *     try:
 */
  __pyx_t_2 = ((__pyx_v_v == NULL) != 0);
  if (__pyx_t_2) {
    PyErr_NoMemory(); __PYX_ERR(11, 282, __pyx_L1_error)
  }

  /* "PETSc/PETSc.pyx":283
 *     v = <char**> malloc(<size_t>(c+1)*sizeof(char*))
 *     if v == NULL: raise MemoryError
 *     memset(v, 0, <size_t>(c+1)*sizeof(char*))             # <<<<<<<<<<<<<<
 *     try:
 *         for 0 <= i < c:
 */
  memset(__pyx_v_v, 0, (((size_t)(__pyx_v_c + 1)) * (sizeof(char *))));

  /* "PETSc/PETSc.pyx":284
 *     if v == NULL: raise MemoryError
 *     memset(v, 0, <size_t>(c+1)*sizeof(char*))
 *     try:             # <<<<<<<<<<<<<<
 *         for 0 <= i < c:
 *             v[i] = strdup(args[i])
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_12);
    /*try:*/ {

      /* "PETSc/PETSc.pyx":285
 *     memset(v, 0, <size_t>(c+1)*sizeof(char*))
 *     try:
 *         for 0 <= i < c:             # <<<<<<<<<<<<<<
 *             v[i] = strdup(args[i])
 *             if v[i] == NULL:
 */
      __pyx_t_13 = __pyx_v_c;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_13; __pyx_v_i++) {

        /* "PETSc/PETSc.pyx":286
 *     try:
 *         for 0 <= i < c:
 *             v[i] = strdup(args[i])             # <<<<<<<<<<<<<<
 *             if v[i] == NULL:
 *                 raise MemoryError
 */
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 286, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_14 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(11, 286, __pyx_L10_error)
        (__pyx_v_v[__pyx_v_i]) = strdup(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "PETSc/PETSc.pyx":287
 *         for 0 <= i < c:
 *             v[i] = strdup(args[i])
 *             if v[i] == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *     except:
 */
        __pyx_t_2 = (((__pyx_v_v[__pyx_v_i]) == NULL) != 0);
        if (__pyx_t_2) {

          /* "PETSc/PETSc.pyx":288
 *             v[i] = strdup(args[i])
 *             if v[i] == NULL:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 *     except:
 *         delinitargs(&c, &v); raise
 */
          PyErr_NoMemory(); __PYX_ERR(11, 288, __pyx_L10_error)

          /* "PETSc/PETSc.pyx":287
 *         for 0 <= i < c:
 *             v[i] = strdup(args[i])
 *             if v[i] == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *     except:
 */
        }
      }

      /* "PETSc/PETSc.pyx":284
 *     if v == NULL: raise MemoryError
 *     memset(v, 0, <size_t>(c+1)*sizeof(char*))
 *     try:             # <<<<<<<<<<<<<<
 *         for 0 <= i < c:
 *             v[i] = strdup(args[i])
 */
    }
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L17_try_end;
    __pyx_L10_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "PETSc/PETSc.pyx":289
 *             if v[i] == NULL:
 *                 raise MemoryError
 *     except:             # <<<<<<<<<<<<<<
 *         delinitargs(&c, &v); raise
 *     argc[0] = c; argv[0] = v
 */
    /*except:*/ {
      __Pyx_AddTraceback("petsc4py.PETSc.getinitargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(11, 289, __pyx_L12_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);

      /* "PETSc/PETSc.pyx":290
 *                 raise MemoryError
 *     except:
 *         delinitargs(&c, &v); raise             # <<<<<<<<<<<<<<
 *     argc[0] = c; argv[0] = v
 *     return 0
 */
      __pyx_f_8petsc4py_5PETSc_delinitargs((&__pyx_v_c), (&__pyx_v_v));
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_4, __pyx_t_7);
      __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0; 
      __PYX_ERR(11, 290, __pyx_L12_except_error)
    }
    __pyx_L12_except_error:;

    /* "PETSc/PETSc.pyx":284
 *     if v == NULL: raise MemoryError
 *     memset(v, 0, <size_t>(c+1)*sizeof(char*))
 *     try:             # <<<<<<<<<<<<<<
 *         for 0 <= i < c:
 *             v[i] = strdup(args[i])
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    goto __pyx_L1_error;
    __pyx_L17_try_end:;
  }

  /* "PETSc/PETSc.pyx":291
 *     except:
 *         delinitargs(&c, &v); raise
 *     argc[0] = c; argv[0] = v             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  (__pyx_v_argc[0]) = __pyx_v_c;
  (__pyx_v_argv[0]) = __pyx_v_v;

  /* "PETSc/PETSc.pyx":292
 *         delinitargs(&c, &v); raise
 *     argc[0] = c; argv[0] = v
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef void delinitargs(int *argc, char **argv[]) nogil:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":273
 * cdef char** PyPetsc_Argv = NULL
 * 
 * cdef int getinitargs(object args, int *argc, char **argv[]) except -1:             # <<<<<<<<<<<<<<
 *     # allocate command line arguments
 *     cdef int i, c = 0
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("petsc4py.PETSc.getinitargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":294
 *     return 0
 * 
 * cdef void delinitargs(int *argc, char **argv[]) nogil:             # <<<<<<<<<<<<<<
 *     # dallocate command line arguments
 *     cdef int i, c = argc[0]
 */

static void __pyx_f_8petsc4py_5PETSc_delinitargs(int *__pyx_v_argc, char ***__pyx_v_argv) {
  int __pyx_v_i;
  int __pyx_v_c;
  char **__pyx_v_v;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "PETSc/PETSc.pyx":296
 * cdef void delinitargs(int *argc, char **argv[]) nogil:
 *     # dallocate command line arguments
 *     cdef int i, c = argc[0]             # <<<<<<<<<<<<<<
 *     cdef char** v = argv[0]
 *     argc[0] = 0; argv[0] = NULL;
 */
  __pyx_v_c = (__pyx_v_argc[0]);

  /* "PETSc/PETSc.pyx":297
 *     # dallocate command line arguments
 *     cdef int i, c = argc[0]
 *     cdef char** v = argv[0]             # <<<<<<<<<<<<<<
 *     argc[0] = 0; argv[0] = NULL;
 *     if c >= 0 and v != NULL:
 */
  __pyx_v_v = (__pyx_v_argv[0]);

  /* "PETSc/PETSc.pyx":298
 *     cdef int i, c = argc[0]
 *     cdef char** v = argv[0]
 *     argc[0] = 0; argv[0] = NULL;             # <<<<<<<<<<<<<<
 *     if c >= 0 and v != NULL:
 *         for 0 <= i < c:
 */
  (__pyx_v_argc[0]) = 0;
  (__pyx_v_argv[0]) = NULL;

  /* "PETSc/PETSc.pyx":299
 *     cdef char** v = argv[0]
 *     argc[0] = 0; argv[0] = NULL;
 *     if c >= 0 and v != NULL:             # <<<<<<<<<<<<<<
 *         for 0 <= i < c:
 *             if  v[i] != NULL: free(v[i])
 */
  __pyx_t_2 = ((__pyx_v_c >= 0) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_v != NULL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "PETSc/PETSc.pyx":300
 *     argc[0] = 0; argv[0] = NULL;
 *     if c >= 0 and v != NULL:
 *         for 0 <= i < c:             # <<<<<<<<<<<<<<
 *             if  v[i] != NULL: free(v[i])
 *         free(v)
 */
    __pyx_t_3 = __pyx_v_c;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

      /* "PETSc/PETSc.pyx":301
 *     if c >= 0 and v != NULL:
 *         for 0 <= i < c:
 *             if  v[i] != NULL: free(v[i])             # <<<<<<<<<<<<<<
 *         free(v)
 * 
 */
      __pyx_t_1 = (((__pyx_v_v[__pyx_v_i]) != NULL) != 0);
      if (__pyx_t_1) {
        free((__pyx_v_v[__pyx_v_i]));
      }
    }

    /* "PETSc/PETSc.pyx":302
 *         for 0 <= i < c:
 *             if  v[i] != NULL: free(v[i])
 *         free(v)             # <<<<<<<<<<<<<<
 * 
 * cdef void finalize() nogil:
 */
    free(__pyx_v_v);

    /* "PETSc/PETSc.pyx":299
 *     cdef char** v = argv[0]
 *     argc[0] = 0; argv[0] = NULL;
 *     if c >= 0 and v != NULL:             # <<<<<<<<<<<<<<
 *         for 0 <= i < c:
 *             if  v[i] != NULL: free(v[i])
 */
  }

  /* "PETSc/PETSc.pyx":294
 *     return 0
 * 
 * cdef void delinitargs(int *argc, char **argv[]) nogil:             # <<<<<<<<<<<<<<
 *     # dallocate command line arguments
 *     cdef int i, c = argc[0]
 */

  /* function exit code */
}

/* "PETSc/PETSc.pyx":304
 *         free(v)
 * 
 * cdef void finalize() nogil:             # <<<<<<<<<<<<<<
 *     cdef int ierr = 0
 *     # deallocate command line arguments
 */

static void __pyx_f_8petsc4py_5PETSc_finalize(void) {
  int __pyx_v_ierr;
  int __pyx_t_1;

  /* "PETSc/PETSc.pyx":305
 * 
 * cdef void finalize() nogil:
 *     cdef int ierr = 0             # <<<<<<<<<<<<<<
 *     # deallocate command line arguments
 *     global PyPetsc_Argc; global PyPetsc_Argv;
 */
  __pyx_v_ierr = 0;

  /* "PETSc/PETSc.pyx":308
 *     # deallocate command line arguments
 *     global PyPetsc_Argc; global PyPetsc_Argv;
 *     delinitargs(&PyPetsc_Argc, &PyPetsc_Argv)             # <<<<<<<<<<<<<<
 *     # manage PETSc finalization
 *     if not (<int>PetscInitializeCalled): return
 */
  __pyx_f_8petsc4py_5PETSc_delinitargs((&__pyx_v_8petsc4py_5PETSc_PyPetsc_Argc), (&__pyx_v_8petsc4py_5PETSc_PyPetsc_Argv));

  /* "PETSc/PETSc.pyx":310
 *     delinitargs(&PyPetsc_Argc, &PyPetsc_Argv)
 *     # manage PETSc finalization
 *     if not (<int>PetscInitializeCalled): return             # <<<<<<<<<<<<<<
 *     if (<int>PetscFinalizeCalled): return
 *     # deinstall Python error handler
 */
  __pyx_t_1 = ((!(((int)PetscInitializeCalled) != 0)) != 0);
  if (__pyx_t_1) {
    goto __pyx_L0;
  }

  /* "PETSc/PETSc.pyx":311
 *     # manage PETSc finalization
 *     if not (<int>PetscInitializeCalled): return
 *     if (<int>PetscFinalizeCalled): return             # <<<<<<<<<<<<<<
 *     # deinstall Python error handler
 *     ierr = PetscPopErrorHandler()
 */
  __pyx_t_1 = (((int)PetscFinalizeCalled) != 0);
  if (__pyx_t_1) {
    goto __pyx_L0;
  }

  /* "PETSc/PETSc.pyx":313
 *     if (<int>PetscFinalizeCalled): return
 *     # deinstall Python error handler
 *     ierr = PetscPopErrorHandler()             # <<<<<<<<<<<<<<
 *     if ierr != 0:
 *         fprintf(stderr, "PetscPopErrorHandler() failed "
 */
  __pyx_v_ierr = PetscPopErrorHandler();

  /* "PETSc/PETSc.pyx":314
 *     # deinstall Python error handler
 *     ierr = PetscPopErrorHandler()
 *     if ierr != 0:             # <<<<<<<<<<<<<<
 *         fprintf(stderr, "PetscPopErrorHandler() failed "
 *                 "[error code: %d]\n", ierr)
 */
  __pyx_t_1 = ((__pyx_v_ierr != 0) != 0);
  if (__pyx_t_1) {

    /* "PETSc/PETSc.pyx":315
 *     ierr = PetscPopErrorHandler()
 *     if ierr != 0:
 *         fprintf(stderr, "PetscPopErrorHandler() failed "             # <<<<<<<<<<<<<<
 *                 "[error code: %d]\n", ierr)
 *     # finalize PETSc
 */
    fprintf(stderr, ((char *)"PetscPopErrorHandler() failed [error code: %d]\n"), __pyx_v_ierr);

    /* "PETSc/PETSc.pyx":314
 *     # deinstall Python error handler
 *     ierr = PetscPopErrorHandler()
 *     if ierr != 0:             # <<<<<<<<<<<<<<
 *         fprintf(stderr, "PetscPopErrorHandler() failed "
 *                 "[error code: %d]\n", ierr)
 */
  }

  /* "PETSc/PETSc.pyx":318
 *                 "[error code: %d]\n", ierr)
 *     # finalize PETSc
 *     ierr = PetscFinalize()             # <<<<<<<<<<<<<<
 *     if ierr != 0:
 *         fprintf(stderr, "PetscFinalize() failed "
 */
  __pyx_v_ierr = PetscFinalize();

  /* "PETSc/PETSc.pyx":319
 *     # finalize PETSc
 *     ierr = PetscFinalize()
 *     if ierr != 0:             # <<<<<<<<<<<<<<
 *         fprintf(stderr, "PetscFinalize() failed "
 *                 "[error code: %d]\n", ierr)
 */
  __pyx_t_1 = ((__pyx_v_ierr != 0) != 0);
  if (__pyx_t_1) {

    /* "PETSc/PETSc.pyx":320
 *     ierr = PetscFinalize()
 *     if ierr != 0:
 *         fprintf(stderr, "PetscFinalize() failed "             # <<<<<<<<<<<<<<
 *                 "[error code: %d]\n", ierr)
 *     # and we are done, see you later !!
 */
    fprintf(stderr, ((char *)"PetscFinalize() failed [error code: %d]\n"), __pyx_v_ierr);

    /* "PETSc/PETSc.pyx":319
 *     # finalize PETSc
 *     ierr = PetscFinalize()
 *     if ierr != 0:             # <<<<<<<<<<<<<<
 *         fprintf(stderr, "PetscFinalize() failed "
 *                 "[error code: %d]\n", ierr)
 */
  }

  /* "PETSc/PETSc.pyx":304
 *         free(v)
 * 
 * cdef void finalize() nogil:             # <<<<<<<<<<<<<<
 *     cdef int ierr = 0
 *     # deallocate command line arguments
 */

  /* function exit code */
  __pyx_L0:;
}

/* "PETSc/PETSc.pyx":324
 *     # and we are done, see you later !!
 * 
 * cdef int initialize(object args, object comm) except -1:             # <<<<<<<<<<<<<<
 *     if (<int>PetscInitializeCalled): return 1
 *     if (<int>PetscFinalizeCalled):   return 0
 */

static int __pyx_f_8petsc4py_5PETSc_initialize(PyObject *__pyx_v_args, PyObject *__pyx_v_comm) {
  PetscErrorHandlerFunction __pyx_v_handler;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  MPI_Comm __pyx_t_3;
  __Pyx_RefNannySetupContext("initialize", 0);

  /* "PETSc/PETSc.pyx":325
 * 
 * cdef int initialize(object args, object comm) except -1:
 *     if (<int>PetscInitializeCalled): return 1             # <<<<<<<<<<<<<<
 *     if (<int>PetscFinalizeCalled):   return 0
 *     # allocate command line arguments
 */
  __pyx_t_1 = (((int)PetscInitializeCalled) != 0);
  if (__pyx_t_1) {
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "PETSc/PETSc.pyx":326
 * cdef int initialize(object args, object comm) except -1:
 *     if (<int>PetscInitializeCalled): return 1
 *     if (<int>PetscFinalizeCalled):   return 0             # <<<<<<<<<<<<<<
 *     # allocate command line arguments
 *     global PyPetsc_Argc; global PyPetsc_Argv;
 */
  __pyx_t_1 = (((int)PetscFinalizeCalled) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/PETSc.pyx":329
 *     # allocate command line arguments
 *     global PyPetsc_Argc; global PyPetsc_Argv;
 *     getinitargs(args, &PyPetsc_Argc, &PyPetsc_Argv)             # <<<<<<<<<<<<<<
 *     # communicator
 *     global PETSC_COMM_WORLD
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_getinitargs(__pyx_v_args, (&__pyx_v_8petsc4py_5PETSc_PyPetsc_Argc), (&__pyx_v_8petsc4py_5PETSc_PyPetsc_Argv)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 329, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":332
 *     # communicator
 *     global PETSC_COMM_WORLD
 *     PETSC_COMM_WORLD = def_Comm(comm, PETSC_COMM_WORLD)             # <<<<<<<<<<<<<<
 *     # initialize PETSc
 *     CHKERR( PetscInitialize(&PyPetsc_Argc, &PyPetsc_Argv, NULL, NULL) )
 */
  __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_def_Comm(__pyx_v_comm, PETSC_COMM_WORLD); if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 332, __pyx_L1_error)
  PETSC_COMM_WORLD = __pyx_t_3;

  /* "PETSc/PETSc.pyx":334
 *     PETSC_COMM_WORLD = def_Comm(comm, PETSC_COMM_WORLD)
 *     # initialize PETSc
 *     CHKERR( PetscInitialize(&PyPetsc_Argc, &PyPetsc_Argv, NULL, NULL) )             # <<<<<<<<<<<<<<
 *     # install Python error handler
 *     cdef PetscErrorHandlerFunction handler = NULL
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscInitialize((&__pyx_v_8petsc4py_5PETSc_PyPetsc_Argc), (&__pyx_v_8petsc4py_5PETSc_PyPetsc_Argv), NULL, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 334, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":336
 *     CHKERR( PetscInitialize(&PyPetsc_Argc, &PyPetsc_Argv, NULL, NULL) )
 *     # install Python error handler
 *     cdef PetscErrorHandlerFunction handler = NULL             # <<<<<<<<<<<<<<
 *     handler = <PetscErrorHandlerFunction>PetscPythonErrorHandler
 *     CHKERR( PetscPushErrorHandler(handler, NULL) )
 */
  __pyx_v_handler = NULL;

  /* "PETSc/PETSc.pyx":337
 *     # install Python error handler
 *     cdef PetscErrorHandlerFunction handler = NULL
 *     handler = <PetscErrorHandlerFunction>PetscPythonErrorHandler             # <<<<<<<<<<<<<<
 *     CHKERR( PetscPushErrorHandler(handler, NULL) )
 *     # register finalization function
 */
  __pyx_v_handler = ((PetscErrorHandlerFunction)__pyx_f_8petsc4py_5PETSc_PetscPythonErrorHandler);

  /* "PETSc/PETSc.pyx":338
 *     cdef PetscErrorHandlerFunction handler = NULL
 *     handler = <PetscErrorHandlerFunction>PetscPythonErrorHandler
 *     CHKERR( PetscPushErrorHandler(handler, NULL) )             # <<<<<<<<<<<<<<
 *     # register finalization function
 *     if Py_AtExit(finalize) < 0:
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPushErrorHandler(__pyx_v_handler, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 338, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":340
 *     CHKERR( PetscPushErrorHandler(handler, NULL) )
 *     # register finalization function
 *     if Py_AtExit(finalize) < 0:             # <<<<<<<<<<<<<<
 *         PySys_WriteStderr(b"warning: could not register %s with Py_AtExit()",
 *                           b"PetscFinalize()")
 */
  __pyx_t_1 = ((Py_AtExit(__pyx_f_8petsc4py_5PETSc_finalize) < 0) != 0);
  if (__pyx_t_1) {

    /* "PETSc/PETSc.pyx":341
 *     # register finalization function
 *     if Py_AtExit(finalize) < 0:
 *         PySys_WriteStderr(b"warning: could not register %s with Py_AtExit()",             # <<<<<<<<<<<<<<
 *                           b"PetscFinalize()")
 *     return 1 # and we are done, enjoy !!
 */
    PySys_WriteStderr(((char *)"warning: could not register %s with Py_AtExit()"), ((char *)"PetscFinalize()"));

    /* "PETSc/PETSc.pyx":340
 *     CHKERR( PetscPushErrorHandler(handler, NULL) )
 *     # register finalization function
 *     if Py_AtExit(finalize) < 0:             # <<<<<<<<<<<<<<
 *         PySys_WriteStderr(b"warning: could not register %s with Py_AtExit()",
 *                           b"PetscFinalize()")
 */
  }

  /* "PETSc/PETSc.pyx":343
 *         PySys_WriteStderr(b"warning: could not register %s with Py_AtExit()",
 *                           b"PetscFinalize()")
 *     return 1 # and we are done, enjoy !!             # <<<<<<<<<<<<<<
 * 
 * cdef extern from *:
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":324
 *     # and we are done, see you later !!
 * 
 * cdef int initialize(object args, object comm) except -1:             # <<<<<<<<<<<<<<
 *     if (<int>PetscInitializeCalled): return 1
 *     if (<int>PetscFinalizeCalled):   return 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.initialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":382
 * """
 * 
 * cdef int register() except -1:             # <<<<<<<<<<<<<<
 *     global registercalled
 *     if registercalled: return 0
 */

static int __pyx_f_8petsc4py_5PETSc_register(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("register", 0);

  /* "PETSc/PETSc.pyx":384
 * cdef int register() except -1:
 *     global registercalled
 *     if registercalled: return 0             # <<<<<<<<<<<<<<
 *     registercalled = True
 *     # register citation
 */
  __pyx_t_1 = (__pyx_v_8petsc4py_5PETSc_registercalled != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "PETSc/PETSc.pyx":385
 *     global registercalled
 *     if registercalled: return 0
 *     registercalled = True             # <<<<<<<<<<<<<<
 *     # register citation
 *     CHKERR( PetscCitationsRegister(citation, NULL) )
 */
  __pyx_v_8petsc4py_5PETSc_registercalled = 1;

  /* "PETSc/PETSc.pyx":387
 *     registercalled = True
 *     # register citation
 *     CHKERR( PetscCitationsRegister(citation, NULL) )             # <<<<<<<<<<<<<<
 *     # make sure all PETSc packages are initialized
 *     CHKERR( PetscInitializePackageAll() )
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscCitationsRegister(__pyx_v_8petsc4py_5PETSc_citation, NULL)); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 387, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":389
 *     CHKERR( PetscCitationsRegister(citation, NULL) )
 *     # make sure all PETSc packages are initialized
 *     CHKERR( PetscInitializePackageAll() )             # <<<<<<<<<<<<<<
 *     # register custom implementations
 *     import_libpetsc4py()
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscInitializePackageAll()); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 389, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":391
 *     CHKERR( PetscInitializePackageAll() )
 *     # register custom implementations
 *     import_libpetsc4py()             # <<<<<<<<<<<<<<
 *     CHKERR( PetscPythonRegisterAll() )
 *     # register Python types
 */
  __pyx_t_2 = import_libpetsc4py(); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 391, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":392
 *     # register custom implementations
 *     import_libpetsc4py()
 *     CHKERR( PetscPythonRegisterAll() )             # <<<<<<<<<<<<<<
 *     # register Python types
 *     PyPetscType_Register(PETSC_OBJECT_CLASSID,      Object)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPythonRegisterAll()); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 392, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":394
 *     CHKERR( PetscPythonRegisterAll() )
 *     # register Python types
 *     PyPetscType_Register(PETSC_OBJECT_CLASSID,      Object)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_VIEWER_CLASSID,      Viewer)
 *     PyPetscType_Register(PETSC_RANDOM_CLASSID,      Random)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(PETSC_OBJECT_CLASSID, __pyx_ptype_8petsc4py_5PETSc_Object); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 394, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":395
 *     # register Python types
 *     PyPetscType_Register(PETSC_OBJECT_CLASSID,      Object)
 *     PyPetscType_Register(PETSC_VIEWER_CLASSID,      Viewer)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_RANDOM_CLASSID,      Random)
 *     PyPetscType_Register(PETSC_IS_CLASSID,          IS)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(PETSC_VIEWER_CLASSID, __pyx_ptype_8petsc4py_5PETSc_Viewer); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 395, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":396
 *     PyPetscType_Register(PETSC_OBJECT_CLASSID,      Object)
 *     PyPetscType_Register(PETSC_VIEWER_CLASSID,      Viewer)
 *     PyPetscType_Register(PETSC_RANDOM_CLASSID,      Random)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_IS_CLASSID,          IS)
 *     PyPetscType_Register(PETSC_LGMAP_CLASSID,       LGMap)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(PETSC_RANDOM_CLASSID, __pyx_ptype_8petsc4py_5PETSc_Random); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 396, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":397
 *     PyPetscType_Register(PETSC_VIEWER_CLASSID,      Viewer)
 *     PyPetscType_Register(PETSC_RANDOM_CLASSID,      Random)
 *     PyPetscType_Register(PETSC_IS_CLASSID,          IS)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_LGMAP_CLASSID,       LGMap)
 *     PyPetscType_Register(PETSC_SF_CLASSID,          SF)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(IS_CLASSID, __pyx_ptype_8petsc4py_5PETSc_IS); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 397, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":398
 *     PyPetscType_Register(PETSC_RANDOM_CLASSID,      Random)
 *     PyPetscType_Register(PETSC_IS_CLASSID,          IS)
 *     PyPetscType_Register(PETSC_LGMAP_CLASSID,       LGMap)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_SF_CLASSID,          SF)
 *     PyPetscType_Register(PETSC_VEC_CLASSID,         Vec)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(IS_LTOGM_CLASSID, __pyx_ptype_8petsc4py_5PETSc_LGMap); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 398, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":399
 *     PyPetscType_Register(PETSC_IS_CLASSID,          IS)
 *     PyPetscType_Register(PETSC_LGMAP_CLASSID,       LGMap)
 *     PyPetscType_Register(PETSC_SF_CLASSID,          SF)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_VEC_CLASSID,         Vec)
 *     PyPetscType_Register(PETSC_SCATTER_CLASSID,     Scatter)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(PETSCSF_CLASSID, __pyx_ptype_8petsc4py_5PETSc_SF); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 399, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":400
 *     PyPetscType_Register(PETSC_LGMAP_CLASSID,       LGMap)
 *     PyPetscType_Register(PETSC_SF_CLASSID,          SF)
 *     PyPetscType_Register(PETSC_VEC_CLASSID,         Vec)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_SCATTER_CLASSID,     Scatter)
 *     PyPetscType_Register(PETSC_SECTION_CLASSID,     Section)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(VEC_CLASSID, __pyx_ptype_8petsc4py_5PETSc_Vec); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 400, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":401
 *     PyPetscType_Register(PETSC_SF_CLASSID,          SF)
 *     PyPetscType_Register(PETSC_VEC_CLASSID,         Vec)
 *     PyPetscType_Register(PETSC_SCATTER_CLASSID,     Scatter)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_SECTION_CLASSID,     Section)
 *     PyPetscType_Register(PETSC_MAT_CLASSID,         Mat)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(VEC_SCATTER_CLASSID, __pyx_ptype_8petsc4py_5PETSc_Scatter); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 401, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":402
 *     PyPetscType_Register(PETSC_VEC_CLASSID,         Vec)
 *     PyPetscType_Register(PETSC_SCATTER_CLASSID,     Scatter)
 *     PyPetscType_Register(PETSC_SECTION_CLASSID,     Section)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_MAT_CLASSID,         Mat)
 *     PyPetscType_Register(PETSC_NULLSPACE_CLASSID,   NullSpace)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(PETSC_SECTION_CLASSID, __pyx_ptype_8petsc4py_5PETSc_Section); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 402, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":403
 *     PyPetscType_Register(PETSC_SCATTER_CLASSID,     Scatter)
 *     PyPetscType_Register(PETSC_SECTION_CLASSID,     Section)
 *     PyPetscType_Register(PETSC_MAT_CLASSID,         Mat)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_NULLSPACE_CLASSID,   NullSpace)
 *     PyPetscType_Register(PETSC_PC_CLASSID,          PC)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(MAT_CLASSID, __pyx_ptype_8petsc4py_5PETSc_Mat); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 403, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":404
 *     PyPetscType_Register(PETSC_SECTION_CLASSID,     Section)
 *     PyPetscType_Register(PETSC_MAT_CLASSID,         Mat)
 *     PyPetscType_Register(PETSC_NULLSPACE_CLASSID,   NullSpace)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_PC_CLASSID,          PC)
 *     PyPetscType_Register(PETSC_KSP_CLASSID,         KSP)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(MAT_NULLSPACE_CLASSID, __pyx_ptype_8petsc4py_5PETSc_NullSpace); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 404, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":405
 *     PyPetscType_Register(PETSC_MAT_CLASSID,         Mat)
 *     PyPetscType_Register(PETSC_NULLSPACE_CLASSID,   NullSpace)
 *     PyPetscType_Register(PETSC_PC_CLASSID,          PC)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_KSP_CLASSID,         KSP)
 *     PyPetscType_Register(PETSC_SNES_CLASSID,        SNES)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(PC_CLASSID, __pyx_ptype_8petsc4py_5PETSc_PC); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 405, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":406
 *     PyPetscType_Register(PETSC_NULLSPACE_CLASSID,   NullSpace)
 *     PyPetscType_Register(PETSC_PC_CLASSID,          PC)
 *     PyPetscType_Register(PETSC_KSP_CLASSID,         KSP)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_SNES_CLASSID,        SNES)
 *     PyPetscType_Register(PETSC_TS_CLASSID,          TS)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(KSP_CLASSID, __pyx_ptype_8petsc4py_5PETSc_KSP); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 406, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":407
 *     PyPetscType_Register(PETSC_PC_CLASSID,          PC)
 *     PyPetscType_Register(PETSC_KSP_CLASSID,         KSP)
 *     PyPetscType_Register(PETSC_SNES_CLASSID,        SNES)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_TS_CLASSID,          TS)
 *     PyPetscType_Register(PETSC_TAO_CLASSID,         TAO)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(SNES_CLASSID, __pyx_ptype_8petsc4py_5PETSc_SNES); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 407, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":408
 *     PyPetscType_Register(PETSC_KSP_CLASSID,         KSP)
 *     PyPetscType_Register(PETSC_SNES_CLASSID,        SNES)
 *     PyPetscType_Register(PETSC_TS_CLASSID,          TS)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_TAO_CLASSID,         TAO)
 *     PyPetscType_Register(PETSC_AO_CLASSID,          AO)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(TS_CLASSID, __pyx_ptype_8petsc4py_5PETSc_TS); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 408, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":409
 *     PyPetscType_Register(PETSC_SNES_CLASSID,        SNES)
 *     PyPetscType_Register(PETSC_TS_CLASSID,          TS)
 *     PyPetscType_Register(PETSC_TAO_CLASSID,         TAO)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_AO_CLASSID,          AO)
 *     PyPetscType_Register(PETSC_DM_CLASSID,          DM)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(TAO_CLASSID, __pyx_ptype_8petsc4py_5PETSc_TAO); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 409, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":410
 *     PyPetscType_Register(PETSC_TS_CLASSID,          TS)
 *     PyPetscType_Register(PETSC_TAO_CLASSID,         TAO)
 *     PyPetscType_Register(PETSC_AO_CLASSID,          AO)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_DM_CLASSID,          DM)
 *     PyPetscType_Register(PETSC_PARTITIONER_CLASSID, Partitioner)
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(AO_CLASSID, __pyx_ptype_8petsc4py_5PETSc_AO); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 410, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":411
 *     PyPetscType_Register(PETSC_TAO_CLASSID,         TAO)
 *     PyPetscType_Register(PETSC_AO_CLASSID,          AO)
 *     PyPetscType_Register(PETSC_DM_CLASSID,          DM)             # <<<<<<<<<<<<<<
 *     PyPetscType_Register(PETSC_PARTITIONER_CLASSID, Partitioner)
 *     return 0 # and we are done, enjoy !!
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(DM_CLASSID, __pyx_ptype_8petsc4py_5PETSc_DM); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 411, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":412
 *     PyPetscType_Register(PETSC_AO_CLASSID,          AO)
 *     PyPetscType_Register(PETSC_DM_CLASSID,          DM)
 *     PyPetscType_Register(PETSC_PARTITIONER_CLASSID, Partitioner)             # <<<<<<<<<<<<<<
 *     return 0 # and we are done, enjoy !!
 * 
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_PyPetscType_Register(PETSCPARTITIONER_CLASSID, __pyx_ptype_8petsc4py_5PETSc_Partitioner); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 412, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":413
 *     PyPetscType_Register(PETSC_DM_CLASSID,          DM)
 *     PyPetscType_Register(PETSC_PARTITIONER_CLASSID, Partitioner)
 *     return 0 # and we are done, enjoy !!             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "PETSc/PETSc.pyx":382
 * """
 * 
 * cdef int register() except -1:             # <<<<<<<<<<<<<<
 *     global registercalled
 *     if registercalled: return 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc.register", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":417
 * # --------------------------------------------------------------------
 * 
 * def _initialize(args=None, comm=None):             # <<<<<<<<<<<<<<
 *     global tracebacklist
 *     Error._traceback_ = tracebacklist
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_1_initialize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc__initialize[] = "_initialize(args=None, comm=None)";
static PyMethodDef __pyx_mdef_8petsc4py_5PETSc_1_initialize = {"_initialize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_1_initialize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc__initialize};
static PyObject *__pyx_pw_8petsc4py_5PETSc_1_initialize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_comm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_initialize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_comm,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comm);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_initialize") < 0)) __PYX_ERR(11, 417, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_args = values[0];
    __pyx_v_comm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_initialize", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(11, 417, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._initialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc__initialize(__pyx_self, __pyx_v_args, __pyx_v_comm);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc__initialize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args, PyObject *__pyx_v_comm) {
  int __pyx_v_ready;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_initialize", 0);

  /* "PETSc/PETSc.pyx":419
 * def _initialize(args=None, comm=None):
 *     global tracebacklist
 *     Error._traceback_ = tracebacklist             # <<<<<<<<<<<<<<
 *     global PetscError
 *     PetscError = Error
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_t_1, __pyx_n_s_traceback, __pyx_v_8petsc4py_5PETSc_tracebacklist) < 0) __PYX_ERR(11, 419, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/PETSc.pyx":421
 *     Error._traceback_ = tracebacklist
 *     global PetscError
 *     PetscError = Error             # <<<<<<<<<<<<<<
 *     #
 *     cdef int ready = initialize(args, comm)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_8petsc4py_5PETSc_PetscError);
  __Pyx_DECREF_SET(__pyx_v_8petsc4py_5PETSc_PetscError, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PETSc.pyx":423
 *     PetscError = Error
 *     #
 *     cdef int ready = initialize(args, comm)             # <<<<<<<<<<<<<<
 *     if ready: register()
 *     #
 */
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_initialize(__pyx_v_args, __pyx_v_comm); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 423, __pyx_L1_error)
  __pyx_v_ready = __pyx_t_2;

  /* "PETSc/PETSc.pyx":424
 *     #
 *     cdef int ready = initialize(args, comm)
 *     if ready: register()             # <<<<<<<<<<<<<<
 *     #
 *     global __COMM_SELF__, __COMM_WORLD__
 */
  __pyx_t_3 = (__pyx_v_ready != 0);
  if (__pyx_t_3) {
    __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_register(); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 424, __pyx_L1_error)
  }

  /* "PETSc/PETSc.pyx":427
 *     #
 *     global __COMM_SELF__, __COMM_WORLD__
 *     __COMM_SELF__.comm  = PETSC_COMM_SELF             # <<<<<<<<<<<<<<
 *     __COMM_WORLD__.comm = PETSC_COMM_WORLD
 *     #
 */
  __pyx_v_8petsc4py_5PETSc___COMM_SELF__->comm = PETSC_COMM_SELF;

  /* "PETSc/PETSc.pyx":428
 *     global __COMM_SELF__, __COMM_WORLD__
 *     __COMM_SELF__.comm  = PETSC_COMM_SELF
 *     __COMM_WORLD__.comm = PETSC_COMM_WORLD             # <<<<<<<<<<<<<<
 *     #
 *     global PETSC_COMM_DEFAULT
 */
  __pyx_v_8petsc4py_5PETSc___COMM_WORLD__->comm = PETSC_COMM_WORLD;

  /* "PETSc/PETSc.pyx":431
 *     #
 *     global PETSC_COMM_DEFAULT
 *     PETSC_COMM_DEFAULT = PETSC_COMM_WORLD             # <<<<<<<<<<<<<<
 * 
 * def _finalize():
 */
  __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT = PETSC_COMM_WORLD;

  /* "PETSc/PETSc.pyx":417
 * # --------------------------------------------------------------------
 * 
 * def _initialize(args=None, comm=None):             # <<<<<<<<<<<<<<
 *     global tracebacklist
 *     Error._traceback_ = tracebacklist
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("petsc4py.PETSc._initialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "PETSc/PETSc.pyx":433
 *     PETSC_COMM_DEFAULT = PETSC_COMM_WORLD
 * 
 * def _finalize():             # <<<<<<<<<<<<<<
 *     finalize()
 *     #
 */

/* Python wrapper */
static PyObject *__pyx_pw_8petsc4py_5PETSc_3_finalize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8petsc4py_5PETSc_2_finalize[] = "_finalize()";
static PyMethodDef __pyx_mdef_8petsc4py_5PETSc_3_finalize = {"_finalize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3_finalize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2_finalize};
static PyObject *__pyx_pw_8petsc4py_5PETSc_3_finalize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_finalize (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("_finalize", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "_finalize", 0))) return NULL;
  __pyx_r = __pyx_pf_8petsc4py_5PETSc_2_finalize(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8petsc4py_5PETSc_2_finalize(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_finalize", 0);

  /* "PETSc/PETSc.pyx":434
 * 
 * def _finalize():
 *     finalize()             # <<<<<<<<<<<<<<
 *     #
 *     global __COMM_SELF__
 */
  __pyx_f_8petsc4py_5PETSc_finalize();

  /* "PETSc/PETSc.pyx":437
 *     #
 *     global __COMM_SELF__
 *     __COMM_SELF__.comm  = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *     global __COMM_WORLD__
 *     __COMM_WORLD__.comm = MPI_COMM_NULL
 */
  __pyx_v_8petsc4py_5PETSc___COMM_SELF__->comm = MPI_COMM_NULL;

  /* "PETSc/PETSc.pyx":439
 *     __COMM_SELF__.comm  = MPI_COMM_NULL
 *     global __COMM_WORLD__
 *     __COMM_WORLD__.comm = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *     #
 *     global PETSC_COMM_DEFAULT
 */
  __pyx_v_8petsc4py_5PETSc___COMM_WORLD__->comm = MPI_COMM_NULL;

  /* "PETSc/PETSc.pyx":442
 *     #
 *     global PETSC_COMM_DEFAULT
 *     PETSC_COMM_DEFAULT = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 *     #
 *     global type_registry
 */
  __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT = MPI_COMM_NULL;

  /* "PETSc/PETSc.pyx":445
 *     #
 *     global type_registry
 *     type_registry.clear()             # <<<<<<<<<<<<<<
 *     global stage_registry
 *     stage_registry.clear()
 */
  if (unlikely(__pyx_v_8petsc4py_5PETSc_type_registry == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "clear");
    __PYX_ERR(11, 445, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Clear(__pyx_v_8petsc4py_5PETSc_type_registry); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(11, 445, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":447
 *     type_registry.clear()
 *     global stage_registry
 *     stage_registry.clear()             # <<<<<<<<<<<<<<
 *     global class_registry
 *     class_registry.clear()
 */
  if (unlikely(__pyx_v_8petsc4py_5PETSc_stage_registry == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "clear");
    __PYX_ERR(11, 447, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Clear(__pyx_v_8petsc4py_5PETSc_stage_registry); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(11, 447, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":449
 *     stage_registry.clear()
 *     global class_registry
 *     class_registry.clear()             # <<<<<<<<<<<<<<
 *     global event_registry
 *     event_registry.clear()
 */
  if (unlikely(__pyx_v_8petsc4py_5PETSc_class_registry == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "clear");
    __PYX_ERR(11, 449, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Clear(__pyx_v_8petsc4py_5PETSc_class_registry); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(11, 449, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":451
 *     class_registry.clear()
 *     global event_registry
 *     event_registry.clear()             # <<<<<<<<<<<<<<
 *     global citations_registry
 *     citations_registry.clear()
 */
  if (unlikely(__pyx_v_8petsc4py_5PETSc_event_registry == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "clear");
    __PYX_ERR(11, 451, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Clear(__pyx_v_8petsc4py_5PETSc_event_registry); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(11, 451, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":453
 *     event_registry.clear()
 *     global citations_registry
 *     citations_registry.clear()             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (unlikely(__pyx_v_8petsc4py_5PETSc_citations_registry == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "clear");
    __PYX_ERR(11, 453, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Clear(__pyx_v_8petsc4py_5PETSc_citations_registry); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(11, 453, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":433
 *     PETSC_COMM_DEFAULT = PETSC_COMM_WORLD
 * 
 * def _finalize():             # <<<<<<<<<<<<<<
 *     finalize()
 *     #
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("petsc4py.PETSc._finalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Comm(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscCommObject *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 PyPetscCommObject *)o);
  p->base = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_4Comm_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc_Comm(PyObject *o) {
  struct PyPetscCommObject *p = (struct PyPetscCommObject *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(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_pw_8petsc4py_5PETSc_4Comm_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->base);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8petsc4py_5PETSc_Comm(PyObject *o, visitproc v, void *a) {
  int e;
  struct PyPetscCommObject *p = (struct PyPetscCommObject *)o;
  if (p->base) {
    e = (*v)(p->base, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8petsc4py_5PETSc_Comm(PyObject *o) {
  PyObject* tmp;
  struct PyPetscCommObject *p = (struct PyPetscCommObject *)o;
  tmp = ((PyObject*)p->base);
  p->base = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4Comm_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4Comm_4size_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4Comm_rank(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4Comm_4rank_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4Comm_fortran(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4Comm_7fortran_1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_Comm[] = {
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4Comm_9destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4Comm_8destroy},
  {"duplicate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4Comm_11duplicate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4Comm_10duplicate},
  {"getSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4Comm_13getSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4Comm_12getSize},
  {"getRank", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4Comm_15getRank, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4Comm_14getRank},
  {"barrier", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4Comm_17barrier, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4Comm_16barrier},
  {"tompi4py", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4Comm_19tompi4py, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4Comm_18tompi4py},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_Comm[] = {
  {(char *)"size", __pyx_getprop_8petsc4py_5PETSc_4Comm_size, 0, (char *)0, 0},
  {(char *)"rank", __pyx_getprop_8petsc4py_5PETSc_4Comm_rank, 0, (char *)0, 0},
  {(char *)"fortran", __pyx_getprop_8petsc4py_5PETSc_4Comm_fortran, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Comm = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_8petsc4py_5PETSc_4Comm_7__nonzero__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

DL_EXPORT(PyTypeObject) PyPetscComm_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.Comm", /*tp_name*/
  sizeof(struct PyPetscCommObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Comm, /*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*/
  &__pyx_tp_as_number_Comm, /*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_8petsc4py_5PETSc_Comm, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Comm, /*tp_clear*/
  __pyx_pw_8petsc4py_5PETSc_4Comm_5__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_Comm, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_Comm, /*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_8petsc4py_5PETSc_Comm, /*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_8petsc4py_5PETSc_Object __pyx_vtable_8petsc4py_5PETSc_Object;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Object(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct PyPetscObjectObject *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 PyPetscObjectObject *)o);
  p->__pyx_vtab = __pyx_vtabptr_8petsc4py_5PETSc_Object;
  p->__pyx___dummy__ = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_6Object_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc_Object(PyObject *o) {
  struct PyPetscObjectObject *p = (struct PyPetscObjectObject *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(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_pw_8petsc4py_5PETSc_6Object_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  if (p->__weakref__) PyObject_ClearWeakRefs(o);
  Py_CLEAR(p->__pyx___dummy__);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8petsc4py_5PETSc_Object(PyObject *o, visitproc v, void *a) {
  int e;
  struct PyPetscObjectObject *p = (struct PyPetscObjectObject *)o;
  if (p->__pyx___dummy__) {
    e = (*v)(p->__pyx___dummy__, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8petsc4py_5PETSc_Object(PyObject *o) {
  PyObject* tmp;
  struct PyPetscObjectObject *p = (struct PyPetscObjectObject *)o;
  tmp = ((PyObject*)p->__pyx___dummy__);
  p->__pyx___dummy__ = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_6Object_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_6Object_4type_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_6Object_type(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_6Object_4type_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_6Object_prefix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_6Object_6prefix_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_6Object_prefix(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_6Object_6prefix_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_6Object_comm(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_6Object_4comm_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_6Object_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_6Object_4name_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_6Object_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_6Object_4name_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_6Object_classid(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_6Object_7classid_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_6Object_klass(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_6Object_5klass_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_6Object_refcount(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_6Object_8refcount_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_6Object_handle(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_6Object_6handle_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_6Object_fortran(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_6Object_7fortran_1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_Object[] = {
  {"__copy__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_9__copy__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_8__copy__},
  {"__deepcopy__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_11__deepcopy__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_10__deepcopy__},
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_13view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_12view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_15destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_14destroy},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_17getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_16getType},
  {"setOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_19setOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_18setOptionsPrefix},
  {"getOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_21getOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_20getOptionsPrefix},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_23setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_22setFromOptions},
  {"getComm", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_25getComm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_24getComm},
  {"getName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_27getName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_26getName},
  {"setName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_29setName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_28setName},
  {"getClassId", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_31getClassId, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_30getClassId},
  {"getClassName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_33getClassName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_32getClassName},
  {"getRefCount", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_35getRefCount, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_34getRefCount},
  {"compose", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_37compose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_36compose},
  {"query", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_39query, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_38query},
  {"incRef", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_41incRef, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_40incRef},
  {"decRef", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_43decRef, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_42decRef},
  {"getAttr", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_45getAttr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_44getAttr},
  {"setAttr", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_47setAttr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_46setAttr},
  {"getDict", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_49getDict, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_48getDict},
  {"stateIncrease", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_51stateIncrease, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_50stateIncrease},
  {"incrementTabLevel", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_53incrementTabLevel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_52incrementTabLevel},
  {"setTabLevel", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_55setTabLevel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_54setTabLevel},
  {"getTabLevel", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Object_57getTabLevel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Object_56getTabLevel},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_Object[] = {
  {(char *)"type", __pyx_getprop_8petsc4py_5PETSc_6Object_type, __pyx_setprop_8petsc4py_5PETSc_6Object_type, (char *)0, 0},
  {(char *)"prefix", __pyx_getprop_8petsc4py_5PETSc_6Object_prefix, __pyx_setprop_8petsc4py_5PETSc_6Object_prefix, (char *)0, 0},
  {(char *)"comm", __pyx_getprop_8petsc4py_5PETSc_6Object_comm, 0, (char *)0, 0},
  {(char *)"name", __pyx_getprop_8petsc4py_5PETSc_6Object_name, __pyx_setprop_8petsc4py_5PETSc_6Object_name, (char *)0, 0},
  {(char *)"classid", __pyx_getprop_8petsc4py_5PETSc_6Object_classid, 0, (char *)0, 0},
  {(char *)"klass", __pyx_getprop_8petsc4py_5PETSc_6Object_klass, 0, (char *)0, 0},
  {(char *)"refcount", __pyx_getprop_8petsc4py_5PETSc_6Object_refcount, 0, (char *)0, 0},
  {(char *)"handle", __pyx_getprop_8petsc4py_5PETSc_6Object_handle, 0, (char *)0, 0},
  {(char *)"fortran", __pyx_getprop_8petsc4py_5PETSc_6Object_fortran, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Object = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_8petsc4py_5PETSc_6Object_7__nonzero__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

DL_EXPORT(PyTypeObject) PyPetscObject_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.Object", /*tp_name*/
  sizeof(struct PyPetscObjectObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  &__pyx_tp_as_number_Object, /*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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  __pyx_pw_8petsc4py_5PETSc_6Object_5__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_Object, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_Object, /*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_8petsc4py_5PETSc_Object, /*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_8petsc4py_5PETSc_Viewer __pyx_vtable_8petsc4py_5PETSc_Viewer;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Viewer(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscViewerObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscViewerObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_Viewer;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_6Viewer_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_Viewer[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_5view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_4view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_7destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_6destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_9create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_8create},
  {"createASCII", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_11createASCII, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_10createASCII},
  {"createBinary", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_13createBinary, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_12createBinary},
  {"createMPIIO", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_15createMPIIO, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_14createMPIIO},
  {"createVTK", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_17createVTK, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_16createVTK},
  {"createHDF5", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_19createHDF5, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_18createHDF5},
  {"createNetCDF", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_21createNetCDF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_20createNetCDF},
  {"createDraw", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_23createDraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_22createDraw},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_25setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_24setType},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_27getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_26getType},
  {"getFormat", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_29getFormat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_28getFormat},
  {"pushFormat", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_31pushFormat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_30pushFormat},
  {"popFormat", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_33popFormat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_32popFormat},
  {"STDOUT", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_35STDOUT, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_34STDOUT},
  {"STDERR", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_37STDERR, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_36STDERR},
  {"ASCII", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_39ASCII, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_38ASCII},
  {"BINARY", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_41BINARY, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_40BINARY},
  {"DRAW", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_43DRAW, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_42DRAW},
  {"flush", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_45flush, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_44flush},
  {"setFileMode", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_47setFileMode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_46setFileMode},
  {"getFileMode", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_49getFileMode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_48getFileMode},
  {"setFileName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_51setFileName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_50setFileName},
  {"getFileName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_53getFileName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_52getFileName},
  {"setDrawInfo", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_55setDrawInfo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_54setDrawInfo},
  {"clearDraw", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Viewer_57clearDraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Viewer_56clearDraw},
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscViewer_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.Viewer", /*tp_name*/
  sizeof(struct PyPetscViewerObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_8petsc4py_5PETSc_6Viewer_3__call__, /*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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_Viewer, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_Viewer, /*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_8petsc4py_5PETSc_Random __pyx_vtable_8petsc4py_5PETSc_Random;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Random(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscRandomObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscRandomObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_Random;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_6Random_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_6Random_seed(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_6Random_4seed_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_6Random_seed(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_6Random_4seed_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_6Random_interval(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_6Random_8interval_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_6Random_interval(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_6Random_8interval_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_Random[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Random_5view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Random_4view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Random_7destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Random_6destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Random_9create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Random_8create},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Random_11setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Random_10setType},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Random_13getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Random_12getType},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Random_15setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Random_14setFromOptions},
  {"getValue", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Random_17getValue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Random_16getValue},
  {"getValueReal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Random_19getValueReal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Random_18getValueReal},
  {"getSeed", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Random_21getSeed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Random_20getSeed},
  {"setSeed", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Random_23setSeed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Random_22setSeed},
  {"getInterval", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Random_25getInterval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Random_24getInterval},
  {"setInterval", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6Random_27setInterval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6Random_26setInterval},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_Random[] = {
  {(char *)"seed", __pyx_getprop_8petsc4py_5PETSc_6Random_seed, __pyx_setprop_8petsc4py_5PETSc_6Random_seed, (char *)0, 0},
  {(char *)"interval", __pyx_getprop_8petsc4py_5PETSc_6Random_interval, __pyx_setprop_8petsc4py_5PETSc_6Random_interval, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscRandom_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.Random", /*tp_name*/
  sizeof(struct PyPetscRandomObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_8petsc4py_5PETSc_6Random_3__call__, /*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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_Random, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_Random, /*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_8petsc4py_5PETSc_Random, /*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_8petsc4py_5PETSc_IS __pyx_vtable_8petsc4py_5PETSc_IS;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_IS(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscISObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscISObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_IS;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_2IS_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2IS_permutation(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2IS_11permutation_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2IS_identity(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2IS_8identity_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2IS_sorted(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2IS_6sorted_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2IS_sizes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2IS_5sizes_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2IS_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2IS_4size_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2IS_local_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2IS_10local_size_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2IS_block_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2IS_10block_size_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2IS_indices(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2IS_7indices_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2IS_array(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2IS_5array_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2IS___array_interface__(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2IS_19__array_interface___1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_IS[] = {
  {"__enter__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_7__enter__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_6__enter__},
  {"__exit__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_9__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_8__exit__},
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_11view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_10view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_13destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_12destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_15create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_14create},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_17setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_16setType},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_19getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_18getType},
  {"createGeneral", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_21createGeneral, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_20createGeneral},
  {"createBlock", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_23createBlock, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_22createBlock},
  {"createStride", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_25createStride, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_24createStride},
  {"duplicate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_27duplicate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_26duplicate},
  {"copy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_29copy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_28copy},
  {"load", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_31load, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_30load},
  {"allGather", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_33allGather, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_32allGather},
  {"toGeneral", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_35toGeneral, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_34toGeneral},
  {"invertPermutation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_37invertPermutation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_36invertPermutation},
  {"getSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_39getSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_38getSize},
  {"getLocalSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_41getLocalSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_40getLocalSize},
  {"getSizes", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_43getSizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_42getSizes},
  {"getBlockSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_45getBlockSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_44getBlockSize},
  {"setBlockSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_47setBlockSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_46setBlockSize},
  {"sort", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_49sort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_48sort},
  {"isSorted", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_51isSorted, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_50isSorted},
  {"setPermutation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_53setPermutation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_52setPermutation},
  {"isPermutation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_55isPermutation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_54isPermutation},
  {"setIdentity", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_57setIdentity, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_56setIdentity},
  {"isIdentity", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_59isIdentity, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_58isIdentity},
  {"equal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_61equal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_60equal},
  {"sum", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_63sum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_62sum},
  {"expand", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_65expand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_64expand},
  {"union", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_67union, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_66union},
  {"difference", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_69difference, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_68difference},
  {"complement", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_71complement, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_70complement},
  {"embed", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_73embed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_72embed},
  {"setIndices", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_75setIndices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_74setIndices},
  {"getIndices", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_77getIndices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_76getIndices},
  {"setBlockIndices", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_79setBlockIndices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_78setBlockIndices},
  {"getBlockIndices", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_81getBlockIndices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_80getBlockIndices},
  {"setStride", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_83setStride, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_82setStride},
  {"getStride", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_85getStride, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_84getStride},
  {"getInfo", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2IS_87getInfo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2IS_86getInfo},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_IS[] = {
  {(char *)"permutation", __pyx_getprop_8petsc4py_5PETSc_2IS_permutation, 0, (char *)0, 0},
  {(char *)"identity", __pyx_getprop_8petsc4py_5PETSc_2IS_identity, 0, (char *)0, 0},
  {(char *)"sorted", __pyx_getprop_8petsc4py_5PETSc_2IS_sorted, 0, (char *)0, 0},
  {(char *)"sizes", __pyx_getprop_8petsc4py_5PETSc_2IS_sizes, 0, (char *)0, 0},
  {(char *)"size", __pyx_getprop_8petsc4py_5PETSc_2IS_size, 0, (char *)0, 0},
  {(char *)"local_size", __pyx_getprop_8petsc4py_5PETSc_2IS_local_size, 0, (char *)0, 0},
  {(char *)"block_size", __pyx_getprop_8petsc4py_5PETSc_2IS_block_size, 0, (char *)0, 0},
  {(char *)"indices", __pyx_getprop_8petsc4py_5PETSc_2IS_indices, 0, (char *)0, 0},
  {(char *)"array", __pyx_getprop_8petsc4py_5PETSc_2IS_array, 0, (char *)0, 0},
  {(char *)"__array_interface__", __pyx_getprop_8petsc4py_5PETSc_2IS___array_interface__, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyBufferProcs __pyx_tp_as_buffer_IS = {
  #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_pw_8petsc4py_5PETSc_2IS_3__getbuffer__, /*bf_getbuffer*/
  __pyx_pw_8petsc4py_5PETSc_2IS_5__releasebuffer__, /*bf_releasebuffer*/
};

DL_EXPORT(PyTypeObject) PyPetscIS_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.IS", /*tp_name*/
  sizeof(struct PyPetscISObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_IS, /*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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_IS, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_IS, /*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_8petsc4py_5PETSc_IS, /*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_8petsc4py_5PETSc_LGMap __pyx_vtable_8petsc4py_5PETSc_LGMap;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_LGMap(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscLGMapObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscLGMapObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_LGMap;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_5LGMap_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_5LGMap_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_5LGMap_4size_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_5LGMap_block_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_5LGMap_10block_size_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_5LGMap_indices(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_5LGMap_7indices_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_5LGMap_block_indices(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_5LGMap_13block_indices_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_5LGMap_info(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_5LGMap_4info_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_5LGMap_block_info(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_5LGMap_10block_info_1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_LGMap[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_5view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_4view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_7destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_6destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_9create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_8create},
  {"createIS", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_11createIS, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_10createIS},
  {"createSF", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_13createSF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_12createSF},
  {"getSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_15getSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_14getSize},
  {"getBlockSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_17getBlockSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_16getBlockSize},
  {"getIndices", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_19getIndices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_18getIndices},
  {"getBlockIndices", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_21getBlockIndices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_20getBlockIndices},
  {"getInfo", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_23getInfo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_22getInfo},
  {"getBlockInfo", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_25getBlockInfo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_24getBlockInfo},
  {"apply", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_27apply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_26apply},
  {"applyBlock", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_29applyBlock, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_28applyBlock},
  {"applyIS", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_31applyIS, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_30applyIS},
  {"applyInverse", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_33applyInverse, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_32applyInverse},
  {"applyBlockInverse", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_5LGMap_35applyBlockInverse, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_5LGMap_34applyBlockInverse},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_LGMap[] = {
  {(char *)"size", __pyx_getprop_8petsc4py_5PETSc_5LGMap_size, 0, (char *)0, 0},
  {(char *)"block_size", __pyx_getprop_8petsc4py_5PETSc_5LGMap_block_size, 0, (char *)0, 0},
  {(char *)"indices", __pyx_getprop_8petsc4py_5PETSc_5LGMap_indices, 0, (char *)0, 0},
  {(char *)"block_indices", __pyx_getprop_8petsc4py_5PETSc_5LGMap_block_indices, 0, (char *)0, 0},
  {(char *)"info", __pyx_getprop_8petsc4py_5PETSc_5LGMap_info, 0, (char *)0, 0},
  {(char *)"block_info", __pyx_getprop_8petsc4py_5PETSc_5LGMap_block_info, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscLGMap_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.LGMap", /*tp_name*/
  sizeof(struct PyPetscLGMapObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_8petsc4py_5PETSc_5LGMap_3__call__, /*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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_LGMap, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_LGMap, /*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_8petsc4py_5PETSc_LGMap, /*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_8petsc4py_5PETSc_SF __pyx_vtable_8petsc4py_5PETSc_SF;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_SF(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscSFObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscSFObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_SF;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_2SF_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc_SF(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(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_pw_8petsc4py_5PETSc_2SF_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_SF[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_5view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_4view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_7destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_6destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_9create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_8create},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_11setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_10setType},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_13getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_12getType},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_15setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_14setFromOptions},
  {"setUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_17setUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_16setUp},
  {"reset", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_19reset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_18reset},
  {"getGraph", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_21getGraph, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_20getGraph},
  {"setGraph", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_23setGraph, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_22setGraph},
  {"setRankOrder", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_25setRankOrder, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_24setRankOrder},
  {"getMulti", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_27getMulti, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_26getMulti},
  {"createInverse", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2SF_29createInverse, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2SF_28createInverse},
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscSF_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.SF", /*tp_name*/
  sizeof(struct PyPetscSFObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_SF, /*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*/
  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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_SF, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_SF, /*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_8petsc4py_5PETSc_Vec __pyx_vtable_8petsc4py_5PETSc_Vec;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Vec(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscVecObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscVecObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_Vec;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_3Vec_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}
static PyObject *__pyx_sq_item_8petsc4py_5PETSc_Vec(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_8petsc4py_5PETSc_Vec(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3Vec_31__setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_8petsc4py_5PETSc_Object->tp_as_mapping && __pyx_ptype_8petsc4py_5PETSc_Object->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_8petsc4py_5PETSc_Object->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec_sizes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_5sizes_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3Vec_sizes(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3Vec_5sizes_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_4size_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec_local_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_10local_size_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec_block_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_10block_size_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec_owner_range(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_11owner_range_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec_owner_ranges(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_12owner_ranges_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec_buffer_w(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_8buffer_w_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec_buffer_r(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_8buffer_r_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec_array_w(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_7array_w_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3Vec_array_w(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3Vec_7array_w_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec_array_r(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_7array_r_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec_buffer(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_6buffer_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec_array(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_5array_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3Vec_array(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3Vec_5array_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Vec___array_interface__(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Vec_19__array_interface___1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_Vec[] = {
  {"__enter__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_37__enter__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_36__enter__},
  {"__exit__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_39__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_38__exit__},
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_41view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_40view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_43destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_42destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_45create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_44create},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_47setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_46setType},
  {"setSizes", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_49setSizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_48setSizes},
  {"createSeq", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_51createSeq, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_50createSeq},
  {"createMPI", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_53createMPI, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_52createMPI},
  {"createWithArray", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_55createWithArray, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_54createWithArray},
  {"createGhost", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_57createGhost, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_56createGhost},
  {"createGhostWithArray", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_59createGhostWithArray, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_58createGhostWithArray},
  {"createShared", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_61createShared, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_60createShared},
  {"createNest", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_63createNest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_62createNest},
  {"setOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_65setOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_64setOptionsPrefix},
  {"getOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_67getOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_66getOptionsPrefix},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_69setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_68setFromOptions},
  {"setUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_71setUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_70setUp},
  {"setOption", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_73setOption, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_72setOption},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_75getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_74getType},
  {"getSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_77getSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_76getSize},
  {"getLocalSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_79getLocalSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_78getLocalSize},
  {"getSizes", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_81getSizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_80getSizes},
  {"setBlockSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_83setBlockSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_82setBlockSize},
  {"getBlockSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_85getBlockSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_84getBlockSize},
  {"getOwnershipRange", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_87getOwnershipRange, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_86getOwnershipRange},
  {"getOwnershipRanges", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_89getOwnershipRanges, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_88getOwnershipRanges},
  {"getBuffer", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_91getBuffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_90getBuffer},
  {"getArray", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_93getArray, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_92getArray},
  {"setArray", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_95setArray, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_94setArray},
  {"placeArray", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_97placeArray, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_96placeArray},
  {"resetArray", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_99resetArray, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_98resetArray},
  {"getCUDAHandle", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_101getCUDAHandle, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_100getCUDAHandle},
  {"restoreCUDAHandle", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_103restoreCUDAHandle, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_102restoreCUDAHandle},
  {"duplicate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_105duplicate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_104duplicate},
  {"copy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_107copy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_106copy},
  {"chop", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_109chop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_108chop},
  {"load", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_111load, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_110load},
  {"equal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_113equal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_112equal},
  {"dot", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_115dot, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_114dot},
  {"dotBegin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_117dotBegin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_116dotBegin},
  {"dotEnd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_119dotEnd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_118dotEnd},
  {"tDot", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_121tDot, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_120tDot},
  {"tDotBegin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_123tDotBegin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_122tDotBegin},
  {"tDotEnd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_125tDotEnd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_124tDotEnd},
  {"mDot", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_127mDot, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_126mDot},
  {"mDotBegin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_129mDotBegin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_128mDotBegin},
  {"mDotEnd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_131mDotEnd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_130mDotEnd},
  {"mtDot", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_133mtDot, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_132mtDot},
  {"mtDotBegin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_135mtDotBegin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_134mtDotBegin},
  {"mtDotEnd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_137mtDotEnd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_136mtDotEnd},
  {"norm", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_139norm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_138norm},
  {"normBegin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_141normBegin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_140normBegin},
  {"normEnd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_143normEnd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_142normEnd},
  {"sum", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_145sum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_144sum},
  {"min", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_147min, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_146min},
  {"max", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_149max, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_148max},
  {"normalize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_151normalize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_150normalize},
  {"reciprocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_153reciprocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_152reciprocal},
  {"exp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_155exp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_154exp},
  {"log", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_157log, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_156log},
  {"sqrtabs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_159sqrtabs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_158sqrtabs},
  {"abs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_161abs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_160abs},
  {"conjugate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_163conjugate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_162conjugate},
  {"setRandom", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_165setRandom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_164setRandom},
  {"permute", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_167permute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_166permute},
  {"zeroEntries", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_169zeroEntries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_168zeroEntries},
  {"set", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_171set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_170set},
  {"isset", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_173isset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_172isset},
  {"scale", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_175scale, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_174scale},
  {"shift", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_177shift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_176shift},
  {"chop", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_179chop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_178chop},
  {"swap", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_181swap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_180swap},
  {"axpy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_183axpy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_182axpy},
  {"isaxpy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_185isaxpy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_184isaxpy},
  {"aypx", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_187aypx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_186aypx},
  {"axpby", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_189axpby, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_188axpby},
  {"waxpy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_191waxpy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_190waxpy},
  {"maxpy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_193maxpy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_192maxpy},
  {"pointwiseMult", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_195pointwiseMult, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_194pointwiseMult},
  {"pointwiseDivide", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_197pointwiseDivide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_196pointwiseDivide},
  {"pointwiseMin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_199pointwiseMin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_198pointwiseMin},
  {"pointwiseMax", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_201pointwiseMax, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_200pointwiseMax},
  {"pointwiseMaxAbs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_203pointwiseMaxAbs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_202pointwiseMaxAbs},
  {"maxPointwiseDivide", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_205maxPointwiseDivide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_204maxPointwiseDivide},
  {"getValue", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_207getValue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_206getValue},
  {"getValues", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_209getValues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_208getValues},
  {"setValue", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_211setValue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_210setValue},
  {"setValues", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_213setValues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_212setValues},
  {"setValuesBlocked", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_215setValuesBlocked, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_214setValuesBlocked},
  {"setLGMap", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_217setLGMap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_216setLGMap},
  {"setValueLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_219setValueLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_218setValueLocal},
  {"setValuesLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_221setValuesLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_220setValuesLocal},
  {"setValuesBlockedLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_223setValuesBlockedLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_222setValuesBlockedLocal},
  {"assemblyBegin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_225assemblyBegin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_224assemblyBegin},
  {"assemblyEnd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_227assemblyEnd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_226assemblyEnd},
  {"assemble", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_229assemble, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_228assemble},
  {"strideScale", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_231strideScale, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_230strideScale},
  {"strideSum", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_233strideSum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_232strideSum},
  {"strideMin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_235strideMin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_234strideMin},
  {"strideMax", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_237strideMax, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_236strideMax},
  {"strideNorm", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_239strideNorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_238strideNorm},
  {"strideScatter", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_241strideScatter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_240strideScatter},
  {"strideGather", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_243strideGather, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_242strideGather},
  {"localForm", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_245localForm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_244localForm},
  {"ghostUpdateBegin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_247ghostUpdateBegin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_246ghostUpdateBegin},
  {"ghostUpdateEnd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_249ghostUpdateEnd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_248ghostUpdateEnd},
  {"ghostUpdate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_251ghostUpdate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_250ghostUpdate},
  {"setMPIGhost", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_253setMPIGhost, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_252setMPIGhost},
  {"getSubVector", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_255getSubVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_254getSubVector},
  {"restoreSubVector", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_257restoreSubVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_256restoreSubVector},
  {"getNestSubVecs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_259getNestSubVecs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_258getNestSubVecs},
  {"setNestSubVecs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Vec_261setNestSubVecs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Vec_260setNestSubVecs},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_Vec[] = {
  {(char *)"sizes", __pyx_getprop_8petsc4py_5PETSc_3Vec_sizes, __pyx_setprop_8petsc4py_5PETSc_3Vec_sizes, (char *)0, 0},
  {(char *)"size", __pyx_getprop_8petsc4py_5PETSc_3Vec_size, 0, (char *)0, 0},
  {(char *)"local_size", __pyx_getprop_8petsc4py_5PETSc_3Vec_local_size, 0, (char *)0, 0},
  {(char *)"block_size", __pyx_getprop_8petsc4py_5PETSc_3Vec_block_size, 0, (char *)0, 0},
  {(char *)"owner_range", __pyx_getprop_8petsc4py_5PETSc_3Vec_owner_range, 0, (char *)0, 0},
  {(char *)"owner_ranges", __pyx_getprop_8petsc4py_5PETSc_3Vec_owner_ranges, 0, (char *)0, 0},
  {(char *)"buffer_w", __pyx_getprop_8petsc4py_5PETSc_3Vec_buffer_w, 0, (char *)"Vec buffer (writable)", 0},
  {(char *)"buffer_r", __pyx_getprop_8petsc4py_5PETSc_3Vec_buffer_r, 0, (char *)"Vec buffer (read-only)", 0},
  {(char *)"array_w", __pyx_getprop_8petsc4py_5PETSc_3Vec_array_w, __pyx_setprop_8petsc4py_5PETSc_3Vec_array_w, (char *)"Vec array (writable)", 0},
  {(char *)"array_r", __pyx_getprop_8petsc4py_5PETSc_3Vec_array_r, 0, (char *)"Vec array (read-only)", 0},
  {(char *)"buffer", __pyx_getprop_8petsc4py_5PETSc_3Vec_buffer, 0, (char *)0, 0},
  {(char *)"array", __pyx_getprop_8petsc4py_5PETSc_3Vec_array, __pyx_setprop_8petsc4py_5PETSc_3Vec_array, (char *)0, 0},
  {(char *)"__array_interface__", __pyx_getprop_8petsc4py_5PETSc_3Vec___array_interface__, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Vec = {
  __pyx_pw_8petsc4py_5PETSc_3Vec_19__add__, /*nb_add*/
  __pyx_pw_8petsc4py_5PETSc_3Vec_21__sub__, /*nb_subtract*/
  __pyx_pw_8petsc4py_5PETSc_3Vec_23__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8petsc4py_5PETSc_3Vec_25__div__, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  __pyx_pw_8petsc4py_5PETSc_3Vec_5__neg__, /*nb_negative*/
  __pyx_pw_8petsc4py_5PETSc_3Vec_3__pos__, /*nb_positive*/
  __pyx_pw_8petsc4py_5PETSc_3Vec_7__abs__, /*nb_absolute*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8petsc4py_5PETSc_6Object_7__nonzero__, /*nb_nonzero*/
  #else
  0, /*nb_nonzero*/
  #endif
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_hex*/
  #endif
  __pyx_pw_8petsc4py_5PETSc_3Vec_9__iadd__, /*nb_inplace_add*/
  __pyx_pw_8petsc4py_5PETSc_3Vec_11__isub__, /*nb_inplace_subtract*/
  __pyx_pw_8petsc4py_5PETSc_3Vec_13__imul__, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8petsc4py_5PETSc_3Vec_15__idiv__, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  __pyx_pw_8petsc4py_5PETSc_3Vec_27__truediv__, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  __pyx_pw_8petsc4py_5PETSc_3Vec_17__itruediv__, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Vec = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_8petsc4py_5PETSc_Vec, /*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_Vec = {
  0, /*mp_length*/
  __pyx_pw_8petsc4py_5PETSc_3Vec_29__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_8petsc4py_5PETSc_Vec, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Vec = {
  #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_pw_8petsc4py_5PETSc_3Vec_33__getbuffer__, /*bf_getbuffer*/
  __pyx_pw_8petsc4py_5PETSc_3Vec_35__releasebuffer__, /*bf_releasebuffer*/
};

DL_EXPORT(PyTypeObject) PyPetscVec_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.Vec", /*tp_name*/
  sizeof(struct PyPetscVecObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  &__pyx_tp_as_number_Vec, /*tp_as_number*/
  &__pyx_tp_as_sequence_Vec, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Vec, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Vec, /*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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_Vec, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_Vec, /*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_8petsc4py_5PETSc_Vec, /*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_8petsc4py_5PETSc_Scatter __pyx_vtable_8petsc4py_5PETSc_Scatter;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Scatter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscScatterObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscScatterObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_Scatter;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_7Scatter_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_Scatter[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Scatter_5view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Scatter_4view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Scatter_7destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Scatter_6destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Scatter_9create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Scatter_8create},
  {"copy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Scatter_11copy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Scatter_10copy},
  {"toAll", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Scatter_13toAll, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Scatter_12toAll},
  {"toZero", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Scatter_15toZero, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Scatter_14toZero},
  {"begin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Scatter_17begin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Scatter_16begin},
  {"end", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Scatter_19end, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Scatter_18end},
  {"scatterBegin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Scatter_21scatterBegin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Scatter_20scatterBegin},
  {"scatterEnd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Scatter_23scatterEnd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Scatter_22scatterEnd},
  {"scatter", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Scatter_25scatter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Scatter_24scatter},
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscScatter_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.Scatter", /*tp_name*/
  sizeof(struct PyPetscScatterObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_8petsc4py_5PETSc_7Scatter_3__call__, /*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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_Scatter, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_Scatter, /*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_8petsc4py_5PETSc_Section __pyx_vtable_8petsc4py_5PETSc_Section;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Section(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscSectionObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscSectionObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_Section;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_7Section_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc_Section(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(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_pw_8petsc4py_5PETSc_7Section_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_Section[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_5view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_4view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_7destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_6destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_9create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_8create},
  {"clone", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_11clone, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_10clone},
  {"setUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_13setUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_12setUp},
  {"reset", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_15reset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_14reset},
  {"getNumFields", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_17getNumFields, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_16getNumFields},
  {"setNumFields", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_19setNumFields, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_18setNumFields},
  {"getFieldName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_21getFieldName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_20getFieldName},
  {"setFieldName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_23setFieldName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_22setFieldName},
  {"getFieldComponents", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_25getFieldComponents, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_24getFieldComponents},
  {"setFieldComponents", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_27setFieldComponents, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_26setFieldComponents},
  {"getChart", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_29getChart, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_28getChart},
  {"setChart", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_31setChart, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_30setChart},
  {"getDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_33getDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_32getDof},
  {"setDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_35setDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_34setDof},
  {"addDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_37addDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_36addDof},
  {"getFieldDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_39getFieldDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_38getFieldDof},
  {"setFieldDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_41setFieldDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_40setFieldDof},
  {"addFieldDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_43addFieldDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_42addFieldDof},
  {"getConstraintDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_45getConstraintDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_44getConstraintDof},
  {"setConstraintDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_47setConstraintDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_46setConstraintDof},
  {"addConstraintDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_49addConstraintDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_48addConstraintDof},
  {"getFieldConstraintDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_51getFieldConstraintDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_50getFieldConstraintDof},
  {"setFieldConstraintDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_53setFieldConstraintDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_52setFieldConstraintDof},
  {"addFieldConstraintDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_55addFieldConstraintDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_54addFieldConstraintDof},
  {"getConstraintIndices", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_57getConstraintIndices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_56getConstraintIndices},
  {"setConstraintIndices", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_59setConstraintIndices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_58setConstraintIndices},
  {"getFieldConstraintIndices", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_61getFieldConstraintIndices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_60getFieldConstraintIndices},
  {"setFieldConstraintIndices", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_63setFieldConstraintIndices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_62setFieldConstraintIndices},
  {"getMaxDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_65getMaxDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_64getMaxDof},
  {"getStorageSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_67getStorageSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_66getStorageSize},
  {"getConstrainedStorageSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_69getConstrainedStorageSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_68getConstrainedStorageSize},
  {"getOffset", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_71getOffset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_70getOffset},
  {"setOffset", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_73setOffset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_72setOffset},
  {"getOffsetRange", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_75getOffsetRange, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_74getOffsetRange},
  {"createGlobalSection", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Section_77createGlobalSection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Section_76createGlobalSection},
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscSection_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.Section", /*tp_name*/
  sizeof(struct PyPetscSectionObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Section, /*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*/
  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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_Section, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_Section, /*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_8petsc4py_5PETSc_Mat __pyx_vtable_8petsc4py_5PETSc_Mat;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Mat(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscMatObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscMatObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_Mat;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_3Mat_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}
static PyObject *__pyx_sq_item_8petsc4py_5PETSc_Mat(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_8petsc4py_5PETSc_Mat(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3Mat_29__setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_8petsc4py_5PETSc_Object->tp_as_mapping && __pyx_ptype_8petsc4py_5PETSc_Object->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_8petsc4py_5PETSc_Object->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Mat_sizes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Mat_5sizes_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3Mat_sizes(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3Mat_5sizes_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Mat_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Mat_4size_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Mat_local_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Mat_10local_size_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Mat_block_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Mat_10block_size_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Mat_block_sizes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Mat_11block_sizes_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Mat_owner_range(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Mat_11owner_range_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Mat_owner_ranges(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Mat_12owner_ranges_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Mat_assembled(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Mat_9assembled_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Mat_symmetric(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Mat_9symmetric_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Mat_hermitian(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Mat_9hermitian_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3Mat_structsymm(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3Mat_10structsymm_1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_Mat[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_33view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_32view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_35destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_34destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_37create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_36create},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_39setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_38setType},
  {"setSizes", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_41setSizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_40setSizes},
  {"setBlockSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_43setBlockSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_42setBlockSize},
  {"setBlockSizes", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_45setBlockSizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_44setBlockSizes},
  {"createAIJ", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_47createAIJ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_46createAIJ},
  {"createBAIJ", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_49createBAIJ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_48createBAIJ},
  {"createSBAIJ", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_51createSBAIJ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_50createSBAIJ},
  {"createAIJCRL", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_53createAIJCRL, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_52createAIJCRL},
  {"setPreallocationNNZ", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_55setPreallocationNNZ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_54setPreallocationNNZ},
  {"setPreallocationCSR", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_57setPreallocationCSR, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_56setPreallocationCSR},
  {"createAIJWithArrays", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_59createAIJWithArrays, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_58createAIJWithArrays},
  {"createDense", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_61createDense, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_60createDense},
  {"setPreallocationDense", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_63setPreallocationDense, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_62setPreallocationDense},
  {"createScatter", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_65createScatter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_64createScatter},
  {"createNormal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_67createNormal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_66createNormal},
  {"createTranspose", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_69createTranspose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_68createTranspose},
  {"createLRC", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_71createLRC, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_70createLRC},
  {"createSubMatrix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_73createSubMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_72createSubMatrix},
  {"createNest", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_75createNest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_74createNest},
  {"createPython", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_77createPython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_76createPython},
  {"setPythonContext", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_79setPythonContext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_78setPythonContext},
  {"getPythonContext", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_81getPythonContext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_80getPythonContext},
  {"setPythonType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_83setPythonType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_82setPythonType},
  {"setOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_85setOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_84setOptionsPrefix},
  {"getOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_87getOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_86getOptionsPrefix},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_89setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_88setFromOptions},
  {"setUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_91setUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_90setUp},
  {"setOption", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_93setOption, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_92setOption},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_95getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_94getType},
  {"getSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_97getSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_96getSize},
  {"getLocalSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_99getLocalSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_98getLocalSize},
  {"getSizes", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_101getSizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_100getSizes},
  {"getBlockSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_103getBlockSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_102getBlockSize},
  {"getBlockSizes", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_105getBlockSizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_104getBlockSizes},
  {"getOwnershipRange", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_107getOwnershipRange, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_106getOwnershipRange},
  {"getOwnershipRanges", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_109getOwnershipRanges, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_108getOwnershipRanges},
  {"getOwnershipRangeColumn", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_111getOwnershipRangeColumn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_110getOwnershipRangeColumn},
  {"getOwnershipRangesColumn", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_113getOwnershipRangesColumn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_112getOwnershipRangesColumn},
  {"getOwnershipIS", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_115getOwnershipIS, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_114getOwnershipIS},
  {"getInfo", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_117getInfo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_116getInfo},
  {"duplicate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_119duplicate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_118duplicate},
  {"copy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_121copy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_120copy},
  {"load", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_123load, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_122load},
  {"convert", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_125convert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_124convert},
  {"transpose", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_127transpose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_126transpose},
  {"realPart", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_129realPart, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_128realPart},
  {"imagPart", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_131imagPart, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_130imagPart},
  {"conjugate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_133conjugate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_132conjugate},
  {"permute", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_135permute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_134permute},
  {"equal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_137equal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_136equal},
  {"isTranspose", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_139isTranspose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_138isTranspose},
  {"isSymmetric", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_141isSymmetric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_140isSymmetric},
  {"isSymmetricKnown", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_143isSymmetricKnown, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_142isSymmetricKnown},
  {"isHermitian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_145isHermitian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_144isHermitian},
  {"isHermitianKnown", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_147isHermitianKnown, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_146isHermitianKnown},
  {"isStructurallySymmetric", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_149isStructurallySymmetric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_148isStructurallySymmetric},
  {"zeroEntries", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_151zeroEntries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_150zeroEntries},
  {"getValue", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_153getValue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_152getValue},
  {"getValues", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_155getValues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_154getValues},
  {"getValuesCSR", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_157getValuesCSR, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_156getValuesCSR},
  {"getRow", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_159getRow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_158getRow},
  {"getRowIJ", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_161getRowIJ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_160getRowIJ},
  {"getColumnIJ", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_163getColumnIJ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_162getColumnIJ},
  {"setValue", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_165setValue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_164setValue},
  {"setValues", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_167setValues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_166setValues},
  {"setValuesRCV", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_169setValuesRCV, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_168setValuesRCV},
  {"setValuesIJV", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_171setValuesIJV, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_170setValuesIJV},
  {"setValuesCSR", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_173setValuesCSR, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_172setValuesCSR},
  {"setValuesBlocked", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_175setValuesBlocked, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_174setValuesBlocked},
  {"setValuesBlockedRCV", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_177setValuesBlockedRCV, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_176setValuesBlockedRCV},
  {"setValuesBlockedIJV", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_179setValuesBlockedIJV, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_178setValuesBlockedIJV},
  {"setValuesBlockedCSR", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_181setValuesBlockedCSR, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_180setValuesBlockedCSR},
  {"setLGMap", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_183setLGMap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_182setLGMap},
  {"setValueLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_185setValueLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_184setValueLocal},
  {"setValuesLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_187setValuesLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_186setValuesLocal},
  {"setValuesLocalRCV", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_189setValuesLocalRCV, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_188setValuesLocalRCV},
  {"setValuesLocalIJV", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_191setValuesLocalIJV, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_190setValuesLocalIJV},
  {"setValuesLocalCSR", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_193setValuesLocalCSR, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_192setValuesLocalCSR},
  {"setValuesBlockedLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_195setValuesBlockedLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_194setValuesBlockedLocal},
  {"setValuesBlockedLocalRCV", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_197setValuesBlockedLocalRCV, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_196setValuesBlockedLocalRCV},
  {"setValuesBlockedLocalIJV", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_199setValuesBlockedLocalIJV, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_198setValuesBlockedLocalIJV},
  {"setValuesBlockedLocalCSR", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_201setValuesBlockedLocalCSR, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_200setValuesBlockedLocalCSR},
  {"setStencil", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_203setStencil, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_202setStencil},
  {"setValueStencil", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_205setValueStencil, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_204setValueStencil},
  {"setValueBlockedStencil", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_207setValueBlockedStencil, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_206setValueBlockedStencil},
  {"zeroRows", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_209zeroRows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_208zeroRows},
  {"zeroRowsLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_211zeroRowsLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_210zeroRowsLocal},
  {"zeroRowsColumns", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_213zeroRowsColumns, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_212zeroRowsColumns},
  {"storeValues", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_215storeValues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_214storeValues},
  {"retrieveValues", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_217retrieveValues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_216retrieveValues},
  {"assemblyBegin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_219assemblyBegin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_218assemblyBegin},
  {"assemblyEnd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_221assemblyEnd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_220assemblyEnd},
  {"assemble", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_223assemble, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_222assemble},
  {"isAssembled", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_225isAssembled, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_224isAssembled},
  {"createVecs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_227createVecs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_226createVecs},
  {"createVecRight", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_229createVecRight, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_228createVecRight},
  {"createVecLeft", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_231createVecLeft, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_230createVecLeft},
  {"getColumnVector", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_233getColumnVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_232getColumnVector},
  {"getRedundantMatrix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_235getRedundantMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_234getRedundantMatrix},
  {"getDiagonal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_237getDiagonal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_236getDiagonal},
  {"getRowSum", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_239getRowSum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_238getRowSum},
  {"setDiagonal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_241setDiagonal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_240setDiagonal},
  {"diagonalScale", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_243diagonalScale, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_242diagonalScale},
  {"invertBlockDiagonal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_245invertBlockDiagonal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_244invertBlockDiagonal},
  {"setNullSpace", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_247setNullSpace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_246setNullSpace},
  {"getNullSpace", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_249getNullSpace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_248getNullSpace},
  {"setNearNullSpace", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_251setNearNullSpace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_250setNearNullSpace},
  {"getNearNullSpace", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_253getNearNullSpace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_252getNearNullSpace},
  {"mult", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_255mult, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_254mult},
  {"multAdd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_257multAdd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_256multAdd},
  {"multTranspose", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_259multTranspose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_258multTranspose},
  {"multTransposeAdd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_261multTransposeAdd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_260multTransposeAdd},
  {"multHermitian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_263multHermitian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_262multHermitian},
  {"multHermitianAdd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_265multHermitianAdd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_264multHermitianAdd},
  {"SOR", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_267SOR, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_266SOR},
  {"getDiagonalBlock", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_269getDiagonalBlock, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_268getDiagonalBlock},
  {"increaseOverlap", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_271increaseOverlap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_270increaseOverlap},
  {"getSubMatrix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_273getSubMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_272getSubMatrix},
  {"getSubMatrices", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_275getSubMatrices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_274getSubMatrices},
  {"getLocalSubMatrix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_277getLocalSubMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_276getLocalSubMatrix},
  {"restoreLocalSubMatrix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_279restoreLocalSubMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_278restoreLocalSubMatrix},
  {"norm", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_281norm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_280norm},
  {"scale", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_283scale, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_282scale},
  {"shift", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_285shift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_284shift},
  {"chop", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_287chop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_286chop},
  {"axpy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_289axpy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_288axpy},
  {"aypx", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_291aypx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_290aypx},
  {"matMultSymbolic", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_293matMultSymbolic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_292matMultSymbolic},
  {"matMultNumeric", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_295matMultNumeric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_294matMultNumeric},
  {"matMult", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_297matMult, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_296matMult},
  {"matTransposeMult", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_299matTransposeMult, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_298matTransposeMult},
  {"transposeMatMult", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_301transposeMatMult, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_300transposeMatMult},
  {"getOrdering", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_303getOrdering, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_302getOrdering},
  {"reorderForNonzeroDiagonal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_305reorderForNonzeroDiagonal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_304reorderForNonzeroDiagonal},
  {"factorLU", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_307factorLU, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_306factorLU},
  {"factorSymbolicLU", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_309factorSymbolicLU, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_308factorSymbolicLU},
  {"factorNumericLU", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_311factorNumericLU, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_310factorNumericLU},
  {"factorILU", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_313factorILU, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_312factorILU},
  {"factorSymbolicILU", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_315factorSymbolicILU, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_314factorSymbolicILU},
  {"factorCholesky", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_317factorCholesky, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_316factorCholesky},
  {"factorSymbolicCholesky", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_319factorSymbolicCholesky, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_318factorSymbolicCholesky},
  {"factorNumericCholesky", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_321factorNumericCholesky, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_320factorNumericCholesky},
  {"factorICC", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_323factorICC, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_322factorICC},
  {"factorSymbolicICC", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_325factorSymbolicICC, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_324factorSymbolicICC},
  {"getInertia", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_327getInertia, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_326getInertia},
  {"setUnfactored", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_329setUnfactored, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_328setUnfactored},
  {"setMumpsIcntl", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_331setMumpsIcntl, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_330setMumpsIcntl},
  {"getMumpsIcntl", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_333getMumpsIcntl, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_332getMumpsIcntl},
  {"setMumpsCntl", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_335setMumpsCntl, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_334setMumpsCntl},
  {"getMumpsCntl", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_337getMumpsCntl, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_336getMumpsCntl},
  {"getMumpsInfo", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_339getMumpsInfo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_338getMumpsInfo},
  {"getMumpsInfog", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_341getMumpsInfog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_340getMumpsInfog},
  {"getMumpsRinfo", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_343getMumpsRinfo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_342getMumpsRinfo},
  {"getMumpsRinfog", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_345getMumpsRinfog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_344getMumpsRinfog},
  {"solveForward", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_347solveForward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_346solveForward},
  {"solveBackward", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_349solveBackward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_348solveBackward},
  {"solve", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_351solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_350solve},
  {"solveTranspose", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_353solveTranspose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_352solveTranspose},
  {"solveAdd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_355solveAdd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_354solveAdd},
  {"solveTransposeAdd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_357solveTransposeAdd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_356solveTransposeAdd},
  {"matSolve", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_359matSolve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_358matSolve},
  {"getDenseArray", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_361getDenseArray, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_360getDenseArray},
  {"getDenseLocalMatrix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Mat_363getDenseLocalMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Mat_362getDenseLocalMatrix},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_Mat[] = {
  {(char *)"sizes", __pyx_getprop_8petsc4py_5PETSc_3Mat_sizes, __pyx_setprop_8petsc4py_5PETSc_3Mat_sizes, (char *)0, 0},
  {(char *)"size", __pyx_getprop_8petsc4py_5PETSc_3Mat_size, 0, (char *)0, 0},
  {(char *)"local_size", __pyx_getprop_8petsc4py_5PETSc_3Mat_local_size, 0, (char *)0, 0},
  {(char *)"block_size", __pyx_getprop_8petsc4py_5PETSc_3Mat_block_size, 0, (char *)0, 0},
  {(char *)"block_sizes", __pyx_getprop_8petsc4py_5PETSc_3Mat_block_sizes, 0, (char *)0, 0},
  {(char *)"owner_range", __pyx_getprop_8petsc4py_5PETSc_3Mat_owner_range, 0, (char *)0, 0},
  {(char *)"owner_ranges", __pyx_getprop_8petsc4py_5PETSc_3Mat_owner_ranges, 0, (char *)0, 0},
  {(char *)"assembled", __pyx_getprop_8petsc4py_5PETSc_3Mat_assembled, 0, (char *)0, 0},
  {(char *)"symmetric", __pyx_getprop_8petsc4py_5PETSc_3Mat_symmetric, 0, (char *)0, 0},
  {(char *)"hermitian", __pyx_getprop_8petsc4py_5PETSc_3Mat_hermitian, 0, (char *)0, 0},
  {(char *)"structsymm", __pyx_getprop_8petsc4py_5PETSc_3Mat_structsymm, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Mat = {
  __pyx_pw_8petsc4py_5PETSc_3Mat_17__add__, /*nb_add*/
  __pyx_pw_8petsc4py_5PETSc_3Mat_19__sub__, /*nb_subtract*/
  __pyx_pw_8petsc4py_5PETSc_3Mat_21__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8petsc4py_5PETSc_3Mat_23__div__, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  __pyx_pw_8petsc4py_5PETSc_3Mat_5__neg__, /*nb_negative*/
  __pyx_pw_8petsc4py_5PETSc_3Mat_3__pos__, /*nb_positive*/
  0, /*nb_absolute*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8petsc4py_5PETSc_6Object_7__nonzero__, /*nb_nonzero*/
  #else
  0, /*nb_nonzero*/
  #endif
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_hex*/
  #endif
  __pyx_pw_8petsc4py_5PETSc_3Mat_7__iadd__, /*nb_inplace_add*/
  __pyx_pw_8petsc4py_5PETSc_3Mat_9__isub__, /*nb_inplace_subtract*/
  __pyx_pw_8petsc4py_5PETSc_3Mat_11__imul__, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8petsc4py_5PETSc_3Mat_13__idiv__, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  __pyx_pw_8petsc4py_5PETSc_3Mat_25__truediv__, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  __pyx_pw_8petsc4py_5PETSc_3Mat_15__itruediv__, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Mat = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_8petsc4py_5PETSc_Mat, /*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_Mat = {
  0, /*mp_length*/
  __pyx_pw_8petsc4py_5PETSc_3Mat_27__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_8petsc4py_5PETSc_Mat, /*mp_ass_subscript*/
};

DL_EXPORT(PyTypeObject) PyPetscMat_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.Mat", /*tp_name*/
  sizeof(struct PyPetscMatObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  &__pyx_tp_as_number_Mat, /*tp_as_number*/
  &__pyx_tp_as_sequence_Mat, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Mat, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_8petsc4py_5PETSc_3Mat_31__call__, /*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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_Mat, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_Mat, /*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_8petsc4py_5PETSc_Mat, /*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_8petsc4py_5PETSc_NullSpace __pyx_vtable_8petsc4py_5PETSc_NullSpace;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_NullSpace(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscNullSpaceObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscNullSpaceObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_NullSpace;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_9NullSpace_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_NullSpace[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_9NullSpace_5view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_9NullSpace_4view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_9NullSpace_7destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_9NullSpace_6destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_9NullSpace_9create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_9NullSpace_8create},
  {"createRigidBody", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_9NullSpace_11createRigidBody, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_9NullSpace_10createRigidBody},
  {"setFunction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_9NullSpace_13setFunction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_9NullSpace_12setFunction},
  {"hasConstant", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_9NullSpace_15hasConstant, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_9NullSpace_14hasConstant},
  {"getVecs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_9NullSpace_17getVecs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_9NullSpace_16getVecs},
  {"getFunction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_9NullSpace_19getFunction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_9NullSpace_18getFunction},
  {"remove", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_9NullSpace_21remove, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_9NullSpace_20remove},
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscNullSpace_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.NullSpace", /*tp_name*/
  sizeof(struct PyPetscNullSpaceObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_8petsc4py_5PETSc_9NullSpace_3__call__, /*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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_NullSpace, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_NullSpace, /*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_8petsc4py_5PETSc_PC __pyx_vtable_8petsc4py_5PETSc_PC;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_PC(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscPCObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscPCObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_PC;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_2PC_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_PC[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_5view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_4view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_7destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_6destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_9create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_8create},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_11setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_10setType},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_13getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_12getType},
  {"setOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_15setOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_14setOptionsPrefix},
  {"getOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_17getOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_16getOptionsPrefix},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_19setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_18setFromOptions},
  {"setOperators", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_21setOperators, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_20setOperators},
  {"getOperators", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_23getOperators, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_22getOperators},
  {"setUseAmat", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_25setUseAmat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_24setUseAmat},
  {"setUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_27setUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_26setUp},
  {"reset", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_29reset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_28reset},
  {"setUpOnBlocks", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_31setUpOnBlocks, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_30setUpOnBlocks},
  {"apply", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_33apply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_32apply},
  {"applyTranspose", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_35applyTranspose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_34applyTranspose},
  {"applySymmetricLeft", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_37applySymmetricLeft, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_36applySymmetricLeft},
  {"applySymmetricRight", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_39applySymmetricRight, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_38applySymmetricRight},
  {"getDM", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_41getDM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_40getDM},
  {"setDM", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_43setDM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_42setDM},
  {"setCoordinates", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_45setCoordinates, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_44setCoordinates},
  {"createPython", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_47createPython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_46createPython},
  {"setPythonContext", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_49setPythonContext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_48setPythonContext},
  {"getPythonContext", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_51getPythonContext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_50getPythonContext},
  {"setPythonType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_53setPythonType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_52setPythonType},
  {"setASMType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_55setASMType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_54setASMType},
  {"setASMOverlap", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_57setASMOverlap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_56setASMOverlap},
  {"setASMLocalSubdomains", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_59setASMLocalSubdomains, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_58setASMLocalSubdomains},
  {"setASMTotalSubdomains", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_61setASMTotalSubdomains, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_60setASMTotalSubdomains},
  {"getASMSubKSP", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_63getASMSubKSP, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_62getASMSubKSP},
  {"setGASMType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_65setGASMType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_64setGASMType},
  {"setGASMOverlap", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_67setGASMOverlap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_66setGASMOverlap},
  {"setGAMGType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_69setGAMGType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_68setGAMGType},
  {"setGAMGLevels", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_71setGAMGLevels, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_70setGAMGLevels},
  {"setGAMGSmooths", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_73setGAMGSmooths, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_72setGAMGSmooths},
  {"getHYPREType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_75getHYPREType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_74getHYPREType},
  {"setHYPREType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_77setHYPREType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_76setHYPREType},
  {"setHYPREDiscreteCurl", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_79setHYPREDiscreteCurl, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_78setHYPREDiscreteCurl},
  {"setHYPREDiscreteGradient", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_81setHYPREDiscreteGradient, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_80setHYPREDiscreteGradient},
  {"setHYPRESetAlphaPoissonMatrix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_83setHYPRESetAlphaPoissonMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_82setHYPRESetAlphaPoissonMatrix},
  {"setHYPRESetBetaPoissonMatrix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_85setHYPRESetBetaPoissonMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_84setHYPRESetBetaPoissonMatrix},
  {"setHYPRESetEdgeConstantVectors", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_87setHYPRESetEdgeConstantVectors, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_86setHYPRESetEdgeConstantVectors},
  {"setFactorSolverPackage", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_89setFactorSolverPackage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_88setFactorSolverPackage},
  {"getFactorSolverPackage", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_91getFactorSolverPackage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_90getFactorSolverPackage},
  {"setFactorOrdering", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_93setFactorOrdering, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_92setFactorOrdering},
  {"setFactorPivot", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_95setFactorPivot, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_94setFactorPivot},
  {"setFactorShift", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_97setFactorShift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_96setFactorShift},
  {"setFactorLevels", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_99setFactorLevels, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_98setFactorLevels},
  {"getFactorMatrix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_101getFactorMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_100getFactorMatrix},
  {"setFieldSplitType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_103setFieldSplitType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_102setFieldSplitType},
  {"setFieldSplitIS", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_105setFieldSplitIS, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_104setFieldSplitIS},
  {"setFieldSplitFields", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_107setFieldSplitFields, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_106setFieldSplitFields},
  {"getFieldSplitSubKSP", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_109getFieldSplitSubKSP, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_108getFieldSplitSubKSP},
  {"setFieldSplitSchurFactType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_111setFieldSplitSchurFactType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_110setFieldSplitSchurFactType},
  {"setFieldSplitSchurPreType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_113setFieldSplitSchurPreType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_112setFieldSplitSchurPreType},
  {"setReusePreconditioner", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_115setReusePreconditioner, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_114setReusePreconditioner},
  {"setCompositeType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_117setCompositeType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_116setCompositeType},
  {"getCompositePC", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_119getCompositePC, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_118getCompositePC},
  {"addCompositePC", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_121addCompositePC, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_120addCompositePC},
  {"getKSP", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_123getKSP, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_122getKSP},
  {"getMGType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_125getMGType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_124getMGType},
  {"setMGType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_127setMGType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_126setMGType},
  {"getMGLevels", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_129getMGLevels, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_128getMGLevels},
  {"getMGCoarseSolve", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_131getMGCoarseSolve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_130getMGCoarseSolve},
  {"setMGInterpolation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_133setMGInterpolation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_132setMGInterpolation},
  {"getMGInterpolation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_135getMGInterpolation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_134getMGInterpolation},
  {"setMGRestriction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_137setMGRestriction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_136setMGRestriction},
  {"getMGRestriction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_139getMGRestriction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_138getMGRestriction},
  {"setMGRScale", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_141setMGRScale, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_140setMGRScale},
  {"getMGRScale", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_143getMGRScale, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_142getMGRScale},
  {"getMGSmoother", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_145getMGSmoother, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_144getMGSmoother},
  {"getMGSmootherDown", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_147getMGSmootherDown, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_146getMGSmootherDown},
  {"getMGSmootherUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_149getMGSmootherUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_148getMGSmootherUp},
  {"setMGCyclesOnLevel", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_151setMGCyclesOnLevel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_150setMGCyclesOnLevel},
  {"setMGRhs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_153setMGRhs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_152setMGRhs},
  {"setMGX", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_155setMGX, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_154setMGX},
  {"setMGR", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2PC_157setMGR, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2PC_156setMGR},
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscPC_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.PC", /*tp_name*/
  sizeof(struct PyPetscPCObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_8petsc4py_5PETSc_2PC_3__call__, /*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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_PC, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_PC, /*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_8petsc4py_5PETSc_KSP __pyx_vtable_8petsc4py_5PETSc_KSP;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_KSP(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscKSPObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscKSPObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_KSP;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_3KSP_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_appctx(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_6appctx_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_appctx(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_6appctx_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_dm(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_2dm_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_dm(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_2dm_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_vec_sol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_7vec_sol_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_vec_rhs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_7vec_rhs_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_mat_op(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_6mat_op_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_mat_pc(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_6mat_pc_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_guess_nonzero(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_13guess_nonzero_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_guess_nonzero(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_13guess_nonzero_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_guess_knoll(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_11guess_knoll_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_guess_knoll(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_11guess_knoll_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_pc(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_2pc_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_pc_side(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_7pc_side_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_pc_side(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_7pc_side_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_norm_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_9norm_type_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_norm_type(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_9norm_type_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_rtol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_4rtol_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_rtol(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_4rtol_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_atol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_4atol_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_atol(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_4atol_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_divtol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_6divtol_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_divtol(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_6divtol_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_max_it(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_6max_it_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_max_it(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_6max_it_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_its(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_3its_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_its(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_3its_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_norm(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_4norm_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_norm(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_4norm_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_history(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_7history_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_reason(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_6reason_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3KSP_reason(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3KSP_6reason_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_iterating(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_9iterating_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_converged(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_9converged_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3KSP_diverged(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3KSP_8diverged_1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_KSP[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_5view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_4view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_7destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_6destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_9create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_8create},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_11setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_10setType},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_13getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_12getType},
  {"setOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_15setOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_14setOptionsPrefix},
  {"getOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_17getOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_16getOptionsPrefix},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_19setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_18setFromOptions},
  {"setAppCtx", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_21setAppCtx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_20setAppCtx},
  {"getAppCtx", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_23getAppCtx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_22getAppCtx},
  {"getDM", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_25getDM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_24getDM},
  {"setDM", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_27setDM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_26setDM},
  {"setDMActive", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_29setDMActive, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_28setDMActive},
  {"setComputeRHS", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_31setComputeRHS, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_30setComputeRHS},
  {"setComputeOperators", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_33setComputeOperators, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_32setComputeOperators},
  {"setOperators", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_35setOperators, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_34setOperators},
  {"getOperators", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_37getOperators, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_36getOperators},
  {"setPC", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_39setPC, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_38setPC},
  {"getPC", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_41getPC, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_40getPC},
  {"setTolerances", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_43setTolerances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_42setTolerances},
  {"getTolerances", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_45getTolerances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_44getTolerances},
  {"setConvergenceTest", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_47setConvergenceTest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_46setConvergenceTest},
  {"getConvergenceTest", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_49getConvergenceTest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_48getConvergenceTest},
  {"callConvergenceTest", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_51callConvergenceTest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_50callConvergenceTest},
  {"setConvergenceHistory", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_53setConvergenceHistory, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_52setConvergenceHistory},
  {"getConvergenceHistory", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_55getConvergenceHistory, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_54getConvergenceHistory},
  {"logConvergenceHistory", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_57logConvergenceHistory, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_56logConvergenceHistory},
  {"setMonitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_59setMonitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_58setMonitor},
  {"getMonitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_61getMonitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_60getMonitor},
  {"cancelMonitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_63cancelMonitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_62cancelMonitor},
  {"monitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_65monitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_64monitor},
  {"setPCSide", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_67setPCSide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_66setPCSide},
  {"getPCSide", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_69getPCSide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_68getPCSide},
  {"setNormType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_71setNormType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_70setNormType},
  {"getNormType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_73getNormType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_72getNormType},
  {"setComputeEigenvalues", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_75setComputeEigenvalues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_74setComputeEigenvalues},
  {"getComputeEigenvalues", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_77getComputeEigenvalues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_76getComputeEigenvalues},
  {"setComputeSingularValues", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_79setComputeSingularValues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_78setComputeSingularValues},
  {"getComputeSingularValues", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_81getComputeSingularValues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_80getComputeSingularValues},
  {"setInitialGuessNonzero", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_83setInitialGuessNonzero, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_82setInitialGuessNonzero},
  {"getInitialGuessNonzero", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_85getInitialGuessNonzero, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_84getInitialGuessNonzero},
  {"setInitialGuessKnoll", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_87setInitialGuessKnoll, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_86setInitialGuessKnoll},
  {"getInitialGuessKnoll", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_89getInitialGuessKnoll, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_88getInitialGuessKnoll},
  {"setUseFischerGuess", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_91setUseFischerGuess, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_90setUseFischerGuess},
  {"setUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_93setUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_92setUp},
  {"reset", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_95reset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_94reset},
  {"setUpOnBlocks", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_97setUpOnBlocks, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_96setUpOnBlocks},
  {"solve", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_99solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_98solve},
  {"solveTranspose", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_101solveTranspose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_100solveTranspose},
  {"setIterationNumber", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_103setIterationNumber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_102setIterationNumber},
  {"getIterationNumber", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_105getIterationNumber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_104getIterationNumber},
  {"setResidualNorm", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_107setResidualNorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_106setResidualNorm},
  {"getResidualNorm", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_109getResidualNorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_108getResidualNorm},
  {"setConvergedReason", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_111setConvergedReason, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_110setConvergedReason},
  {"getConvergedReason", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_113getConvergedReason, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_112getConvergedReason},
  {"getRhs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_115getRhs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_114getRhs},
  {"getSolution", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_117getSolution, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_116getSolution},
  {"getWorkVecs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_119getWorkVecs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_118getWorkVecs},
  {"buildSolution", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_121buildSolution, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_120buildSolution},
  {"buildResidual", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_123buildResidual, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_122buildResidual},
  {"computeEigenvalues", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_125computeEigenvalues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_124computeEigenvalues},
  {"computeExtremeSingularValues", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_127computeExtremeSingularValues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_126computeExtremeSingularValues},
  {"setGMRESRestart", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_129setGMRESRestart, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_128setGMRESRestart},
  {"createPython", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_131createPython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_130createPython},
  {"setPythonContext", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_133setPythonContext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_132setPythonContext},
  {"getPythonContext", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_135getPythonContext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_134getPythonContext},
  {"setPythonType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3KSP_137setPythonType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3KSP_136setPythonType},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_KSP[] = {
  {(char *)"appctx", __pyx_getprop_8petsc4py_5PETSc_3KSP_appctx, __pyx_setprop_8petsc4py_5PETSc_3KSP_appctx, (char *)0, 0},
  {(char *)"dm", __pyx_getprop_8petsc4py_5PETSc_3KSP_dm, __pyx_setprop_8petsc4py_5PETSc_3KSP_dm, (char *)0, 0},
  {(char *)"vec_sol", __pyx_getprop_8petsc4py_5PETSc_3KSP_vec_sol, 0, (char *)0, 0},
  {(char *)"vec_rhs", __pyx_getprop_8petsc4py_5PETSc_3KSP_vec_rhs, 0, (char *)0, 0},
  {(char *)"mat_op", __pyx_getprop_8petsc4py_5PETSc_3KSP_mat_op, 0, (char *)0, 0},
  {(char *)"mat_pc", __pyx_getprop_8petsc4py_5PETSc_3KSP_mat_pc, 0, (char *)0, 0},
  {(char *)"guess_nonzero", __pyx_getprop_8petsc4py_5PETSc_3KSP_guess_nonzero, __pyx_setprop_8petsc4py_5PETSc_3KSP_guess_nonzero, (char *)0, 0},
  {(char *)"guess_knoll", __pyx_getprop_8petsc4py_5PETSc_3KSP_guess_knoll, __pyx_setprop_8petsc4py_5PETSc_3KSP_guess_knoll, (char *)0, 0},
  {(char *)"pc", __pyx_getprop_8petsc4py_5PETSc_3KSP_pc, 0, (char *)0, 0},
  {(char *)"pc_side", __pyx_getprop_8petsc4py_5PETSc_3KSP_pc_side, __pyx_setprop_8petsc4py_5PETSc_3KSP_pc_side, (char *)0, 0},
  {(char *)"norm_type", __pyx_getprop_8petsc4py_5PETSc_3KSP_norm_type, __pyx_setprop_8petsc4py_5PETSc_3KSP_norm_type, (char *)0, 0},
  {(char *)"rtol", __pyx_getprop_8petsc4py_5PETSc_3KSP_rtol, __pyx_setprop_8petsc4py_5PETSc_3KSP_rtol, (char *)0, 0},
  {(char *)"atol", __pyx_getprop_8petsc4py_5PETSc_3KSP_atol, __pyx_setprop_8petsc4py_5PETSc_3KSP_atol, (char *)0, 0},
  {(char *)"divtol", __pyx_getprop_8petsc4py_5PETSc_3KSP_divtol, __pyx_setprop_8petsc4py_5PETSc_3KSP_divtol, (char *)0, 0},
  {(char *)"max_it", __pyx_getprop_8petsc4py_5PETSc_3KSP_max_it, __pyx_setprop_8petsc4py_5PETSc_3KSP_max_it, (char *)0, 0},
  {(char *)"its", __pyx_getprop_8petsc4py_5PETSc_3KSP_its, __pyx_setprop_8petsc4py_5PETSc_3KSP_its, (char *)0, 0},
  {(char *)"norm", __pyx_getprop_8petsc4py_5PETSc_3KSP_norm, __pyx_setprop_8petsc4py_5PETSc_3KSP_norm, (char *)0, 0},
  {(char *)"history", __pyx_getprop_8petsc4py_5PETSc_3KSP_history, 0, (char *)0, 0},
  {(char *)"reason", __pyx_getprop_8petsc4py_5PETSc_3KSP_reason, __pyx_setprop_8petsc4py_5PETSc_3KSP_reason, (char *)0, 0},
  {(char *)"iterating", __pyx_getprop_8petsc4py_5PETSc_3KSP_iterating, 0, (char *)0, 0},
  {(char *)"converged", __pyx_getprop_8petsc4py_5PETSc_3KSP_converged, 0, (char *)0, 0},
  {(char *)"diverged", __pyx_getprop_8petsc4py_5PETSc_3KSP_diverged, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscKSP_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.KSP", /*tp_name*/
  sizeof(struct PyPetscKSPObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_8petsc4py_5PETSc_3KSP_3__call__, /*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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_KSP, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_KSP, /*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_8petsc4py_5PETSc_KSP, /*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_8petsc4py_5PETSc_SNES __pyx_vtable_8petsc4py_5PETSc_SNES;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_SNES(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscSNESObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscSNESObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_SNES;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_4SNES_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_appctx(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_6appctx_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_appctx(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_6appctx_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_dm(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_2dm_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_dm(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_2dm_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_npc(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_3npc_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_npc(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_3npc_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_vec_sol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_7vec_sol_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_vec_upd(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_7vec_upd_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_vec_rhs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_7vec_rhs_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_ksp(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_3ksp_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_ksp(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_3ksp_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_use_ew(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_6use_ew_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_use_ew(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_6use_ew_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_rtol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_4rtol_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_rtol(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_4rtol_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_atol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_4atol_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_atol(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_4atol_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_stol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_4stol_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_stol(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_4stol_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_max_it(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_6max_it_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_max_it(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_6max_it_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_max_funcs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_9max_funcs_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_max_funcs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_9max_funcs_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_its(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_3its_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_its(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_3its_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_history(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_7history_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_reason(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_6reason_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_reason(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_6reason_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_iterating(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_9iterating_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_converged(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_9converged_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_diverged(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_8diverged_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_use_mf(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_6use_mf_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_use_mf(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_6use_mf_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4SNES_use_fd(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4SNES_6use_fd_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_4SNES_use_fd(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_4SNES_6use_fd_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_SNES[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_3view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_2view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_5destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_4destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_7create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_6create},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_9setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_8setType},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_11getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_10getType},
  {"setOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_13setOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_12setOptionsPrefix},
  {"getOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_15getOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_14getOptionsPrefix},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_17setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_16setFromOptions},
  {"setAppCtx", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_19setAppCtx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_18setAppCtx},
  {"getAppCtx", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_21getAppCtx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_20getAppCtx},
  {"getDM", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_23getDM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_22getDM},
  {"setDM", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_25setDM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_24setDM},
  {"setFASInterpolation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_27setFASInterpolation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_26setFASInterpolation},
  {"getFASInterpolation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_29getFASInterpolation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_28getFASInterpolation},
  {"setFASRestriction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_31setFASRestriction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_30setFASRestriction},
  {"getFASRestriction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_33getFASRestriction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_32getFASRestriction},
  {"setFASInjection", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_35setFASInjection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_34setFASInjection},
  {"getFASInjection", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_37getFASInjection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_36getFASInjection},
  {"setFASRScale", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_39setFASRScale, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_38setFASRScale},
  {"setFASLevels", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_41setFASLevels, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_40setFASLevels},
  {"getFASLevels", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_43getFASLevels, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_42getFASLevels},
  {"getFASCycleSNES", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_45getFASCycleSNES, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_44getFASCycleSNES},
  {"getFASCoarseSolve", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_47getFASCoarseSolve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_46getFASCoarseSolve},
  {"getFASSmoother", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_49getFASSmoother, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_48getFASSmoother},
  {"getFASSmootherDown", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_51getFASSmootherDown, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_50getFASSmootherDown},
  {"getFASSmootherUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_53getFASSmootherUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_52getFASSmootherUp},
  {"getNPC", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_55getNPC, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_54getNPC},
  {"hasNPC", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_57hasNPC, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_56hasNPC},
  {"setNPC", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_59setNPC, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_58setNPC},
  {"setInitialGuess", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_61setInitialGuess, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_60setInitialGuess},
  {"getInitialGuess", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_63getInitialGuess, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_62getInitialGuess},
  {"setFunction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_65setFunction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_64setFunction},
  {"getFunction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_67getFunction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_66getFunction},
  {"setUpdate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_69setUpdate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_68setUpdate},
  {"getUpdate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_71getUpdate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_70getUpdate},
  {"setJacobian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_73setJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_72setJacobian},
  {"getJacobian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_75getJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_74getJacobian},
  {"setObjective", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_77setObjective, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_76setObjective},
  {"getObjective", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_79getObjective, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_78getObjective},
  {"computeFunction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_81computeFunction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_80computeFunction},
  {"computeJacobian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_83computeJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_82computeJacobian},
  {"computeObjective", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_85computeObjective, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_84computeObjective},
  {"setTolerances", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_87setTolerances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_86setTolerances},
  {"getTolerances", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_89getTolerances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_88getTolerances},
  {"setNormSchedule", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_91setNormSchedule, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_90setNormSchedule},
  {"getNormSchedule", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_93getNormSchedule, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_92getNormSchedule},
  {"setConvergenceTest", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_95setConvergenceTest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_94setConvergenceTest},
  {"getConvergenceTest", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_97getConvergenceTest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_96getConvergenceTest},
  {"callConvergenceTest", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_99callConvergenceTest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_98callConvergenceTest},
  {"setConvergenceHistory", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_101setConvergenceHistory, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_100setConvergenceHistory},
  {"getConvergenceHistory", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_103getConvergenceHistory, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_102getConvergenceHistory},
  {"logConvergenceHistory", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_105logConvergenceHistory, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_104logConvergenceHistory},
  {"setResetCounters", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_107setResetCounters, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_106setResetCounters},
  {"setMonitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_109setMonitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_108setMonitor},
  {"getMonitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_111getMonitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_110getMonitor},
  {"cancelMonitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_113cancelMonitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_112cancelMonitor},
  {"monitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_115monitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_114monitor},
  {"setMaxFunctionEvaluations", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_117setMaxFunctionEvaluations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_116setMaxFunctionEvaluations},
  {"getMaxFunctionEvaluations", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_119getMaxFunctionEvaluations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_118getMaxFunctionEvaluations},
  {"getFunctionEvaluations", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_121getFunctionEvaluations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_120getFunctionEvaluations},
  {"setMaxStepFailures", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_123setMaxStepFailures, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_122setMaxStepFailures},
  {"getMaxStepFailures", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_125getMaxStepFailures, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_124getMaxStepFailures},
  {"getStepFailures", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_127getStepFailures, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_126getStepFailures},
  {"setMaxKSPFailures", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_129setMaxKSPFailures, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_128setMaxKSPFailures},
  {"getMaxKSPFailures", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_131getMaxKSPFailures, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_130getMaxKSPFailures},
  {"getKSPFailures", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_133getKSPFailures, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_132getKSPFailures},
  {"setUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_135setUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_134setUp},
  {"reset", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_137reset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_136reset},
  {"solve", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_139solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_138solve},
  {"setConvergedReason", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_141setConvergedReason, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_140setConvergedReason},
  {"getConvergedReason", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_143getConvergedReason, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_142getConvergedReason},
  {"setIterationNumber", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_145setIterationNumber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_144setIterationNumber},
  {"getIterationNumber", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_147getIterationNumber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_146getIterationNumber},
  {"getLinearSolveIterations", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_149getLinearSolveIterations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_148getLinearSolveIterations},
  {"getRhs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_151getRhs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_150getRhs},
  {"getSolution", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_153getSolution, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_152getSolution},
  {"setSolution", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_155setSolution, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_154setSolution},
  {"getSolutionUpdate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_157getSolutionUpdate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_156getSolutionUpdate},
  {"setKSP", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_159setKSP, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_158setKSP},
  {"getKSP", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_161getKSP, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_160getKSP},
  {"setUseEW", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_163setUseEW, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_162setUseEW},
  {"getUseEW", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_165getUseEW, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_164getUseEW},
  {"setParamsEW", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_167setParamsEW, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_166setParamsEW},
  {"getParamsEW", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_169getParamsEW, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_168getParamsEW},
  {"setUseMF", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_171setUseMF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_170setUseMF},
  {"getUseMF", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_173getUseMF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_172getUseMF},
  {"setUseFD", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_175setUseFD, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_174setUseFD},
  {"getUseFD", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_177getUseFD, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_176getUseFD},
  {"setVariableBounds", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_179setVariableBounds, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_178setVariableBounds},
  {"getVIInactiveSet", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_181getVIInactiveSet, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_180getVIInactiveSet},
  {"createPython", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_183createPython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_182createPython},
  {"setPythonContext", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_185setPythonContext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_184setPythonContext},
  {"getPythonContext", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_187getPythonContext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_186getPythonContext},
  {"setPythonType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_189setPythonType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_188setPythonType},
  {"getCompositeSNES", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_191getCompositeSNES, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_190getCompositeSNES},
  {"getCompositeNumber", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4SNES_193getCompositeNumber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4SNES_192getCompositeNumber},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_SNES[] = {
  {(char *)"appctx", __pyx_getprop_8petsc4py_5PETSc_4SNES_appctx, __pyx_setprop_8petsc4py_5PETSc_4SNES_appctx, (char *)0, 0},
  {(char *)"dm", __pyx_getprop_8petsc4py_5PETSc_4SNES_dm, __pyx_setprop_8petsc4py_5PETSc_4SNES_dm, (char *)0, 0},
  {(char *)"npc", __pyx_getprop_8petsc4py_5PETSc_4SNES_npc, __pyx_setprop_8petsc4py_5PETSc_4SNES_npc, (char *)0, 0},
  {(char *)"vec_sol", __pyx_getprop_8petsc4py_5PETSc_4SNES_vec_sol, 0, (char *)0, 0},
  {(char *)"vec_upd", __pyx_getprop_8petsc4py_5PETSc_4SNES_vec_upd, 0, (char *)0, 0},
  {(char *)"vec_rhs", __pyx_getprop_8petsc4py_5PETSc_4SNES_vec_rhs, 0, (char *)0, 0},
  {(char *)"ksp", __pyx_getprop_8petsc4py_5PETSc_4SNES_ksp, __pyx_setprop_8petsc4py_5PETSc_4SNES_ksp, (char *)0, 0},
  {(char *)"use_ew", __pyx_getprop_8petsc4py_5PETSc_4SNES_use_ew, __pyx_setprop_8petsc4py_5PETSc_4SNES_use_ew, (char *)0, 0},
  {(char *)"rtol", __pyx_getprop_8petsc4py_5PETSc_4SNES_rtol, __pyx_setprop_8petsc4py_5PETSc_4SNES_rtol, (char *)0, 0},
  {(char *)"atol", __pyx_getprop_8petsc4py_5PETSc_4SNES_atol, __pyx_setprop_8petsc4py_5PETSc_4SNES_atol, (char *)0, 0},
  {(char *)"stol", __pyx_getprop_8petsc4py_5PETSc_4SNES_stol, __pyx_setprop_8petsc4py_5PETSc_4SNES_stol, (char *)0, 0},
  {(char *)"max_it", __pyx_getprop_8petsc4py_5PETSc_4SNES_max_it, __pyx_setprop_8petsc4py_5PETSc_4SNES_max_it, (char *)0, 0},
  {(char *)"max_funcs", __pyx_getprop_8petsc4py_5PETSc_4SNES_max_funcs, __pyx_setprop_8petsc4py_5PETSc_4SNES_max_funcs, (char *)0, 0},
  {(char *)"its", __pyx_getprop_8petsc4py_5PETSc_4SNES_its, __pyx_setprop_8petsc4py_5PETSc_4SNES_its, (char *)0, 0},
  {(char *)"history", __pyx_getprop_8petsc4py_5PETSc_4SNES_history, 0, (char *)0, 0},
  {(char *)"reason", __pyx_getprop_8petsc4py_5PETSc_4SNES_reason, __pyx_setprop_8petsc4py_5PETSc_4SNES_reason, (char *)0, 0},
  {(char *)"iterating", __pyx_getprop_8petsc4py_5PETSc_4SNES_iterating, 0, (char *)0, 0},
  {(char *)"converged", __pyx_getprop_8petsc4py_5PETSc_4SNES_converged, 0, (char *)0, 0},
  {(char *)"diverged", __pyx_getprop_8petsc4py_5PETSc_4SNES_diverged, 0, (char *)0, 0},
  {(char *)"use_mf", __pyx_getprop_8petsc4py_5PETSc_4SNES_use_mf, __pyx_setprop_8petsc4py_5PETSc_4SNES_use_mf, (char *)0, 0},
  {(char *)"use_fd", __pyx_getprop_8petsc4py_5PETSc_4SNES_use_fd, __pyx_setprop_8petsc4py_5PETSc_4SNES_use_fd, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscSNES_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.SNES", /*tp_name*/
  sizeof(struct PyPetscSNESObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_SNES, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_SNES, /*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_8petsc4py_5PETSc_SNES, /*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_8petsc4py_5PETSc_TS __pyx_vtable_8petsc4py_5PETSc_TS;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_TS(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscTSObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscTSObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_TS;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_2TS_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_appctx(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_6appctx_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_2TS_appctx(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_2TS_6appctx_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_dm(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_2dm_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_2TS_dm(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_2TS_2dm_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_problem_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_12problem_type_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_2TS_problem_type(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_2TS_12problem_type_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_equation_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_13equation_type_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_2TS_equation_type(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_2TS_13equation_type_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_snes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_4snes_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_ksp(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_3ksp_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_vec_sol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_7vec_sol_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_time(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_4time_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_2TS_time(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_2TS_4time_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_time_step(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_9time_step_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_2TS_time_step(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_2TS_9time_step_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_step_number(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_11step_number_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_2TS_step_number(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_2TS_11step_number_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_max_time(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_8max_time_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_2TS_max_time(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_2TS_8max_time_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_max_steps(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_9max_steps_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_2TS_max_steps(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_2TS_9max_steps_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_rtol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_4rtol_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_2TS_rtol(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_2TS_4rtol_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_atol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_4atol_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_2TS_atol(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_2TS_4atol_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_reason(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_6reason_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_2TS_reason(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_2TS_6reason_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_iterating(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_9iterating_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_converged(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_9converged_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_2TS_diverged(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_2TS_8diverged_1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_TS[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_3view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_2view},
  {"load", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_5load, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_4load},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_7destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_6destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_9create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_8create},
  {"clone", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_11clone, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_10clone},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_13setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_12setType},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_15getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_14getType},
  {"setProblemType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_17setProblemType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_16setProblemType},
  {"getProblemType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_19getProblemType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_18getProblemType},
  {"setEquationType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_21setEquationType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_20setEquationType},
  {"getEquationType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_23getEquationType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_22getEquationType},
  {"setOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_25setOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_24setOptionsPrefix},
  {"getOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_27getOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_26getOptionsPrefix},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_29setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_28setFromOptions},
  {"setAppCtx", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_31setAppCtx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_30setAppCtx},
  {"getAppCtx", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_33getAppCtx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_32getAppCtx},
  {"setRHSFunction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_35setRHSFunction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_34setRHSFunction},
  {"setRHSJacobian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_37setRHSJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_36setRHSJacobian},
  {"computeRHSFunction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_39computeRHSFunction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_38computeRHSFunction},
  {"computeRHSFunctionLinear", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_41computeRHSFunctionLinear, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_40computeRHSFunctionLinear},
  {"computeRHSJacobian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_43computeRHSJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_42computeRHSJacobian},
  {"computeRHSJacobianConstant", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_45computeRHSJacobianConstant, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_44computeRHSJacobianConstant},
  {"getRHSFunction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_47getRHSFunction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_46getRHSFunction},
  {"getRHSJacobian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_49getRHSJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_48getRHSJacobian},
  {"setIFunction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_51setIFunction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_50setIFunction},
  {"setIJacobian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_53setIJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_52setIJacobian},
  {"computeIFunction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_55computeIFunction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_54computeIFunction},
  {"computeIJacobian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_57computeIJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_56computeIJacobian},
  {"getIFunction", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_59getIFunction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_58getIFunction},
  {"getIJacobian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_61getIJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_60getIJacobian},
  {"setSolution", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_63setSolution, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_62setSolution},
  {"getSolution", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_65getSolution, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_64getSolution},
  {"getSNES", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_67getSNES, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_66getSNES},
  {"getKSP", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_69getKSP, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_68getKSP},
  {"getDM", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_71getDM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_70getDM},
  {"setDM", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_73setDM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_72setDM},
  {"setTime", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_75setTime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_74setTime},
  {"getTime", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_77getTime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_76getTime},
  {"getPrevTime", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_79getPrevTime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_78getPrevTime},
  {"getSolveTime", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_81getSolveTime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_80getSolveTime},
  {"setInitialTimeStep", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_83setInitialTimeStep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_82setInitialTimeStep},
  {"setTimeStep", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_85setTimeStep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_84setTimeStep},
  {"getTimeStep", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_87getTimeStep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_86getTimeStep},
  {"setStepNumber", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_89setStepNumber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_88setStepNumber},
  {"getStepNumber", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_91getStepNumber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_90getStepNumber},
  {"setMaxTime", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_93setMaxTime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_92setMaxTime},
  {"getMaxTime", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_95getMaxTime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_94getMaxTime},
  {"setMaxSteps", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_97setMaxSteps, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_96setMaxSteps},
  {"getMaxSteps", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_99getMaxSteps, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_98getMaxSteps},
  {"setDuration", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_101setDuration, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_100setDuration},
  {"getDuration", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_103getDuration, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_102getDuration},
  {"getTotalSteps", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_105getTotalSteps, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_104getTotalSteps},
  {"getSNESIterations", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_107getSNESIterations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_106getSNESIterations},
  {"getKSPIterations", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_109getKSPIterations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_108getKSPIterations},
  {"setMaxStepRejections", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_111setMaxStepRejections, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_110setMaxStepRejections},
  {"getStepRejections", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_113getStepRejections, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_112getStepRejections},
  {"setMaxSNESFailures", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_115setMaxSNESFailures, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_114setMaxSNESFailures},
  {"getSNESFailures", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_117getSNESFailures, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_116getSNESFailures},
  {"setErrorIfStepFails", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_119setErrorIfStepFails, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_118setErrorIfStepFails},
  {"setTolerances", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_121setTolerances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_120setTolerances},
  {"getTolerances", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_123getTolerances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_122getTolerances},
  {"setExactFinalTime", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_125setExactFinalTime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_124setExactFinalTime},
  {"setConvergedReason", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_127setConvergedReason, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_126setConvergedReason},
  {"getConvergedReason", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_129getConvergedReason, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_128getConvergedReason},
  {"setMonitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_131setMonitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_130setMonitor},
  {"getMonitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_133getMonitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_132getMonitor},
  {"cancelMonitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_135cancelMonitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_134cancelMonitor},
  {"monitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_137monitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_136monitor},
  {"setPreStep", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_139setPreStep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_138setPreStep},
  {"getPreStep", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_141getPreStep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_140getPreStep},
  {"setPostStep", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_143setPostStep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_142setPostStep},
  {"getPostStep", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_145getPostStep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_144getPostStep},
  {"setUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_147setUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_146setUp},
  {"reset", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_149reset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_148reset},
  {"step", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_151step, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_150step},
  {"rollBack", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_153rollBack, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_152rollBack},
  {"solve", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_155solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_154solve},
  {"interpolate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_157interpolate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_156interpolate},
  {"createPython", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_159createPython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_158createPython},
  {"setPythonContext", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_161setPythonContext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_160setPythonContext},
  {"getPythonContext", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_163getPythonContext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_162getPythonContext},
  {"setPythonType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_165setPythonType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_164setPythonType},
  {"setTheta", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_167setTheta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_166setTheta},
  {"getTheta", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_169getTheta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_168getTheta},
  {"setThetaEndpoint", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_171setThetaEndpoint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_170setThetaEndpoint},
  {"getThetaEndpoint", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_173getThetaEndpoint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_172getThetaEndpoint},
  {"setAlphaRadius", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_175setAlphaRadius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_174setAlphaRadius},
  {"setAlphaParams", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_177setAlphaParams, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_176setAlphaParams},
  {"getAlphaParams", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2TS_179getAlphaParams, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2TS_178getAlphaParams},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_TS[] = {
  {(char *)"appctx", __pyx_getprop_8petsc4py_5PETSc_2TS_appctx, __pyx_setprop_8petsc4py_5PETSc_2TS_appctx, (char *)0, 0},
  {(char *)"dm", __pyx_getprop_8petsc4py_5PETSc_2TS_dm, __pyx_setprop_8petsc4py_5PETSc_2TS_dm, (char *)0, 0},
  {(char *)"problem_type", __pyx_getprop_8petsc4py_5PETSc_2TS_problem_type, __pyx_setprop_8petsc4py_5PETSc_2TS_problem_type, (char *)0, 0},
  {(char *)"equation_type", __pyx_getprop_8petsc4py_5PETSc_2TS_equation_type, __pyx_setprop_8petsc4py_5PETSc_2TS_equation_type, (char *)0, 0},
  {(char *)"snes", __pyx_getprop_8petsc4py_5PETSc_2TS_snes, 0, (char *)0, 0},
  {(char *)"ksp", __pyx_getprop_8petsc4py_5PETSc_2TS_ksp, 0, (char *)0, 0},
  {(char *)"vec_sol", __pyx_getprop_8petsc4py_5PETSc_2TS_vec_sol, 0, (char *)0, 0},
  {(char *)"time", __pyx_getprop_8petsc4py_5PETSc_2TS_time, __pyx_setprop_8petsc4py_5PETSc_2TS_time, (char *)0, 0},
  {(char *)"time_step", __pyx_getprop_8petsc4py_5PETSc_2TS_time_step, __pyx_setprop_8petsc4py_5PETSc_2TS_time_step, (char *)0, 0},
  {(char *)"step_number", __pyx_getprop_8petsc4py_5PETSc_2TS_step_number, __pyx_setprop_8petsc4py_5PETSc_2TS_step_number, (char *)0, 0},
  {(char *)"max_time", __pyx_getprop_8petsc4py_5PETSc_2TS_max_time, __pyx_setprop_8petsc4py_5PETSc_2TS_max_time, (char *)0, 0},
  {(char *)"max_steps", __pyx_getprop_8petsc4py_5PETSc_2TS_max_steps, __pyx_setprop_8petsc4py_5PETSc_2TS_max_steps, (char *)0, 0},
  {(char *)"rtol", __pyx_getprop_8petsc4py_5PETSc_2TS_rtol, __pyx_setprop_8petsc4py_5PETSc_2TS_rtol, (char *)0, 0},
  {(char *)"atol", __pyx_getprop_8petsc4py_5PETSc_2TS_atol, __pyx_setprop_8petsc4py_5PETSc_2TS_atol, (char *)0, 0},
  {(char *)"reason", __pyx_getprop_8petsc4py_5PETSc_2TS_reason, __pyx_setprop_8petsc4py_5PETSc_2TS_reason, (char *)0, 0},
  {(char *)"iterating", __pyx_getprop_8petsc4py_5PETSc_2TS_iterating, 0, (char *)0, 0},
  {(char *)"converged", __pyx_getprop_8petsc4py_5PETSc_2TS_converged, 0, (char *)0, 0},
  {(char *)"diverged", __pyx_getprop_8petsc4py_5PETSc_2TS_diverged, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscTS_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.TS", /*tp_name*/
  sizeof(struct PyPetscTSObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_TS, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_TS, /*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_8petsc4py_5PETSc_TS, /*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_8petsc4py_5PETSc_TAO __pyx_vtable_8petsc4py_5PETSc_TAO;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_TAO(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscTAOObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscTAOObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_TAO;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_3TAO_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_appctx(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_6appctx_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3TAO_appctx(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3TAO_6appctx_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_ksp(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_3ksp_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_ftol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_4ftol_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3TAO_ftol(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3TAO_4ftol_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_gtol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_4gtol_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3TAO_gtol(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3TAO_4gtol_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_ctol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_4ctol_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_3TAO_ctol(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_3TAO_4ctol_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_its(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_3its_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_gnorm(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_5gnorm_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_cnorm(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_5cnorm_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_solution(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_8solution_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_objective(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_9objective_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_function(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_8function_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_gradient(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_8gradient_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_reason(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_6reason_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_iterating(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_9iterating_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_converged(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_9converged_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_3TAO_diverged(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_3TAO_8diverged_1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_TAO[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_3view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_2view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_5destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_4destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_7create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_6create},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_9setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_8setType},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_11getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_10getType},
  {"setOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_13setOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_12setOptionsPrefix},
  {"getOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_15getOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_14getOptionsPrefix},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_17setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_16setFromOptions},
  {"setUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_19setUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_18setUp},
  {"setInitialTrustRegionRadius", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_21setInitialTrustRegionRadius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_20setInitialTrustRegionRadius},
  {"setAppCtx", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_23setAppCtx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_22setAppCtx},
  {"getAppCtx", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_25getAppCtx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_24getAppCtx},
  {"setInitial", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_27setInitial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_26setInitial},
  {"setObjective", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_29setObjective, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_28setObjective},
  {"setSeparableObjective", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_31setSeparableObjective, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_30setSeparableObjective},
  {"setGradient", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_33setGradient, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_32setGradient},
  {"setObjectiveGradient", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_35setObjectiveGradient, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_34setObjectiveGradient},
  {"setVariableBounds", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_37setVariableBounds, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_36setVariableBounds},
  {"setConstraints", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_39setConstraints, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_38setConstraints},
  {"setHessian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_41setHessian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_40setHessian},
  {"setJacobian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_43setJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_42setJacobian},
  {"setStateDesignIS", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_45setStateDesignIS, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_44setStateDesignIS},
  {"setJacobianState", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_47setJacobianState, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_46setJacobianState},
  {"setJacobianDesign", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_49setJacobianDesign, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_48setJacobianDesign},
  {"computeObjective", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_51computeObjective, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_50computeObjective},
  {"computeSeparableObjective", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_53computeSeparableObjective, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_52computeSeparableObjective},
  {"computeGradient", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_55computeGradient, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_54computeGradient},
  {"computeObjectiveGradient", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_57computeObjectiveGradient, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_56computeObjectiveGradient},
  {"computeDualVariables", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_59computeDualVariables, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_58computeDualVariables},
  {"computeVariableBounds", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_61computeVariableBounds, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_60computeVariableBounds},
  {"computeConstraints", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_63computeConstraints, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_62computeConstraints},
  {"computeHessian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_65computeHessian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_64computeHessian},
  {"computeJacobian", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_67computeJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_66computeJacobian},
  {"setTolerances", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_69setTolerances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_68setTolerances},
  {"getTolerances", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_71getTolerances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_70getTolerances},
  {"setConstraintTolerances", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_73setConstraintTolerances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_72setConstraintTolerances},
  {"getConstraintTolerances", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_75getConstraintTolerances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_74getConstraintTolerances},
  {"setConvergenceTest", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_77setConvergenceTest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_76setConvergenceTest},
  {"getConvergenceTest", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_79getConvergenceTest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_78getConvergenceTest},
  {"setConvergedReason", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_81setConvergedReason, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_80setConvergedReason},
  {"getConvergedReason", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_83getConvergedReason, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_82getConvergedReason},
  {"setMonitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_85setMonitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_84setMonitor},
  {"getMonitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_87getMonitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_86getMonitor},
  {"cancelMonitor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_89cancelMonitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_88cancelMonitor},
  {"solve", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_91solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_90solve},
  {"getSolution", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_93getSolution, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_92getSolution},
  {"getGradient", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_95getGradient, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_94getGradient},
  {"setGradientNorm", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_97setGradientNorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_96setGradientNorm},
  {"getGradientNorm", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_99getGradientNorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_98getGradientNorm},
  {"setLMVMH0", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_101setLMVMH0, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_100setLMVMH0},
  {"getLMVMH0", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_103getLMVMH0, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_102getLMVMH0},
  {"getLMVMH0KSP", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_105getLMVMH0KSP, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_104getLMVMH0KSP},
  {"getVariableBounds", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_107getVariableBounds, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_106getVariableBounds},
  {"getIterationNumber", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_109getIterationNumber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_108getIterationNumber},
  {"getObjectiveValue", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_111getObjectiveValue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_110getObjectiveValue},
  {"getConvergedReason", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_113getConvergedReason, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_112getConvergedReason},
  {"getSolutionNorm", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_115getSolutionNorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_114getSolutionNorm},
  {"getSolutionStatus", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_117getSolutionStatus, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_116getSolutionStatus},
  {"getKSP", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3TAO_119getKSP, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3TAO_118getKSP},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_TAO[] = {
  {(char *)"appctx", __pyx_getprop_8petsc4py_5PETSc_3TAO_appctx, __pyx_setprop_8petsc4py_5PETSc_3TAO_appctx, (char *)0, 0},
  {(char *)"ksp", __pyx_getprop_8petsc4py_5PETSc_3TAO_ksp, 0, (char *)0, 0},
  {(char *)"ftol", __pyx_getprop_8petsc4py_5PETSc_3TAO_ftol, __pyx_setprop_8petsc4py_5PETSc_3TAO_ftol, (char *)0, 0},
  {(char *)"gtol", __pyx_getprop_8petsc4py_5PETSc_3TAO_gtol, __pyx_setprop_8petsc4py_5PETSc_3TAO_gtol, (char *)0, 0},
  {(char *)"ctol", __pyx_getprop_8petsc4py_5PETSc_3TAO_ctol, __pyx_setprop_8petsc4py_5PETSc_3TAO_ctol, (char *)0, 0},
  {(char *)"its", __pyx_getprop_8petsc4py_5PETSc_3TAO_its, 0, (char *)0, 0},
  {(char *)"gnorm", __pyx_getprop_8petsc4py_5PETSc_3TAO_gnorm, 0, (char *)0, 0},
  {(char *)"cnorm", __pyx_getprop_8petsc4py_5PETSc_3TAO_cnorm, 0, (char *)0, 0},
  {(char *)"solution", __pyx_getprop_8petsc4py_5PETSc_3TAO_solution, 0, (char *)0, 0},
  {(char *)"objective", __pyx_getprop_8petsc4py_5PETSc_3TAO_objective, 0, (char *)0, 0},
  {(char *)"function", __pyx_getprop_8petsc4py_5PETSc_3TAO_function, 0, (char *)0, 0},
  {(char *)"gradient", __pyx_getprop_8petsc4py_5PETSc_3TAO_gradient, 0, (char *)0, 0},
  {(char *)"reason", __pyx_getprop_8petsc4py_5PETSc_3TAO_reason, 0, (char *)0, 0},
  {(char *)"iterating", __pyx_getprop_8petsc4py_5PETSc_3TAO_iterating, 0, (char *)0, 0},
  {(char *)"converged", __pyx_getprop_8petsc4py_5PETSc_3TAO_converged, 0, (char *)0, 0},
  {(char *)"diverged", __pyx_getprop_8petsc4py_5PETSc_3TAO_diverged, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscTAO_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.TAO", /*tp_name*/
  sizeof(struct PyPetscTAOObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  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*/
  "\n    TAO Solver\n    ", /*tp_doc*/
  __pyx_tp_traverse_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_TAO, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_TAO, /*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_8petsc4py_5PETSc_TAO, /*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_8petsc4py_5PETSc_AO __pyx_vtable_8petsc4py_5PETSc_AO;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_AO(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscAOObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscAOObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_AO;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_2AO_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_AO[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2AO_3view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2AO_2view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2AO_5destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2AO_4destroy},
  {"createBasic", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2AO_7createBasic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2AO_6createBasic},
  {"createMemoryScalable", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2AO_9createMemoryScalable, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2AO_8createMemoryScalable},
  {"createMapping", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2AO_11createMapping, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2AO_10createMapping},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2AO_13getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2AO_12getType},
  {"app2petsc", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2AO_15app2petsc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2AO_14app2petsc},
  {"petsc2app", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2AO_17petsc2app, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2AO_16petsc2app},
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscAO_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.AO", /*tp_name*/
  sizeof(struct PyPetscAOObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_AO, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_AO, /*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_8petsc4py_5PETSc_DM __pyx_vtable_8petsc4py_5PETSc_DM;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_DM(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscDMObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscDMObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_DM;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_2DM_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_DM[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_3view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_2view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_5destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_4destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_7create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_6create},
  {"clone", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_9clone, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_8clone},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_11setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_10setType},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_13getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_12getType},
  {"getDimension", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_15getDimension, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_14getDimension},
  {"setDimension", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_17setDimension, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_16setDimension},
  {"setOptionsPrefix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_19setOptionsPrefix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_18setOptionsPrefix},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_21setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_20setFromOptions},
  {"setUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_23setUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_22setUp},
  {"setAppCtx", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_25setAppCtx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_24setAppCtx},
  {"getAppCtx", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_27getAppCtx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_26getAppCtx},
  {"getBlockSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_29getBlockSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_28getBlockSize},
  {"setVecType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_31setVecType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_30setVecType},
  {"createGlobalVec", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_33createGlobalVec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_32createGlobalVec},
  {"createLocalVec", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_35createLocalVec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_34createLocalVec},
  {"globalToLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_37globalToLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_36globalToLocal},
  {"localToGlobal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_39localToGlobal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_38localToGlobal},
  {"localToLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_41localToLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_40localToLocal},
  {"getLGMap", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_43getLGMap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_42getLGMap},
  {"getCoordinateDM", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_45getCoordinateDM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_44getCoordinateDM},
  {"getCoordinateSection", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_47getCoordinateSection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_46getCoordinateSection},
  {"setCoordinates", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_49setCoordinates, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_48setCoordinates},
  {"getCoordinates", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_51getCoordinates, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_50getCoordinates},
  {"setCoordinatesLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_53setCoordinatesLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_52setCoordinatesLocal},
  {"getCoordinatesLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_55getCoordinatesLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_54getCoordinatesLocal},
  {"setMatType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_57setMatType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_56setMatType},
  {"createMat", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_59createMat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_58createMat},
  {"createInterpolation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_61createInterpolation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_60createInterpolation},
  {"createInjection", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_63createInjection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_62createInjection},
  {"createAggregates", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_65createAggregates, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_64createAggregates},
  {"convert", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_67convert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_66convert},
  {"refine", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_69refine, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_68refine},
  {"coarsen", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_71coarsen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_70coarsen},
  {"refineHierarchy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_73refineHierarchy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_72refineHierarchy},
  {"coarsenHierarchy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_75coarsenHierarchy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_74coarsenHierarchy},
  {"setDefaultSection", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_77setDefaultSection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_76setDefaultSection},
  {"getDefaultSection", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_79getDefaultSection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_78getDefaultSection},
  {"setDefaultGlobalSection", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_81setDefaultGlobalSection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_80setDefaultGlobalSection},
  {"getDefaultGlobalSection", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_83getDefaultGlobalSection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_82getDefaultGlobalSection},
  {"createDefaultSF", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_85createDefaultSF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_84createDefaultSF},
  {"getDefaultSF", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_87getDefaultSF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_86getDefaultSF},
  {"getPointSF", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_89getPointSF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_88getPointSF},
  {"setPointSF", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_91setPointSF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_90setPointSF},
  {"getNumLabels", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_93getNumLabels, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_92getNumLabels},
  {"getLabelName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_95getLabelName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_94getLabelName},
  {"hasLabel", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_97hasLabel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_96hasLabel},
  {"createLabel", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_99createLabel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_98createLabel},
  {"removeLabel", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_101removeLabel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_100removeLabel},
  {"getLabelValue", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_103getLabelValue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_102getLabelValue},
  {"setLabelValue", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_105setLabelValue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_104setLabelValue},
  {"clearLabelValue", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_107clearLabelValue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_106clearLabelValue},
  {"getLabelSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_109getLabelSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_108getLabelSize},
  {"getLabelIdIS", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_111getLabelIdIS, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_110getLabelIdIS},
  {"getStratumSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_113getStratumSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_112getStratumSize},
  {"getStratumIS", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_115getStratumIS, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_114getStratumIS},
  {"clearLabelStratum", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_117clearLabelStratum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_116clearLabelStratum},
  {"setLabelOutput", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_119setLabelOutput, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_118setLabelOutput},
  {"getLabelOutput", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_2DM_121getLabelOutput, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_2DM_120getLabelOutput},
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscDM_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.DM", /*tp_name*/
  sizeof(struct PyPetscDMObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_DM, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_DM, /*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_8petsc4py_5PETSc_Partitioner __pyx_vtable_8petsc4py_5PETSc_Partitioner;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_Partitioner(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct PyPetscPartitionerObject *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Object(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct PyPetscPartitionerObject *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_Partitioner;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_11Partitioner_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_Partitioner[] = {
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11Partitioner_3view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11Partitioner_2view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11Partitioner_5destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11Partitioner_4destroy},
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11Partitioner_7create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11Partitioner_6create},
  {"setType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11Partitioner_9setType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11Partitioner_8setType},
  {"getType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11Partitioner_11getType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11Partitioner_10getType},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11Partitioner_13setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11Partitioner_12setFromOptions},
  {"setUp", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11Partitioner_15setUp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11Partitioner_14setUp},
  {"setShellPartition", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11Partitioner_17setShellPartition, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11Partitioner_16setShellPartition},
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) PyPetscPartitioner_Type = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.Partitioner", /*tp_name*/
  sizeof(struct PyPetscPartitionerObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_Partitioner, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_Partitioner, /*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_8petsc4py_5PETSc__IS_buffer __pyx_vtable_8petsc4py_5PETSc__IS_buffer;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc__IS_buffer(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *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_obj_8petsc4py_5PETSc__IS_buffer *)o);
  p->__pyx_vtab = __pyx_vtabptr_8petsc4py_5PETSc__IS_buffer;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_10_IS_buffer_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc__IS_buffer(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(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_pw_8petsc4py_5PETSc_10_IS_buffer_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_10_IS_buffer___array_interface__(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_19__array_interface___1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc__IS_buffer[] = {
  {"__enter__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_10_IS_buffer_9__enter__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_10_IS_buffer_8__enter__},
  {"__exit__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_10_IS_buffer_11__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_10_IS_buffer_10__exit__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc__IS_buffer[] = {
  {(char *)"__array_interface__", __pyx_getprop_8petsc4py_5PETSc_10_IS_buffer___array_interface__, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyBufferProcs __pyx_tp_as_buffer__IS_buffer = {
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_15__getreadbuffer__, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_13__getsegcount__, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_5__getbuffer__, /*bf_getbuffer*/
  __pyx_pw_8petsc4py_5PETSc_10_IS_buffer_7__releasebuffer__, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc__IS_buffer = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc._IS_buffer", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc__IS_buffer, /*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*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__IS_buffer, /*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_8petsc4py_5PETSc__IS_buffer, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc__IS_buffer, /*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_8petsc4py_5PETSc__IS_buffer, /*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_8petsc4py_5PETSc__Vec_buffer __pyx_vtable_8petsc4py_5PETSc__Vec_buffer;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc__Vec_buffer(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *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_obj_8petsc4py_5PETSc__Vec_buffer *)o);
  p->__pyx_vtab = __pyx_vtabptr_8petsc4py_5PETSc__Vec_buffer;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc__Vec_buffer(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(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_pw_8petsc4py_5PETSc_11_Vec_buffer_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_11_Vec_buffer___array_interface__(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_19__array_interface___1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc__Vec_buffer[] = {
  {"__enter__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_9__enter__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11_Vec_buffer_8__enter__},
  {"__exit__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_11__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11_Vec_buffer_10__exit__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc__Vec_buffer[] = {
  {(char *)"__array_interface__", __pyx_getprop_8petsc4py_5PETSc_11_Vec_buffer___array_interface__, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyBufferProcs __pyx_tp_as_buffer__Vec_buffer = {
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_15__getreadbuffer__, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_17__getwritebuffer__, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_13__getsegcount__, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_5__getbuffer__, /*bf_getbuffer*/
  __pyx_pw_8petsc4py_5PETSc_11_Vec_buffer_7__releasebuffer__, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc__Vec_buffer = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc._Vec_buffer", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc__Vec_buffer, /*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*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__Vec_buffer, /*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_8petsc4py_5PETSc__Vec_buffer, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc__Vec_buffer, /*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_8petsc4py_5PETSc__Vec_buffer, /*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_8petsc4py_5PETSc__Vec_LocalForm(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *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_obj_8petsc4py_5PETSc__Vec_LocalForm *)o);
  p->gvec = ((struct PyPetscVecObject *)Py_None); Py_INCREF(Py_None);
  p->lvec = ((struct PyPetscVecObject *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc__Vec_LocalForm(PyObject *o) {
  struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *p = (struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->gvec);
  Py_CLEAR(p->lvec);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8petsc4py_5PETSc__Vec_LocalForm(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *p = (struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *)o;
  if (p->gvec) {
    e = (*v)(((PyObject*)p->gvec), a); if (e) return e;
  }
  if (p->lvec) {
    e = (*v)(((PyObject*)p->lvec), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8petsc4py_5PETSc__Vec_LocalForm(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *p = (struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm *)o;
  tmp = ((PyObject*)p->gvec);
  p->gvec = ((struct PyPetscVecObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->lvec);
  p->lvec = ((struct PyPetscVecObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc__Vec_LocalForm[] = {
  {"__enter__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_14_Vec_LocalForm_3__enter__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_14_Vec_LocalForm_2__enter__},
  {"__exit__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_14_Vec_LocalForm_5__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_14_Vec_LocalForm_4__exit__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc__Vec_LocalForm = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc._Vec_LocalForm", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc__Vec_LocalForm), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc__Vec_LocalForm, /*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*/
  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*/
  "_Vec_LocalForm(Vec gvec)\nContext manager for `Vec` local form", /*tp_doc*/
  __pyx_tp_traverse_8petsc4py_5PETSc__Vec_LocalForm, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc__Vec_LocalForm, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc__Vec_LocalForm, /*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_pw_8petsc4py_5PETSc_14_Vec_LocalForm_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc__Vec_LocalForm, /*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_8petsc4py_5PETSc__Mat_Stencil(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  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;
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc__Mat_Stencil(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_12_Mat_Stencil_i(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_1i_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static int __pyx_setprop_8petsc4py_5PETSc_12_Mat_Stencil_j(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_1j_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static int __pyx_setprop_8petsc4py_5PETSc_12_Mat_Stencil_k(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_1k_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static int __pyx_setprop_8petsc4py_5PETSc_12_Mat_Stencil_c(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_1c_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static int __pyx_setprop_8petsc4py_5PETSc_12_Mat_Stencil_index(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_5index_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static int __pyx_setprop_8petsc4py_5PETSc_12_Mat_Stencil_field(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_12_Mat_Stencil_5field_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc__Mat_Stencil[] = {
  {(char *)"i", 0, __pyx_setprop_8petsc4py_5PETSc_12_Mat_Stencil_i, (char *)0, 0},
  {(char *)"j", 0, __pyx_setprop_8petsc4py_5PETSc_12_Mat_Stencil_j, (char *)0, 0},
  {(char *)"k", 0, __pyx_setprop_8petsc4py_5PETSc_12_Mat_Stencil_k, (char *)0, 0},
  {(char *)"c", 0, __pyx_setprop_8petsc4py_5PETSc_12_Mat_Stencil_c, (char *)0, 0},
  {(char *)"index", 0, __pyx_setprop_8petsc4py_5PETSc_12_Mat_Stencil_index, (char *)0, 0},
  {(char *)"field", 0, __pyx_setprop_8petsc4py_5PETSc_12_Mat_Stencil_field, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc__Mat_Stencil = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc._Mat_Stencil", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc__Mat_Stencil), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc__Mat_Stencil, /*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*/
  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, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc__Mat_Stencil, /*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_8petsc4py_5PETSc__Mat_Stencil, /*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_8petsc4py_5PETSc__DMDA_Vec_array __pyx_vtable_8petsc4py_5PETSc__DMDA_Vec_array;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc__DMDA_Vec_array(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *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_obj_8petsc4py_5PETSc__DMDA_Vec_array *)o);
  p->__pyx_vtab = __pyx_vtabptr_8petsc4py_5PETSc__DMDA_Vec_array;
  p->vecbuf = ((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)Py_None); Py_INCREF(Py_None);
  p->starts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->sizes = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->shape = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->strides = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->array = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc__DMDA_Vec_array(PyObject *o) {
  struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *p = (struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->vecbuf);
  Py_CLEAR(p->starts);
  Py_CLEAR(p->sizes);
  Py_CLEAR(p->shape);
  Py_CLEAR(p->strides);
  Py_CLEAR(p->array);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8petsc4py_5PETSc__DMDA_Vec_array(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *p = (struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)o;
  if (p->vecbuf) {
    e = (*v)(((PyObject*)p->vecbuf), a); if (e) return e;
  }
  if (p->starts) {
    e = (*v)(p->starts, a); if (e) return e;
  }
  if (p->sizes) {
    e = (*v)(p->sizes, a); if (e) return e;
  }
  if (p->shape) {
    e = (*v)(p->shape, a); if (e) return e;
  }
  if (p->strides) {
    e = (*v)(p->strides, a); if (e) return e;
  }
  if (p->array) {
    e = (*v)(((PyObject*)p->array), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8petsc4py_5PETSc__DMDA_Vec_array(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *p = (struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *)o;
  tmp = ((PyObject*)p->vecbuf);
  p->vecbuf = ((struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->starts);
  p->starts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->sizes);
  p->sizes = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->shape);
  p->shape = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->strides);
  p->strides = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->array);
  p->array = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_8petsc4py_5PETSc__DMDA_Vec_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_8petsc4py_5PETSc__DMDA_Vec_array(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_5__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_8petsc4py_5PETSc_15_DMDA_Vec_array_starts(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_6starts_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_15_DMDA_Vec_array_sizes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_5sizes_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_15_DMDA_Vec_array_shape(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_5shape_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_15_DMDA_Vec_array_strides(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_7strides_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_15_DMDA_Vec_array_array(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_5array_1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc__DMDA_Vec_array[] = {
  {"__enter__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_7__enter__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_15_DMDA_Vec_array_6__enter__},
  {"__exit__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_9__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_15_DMDA_Vec_array_8__exit__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc__DMDA_Vec_array[] = {
  {(char *)"starts", __pyx_getprop_8petsc4py_5PETSc_15_DMDA_Vec_array_starts, 0, (char *)0, 0},
  {(char *)"sizes", __pyx_getprop_8petsc4py_5PETSc_15_DMDA_Vec_array_sizes, 0, (char *)0, 0},
  {(char *)"shape", __pyx_getprop_8petsc4py_5PETSc_15_DMDA_Vec_array_shape, 0, (char *)0, 0},
  {(char *)"strides", __pyx_getprop_8petsc4py_5PETSc_15_DMDA_Vec_array_strides, 0, (char *)0, 0},
  {(char *)"array", __pyx_getprop_8petsc4py_5PETSc_15_DMDA_Vec_array_array, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence__DMDA_Vec_array = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_8petsc4py_5PETSc__DMDA_Vec_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__DMDA_Vec_array = {
  0, /*mp_length*/
  __pyx_pw_8petsc4py_5PETSc_15_DMDA_Vec_array_3__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_8petsc4py_5PETSc__DMDA_Vec_array, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc__DMDA_Vec_array = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc._DMDA_Vec_array", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc__DMDA_Vec_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__DMDA_Vec_array, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__DMDA_Vec_array, /*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_8petsc4py_5PETSc__DMDA_Vec_array, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc__DMDA_Vec_array, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc__DMDA_Vec_array, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc__DMDA_Vec_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_8petsc4py_5PETSc__DMDA_Vec_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_8petsc4py_5PETSc__DMComposite_access(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *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_obj_8petsc4py_5PETSc__DMComposite_access *)o);
  p->locs_mem = Py_None; Py_INCREF(Py_None);
  p->vecs_mem = Py_None; Py_INCREF(Py_None);
  p->access = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_19_DMComposite_access_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc__DMComposite_access(PyObject *o) {
  struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *p = (struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(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_pw_8petsc4py_5PETSc_19_DMComposite_access_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->locs_mem);
  Py_CLEAR(p->vecs_mem);
  Py_CLEAR(p->access);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8petsc4py_5PETSc__DMComposite_access(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *p = (struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *)o;
  if (p->locs_mem) {
    e = (*v)(p->locs_mem, a); if (e) return e;
  }
  if (p->vecs_mem) {
    e = (*v)(p->vecs_mem, a); if (e) return e;
  }
  if (p->access) {
    e = (*v)(p->access, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8petsc4py_5PETSc__DMComposite_access(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *p = (struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access *)o;
  tmp = ((PyObject*)p->locs_mem);
  p->locs_mem = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->vecs_mem);
  p->vecs_mem = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->access);
  p->access = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc__DMComposite_access[] = {
  {"__enter__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_19_DMComposite_access_5__enter__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_19_DMComposite_access_4__enter__},
  {"__exit__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_19_DMComposite_access_7__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_19_DMComposite_access_6__exit__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc__DMComposite_access = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc._DMComposite_access", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc__DMComposite_access), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc__DMComposite_access, /*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*/
  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_8petsc4py_5PETSc__DMComposite_access, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc__DMComposite_access, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc__DMComposite_access, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc__DMComposite_access, /*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_8petsc4py_5PETSc_Options(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8petsc4py_5PETSc_Options *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_obj_8petsc4py_5PETSc_Options *)o);
  p->_prefix = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc_Options(PyObject *o) {
  struct __pyx_obj_8petsc4py_5PETSc_Options *p = (struct __pyx_obj_8petsc4py_5PETSc_Options *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(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_pw_8petsc4py_5PETSc_7Options_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_prefix);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8petsc4py_5PETSc_Options(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8petsc4py_5PETSc_Options *p = (struct __pyx_obj_8petsc4py_5PETSc_Options *)o;
  if (p->_prefix) {
    e = (*v)(p->_prefix, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8petsc4py_5PETSc_Options(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8petsc4py_5PETSc_Options *p = (struct __pyx_obj_8petsc4py_5PETSc_Options *)o;
  tmp = ((PyObject*)p->_prefix);
  p->_prefix = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_8petsc4py_5PETSc_Options(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_8petsc4py_5PETSc_Options(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_7Options_9__setitem__(o, i, v);
  }
  else {
    return __pyx_pw_8petsc4py_5PETSc_7Options_11__delitem__(o, i);
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_7Options_prefix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_7Options_6prefix_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_7Options_prefix(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_7Options_6prefix_3__set__(o, v);
  }
  else {
    return __pyx_pw_8petsc4py_5PETSc_7Options_6prefix_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_Options[] = {
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_13create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_12create},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_15destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_14destroy},
  {"clear", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_17clear, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_16clear},
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_19view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_18view},
  {"setFromOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_21setFromOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_20setFromOptions},
  {"prefixPush", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_23prefixPush, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_22prefixPush},
  {"prefixPop", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_25prefixPop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_24prefixPop},
  {"hasName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_27hasName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_26hasName},
  {"setValue", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_29setValue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_28setValue},
  {"delValue", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_31delValue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_30delValue},
  {"getBool", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_33getBool, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_32getBool},
  {"getInt", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_35getInt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_34getInt},
  {"getReal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_37getReal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_36getReal},
  {"getScalar", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_39getScalar, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_38getScalar},
  {"getString", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_41getString, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_40getString},
  {"getAll", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7Options_43getAll, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7Options_42getAll},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_Options[] = {
  {(char *)"prefix", __pyx_getprop_8petsc4py_5PETSc_7Options_prefix, __pyx_setprop_8petsc4py_5PETSc_7Options_prefix, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_Options = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_8petsc4py_5PETSc_Options, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_8petsc4py_5PETSc_7Options_5__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Options = {
  0, /*mp_length*/
  __pyx_pw_8petsc4py_5PETSc_7Options_7__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_8petsc4py_5PETSc_Options, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc_Options = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.Options", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc_Options), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Options, /*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_Options, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Options, /*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*/
  "Options(prefix=None)", /*tp_doc*/
  __pyx_tp_traverse_8petsc4py_5PETSc_Options, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Options, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_Options, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_Options, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_8petsc4py_5PETSc_7Options_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_Options, /*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_8petsc4py_5PETSc_Sys(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  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;
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc_Sys(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_Sys[] = {
  {"getVersion", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_1getVersion, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_getVersion},
  {"getVersionInfo", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_3getVersionInfo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_2getVersionInfo},
  {"isInitialized", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_5isInitialized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_4isInitialized},
  {"isFinalized", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_7isFinalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_6isFinalized},
  {"getDefaultComm", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_9getDefaultComm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_8getDefaultComm},
  {"setDefaultComm", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_11setDefaultComm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_10setDefaultComm},
  {"Print", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_13Print, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_12Print},
  {"syncPrint", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_15syncPrint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_14syncPrint},
  {"syncFlush", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_17syncFlush, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_16syncFlush},
  {"splitOwnership", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_19splitOwnership, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_18splitOwnership},
  {"sleep", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_21sleep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_20sleep},
  {"pushErrorHandler", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_23pushErrorHandler, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_22pushErrorHandler},
  {"popErrorHandler", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_25popErrorHandler, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_24popErrorHandler},
  {"infoAllow", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_27infoAllow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_26infoAllow},
  {"registerCitation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Sys_29registerCitation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Sys_28registerCitation},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc_Sys = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.Sys", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc_Sys), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Sys, /*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*/
  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, /*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_8petsc4py_5PETSc_Sys, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_Sys, /*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_8petsc4py_5PETSc_Log(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  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;
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc_Log(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_Log[] = {
  {"Stage", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Log_1Stage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Log_Stage},
  {"Class", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Log_3Class, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Log_2Class},
  {"Event", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Log_5Event, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Log_4Event},
  {"begin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Log_7begin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Log_6begin},
  {"view", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Log_9view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Log_8view},
  {"destroy", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Log_11destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Log_10destroy},
  {"logFlops", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Log_13logFlops, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Log_12logFlops},
  {"addFlops", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Log_15addFlops, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Log_14addFlops},
  {"getFlops", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Log_17getFlops, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Log_16getFlops},
  {"getTime", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Log_19getTime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Log_18getTime},
  {"getCPUTime", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_3Log_21getCPUTime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_3Log_20getCPUTime},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc_Log = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.Log", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc_Log), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Log, /*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*/
  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, /*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_8petsc4py_5PETSc_Log, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_Log, /*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_8petsc4py_5PETSc_LogStage(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  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;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_8LogStage_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc_LogStage(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_8LogStage_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_8LogStage_4name_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_8LogStage_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_8LogStage_4name_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_8LogStage_active(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_8LogStage_6active_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_8LogStage_active(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_8LogStage_6active_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_8LogStage_visible(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_8LogStage_7visible_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_8LogStage_visible(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_8LogStage_7visible_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_8LogStage_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_8LogStage_2id_1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_LogStage[] = {
  {"__enter__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogStage_5__enter__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogStage_4__enter__},
  {"__exit__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogStage_7__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogStage_6__exit__},
  {"push", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogStage_9push, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogStage_8push},
  {"pop", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogStage_11pop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogStage_10pop},
  {"getName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogStage_13getName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogStage_12getName},
  {"activate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogStage_15activate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogStage_14activate},
  {"deactivate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogStage_17deactivate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogStage_16deactivate},
  {"getActive", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogStage_19getActive, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogStage_18getActive},
  {"setActive", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogStage_21setActive, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogStage_20setActive},
  {"getVisible", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogStage_23getVisible, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogStage_22getVisible},
  {"setVisible", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogStage_25setVisible, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogStage_24setVisible},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_LogStage[] = {
  {(char *)"name", __pyx_getprop_8petsc4py_5PETSc_8LogStage_name, __pyx_setprop_8petsc4py_5PETSc_8LogStage_name, (char *)0, 0},
  {(char *)"active", __pyx_getprop_8petsc4py_5PETSc_8LogStage_active, __pyx_setprop_8petsc4py_5PETSc_8LogStage_active, (char *)0, 0},
  {(char *)"visible", __pyx_getprop_8petsc4py_5PETSc_8LogStage_visible, __pyx_setprop_8petsc4py_5PETSc_8LogStage_visible, (char *)0, 0},
  {(char *)"id", __pyx_getprop_8petsc4py_5PETSc_8LogStage_id, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_LogStage = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_coerce*/
  #endif
  __pyx_pw_8petsc4py_5PETSc_8LogStage_3__int__, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_8petsc4py_5PETSc_8LogStage_3__int__, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc_LogStage = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.LogStage", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc_LogStage), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_LogStage, /*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*/
  &__pyx_tp_as_number_LogStage, /*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, /*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_8petsc4py_5PETSc_LogStage, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_LogStage, /*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_8petsc4py_5PETSc_LogStage, /*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_8petsc4py_5PETSc_LogClass(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  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;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_8LogClass_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc_LogClass(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_8LogClass_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_8LogClass_4name_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_8LogClass_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_8LogClass_4name_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_8LogClass_active(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_8LogClass_6active_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_8LogClass_active(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_8LogClass_6active_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_8LogClass_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_8LogClass_2id_1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_LogClass[] = {
  {"getName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogClass_5getName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogClass_4getName},
  {"activate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogClass_7activate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogClass_6activate},
  {"deactivate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogClass_9deactivate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogClass_8deactivate},
  {"getActive", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogClass_11getActive, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogClass_10getActive},
  {"setActive", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogClass_13setActive, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogClass_12setActive},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_LogClass[] = {
  {(char *)"name", __pyx_getprop_8petsc4py_5PETSc_8LogClass_name, __pyx_setprop_8petsc4py_5PETSc_8LogClass_name, (char *)0, 0},
  {(char *)"active", __pyx_getprop_8petsc4py_5PETSc_8LogClass_active, __pyx_setprop_8petsc4py_5PETSc_8LogClass_active, (char *)0, 0},
  {(char *)"id", __pyx_getprop_8petsc4py_5PETSc_8LogClass_id, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_LogClass = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_coerce*/
  #endif
  __pyx_pw_8petsc4py_5PETSc_8LogClass_3__int__, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_8petsc4py_5PETSc_8LogClass_3__int__, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc_LogClass = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.LogClass", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc_LogClass), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_LogClass, /*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*/
  &__pyx_tp_as_number_LogClass, /*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, /*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_8petsc4py_5PETSc_LogClass, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_LogClass, /*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_8petsc4py_5PETSc_LogClass, /*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_8petsc4py_5PETSc_LogEvent(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  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;
  if (unlikely(__pyx_pw_8petsc4py_5PETSc_8LogEvent_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8petsc4py_5PETSc_LogEvent(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_8LogEvent_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_8LogEvent_4name_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_8LogEvent_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_8LogEvent_4name_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_8LogEvent_active(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_8LogEvent_6active_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_8LogEvent_active(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_8LogEvent_6active_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_8LogEvent_active_all(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_8LogEvent_10active_all_1__get__(o);
}

static int __pyx_setprop_8petsc4py_5PETSc_8LogEvent_active_all(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8petsc4py_5PETSc_8LogEvent_10active_all_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_8LogEvent_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_8LogEvent_2id_1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_LogEvent[] = {
  {"__enter__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_5__enter__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_4__enter__},
  {"__exit__", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_7__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_6__exit__},
  {"begin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_9begin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_8begin},
  {"end", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_11end, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_10end},
  {"barrierBegin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_13barrierBegin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_12barrierBegin},
  {"barrierEnd", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_15barrierEnd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_14barrierEnd},
  {"getName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_17getName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_16getName},
  {"activate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_19activate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_18activate},
  {"deactivate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_21deactivate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_20deactivate},
  {"getActive", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_23getActive, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_22getActive},
  {"setActive", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_25setActive, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_24setActive},
  {"getActiveAll", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_27getActiveAll, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_26getActiveAll},
  {"setActiveAll", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_29setActiveAll, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_28setActiveAll},
  {"getPerfInfo", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_8LogEvent_31getPerfInfo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_8LogEvent_30getPerfInfo},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_LogEvent[] = {
  {(char *)"name", __pyx_getprop_8petsc4py_5PETSc_8LogEvent_name, __pyx_setprop_8petsc4py_5PETSc_8LogEvent_name, (char *)0, 0},
  {(char *)"active", __pyx_getprop_8petsc4py_5PETSc_8LogEvent_active, __pyx_setprop_8petsc4py_5PETSc_8LogEvent_active, (char *)0, 0},
  {(char *)"active_all", __pyx_getprop_8petsc4py_5PETSc_8LogEvent_active_all, __pyx_setprop_8petsc4py_5PETSc_8LogEvent_active_all, (char *)0, 0},
  {(char *)"id", __pyx_getprop_8petsc4py_5PETSc_8LogEvent_id, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_LogEvent = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_coerce*/
  #endif
  __pyx_pw_8petsc4py_5PETSc_8LogEvent_3__int__, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_8petsc4py_5PETSc_8LogEvent_3__int__, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc_LogEvent = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.LogEvent", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc_LogEvent), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_LogEvent, /*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*/
  &__pyx_tp_as_number_LogEvent, /*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, /*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_8petsc4py_5PETSc_LogEvent, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_LogEvent, /*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_8petsc4py_5PETSc_LogEvent, /*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_8petsc4py_5PETSc_ViewerHDF5 __pyx_vtable_8petsc4py_5PETSc_ViewerHDF5;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_ViewerHDF5(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_Viewer(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5 *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_ViewerHDF5;
  return o;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_ViewerHDF5[] = {
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_1create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_create},
  {"getTimestep", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_3getTimestep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_2getTimestep},
  {"setTimestep", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_5setTimestep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_4setTimestep},
  {"incrementTimestep", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_7incrementTimestep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_6incrementTimestep},
  {"pushGroup", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_9pushGroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_8pushGroup},
  {"popGroup", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_11popGroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_10popGroup},
  {"getGroup", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_10ViewerHDF5_13getGroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_10ViewerHDF5_12getGroup},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc_ViewerHDF5 = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.ViewerHDF5", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8petsc4py_5PETSc_6Viewer_3__call__, /*tp_call*/
  #else
  0, /*tp_call*/
  #endif
  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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_ViewerHDF5, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_ViewerHDF5, /*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_8petsc4py_5PETSc_DMDA __pyx_vtable_8petsc4py_5PETSc_DMDA;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_DMDA(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8petsc4py_5PETSc_DMDA *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_DM(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8petsc4py_5PETSc_DMDA *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_DMDA;
  return o;
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4DMDA_dim(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4DMDA_3dim_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4DMDA_dof(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4DMDA_3dof_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4DMDA_sizes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4DMDA_5sizes_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4DMDA_proc_sizes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4DMDA_10proc_sizes_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4DMDA_boundary_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4DMDA_13boundary_type_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4DMDA_stencil(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4DMDA_7stencil_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4DMDA_stencil_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4DMDA_12stencil_type_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4DMDA_stencil_width(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4DMDA_13stencil_width_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4DMDA_ranges(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4DMDA_6ranges_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4DMDA_ghost_ranges(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4DMDA_12ghost_ranges_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4DMDA_corners(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4DMDA_7corners_1__get__(o);
}

static PyObject *__pyx_getprop_8petsc4py_5PETSc_4DMDA_ghost_corners(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8petsc4py_5PETSc_4DMDA_13ghost_corners_1__get__(o);
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_DMDA[] = {
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_1create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_create},
  {"duplicate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_3duplicate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_2duplicate},
  {"setDim", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_5setDim, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_4setDim},
  {"getDim", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_7getDim, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_6getDim},
  {"setDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_9setDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_8setDof},
  {"getDof", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_11getDof, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_10getDof},
  {"setSizes", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_13setSizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_12setSizes},
  {"getSizes", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_15getSizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_14getSizes},
  {"setProcSizes", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_17setProcSizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_16setProcSizes},
  {"getProcSizes", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_19getProcSizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_18getProcSizes},
  {"setBoundaryType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_21setBoundaryType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_20setBoundaryType},
  {"getBoundaryType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_23getBoundaryType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_22getBoundaryType},
  {"setStencilType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_25setStencilType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_24setStencilType},
  {"getStencilType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_27getStencilType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_26getStencilType},
  {"setStencilWidth", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_29setStencilWidth, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_28setStencilWidth},
  {"getStencilWidth", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_31getStencilWidth, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_30getStencilWidth},
  {"setStencil", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_33setStencil, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_32setStencil},
  {"getStencil", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_35getStencil, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_34getStencil},
  {"getRanges", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_37getRanges, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_36getRanges},
  {"getGhostRanges", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_39getGhostRanges, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_38getGhostRanges},
  {"getOwnershipRanges", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_41getOwnershipRanges, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_40getOwnershipRanges},
  {"getCorners", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_43getCorners, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_42getCorners},
  {"getGhostCorners", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_45getGhostCorners, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_44getGhostCorners},
  {"setFieldName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_47setFieldName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_46setFieldName},
  {"getFieldName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_49getFieldName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_48getFieldName},
  {"getVecArray", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_51getVecArray, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_50getVecArray},
  {"setUniformCoordinates", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_53setUniformCoordinates, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_52setUniformCoordinates},
  {"setCoordinateName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_55setCoordinateName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_54setCoordinateName},
  {"getCoordinateName", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_57getCoordinateName, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_56getCoordinateName},
  {"getBoundingBox", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_59getBoundingBox, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_58getBoundingBox},
  {"getLocalBoundingBox", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_61getLocalBoundingBox, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_60getLocalBoundingBox},
  {"createNaturalVec", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_63createNaturalVec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_62createNaturalVec},
  {"globalToNatural", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_65globalToNatural, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_64globalToNatural},
  {"naturalToGlobal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_67naturalToGlobal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_66naturalToGlobal},
  {"getAO", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_69getAO, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_68getAO},
  {"getScatter", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_71getScatter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_70getScatter},
  {"setRefinementFactor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_73setRefinementFactor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_72setRefinementFactor},
  {"getRefinementFactor", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_75getRefinementFactor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_74getRefinementFactor},
  {"setInterpolationType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_77setInterpolationType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_76setInterpolationType},
  {"getInterpolationType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_79getInterpolationType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_78getInterpolationType},
  {"setElementType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_81setElementType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_80setElementType},
  {"getElementType", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_83getElementType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_82getElementType},
  {"getElements", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_4DMDA_85getElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_4DMDA_84getElements},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8petsc4py_5PETSc_DMDA[] = {
  {(char *)"dim", __pyx_getprop_8petsc4py_5PETSc_4DMDA_dim, 0, (char *)0, 0},
  {(char *)"dof", __pyx_getprop_8petsc4py_5PETSc_4DMDA_dof, 0, (char *)0, 0},
  {(char *)"sizes", __pyx_getprop_8petsc4py_5PETSc_4DMDA_sizes, 0, (char *)0, 0},
  {(char *)"proc_sizes", __pyx_getprop_8petsc4py_5PETSc_4DMDA_proc_sizes, 0, (char *)0, 0},
  {(char *)"boundary_type", __pyx_getprop_8petsc4py_5PETSc_4DMDA_boundary_type, 0, (char *)0, 0},
  {(char *)"stencil", __pyx_getprop_8petsc4py_5PETSc_4DMDA_stencil, 0, (char *)0, 0},
  {(char *)"stencil_type", __pyx_getprop_8petsc4py_5PETSc_4DMDA_stencil_type, 0, (char *)0, 0},
  {(char *)"stencil_width", __pyx_getprop_8petsc4py_5PETSc_4DMDA_stencil_width, 0, (char *)0, 0},
  {(char *)"ranges", __pyx_getprop_8petsc4py_5PETSc_4DMDA_ranges, 0, (char *)0, 0},
  {(char *)"ghost_ranges", __pyx_getprop_8petsc4py_5PETSc_4DMDA_ghost_ranges, 0, (char *)0, 0},
  {(char *)"corners", __pyx_getprop_8petsc4py_5PETSc_4DMDA_corners, 0, (char *)0, 0},
  {(char *)"ghost_corners", __pyx_getprop_8petsc4py_5PETSc_4DMDA_ghost_corners, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc_DMDA = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.DMDA", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc_DMDA), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_DMDA, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8petsc4py_5PETSc_DMDA, /*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_8petsc4py_5PETSc_DMDA, /*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_8petsc4py_5PETSc_DMPlex __pyx_vtable_8petsc4py_5PETSc_DMPlex;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_DMPlex(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8petsc4py_5PETSc_DMPlex *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_DM(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8petsc4py_5PETSc_DMPlex *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_DMPlex;
  return o;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_DMPlex[] = {
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_1create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_create},
  {"createFromCellList", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_3createFromCellList, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_2createFromCellList},
  {"createBoxMesh", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_5createBoxMesh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_4createBoxMesh},
  {"createHexBoxMesh", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_7createHexBoxMesh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_6createHexBoxMesh},
  {"createCGNS", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_9createCGNS, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_8createCGNS},
  {"createCGNSFromFile", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_11createCGNSFromFile, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_10createCGNSFromFile},
  {"createExodusFromFile", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_13createExodusFromFile, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_12createExodusFromFile},
  {"createExodus", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_15createExodus, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_14createExodus},
  {"createGmsh", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_17createGmsh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_16createGmsh},
  {"createCohesiveSubmesh", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_19createCohesiveSubmesh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_18createCohesiveSubmesh},
  {"getChart", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_21getChart, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_20getChart},
  {"setChart", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_23setChart, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_22setChart},
  {"getConeSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_25getConeSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_24getConeSize},
  {"setConeSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_27setConeSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_26setConeSize},
  {"getCone", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_29getCone, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_28getCone},
  {"setCone", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_31setCone, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_30setCone},
  {"insertCone", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_33insertCone, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_32insertCone},
  {"insertConeOrientation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_35insertConeOrientation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_34insertConeOrientation},
  {"getConeOrientation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_37getConeOrientation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_36getConeOrientation},
  {"setConeOrientation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_39setConeOrientation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_38setConeOrientation},
  {"getSupportSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_41getSupportSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_40getSupportSize},
  {"setSupportSize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_43setSupportSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_42setSupportSize},
  {"getSupport", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_45getSupport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_44getSupport},
  {"setSupport", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_47setSupport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_46setSupport},
  {"getMaxSizes", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_49getMaxSizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_48getMaxSizes},
  {"symmetrize", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_51symmetrize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_50symmetrize},
  {"stratify", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_53stratify, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_52stratify},
  {"orient", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_55orient, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_54orient},
  {"getCellNumbering", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_57getCellNumbering, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_56getCellNumbering},
  {"getVertexNumbering", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_59getVertexNumbering, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_58getVertexNumbering},
  {"createPointNumbering", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_61createPointNumbering, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_60createPointNumbering},
  {"getDepth", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_63getDepth, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_62getDepth},
  {"getDepthStratum", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_65getDepthStratum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_64getDepthStratum},
  {"getHeightStratum", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_67getHeightStratum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_66getHeightStratum},
  {"getMeet", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_69getMeet, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_68getMeet},
  {"getJoin", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_71getJoin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_70getJoin},
  {"getTransitiveClosure", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_73getTransitiveClosure, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_72getTransitiveClosure},
  {"vecGetClosure", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_75vecGetClosure, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_74vecGetClosure},
  {"generate", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_77generate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_76generate},
  {"setTriangleOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_79setTriangleOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_78setTriangleOptions},
  {"setTetGenOptions", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_81setTetGenOptions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_80setTetGenOptions},
  {"createSquareBoundary", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_83createSquareBoundary, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_82createSquareBoundary},
  {"createCubeBoundary", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_85createCubeBoundary, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_84createCubeBoundary},
  {"markBoundaryFaces", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_87markBoundaryFaces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_86markBoundaryFaces},
  {"setAdjacencyUseCone", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_89setAdjacencyUseCone, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_88setAdjacencyUseCone},
  {"setAdjacencyUseClosure", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_91setAdjacencyUseClosure, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_90setAdjacencyUseClosure},
  {"getPartitioner", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_93getPartitioner, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_92getPartitioner},
  {"distribute", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_95distribute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_94distribute},
  {"distributeOverlap", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_97distributeOverlap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_96distributeOverlap},
  {"distributeField", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_99distributeField, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_98distributeField},
  {"createCoarsePointIS", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_101createCoarsePointIS, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_100createCoarsePointIS},
  {"createSection", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_103createSection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_102createSection},
  {"setRefinementUniform", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_105setRefinementUniform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_104setRefinementUniform},
  {"getRefinementUniform", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_107getRefinementUniform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_106getRefinementUniform},
  {"setRefinementLimit", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_109setRefinementLimit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_108setRefinementLimit},
  {"getRefinementLimit", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_111getRefinementLimit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_110getRefinementLimit},
  {"getOrdering", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_113getOrdering, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_112getOrdering},
  {"permute", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_115permute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_114permute},
  {"computeCellGeometryFVM", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_6DMPlex_117computeCellGeometryFVM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_6DMPlex_116computeCellGeometryFVM},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc_DMPlex = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.DMPlex", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc_DMPlex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_DMPlex, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_DMPlex, /*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_8petsc4py_5PETSc_DMComposite __pyx_vtable_8petsc4py_5PETSc_DMComposite;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_DMComposite(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8petsc4py_5PETSc_DMComposite *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_DM(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8petsc4py_5PETSc_DMComposite *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_DMComposite;
  return o;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_DMComposite[] = {
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11DMComposite_1create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11DMComposite_create},
  {"addDM", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11DMComposite_3addDM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11DMComposite_2addDM},
  {"getNumber", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11DMComposite_5getNumber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11DMComposite_4getNumber},
  {"getEntries", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11DMComposite_7getEntries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11DMComposite_6getEntries},
  {"scatter", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11DMComposite_9scatter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11DMComposite_8scatter},
  {"gather", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11DMComposite_11gather, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11DMComposite_10gather},
  {"getGlobalISs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11DMComposite_13getGlobalISs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11DMComposite_12getGlobalISs},
  {"getLocalISs", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11DMComposite_15getLocalISs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11DMComposite_14getLocalISs},
  {"getLGMaps", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11DMComposite_17getLGMaps, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11DMComposite_16getLGMaps},
  {"getAccess", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_11DMComposite_19getAccess, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_11DMComposite_18getAccess},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc_DMComposite = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.DMComposite", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc_DMComposite), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_DMComposite, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_DMComposite, /*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_8petsc4py_5PETSc_DMShell __pyx_vtable_8petsc4py_5PETSc_DMShell;

static PyObject *__pyx_tp_new_8petsc4py_5PETSc_DMShell(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8petsc4py_5PETSc_DMShell *p;
  PyObject *o = __pyx_tp_new_8petsc4py_5PETSc_DM(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8petsc4py_5PETSc_DMShell *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8petsc4py_5PETSc_Object*)__pyx_vtabptr_8petsc4py_5PETSc_DMShell;
  return o;
}

static PyMethodDef __pyx_methods_8petsc4py_5PETSc_DMShell[] = {
  {"create", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_1create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_create},
  {"setMatrix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_3setMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_2setMatrix},
  {"setGlobalVector", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_5setGlobalVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_4setGlobalVector},
  {"setLocalVector", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_7setLocalVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_6setLocalVector},
  {"setCreateGlobalVector", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_9setCreateGlobalVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_8setCreateGlobalVector},
  {"setCreateLocalVector", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_11setCreateLocalVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_10setCreateLocalVector},
  {"setGlobalToLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_13setGlobalToLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_12setGlobalToLocal},
  {"setGlobalToLocalVecScatter", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_15setGlobalToLocalVecScatter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_14setGlobalToLocalVecScatter},
  {"setLocalToGlobal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_17setLocalToGlobal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_16setLocalToGlobal},
  {"setLocalToGlobalVecScatter", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_19setLocalToGlobalVecScatter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_18setLocalToGlobalVecScatter},
  {"setLocalToLocal", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_21setLocalToLocal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_20setLocalToLocal},
  {"setLocalToLocalVecScatter", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_23setLocalToLocalVecScatter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_22setLocalToLocalVecScatter},
  {"setCreateMatrix", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_25setCreateMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_24setCreateMatrix},
  {"setCoarsen", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_27setCoarsen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_26setCoarsen},
  {"setRefine", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_29setRefine, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_28setRefine},
  {"setCreateInterpolation", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_31setCreateInterpolation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_30setCreateInterpolation},
  {"setCreateInjection", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_33setCreateInjection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_32setCreateInjection},
  {"setCreateFieldDecomposition", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_35setCreateFieldDecomposition, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_34setCreateFieldDecomposition},
  {"setCreateSubDM", (PyCFunction)__pyx_pw_8petsc4py_5PETSc_7DMShell_37setCreateSubDM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8petsc4py_5PETSc_7DMShell_36setCreateSubDM},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8petsc4py_5PETSc_DMShell = {
  PyVarObject_HEAD_INIT(0, 0)
  "petsc4py.PETSc.DMShell", /*tp_name*/
  sizeof(struct __pyx_obj_8petsc4py_5PETSc_DMShell), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8petsc4py_5PETSc_Object, /*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*/
  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_8petsc4py_5PETSc_Object, /*tp_traverse*/
  __pyx_tp_clear_8petsc4py_5PETSc_Object, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8petsc4py_5PETSc_DMShell, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8petsc4py_5PETSc_DMShell, /*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
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    "PETSc",
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    (freefunc)__pyx_module_cleanup /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1},
  {&__pyx_n_s_A11, __pyx_k_A11, sizeof(__pyx_k_A11), 0, 0, 1, 1},
  {&__pyx_n_s_ADD, __pyx_k_ADD, sizeof(__pyx_k_ADD), 0, 0, 1, 1},
  {&__pyx_n_s_ADDITIVE, __pyx_k_ADDITIVE, sizeof(__pyx_k_ADDITIVE), 0, 0, 1, 1},
  {&__pyx_n_s_ADD_ALL, __pyx_k_ADD_ALL, sizeof(__pyx_k_ADD_ALL), 0, 0, 1, 1},
  {&__pyx_n_s_ADD_ALL_VALUES, __pyx_k_ADD_ALL_VALUES, sizeof(__pyx_k_ADD_ALL_VALUES), 0, 0, 1, 1},
  {&__pyx_n_s_ADD_BC, __pyx_k_ADD_BC, sizeof(__pyx_k_ADD_BC), 0, 0, 1, 1},
  {&__pyx_n_s_ADD_BC_VALUES, __pyx_k_ADD_BC_VALUES, sizeof(__pyx_k_ADD_BC_VALUES), 0, 0, 1, 1},
  {&__pyx_n_s_ADD_VALUES, __pyx_k_ADD_VALUES, sizeof(__pyx_k_ADD_VALUES), 0, 0, 1, 1},
  {&__pyx_n_s_ADVANCED, __pyx_k_ADVANCED, sizeof(__pyx_k_ADVANCED), 0, 0, 1, 1},
  {&__pyx_n_s_AGG, __pyx_k_AGG, sizeof(__pyx_k_AGG), 0, 0, 1, 1},
  {&__pyx_n_s_AIJ, __pyx_k_AIJ, sizeof(__pyx_k_AIJ), 0, 0, 1, 1},
  {&__pyx_n_s_AIJCRL, __pyx_k_AIJCRL, sizeof(__pyx_k_AIJCRL), 0, 0, 1, 1},
  {&__pyx_n_s_AIJCUSP, __pyx_k_AIJCUSP, sizeof(__pyx_k_AIJCUSP), 0, 0, 1, 1},
  {&__pyx_n_s_AIJCUSPARSE, __pyx_k_AIJCUSPARSE, sizeof(__pyx_k_AIJCUSPARSE), 0, 0, 1, 1},
  {&__pyx_n_s_AIJPERM, __pyx_k_AIJPERM, sizeof(__pyx_k_AIJPERM), 0, 0, 1, 1},
  {&__pyx_n_s_AIJVIENNACL, __pyx_k_AIJVIENNACL, sizeof(__pyx_k_AIJVIENNACL), 0, 0, 1, 1},
  {&__pyx_n_s_AINVCUSP, __pyx_k_AINVCUSP, sizeof(__pyx_k_AINVCUSP), 0, 0, 1, 1},
  {&__pyx_n_s_ALPHA, __pyx_k_ALPHA, sizeof(__pyx_k_ALPHA), 0, 0, 1, 1},
  {&__pyx_n_s_ALPHA2, __pyx_k_ALPHA2, sizeof(__pyx_k_ALPHA2), 0, 0, 1, 1},
  {&__pyx_n_s_ALWAYS, __pyx_k_ALWAYS, sizeof(__pyx_k_ALWAYS), 0, 0, 1, 1},
  {&__pyx_n_s_AMD, __pyx_k_AMD, sizeof(__pyx_k_AMD), 0, 0, 1, 1},
  {&__pyx_n_s_ANDERSON, __pyx_k_ANDERSON, sizeof(__pyx_k_ANDERSON), 0, 0, 1, 1},
  {&__pyx_n_s_AOType, __pyx_k_AOType, sizeof(__pyx_k_AOType), 0, 0, 1, 1},
  {&__pyx_n_s_APPEND, __pyx_k_APPEND, sizeof(__pyx_k_APPEND), 0, 0, 1, 1},
  {&__pyx_n_s_APPEND_UPDATE, __pyx_k_APPEND_UPDATE, sizeof(__pyx_k_APPEND_UPDATE), 0, 0, 1, 1},
  {&__pyx_n_s_APPLY_LOWER, __pyx_k_APPLY_LOWER, sizeof(__pyx_k_APPLY_LOWER), 0, 0, 1, 1},
  {&__pyx_n_s_APPLY_UPPER, __pyx_k_APPLY_UPPER, sizeof(__pyx_k_APPLY_UPPER), 0, 0, 1, 1},
  {&__pyx_n_s_ARKIMEX, __pyx_k_ARKIMEX, sizeof(__pyx_k_ARKIMEX), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_COMMON, __pyx_k_ASCII_COMMON, sizeof(__pyx_k_ASCII_COMMON), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_DENSE, __pyx_k_ASCII_DENSE, sizeof(__pyx_k_ASCII_DENSE), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_FACTOR_INFO, __pyx_k_ASCII_FACTOR_INFO, sizeof(__pyx_k_ASCII_FACTOR_INFO), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_IMPL, __pyx_k_ASCII_IMPL, sizeof(__pyx_k_ASCII_IMPL), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_INDEX, __pyx_k_ASCII_INDEX, sizeof(__pyx_k_ASCII_INDEX), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_INFO, __pyx_k_ASCII_INFO, sizeof(__pyx_k_ASCII_INFO), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_INFO_DETAIL, __pyx_k_ASCII_INFO_DETAIL, sizeof(__pyx_k_ASCII_INFO_DETAIL), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_LATEX, __pyx_k_ASCII_LATEX, sizeof(__pyx_k_ASCII_LATEX), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_MATHEMATICA, __pyx_k_ASCII_MATHEMATICA, sizeof(__pyx_k_ASCII_MATHEMATICA), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_MATLAB, __pyx_k_ASCII_MATLAB, sizeof(__pyx_k_ASCII_MATLAB), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_MATRIXMARKET, __pyx_k_ASCII_MATRIXMARKET, sizeof(__pyx_k_ASCII_MATRIXMARKET), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_PCICE, __pyx_k_ASCII_PCICE, sizeof(__pyx_k_ASCII_PCICE), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_PYTHON, __pyx_k_ASCII_PYTHON, sizeof(__pyx_k_ASCII_PYTHON), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_SYMMODU, __pyx_k_ASCII_SYMMODU, sizeof(__pyx_k_ASCII_SYMMODU), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_VTK, __pyx_k_ASCII_VTK, sizeof(__pyx_k_ASCII_VTK), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_VTK_CELL, __pyx_k_ASCII_VTK_CELL, sizeof(__pyx_k_ASCII_VTK_CELL), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_VTK_COORDS, __pyx_k_ASCII_VTK_COORDS, sizeof(__pyx_k_ASCII_VTK_COORDS), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII_XML, __pyx_k_ASCII_XML, sizeof(__pyx_k_ASCII_XML), 0, 0, 1, 1},
  {&__pyx_n_s_ASFLS, __pyx_k_ASFLS, sizeof(__pyx_k_ASFLS), 0, 0, 1, 1},
  {&__pyx_n_s_ASILS, __pyx_k_ASILS, sizeof(__pyx_k_ASILS), 0, 0, 1, 1},
  {&__pyx_n_s_ASM, __pyx_k_ASM, sizeof(__pyx_k_ASM), 0, 0, 1, 1},
  {&__pyx_n_s_ASMType, __pyx_k_ASMType, sizeof(__pyx_k_ASMType), 0, 0, 1, 1},
  {&__pyx_n_s_ASPIN, __pyx_k_ASPIN, sizeof(__pyx_k_ASPIN), 0, 0, 1, 1},
  {&__pyx_n_s_AU, __pyx_k_AU, sizeof(__pyx_k_AU), 0, 0, 1, 1},
  {&__pyx_kp_s_A_matrix_with_d_rows_requires_a, __pyx_k_A_matrix_with_d_rows_requires_a, sizeof(__pyx_k_A_matrix_with_d_rows_requires_a), 0, 0, 1, 0},
  {&__pyx_n_s_AssemblyType, __pyx_k_AssemblyType, sizeof(__pyx_k_AssemblyType), 0, 0, 1, 1},
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1},
  {&__pyx_n_s_BACKWARD_SWEEP, __pyx_k_BACKWARD_SWEEP, sizeof(__pyx_k_BACKWARD_SWEEP), 0, 0, 1, 1},
  {&__pyx_n_s_BAIJ, __pyx_k_BAIJ, sizeof(__pyx_k_BAIJ), 0, 0, 1, 1},
  {&__pyx_n_s_BASIC, __pyx_k_BASIC, sizeof(__pyx_k_BASIC), 0, 0, 1, 1},
  {&__pyx_n_s_BCGS, __pyx_k_BCGS, sizeof(__pyx_k_BCGS), 0, 0, 1, 1},
  {&__pyx_n_s_BCGSL, __pyx_k_BCGSL, sizeof(__pyx_k_BCGSL), 0, 0, 1, 1},
  {&__pyx_n_s_BDDC, __pyx_k_BDDC, sizeof(__pyx_k_BDDC), 0, 0, 1, 1},
  {&__pyx_n_s_BDF, __pyx_k_BDF, sizeof(__pyx_k_BDF), 0, 0, 1, 1},
  {&__pyx_n_s_BE, __pyx_k_BE, sizeof(__pyx_k_BE), 0, 0, 1, 1},
  {&__pyx_n_s_BEULER, __pyx_k_BEULER, sizeof(__pyx_k_BEULER), 0, 0, 1, 1},
  {&__pyx_n_s_BFBT, __pyx_k_BFBT, sizeof(__pyx_k_BFBT), 0, 0, 1, 1},
  {&__pyx_n_s_BICG, __pyx_k_BICG, sizeof(__pyx_k_BICG), 0, 0, 1, 1},
  {&__pyx_n_s_BICGSTABCUSP, __pyx_k_BICGSTABCUSP, sizeof(__pyx_k_BICGSTABCUSP), 0, 0, 1, 1},
  {&__pyx_n_s_BINARY, __pyx_k_BINARY, sizeof(__pyx_k_BINARY), 0, 0, 1, 1},
  {&__pyx_n_s_BINARY_MATLAB, __pyx_k_BINARY_MATLAB, sizeof(__pyx_k_BINARY_MATLAB), 0, 0, 1, 1},
  {&__pyx_n_s_BJACOBI, __pyx_k_BJACOBI, sizeof(__pyx_k_BJACOBI), 0, 0, 1, 1},
  {&__pyx_n_s_BLMVM, __pyx_k_BLMVM, sizeof(__pyx_k_BLMVM), 0, 0, 1, 1},
  {&__pyx_n_s_BLOCK, __pyx_k_BLOCK, sizeof(__pyx_k_BLOCK), 0, 0, 1, 1},
  {&__pyx_n_s_BLOCKMAT, __pyx_k_BLOCKMAT, sizeof(__pyx_k_BLOCKMAT), 0, 0, 1, 1},
  {&__pyx_n_s_BMRM, __pyx_k_BMRM, sizeof(__pyx_k_BMRM), 0, 0, 1, 1},
  {&__pyx_n_s_BOX, __pyx_k_BOX, sizeof(__pyx_k_BOX), 0, 0, 1, 1},
  {&__pyx_n_s_BQPIP, __pyx_k_BQPIP, sizeof(__pyx_k_BQPIP), 0, 0, 1, 1},
  {&__pyx_n_s_BSTRM, __pyx_k_BSTRM, sizeof(__pyx_k_BSTRM), 0, 0, 1, 1},
  {&__pyx_n_s_Barrier, __pyx_k_Barrier, sizeof(__pyx_k_Barrier), 0, 0, 1, 1},
  {&__pyx_n_s_BoundaryType, __pyx_k_BoundaryType, sizeof(__pyx_k_BoundaryType), 0, 0, 1, 1},
  {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
  {&__pyx_n_s_CARTESIAN, __pyx_k_CARTESIAN, sizeof(__pyx_k_CARTESIAN), 0, 0, 1, 1},
  {&__pyx_n_s_CG, __pyx_k_CG, sizeof(__pyx_k_CG), 0, 0, 1, 1},
  {&__pyx_n_s_CGLS, __pyx_k_CGLS, sizeof(__pyx_k_CGLS), 0, 0, 1, 1},
  {&__pyx_n_s_CGNE, __pyx_k_CGNE, sizeof(__pyx_k_CGNE), 0, 0, 1, 1},
  {&__pyx_n_s_CGS, __pyx_k_CGS, sizeof(__pyx_k_CGS), 0, 0, 1, 1},
  {&__pyx_n_s_CHACO, __pyx_k_CHACO, sizeof(__pyx_k_CHACO), 0, 0, 1, 1},
  {&__pyx_n_s_CHEBYSHEV, __pyx_k_CHEBYSHEV, sizeof(__pyx_k_CHEBYSHEV), 0, 0, 1, 1},
  {&__pyx_n_s_CHOLESKY, __pyx_k_CHOLESKY, sizeof(__pyx_k_CHOLESKY), 0, 0, 1, 1},
  {&__pyx_n_s_CLASSICAL, __pyx_k_CLASSICAL, sizeof(__pyx_k_CLASSICAL), 0, 0, 1, 1},
  {&__pyx_n_s_CN, __pyx_k_CN, sizeof(__pyx_k_CN), 0, 0, 1, 1},
  {&__pyx_n_s_COMM_NULL, __pyx_k_COMM_NULL, sizeof(__pyx_k_COMM_NULL), 0, 0, 1, 1},
  {&__pyx_n_s_COMM_SELF, __pyx_k_COMM_SELF, sizeof(__pyx_k_COMM_SELF), 0, 0, 1, 1},
  {&__pyx_n_s_COMM_WORLD, __pyx_k_COMM_WORLD, sizeof(__pyx_k_COMM_WORLD), 0, 0, 1, 1},
  {&__pyx_n_s_COMPOSITE, __pyx_k_COMPOSITE, sizeof(__pyx_k_COMPOSITE), 0, 0, 1, 1},
  {&__pyx_n_s_CONTINUE_ITERATING, __pyx_k_CONTINUE_ITERATING, sizeof(__pyx_k_CONTINUE_ITERATING), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_ATOL, __pyx_k_CONVERGED_ATOL, sizeof(__pyx_k_CONVERGED_ATOL), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_ATOL_NORMAL, __pyx_k_CONVERGED_ATOL_NORMAL, sizeof(__pyx_k_CONVERGED_ATOL_NORMAL), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_CG_CONSTRAINED, __pyx_k_CONVERGED_CG_CONSTRAINED, sizeof(__pyx_k_CONVERGED_CG_CONSTRAINED), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_CG_NEG_CURVE, __pyx_k_CONVERGED_CG_NEG_CURVE, sizeof(__pyx_k_CONVERGED_CG_NEG_CURVE), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_EVENT, __pyx_k_CONVERGED_EVENT, sizeof(__pyx_k_CONVERGED_EVENT), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_FNORM_ABS, __pyx_k_CONVERGED_FNORM_ABS, sizeof(__pyx_k_CONVERGED_FNORM_ABS), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_FNORM_RELATIVE, __pyx_k_CONVERGED_FNORM_RELATIVE, sizeof(__pyx_k_CONVERGED_FNORM_RELATIVE), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_GATOL, __pyx_k_CONVERGED_GATOL, sizeof(__pyx_k_CONVERGED_GATOL), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_GRTOL, __pyx_k_CONVERGED_GRTOL, sizeof(__pyx_k_CONVERGED_GRTOL), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_GTTOL, __pyx_k_CONVERGED_GTTOL, sizeof(__pyx_k_CONVERGED_GTTOL), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_HAPPY_BREAKDOWN, __pyx_k_CONVERGED_HAPPY_BREAKDOWN, sizeof(__pyx_k_CONVERGED_HAPPY_BREAKDOWN), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_ITERATING, __pyx_k_CONVERGED_ITERATING, sizeof(__pyx_k_CONVERGED_ITERATING), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_ITS, __pyx_k_CONVERGED_ITS, sizeof(__pyx_k_CONVERGED_ITS), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_MINF, __pyx_k_CONVERGED_MINF, sizeof(__pyx_k_CONVERGED_MINF), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_RTOL, __pyx_k_CONVERGED_RTOL, sizeof(__pyx_k_CONVERGED_RTOL), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_RTOL_NORMAL, __pyx_k_CONVERGED_RTOL_NORMAL, sizeof(__pyx_k_CONVERGED_RTOL_NORMAL), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_SNORM_RELATIVE, __pyx_k_CONVERGED_SNORM_RELATIVE, sizeof(__pyx_k_CONVERGED_SNORM_RELATIVE), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_STEPTOL, __pyx_k_CONVERGED_STEPTOL, sizeof(__pyx_k_CONVERGED_STEPTOL), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_STEP_LENGTH, __pyx_k_CONVERGED_STEP_LENGTH, sizeof(__pyx_k_CONVERGED_STEP_LENGTH), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_TIME, __pyx_k_CONVERGED_TIME, sizeof(__pyx_k_CONVERGED_TIME), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_TR_DELTA, __pyx_k_CONVERGED_TR_DELTA, sizeof(__pyx_k_CONVERGED_TR_DELTA), 0, 0, 1, 1},
  {&__pyx_n_s_CONVERGED_USER, __pyx_k_CONVERGED_USER, sizeof(__pyx_k_CONVERGED_USER), 0, 0, 1, 1},
  {&__pyx_n_s_CP, __pyx_k_CP, sizeof(__pyx_k_CP), 0, 0, 1, 1},
  {&__pyx_n_s_CR, __pyx_k_CR, sizeof(__pyx_k_CR), 0, 0, 1, 1},
  {&__pyx_n_s_CRANK_NICOLSON, __pyx_k_CRANK_NICOLSON, sizeof(__pyx_k_CRANK_NICOLSON), 0, 0, 1, 1},
  {&__pyx_n_s_CUSP, __pyx_k_CUSP, sizeof(__pyx_k_CUSP), 0, 0, 1, 1},
  {&__pyx_n_s_Class, __pyx_k_Class, sizeof(__pyx_k_Class), 0, 0, 1, 1},
  {&__pyx_n_s_Clone, __pyx_k_Clone, sizeof(__pyx_k_Clone), 0, 0, 1, 1},
  {&__pyx_n_s_ComplexType, __pyx_k_ComplexType, sizeof(__pyx_k_ComplexType), 0, 0, 1, 1},
  {&__pyx_n_s_CompositeType, __pyx_k_CompositeType, sizeof(__pyx_k_CompositeType), 0, 0, 1, 1},
  {&__pyx_n_s_ConvergedReason, __pyx_k_ConvergedReason, sizeof(__pyx_k_ConvergedReason), 0, 0, 1, 1},
  {&__pyx_n_s_DA, __pyx_k_DA, sizeof(__pyx_k_DA), 0, 0, 1, 1},
  {&__pyx_n_s_DAAD, __pyx_k_DAAD, sizeof(__pyx_k_DAAD), 0, 0, 1, 1},
  {&__pyx_n_s_DAE_IMPLICIT_INDEX1, __pyx_k_DAE_IMPLICIT_INDEX1, sizeof(__pyx_k_DAE_IMPLICIT_INDEX1), 0, 0, 1, 1},
  {&__pyx_n_s_DAE_IMPLICIT_INDEX2, __pyx_k_DAE_IMPLICIT_INDEX2, sizeof(__pyx_k_DAE_IMPLICIT_INDEX2), 0, 0, 1, 1},
  {&__pyx_n_s_DAE_IMPLICIT_INDEX3, __pyx_k_DAE_IMPLICIT_INDEX3, sizeof(__pyx_k_DAE_IMPLICIT_INDEX3), 0, 0, 1, 1},
  {&__pyx_n_s_DAE_IMPLICIT_INDEXHI, __pyx_k_DAE_IMPLICIT_INDEXHI, sizeof(__pyx_k_DAE_IMPLICIT_INDEXHI), 0, 0, 1, 1},
  {&__pyx_n_s_DAE_SEMI_EXPLICIT_INDEX1, __pyx_k_DAE_SEMI_EXPLICIT_INDEX1, sizeof(__pyx_k_DAE_SEMI_EXPLICIT_INDEX1), 0, 0, 1, 1},
  {&__pyx_n_s_DAE_SEMI_EXPLICIT_INDEX2, __pyx_k_DAE_SEMI_EXPLICIT_INDEX2, sizeof(__pyx_k_DAE_SEMI_EXPLICIT_INDEX2), 0, 0, 1, 1},
  {&__pyx_n_s_DAE_SEMI_EXPLICIT_INDEX3, __pyx_k_DAE_SEMI_EXPLICIT_INDEX3, sizeof(__pyx_k_DAE_SEMI_EXPLICIT_INDEX3), 0, 0, 1, 1},
  {&__pyx_n_s_DAE_SEMI_EXPLICIT_INDEXHI, __pyx_k_DAE_SEMI_EXPLICIT_INDEXHI, sizeof(__pyx_k_DAE_SEMI_EXPLICIT_INDEXHI), 0, 0, 1, 1},
  {&__pyx_n_s_DECIDE, __pyx_k_DECIDE, sizeof(__pyx_k_DECIDE), 0, 0, 1, 1},
  {&__pyx_n_s_DEFAULT, __pyx_k_DEFAULT, sizeof(__pyx_k_DEFAULT), 0, 0, 1, 1},
  {&__pyx_n_s_DENSE, __pyx_k_DENSE, sizeof(__pyx_k_DENSE), 0, 0, 1, 1},
  {&__pyx_n_s_DETERMINE, __pyx_k_DETERMINE, sizeof(__pyx_k_DETERMINE), 0, 0, 1, 1},
  {&__pyx_n_s_DGMRES, __pyx_k_DGMRES, sizeof(__pyx_k_DGMRES), 0, 0, 1, 1},
  {&__pyx_n_s_DIAG, __pyx_k_DIAG, sizeof(__pyx_k_DIAG), 0, 0, 1, 1},
  {&__pyx_n_s_DIFFERENT, __pyx_k_DIFFERENT, sizeof(__pyx_k_DIFFERENT), 0, 0, 1, 1},
  {&__pyx_n_s_DIFFERENT_NONZERO_PATTERN, __pyx_k_DIFFERENT_NONZERO_PATTERN, sizeof(__pyx_k_DIFFERENT_NONZERO_PATTERN), 0, 0, 1, 1},
  {&__pyx_n_s_DIFFERENT_NZ, __pyx_k_DIFFERENT_NZ, sizeof(__pyx_k_DIFFERENT_NZ), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_BREAKDOWN, __pyx_k_DIVERGED_BREAKDOWN, sizeof(__pyx_k_DIVERGED_BREAKDOWN), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_BREAKDOWN_BICG, __pyx_k_DIVERGED_BREAKDOWN_BICG, sizeof(__pyx_k_DIVERGED_BREAKDOWN_BICG), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_DTOL, __pyx_k_DIVERGED_DTOL, sizeof(__pyx_k_DIVERGED_DTOL), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_FNORM_NAN, __pyx_k_DIVERGED_FNORM_NAN, sizeof(__pyx_k_DIVERGED_FNORM_NAN), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_FUNCTION_COUNT, __pyx_k_DIVERGED_FUNCTION_COUNT, sizeof(__pyx_k_DIVERGED_FUNCTION_COUNT), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_FUNCTION_DOMAIN, __pyx_k_DIVERGED_FUNCTION_DOMAIN, sizeof(__pyx_k_DIVERGED_FUNCTION_DOMAIN), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_INDEFINITE_MAT, __pyx_k_DIVERGED_INDEFINITE_MAT, sizeof(__pyx_k_DIVERGED_INDEFINITE_MAT), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_INDEFINITE_PC, __pyx_k_DIVERGED_INDEFINITE_PC, sizeof(__pyx_k_DIVERGED_INDEFINITE_PC), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_INNER, __pyx_k_DIVERGED_INNER, sizeof(__pyx_k_DIVERGED_INNER), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_LINE_SEARCH, __pyx_k_DIVERGED_LINE_SEARCH, sizeof(__pyx_k_DIVERGED_LINE_SEARCH), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_LOCAL_MIN, __pyx_k_DIVERGED_LOCAL_MIN, sizeof(__pyx_k_DIVERGED_LOCAL_MIN), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_LS_FAILURE, __pyx_k_DIVERGED_LS_FAILURE, sizeof(__pyx_k_DIVERGED_LS_FAILURE), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_MAXFCN, __pyx_k_DIVERGED_MAXFCN, sizeof(__pyx_k_DIVERGED_MAXFCN), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_MAXITS, __pyx_k_DIVERGED_MAXITS, sizeof(__pyx_k_DIVERGED_MAXITS), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_MAX_IT, __pyx_k_DIVERGED_MAX_IT, sizeof(__pyx_k_DIVERGED_MAX_IT), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_NAN, __pyx_k_DIVERGED_NAN, sizeof(__pyx_k_DIVERGED_NAN), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_NANORINF, __pyx_k_DIVERGED_NANORINF, sizeof(__pyx_k_DIVERGED_NANORINF), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_NONLINEAR_SOLVE, __pyx_k_DIVERGED_NONLINEAR_SOLVE, sizeof(__pyx_k_DIVERGED_NONLINEAR_SOLVE), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_NONSYMMETRIC, __pyx_k_DIVERGED_NONSYMMETRIC, sizeof(__pyx_k_DIVERGED_NONSYMMETRIC), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_NULL, __pyx_k_DIVERGED_NULL, sizeof(__pyx_k_DIVERGED_NULL), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_STEP_REJECTED, __pyx_k_DIVERGED_STEP_REJECTED, sizeof(__pyx_k_DIVERGED_STEP_REJECTED), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_TR_REDUCTION, __pyx_k_DIVERGED_TR_REDUCTION, sizeof(__pyx_k_DIVERGED_TR_REDUCTION), 0, 0, 1, 1},
  {&__pyx_n_s_DIVERGED_USER, __pyx_k_DIVERGED_USER, sizeof(__pyx_k_DIVERGED_USER), 0, 0, 1, 1},
  {&__pyx_n_s_DMBoundaryType, __pyx_k_DMBoundaryType, sizeof(__pyx_k_DMBoundaryType), 0, 0, 1, 1},
  {&__pyx_n_s_DMDAElementType, __pyx_k_DMDAElementType, sizeof(__pyx_k_DMDAElementType), 0, 0, 1, 1},
  {&__pyx_n_s_DMDAInterpolationType, __pyx_k_DMDAInterpolationType, sizeof(__pyx_k_DMDAInterpolationType), 0, 0, 1, 1},
  {&__pyx_n_s_DMDAStencilType, __pyx_k_DMDAStencilType, sizeof(__pyx_k_DMDAStencilType), 0, 0, 1, 1},
  {&__pyx_n_s_DMType, __pyx_k_DMType, sizeof(__pyx_k_DMType), 0, 0, 1, 1},
  {&__pyx_n_s_DOF, __pyx_k_DOF, sizeof(__pyx_k_DOF), 0, 0, 1, 1},
  {&__pyx_n_s_DRAW, __pyx_k_DRAW, sizeof(__pyx_k_DRAW), 0, 0, 1, 1},
  {&__pyx_n_s_DRAW_BASIC, __pyx_k_DRAW_BASIC, sizeof(__pyx_k_DRAW_BASIC), 0, 0, 1, 1},
  {&__pyx_n_s_DRAW_CONTOUR, __pyx_k_DRAW_CONTOUR, sizeof(__pyx_k_DRAW_CONTOUR), 0, 0, 1, 1},
  {&__pyx_n_s_DRAW_LG, __pyx_k_DRAW_LG, sizeof(__pyx_k_DRAW_LG), 0, 0, 1, 1},
  {&__pyx_n_s_DRAW_PORTS, __pyx_k_DRAW_PORTS, sizeof(__pyx_k_DRAW_PORTS), 0, 0, 1, 1},
  {&__pyx_n_s_DROP, __pyx_k_DROP, sizeof(__pyx_k_DROP), 0, 0, 1, 1},
  {&__pyx_n_s_DrawSize, __pyx_k_DrawSize, sizeof(__pyx_k_DrawSize), 0, 0, 1, 1},
  {&__pyx_n_s_Dup, __pyx_k_Dup, sizeof(__pyx_k_Dup), 0, 0, 1, 1},
  {&__pyx_n_s_EIMEX, __pyx_k_EIMEX, sizeof(__pyx_k_EIMEX), 0, 0, 1, 1},
  {&__pyx_n_s_EISENSTAT, __pyx_k_EISENSTAT, sizeof(__pyx_k_EISENSTAT), 0, 0, 1, 1},
  {&__pyx_n_s_ELEMENTAL, __pyx_k_ELEMENTAL, sizeof(__pyx_k_ELEMENTAL), 0, 0, 1, 1},
  {&__pyx_n_s_ERROR_LOWER_TRIANGULAR, __pyx_k_ERROR_LOWER_TRIANGULAR, sizeof(__pyx_k_ERROR_LOWER_TRIANGULAR), 0, 0, 1, 1},
  {&__pyx_n_s_EULER, __pyx_k_EULER, sizeof(__pyx_k_EULER), 0, 0, 1, 1},
  {&__pyx_n_s_EXOTIC, __pyx_k_EXOTIC, sizeof(__pyx_k_EXOTIC), 0, 0, 1, 1},
  {&__pyx_n_s_EXPLICIT, __pyx_k_EXPLICIT, sizeof(__pyx_k_EXPLICIT), 0, 0, 1, 1},
  {&__pyx_n_s_ElementType, __pyx_k_ElementType, sizeof(__pyx_k_ElementType), 0, 0, 1, 1},
  {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
  {&__pyx_n_s_EquationType, __pyx_k_EquationType, sizeof(__pyx_k_EquationType), 0, 0, 1, 1},
  {&__pyx_n_s_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 0, 1, 1},
  {&__pyx_n_s_Error___init, __pyx_k_Error___init, sizeof(__pyx_k_Error___init), 0, 0, 1, 1},
  {&__pyx_n_s_Error___nonzero, __pyx_k_Error___nonzero, sizeof(__pyx_k_Error___nonzero), 0, 0, 1, 1},
  {&__pyx_n_s_Error___repr, __pyx_k_Error___repr, sizeof(__pyx_k_Error___repr), 0, 0, 1, 1},
  {&__pyx_n_s_Error___str, __pyx_k_Error___str, sizeof(__pyx_k_Error___str), 0, 0, 1, 1},
  {&__pyx_n_s_Event, __pyx_k_Event, sizeof(__pyx_k_Event), 0, 0, 1, 1},
  {&__pyx_n_s_ExactFinalTime, __pyx_k_ExactFinalTime, sizeof(__pyx_k_ExactFinalTime), 0, 0, 1, 1},
  {&__pyx_n_s_ExactFinalTimeOption, __pyx_k_ExactFinalTimeOption, sizeof(__pyx_k_ExactFinalTimeOption), 0, 0, 1, 1},
  {&__pyx_n_s_FAS, __pyx_k_FAS, sizeof(__pyx_k_FAS), 0, 0, 1, 1},
  {&__pyx_n_s_FBCGS, __pyx_k_FBCGS, sizeof(__pyx_k_FBCGS), 0, 0, 1, 1},
  {&__pyx_n_s_FBCGSR, __pyx_k_FBCGSR, sizeof(__pyx_k_FBCGSR), 0, 0, 1, 1},
  {&__pyx_n_s_FCG, __pyx_k_FCG, sizeof(__pyx_k_FCG), 0, 0, 1, 1},
  {&__pyx_n_s_FE, __pyx_k_FE, sizeof(__pyx_k_FE), 0, 0, 1, 1},
  {&__pyx_n_s_FFT, __pyx_k_FFT, sizeof(__pyx_k_FFT), 0, 0, 1, 1},
  {&__pyx_n_s_FFTW, __pyx_k_FFTW, sizeof(__pyx_k_FFTW), 0, 0, 1, 1},
  {&__pyx_n_s_FGMRES, __pyx_k_FGMRES, sizeof(__pyx_k_FGMRES), 0, 0, 1, 1},
  {&__pyx_n_s_FIELDSPLIT, __pyx_k_FIELDSPLIT, sizeof(__pyx_k_FIELDSPLIT), 0, 0, 1, 1},
  {&__pyx_n_s_FINAL, __pyx_k_FINAL, sizeof(__pyx_k_FINAL), 0, 0, 1, 1},
  {&__pyx_n_s_FINAL_ASSEMBLY, __pyx_k_FINAL_ASSEMBLY, sizeof(__pyx_k_FINAL_ASSEMBLY), 0, 0, 1, 1},
  {&__pyx_n_s_FINAL_ONLY, __pyx_k_FINAL_ONLY, sizeof(__pyx_k_FINAL_ONLY), 0, 0, 1, 1},
  {&__pyx_n_s_FLUSH, __pyx_k_FLUSH, sizeof(__pyx_k_FLUSH), 0, 0, 1, 1},
  {&__pyx_n_s_FLUSH_ASSEMBLY, __pyx_k_FLUSH_ASSEMBLY, sizeof(__pyx_k_FLUSH_ASSEMBLY), 0, 0, 1, 1},
  {&__pyx_n_s_FORWARD, __pyx_k_FORWARD, sizeof(__pyx_k_FORWARD), 0, 0, 1, 1},
  {&__pyx_n_s_FORWARD_LOCAL, __pyx_k_FORWARD_LOCAL, sizeof(__pyx_k_FORWARD_LOCAL), 0, 0, 1, 1},
  {&__pyx_n_s_FORWARD_SWEEP, __pyx_k_FORWARD_SWEEP, sizeof(__pyx_k_FORWARD_SWEEP), 0, 0, 1, 1},
  {&__pyx_n_s_FRB, __pyx_k_FRB, sizeof(__pyx_k_FRB), 0, 0, 1, 1},
  {&__pyx_n_s_FROBENIUS, __pyx_k_FROBENIUS, sizeof(__pyx_k_FROBENIUS), 0, 0, 1, 1},
  {&__pyx_n_s_FULL, __pyx_k_FULL, sizeof(__pyx_k_FULL), 0, 0, 1, 1},
  {&__pyx_n_s_FULL_SIZE, __pyx_k_FULL_SIZE, sizeof(__pyx_k_FULL_SIZE), 0, 0, 1, 1},
  {&__pyx_n_s_FactorShiftType, __pyx_k_FactorShiftType, sizeof(__pyx_k_FactorShiftType), 0, 0, 1, 1},
  {&__pyx_n_s_FileMode, __pyx_k_FileMode, sizeof(__pyx_k_FileMode), 0, 0, 1, 1},
  {&__pyx_n_s_Format, __pyx_k_Format, sizeof(__pyx_k_Format), 0, 0, 1, 1},
  {&__pyx_n_s_Free, __pyx_k_Free, sizeof(__pyx_k_Free), 0, 0, 1, 1},
  {&__pyx_n_s_GALERKIN, __pyx_k_GALERKIN, sizeof(__pyx_k_GALERKIN), 0, 0, 1, 1},
  {&__pyx_n_s_GAMG, __pyx_k_GAMG, sizeof(__pyx_k_GAMG), 0, 0, 1, 1},
  {&__pyx_n_s_GAMGType, __pyx_k_GAMGType, sizeof(__pyx_k_GAMGType), 0, 0, 1, 1},
  {&__pyx_n_s_GASM, __pyx_k_GASM, sizeof(__pyx_k_GASM), 0, 0, 1, 1},
  {&__pyx_n_s_GASMType, __pyx_k_GASMType, sizeof(__pyx_k_GASMType), 0, 0, 1, 1},
  {&__pyx_n_s_GCR, __pyx_k_GCR, sizeof(__pyx_k_GCR), 0, 0, 1, 1},
  {&__pyx_n_s_GENERAL, __pyx_k_GENERAL, sizeof(__pyx_k_GENERAL), 0, 0, 1, 1},
  {&__pyx_n_s_GEO, __pyx_k_GEO, sizeof(__pyx_k_GEO), 0, 0, 1, 1},
  {&__pyx_n_s_GETROW_UPPERTRIANGULAR, __pyx_k_GETROW_UPPERTRIANGULAR, sizeof(__pyx_k_GETROW_UPPERTRIANGULAR), 0, 0, 1, 1},
  {&__pyx_n_s_GHOSTED, __pyx_k_GHOSTED, sizeof(__pyx_k_GHOSTED), 0, 0, 1, 1},
  {&__pyx_n_s_GL, __pyx_k_GL, sizeof(__pyx_k_GL), 0, 0, 1, 1},
  {&__pyx_n_s_GLMapType, __pyx_k_GLMapType, sizeof(__pyx_k_GLMapType), 0, 0, 1, 1},
  {&__pyx_n_s_GLOBAL_MAX, __pyx_k_GLOBAL_MAX, sizeof(__pyx_k_GLOBAL_MAX), 0, 0, 1, 1},
  {&__pyx_n_s_GLOBAL_SUM, __pyx_k_GLOBAL_SUM, sizeof(__pyx_k_GLOBAL_SUM), 0, 0, 1, 1},
  {&__pyx_n_s_GLTR, __pyx_k_GLTR, sizeof(__pyx_k_GLTR), 0, 0, 1, 1},
  {&__pyx_n_s_GMRES, __pyx_k_GMRES, sizeof(__pyx_k_GMRES), 0, 0, 1, 1},
  {&__pyx_n_s_GPCG, __pyx_k_GPCG, sizeof(__pyx_k_GPCG), 0, 0, 1, 1},
  {&__pyx_n_s_GROPPCG, __pyx_k_GROPPCG, sizeof(__pyx_k_GROPPCG), 0, 0, 1, 1},
  {&__pyx_n_s_Get_rank, __pyx_k_Get_rank, sizeof(__pyx_k_Get_rank), 0, 0, 1, 1},
  {&__pyx_n_s_Get_size, __pyx_k_Get_size, sizeof(__pyx_k_Get_size), 0, 0, 1, 1},
  {&__pyx_kp_s_Given_d_column_indices_but_d_non, __pyx_k_Given_d_column_indices_but_d_non, sizeof(__pyx_k_Given_d_column_indices_but_d_non), 0, 0, 1, 0},
  {&__pyx_n_s_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 0, 1, 1},
  {&__pyx_n_s_HALF, __pyx_k_HALF, sizeof(__pyx_k_HALF), 0, 0, 1, 1},
  {&__pyx_n_s_HALF_SIZE, __pyx_k_HALF_SIZE, sizeof(__pyx_k_HALF_SIZE), 0, 0, 1, 1},
  {&__pyx_n_s_HDF5, __pyx_k_HDF5, sizeof(__pyx_k_HDF5), 0, 0, 1, 1},
  {&__pyx_n_s_HDF5_VIZ, __pyx_k_HDF5_VIZ, sizeof(__pyx_k_HDF5_VIZ), 0, 0, 1, 1},
  {&__pyx_n_s_HERMITIAN, __pyx_k_HERMITIAN, sizeof(__pyx_k_HERMITIAN), 0, 0, 1, 1},
  {&__pyx_n_s_HYPRE, __pyx_k_HYPRE, sizeof(__pyx_k_HYPRE), 0, 0, 1, 1},
  {&__pyx_n_s_HYPRESSTRUCT, __pyx_k_HYPRESSTRUCT, sizeof(__pyx_k_HYPRESSTRUCT), 0, 0, 1, 1},
  {&__pyx_n_s_HYPRESTRUCT, __pyx_k_HYPRESTRUCT, sizeof(__pyx_k_HYPRESTRUCT), 0, 0, 1, 1},
  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
  {&__pyx_n_s_IBCGS, __pyx_k_IBCGS, sizeof(__pyx_k_IBCGS), 0, 0, 1, 1},
  {&__pyx_n_s_ICC, __pyx_k_ICC, sizeof(__pyx_k_ICC), 0, 0, 1, 1},
  {&__pyx_n_s_IGNORE_LOWER_TRIANGULAR, __pyx_k_IGNORE_LOWER_TRIANGULAR, sizeof(__pyx_k_IGNORE_LOWER_TRIANGULAR), 0, 0, 1, 1},
  {&__pyx_n_s_IGNORE_NEGATIVE_INDICES, __pyx_k_IGNORE_NEGATIVE_INDICES, sizeof(__pyx_k_IGNORE_NEGATIVE_INDICES), 0, 0, 1, 1},
  {&__pyx_n_s_IGNORE_OFF_PROC_ENTRIES, __pyx_k_IGNORE_OFF_PROC_ENTRIES, sizeof(__pyx_k_IGNORE_OFF_PROC_ENTRIES), 0, 0, 1, 1},
  {&__pyx_n_s_IGNORE_ZERO_ENTRIES, __pyx_k_IGNORE_ZERO_ENTRIES, sizeof(__pyx_k_IGNORE_ZERO_ENTRIES), 0, 0, 1, 1},
  {&__pyx_n_s_ILU, __pyx_k_ILU, sizeof(__pyx_k_ILU), 0, 0, 1, 1},
  {&__pyx_n_s_IMPLICIT, __pyx_k_IMPLICIT, sizeof(__pyx_k_IMPLICIT), 0, 0, 1, 1},
  {&__pyx_n_s_INBLOCKS, __pyx_k_INBLOCKS, sizeof(__pyx_k_INBLOCKS), 0, 0, 1, 1},
  {&__pyx_n_s_INF, __pyx_k_INF, sizeof(__pyx_k_INF), 0, 0, 1, 1},
  {&__pyx_n_s_INFINITY, __pyx_k_INFINITY, sizeof(__pyx_k_INFINITY), 0, 0, 1, 1},
  {&__pyx_n_s_INITIAL_FINAL_ONLY, __pyx_k_INITIAL_FINAL_ONLY, sizeof(__pyx_k_INITIAL_FINAL_ONLY), 0, 0, 1, 1},
  {&__pyx_n_s_INITIAL_ONLY, __pyx_k_INITIAL_ONLY, sizeof(__pyx_k_INITIAL_ONLY), 0, 0, 1, 1},
  {&__pyx_n_s_INSERT, __pyx_k_INSERT, sizeof(__pyx_k_INSERT), 0, 0, 1, 1},
  {&__pyx_n_s_INSERT_ALL, __pyx_k_INSERT_ALL, sizeof(__pyx_k_INSERT_ALL), 0, 0, 1, 1},
  {&__pyx_n_s_INSERT_ALL_VALUES, __pyx_k_INSERT_ALL_VALUES, sizeof(__pyx_k_INSERT_ALL_VALUES), 0, 0, 1, 1},
  {&__pyx_n_s_INSERT_BC, __pyx_k_INSERT_BC, sizeof(__pyx_k_INSERT_BC), 0, 0, 1, 1},
  {&__pyx_n_s_INSERT_BC_VALUES, __pyx_k_INSERT_BC_VALUES, sizeof(__pyx_k_INSERT_BC_VALUES), 0, 0, 1, 1},
  {&__pyx_n_s_INSERT_VALUES, __pyx_k_INSERT_VALUES, sizeof(__pyx_k_INSERT_VALUES), 0, 0, 1, 1},
  {&__pyx_n_s_INTERPOLATE, __pyx_k_INTERPOLATE, sizeof(__pyx_k_INTERPOLATE), 0, 0, 1, 1},
  {&__pyx_n_s_IPM, __pyx_k_IPM, sizeof(__pyx_k_IPM), 0, 0, 1, 1},
  {&__pyx_n_s_IS, __pyx_k_IS, sizeof(__pyx_k_IS), 0, 0, 1, 1},
  {&__pyx_n_s_ISType, __pyx_k_ISType, sizeof(__pyx_k_ISType), 0, 0, 1, 1},
  {&__pyx_n_s_ITERATING, __pyx_k_ITERATING, sizeof(__pyx_k_ITERATING), 0, 0, 1, 1},
  {&__pyx_kp_s_I_0_is_d_expected_d, __pyx_k_I_0_is_d_expected_d, sizeof(__pyx_k_I_0_is_d_expected_d), 0, 0, 1, 0},
  {&__pyx_n_s_InfoType, __pyx_k_InfoType, sizeof(__pyx_k_InfoType), 0, 0, 1, 1},
  {&__pyx_n_s_InsertMode, __pyx_k_InsertMode, sizeof(__pyx_k_InsertMode), 0, 0, 1, 1},
  {&__pyx_n_s_IntType, __pyx_k_IntType, sizeof(__pyx_k_IntType), 0, 0, 1, 1},
  {&__pyx_n_s_InterpolationType, __pyx_k_InterpolationType, sizeof(__pyx_k_InterpolationType), 0, 0, 1, 1},
  {&__pyx_kp_s_Invalid_mode_expected_rw_r_or_w, __pyx_k_Invalid_mode_expected_rw_r_or_w, sizeof(__pyx_k_Invalid_mode_expected_rw_r_or_w), 0, 0, 1, 0},
  {&__pyx_n_s_J, __pyx_k_J, sizeof(__pyx_k_J), 0, 0, 1, 1},
  {&__pyx_n_s_JACOBI, __pyx_k_JACOBI, sizeof(__pyx_k_JACOBI), 0, 0, 1, 1},
  {&__pyx_n_s_KACZMARZ, __pyx_k_KACZMARZ, sizeof(__pyx_k_KACZMARZ), 0, 0, 1, 1},
  {&__pyx_n_s_KASKADE, __pyx_k_KASKADE, sizeof(__pyx_k_KASKADE), 0, 0, 1, 1},
  {&__pyx_n_s_KEEP_NONZERO_PATTERN, __pyx_k_KEEP_NONZERO_PATTERN, sizeof(__pyx_k_KEEP_NONZERO_PATTERN), 0, 0, 1, 1},
  {&__pyx_n_s_KSP, __pyx_k_KSP, sizeof(__pyx_k_KSP), 0, 0, 1, 1},
  {&__pyx_n_s_KSPConvergedReason, __pyx_k_KSPConvergedReason, sizeof(__pyx_k_KSPConvergedReason), 0, 0, 1, 1},
  {&__pyx_n_s_KSPNormType, __pyx_k_KSPNormType, sizeof(__pyx_k_KSPNormType), 0, 0, 1, 1},
  {&__pyx_n_s_KSPONLY, __pyx_k_KSPONLY, sizeof(__pyx_k_KSPONLY), 0, 0, 1, 1},
  {&__pyx_n_s_KSPType, __pyx_k_KSPType, sizeof(__pyx_k_KSPType), 0, 0, 1, 1},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_n_s_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 1, 1},
  {&__pyx_n_s_LCD, __pyx_k_LCD, sizeof(__pyx_k_LCD), 0, 0, 1, 1},
  {&__pyx_n_s_LCL, __pyx_k_LCL, sizeof(__pyx_k_LCL), 0, 0, 1, 1},
  {&__pyx_n_s_LEFT, __pyx_k_LEFT, sizeof(__pyx_k_LEFT), 0, 0, 1, 1},
  {&__pyx_n_s_LGMRES, __pyx_k_LGMRES, sizeof(__pyx_k_LGMRES), 0, 0, 1, 1},
  {&__pyx_n_s_LINEAR, __pyx_k_LINEAR, sizeof(__pyx_k_LINEAR), 0, 0, 1, 1},
  {&__pyx_n_s_LMVM, __pyx_k_LMVM, sizeof(__pyx_k_LMVM), 0, 0, 1, 1},
  {&__pyx_n_s_LOCAL, __pyx_k_LOCAL, sizeof(__pyx_k_LOCAL), 0, 0, 1, 1},
  {&__pyx_n_s_LOCALREF, __pyx_k_LOCALREF, sizeof(__pyx_k_LOCALREF), 0, 0, 1, 1},
  {&__pyx_n_s_LOCAL_BACKWARD_SWEEP, __pyx_k_LOCAL_BACKWARD_SWEEP, sizeof(__pyx_k_LOCAL_BACKWARD_SWEEP), 0, 0, 1, 1},
  {&__pyx_n_s_LOCAL_FORWARD_SWEEP, __pyx_k_LOCAL_FORWARD_SWEEP, sizeof(__pyx_k_LOCAL_FORWARD_SWEEP), 0, 0, 1, 1},
  {&__pyx_n_s_LOCAL_SYMMETRIC_SWEEP, __pyx_k_LOCAL_SYMMETRIC_SWEEP, sizeof(__pyx_k_LOCAL_SYMMETRIC_SWEEP), 0, 0, 1, 1},
  {&__pyx_n_s_LOWER, __pyx_k_LOWER, sizeof(__pyx_k_LOWER), 0, 0, 1, 1},
  {&__pyx_n_s_LRC, __pyx_k_LRC, sizeof(__pyx_k_LRC), 0, 0, 1, 1},
  {&__pyx_n_s_LSC, __pyx_k_LSC, sizeof(__pyx_k_LSC), 0, 0, 1, 1},
  {&__pyx_n_s_LSQR, __pyx_k_LSQR, sizeof(__pyx_k_LSQR), 0, 0, 1, 1},
  {&__pyx_n_s_LU, __pyx_k_LU, sizeof(__pyx_k_LU), 0, 0, 1, 1},
  {&__pyx_n_s_Left, __pyx_k_Left, sizeof(__pyx_k_Left), 0, 0, 1, 1},
  {&__pyx_n_s_MAIJ, __pyx_k_MAIJ, sizeof(__pyx_k_MAIJ), 0, 0, 1, 1},
  {&__pyx_n_s_MAPPING, __pyx_k_MAPPING, sizeof(__pyx_k_MAPPING), 0, 0, 1, 1},
  {&__pyx_n_s_MASK, __pyx_k_MASK, sizeof(__pyx_k_MASK), 0, 0, 1, 1},
  {&__pyx_n_s_MAT, __pyx_k_MAT, sizeof(__pyx_k_MAT), 0, 0, 1, 1},
  {&__pyx_n_s_MATCHSTEP, __pyx_k_MATCHSTEP, sizeof(__pyx_k_MATCHSTEP), 0, 0, 1, 1},
  {&__pyx_n_s_MATHEMATICA, __pyx_k_MATHEMATICA, sizeof(__pyx_k_MATHEMATICA), 0, 0, 1, 1},
  {&__pyx_n_s_MATLAB, __pyx_k_MATLAB, sizeof(__pyx_k_MATLAB), 0, 0, 1, 1},
  {&__pyx_n_s_MAX, __pyx_k_MAX, sizeof(__pyx_k_MAX), 0, 0, 1, 1},
  {&__pyx_n_s_MAX_VALUES, __pyx_k_MAX_VALUES, sizeof(__pyx_k_MAX_VALUES), 0, 0, 1, 1},
  {&__pyx_n_s_MEMORYSCALABLE, __pyx_k_MEMORYSCALABLE, sizeof(__pyx_k_MEMORYSCALABLE), 0, 0, 1, 1},
  {&__pyx_n_s_MFFD, __pyx_k_MFFD, sizeof(__pyx_k_MFFD), 0, 0, 1, 1},
  {&__pyx_n_s_MG, __pyx_k_MG, sizeof(__pyx_k_MG), 0, 0, 1, 1},
  {&__pyx_n_s_MGType, __pyx_k_MGType, sizeof(__pyx_k_MGType), 0, 0, 1, 1},
  {&__pyx_n_s_MIMEX, __pyx_k_MIMEX, sizeof(__pyx_k_MIMEX), 0, 0, 1, 1},
  {&__pyx_n_s_MINRES, __pyx_k_MINRES, sizeof(__pyx_k_MINRES), 0, 0, 1, 1},
  {&__pyx_n_s_MIRROR, __pyx_k_MIRROR, sizeof(__pyx_k_MIRROR), 0, 0, 1, 1},
  {&__pyx_n_s_ML, __pyx_k_ML, sizeof(__pyx_k_ML), 0, 0, 1, 1},
  {&__pyx_n_s_MOAB, __pyx_k_MOAB, sizeof(__pyx_k_MOAB), 0, 0, 1, 1},
  {&__pyx_n_s_MPI, __pyx_k_MPI, sizeof(__pyx_k_MPI), 0, 0, 1, 1},
  {&__pyx_n_s_MPIADJ, __pyx_k_MPIADJ, sizeof(__pyx_k_MPIADJ), 0, 0, 1, 1},
  {&__pyx_n_s_MPIAIJ, __pyx_k_MPIAIJ, sizeof(__pyx_k_MPIAIJ), 0, 0, 1, 1},
  {&__pyx_n_s_MPIAIJCRL, __pyx_k_MPIAIJCRL, sizeof(__pyx_k_MPIAIJCRL), 0, 0, 1, 1},
  {&__pyx_n_s_MPIAIJCUSP, __pyx_k_MPIAIJCUSP, sizeof(__pyx_k_MPIAIJCUSP), 0, 0, 1, 1},
  {&__pyx_n_s_MPIAIJCUSPARSE, __pyx_k_MPIAIJCUSPARSE, sizeof(__pyx_k_MPIAIJCUSPARSE), 0, 0, 1, 1},
  {&__pyx_n_s_MPIAIJPERM, __pyx_k_MPIAIJPERM, sizeof(__pyx_k_MPIAIJPERM), 0, 0, 1, 1},
  {&__pyx_n_s_MPIAIJVIENNACL, __pyx_k_MPIAIJVIENNACL, sizeof(__pyx_k_MPIAIJVIENNACL), 0, 0, 1, 1},
  {&__pyx_n_s_MPIBAIJ, __pyx_k_MPIBAIJ, sizeof(__pyx_k_MPIBAIJ), 0, 0, 1, 1},
  {&__pyx_n_s_MPIBSTRM, __pyx_k_MPIBSTRM, sizeof(__pyx_k_MPIBSTRM), 0, 0, 1, 1},
  {&__pyx_n_s_MPICUSP, __pyx_k_MPICUSP, sizeof(__pyx_k_MPICUSP), 0, 0, 1, 1},
  {&__pyx_n_s_MPIDENSE, __pyx_k_MPIDENSE, sizeof(__pyx_k_MPIDENSE), 0, 0, 1, 1},
  {&__pyx_n_s_MPIMAIJ, __pyx_k_MPIMAIJ, sizeof(__pyx_k_MPIMAIJ), 0, 0, 1, 1},
  {&__pyx_n_s_MPISBAIJ, __pyx_k_MPISBAIJ, sizeof(__pyx_k_MPISBAIJ), 0, 0, 1, 1},
  {&__pyx_n_s_MPISBSTRM, __pyx_k_MPISBSTRM, sizeof(__pyx_k_MPISBSTRM), 0, 0, 1, 1},
  {&__pyx_n_s_MPIVIENNACL, __pyx_k_MPIVIENNACL, sizeof(__pyx_k_MPIVIENNACL), 0, 0, 1, 1},
  {&__pyx_n_s_MS, __pyx_k_MS, sizeof(__pyx_k_MS), 0, 0, 1, 1},
  {&__pyx_n_s_MULTIPLICATIVE, __pyx_k_MULTIPLICATIVE, sizeof(__pyx_k_MULTIPLICATIVE), 0, 0, 1, 1},
  {&__pyx_n_s_MapType, __pyx_k_MapType, sizeof(__pyx_k_MapType), 0, 0, 1, 1},
  {&__pyx_n_s_MatAssemblyType, __pyx_k_MatAssemblyType, sizeof(__pyx_k_MatAssemblyType), 0, 0, 1, 1},
  {&__pyx_n_s_MatFactorShiftType, __pyx_k_MatFactorShiftType, sizeof(__pyx_k_MatFactorShiftType), 0, 0, 1, 1},
  {&__pyx_n_s_MatInfoType, __pyx_k_MatInfoType, sizeof(__pyx_k_MatInfoType), 0, 0, 1, 1},
  {&__pyx_n_s_MatOption, __pyx_k_MatOption, sizeof(__pyx_k_MatOption), 0, 0, 1, 1},
  {&__pyx_n_s_MatOrderingType, __pyx_k_MatOrderingType, sizeof(__pyx_k_MatOrderingType), 0, 0, 1, 1},
  {&__pyx_n_s_MatSORType, __pyx_k_MatSORType, sizeof(__pyx_k_MatSORType), 0, 0, 1, 1},
  {&__pyx_n_s_MatStructure, __pyx_k_MatStructure, sizeof(__pyx_k_MatStructure), 0, 0, 1, 1},
  {&__pyx_n_s_MatType, __pyx_k_MatType, sizeof(__pyx_k_MatType), 0, 0, 1, 1},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__pyx_n_s_Mode, __pyx_k_Mode, sizeof(__pyx_k_Mode), 0, 0, 1, 1},
  {&__pyx_kp_s_Must_provide_as_many_communicato, __pyx_k_Must_provide_as_many_communicato, sizeof(__pyx_k_Must_provide_as_many_communicato), 0, 0, 1, 0},
  {&__pyx_kp_s_Must_provide_both_sizes_and_poin, __pyx_k_Must_provide_both_sizes_and_poin, sizeof(__pyx_k_Must_provide_both_sizes_and_poin), 0, 0, 1, 0},
  {&__pyx_n_s_N1, __pyx_k_N1, sizeof(__pyx_k_N1), 0, 0, 1, 1},
  {&__pyx_n_s_N12, __pyx_k_N12, sizeof(__pyx_k_N12), 0, 0, 1, 1},
  {&__pyx_n_s_N2, __pyx_k_N2, sizeof(__pyx_k_N2), 0, 0, 1, 1},
  {&__pyx_n_s_NASH, __pyx_k_NASH, sizeof(__pyx_k_NASH), 0, 0, 1, 1},
  {&__pyx_n_s_NASM, __pyx_k_NASM, sizeof(__pyx_k_NASM), 0, 0, 1, 1},
  {&__pyx_n_s_NATIVE, __pyx_k_NATIVE, sizeof(__pyx_k_NATIVE), 0, 0, 1, 1},
  {&__pyx_n_s_NATURAL, __pyx_k_NATURAL, sizeof(__pyx_k_NATURAL), 0, 0, 1, 1},
  {&__pyx_n_s_NCG, __pyx_k_NCG, sizeof(__pyx_k_NCG), 0, 0, 1, 1},
  {&__pyx_n_s_ND, __pyx_k_ND, sizeof(__pyx_k_ND), 0, 0, 1, 1},
  {&__pyx_n_s_NEST, __pyx_k_NEST, sizeof(__pyx_k_NEST), 0, 0, 1, 1},
  {&__pyx_n_s_NETCDF, __pyx_k_NETCDF, sizeof(__pyx_k_NETCDF), 0, 0, 1, 1},
  {&__pyx_n_s_NETWORK, __pyx_k_NETWORK, sizeof(__pyx_k_NETWORK), 0, 0, 1, 1},
  {&__pyx_n_s_NEWTONLS, __pyx_k_NEWTONLS, sizeof(__pyx_k_NEWTONLS), 0, 0, 1, 1},
  {&__pyx_n_s_NEWTONTR, __pyx_k_NEWTONTR, sizeof(__pyx_k_NEWTONTR), 0, 0, 1, 1},
  {&__pyx_n_s_NEW_DIAGONALS, __pyx_k_NEW_DIAGONALS, sizeof(__pyx_k_NEW_DIAGONALS), 0, 0, 1, 1},
  {&__pyx_n_s_NEW_NONZERO_ALLOCATION_ERR, __pyx_k_NEW_NONZERO_ALLOCATION_ERR, sizeof(__pyx_k_NEW_NONZERO_ALLOCATION_ERR), 0, 0, 1, 1},
  {&__pyx_n_s_NEW_NONZERO_LOCATIONS, __pyx_k_NEW_NONZERO_LOCATIONS, sizeof(__pyx_k_NEW_NONZERO_LOCATIONS), 0, 0, 1, 1},
  {&__pyx_n_s_NEW_NONZERO_LOCATION_ERR, __pyx_k_NEW_NONZERO_LOCATION_ERR, sizeof(__pyx_k_NEW_NONZERO_LOCATION_ERR), 0, 0, 1, 1},
  {&__pyx_n_s_NGMRES, __pyx_k_NGMRES, sizeof(__pyx_k_NGMRES), 0, 0, 1, 1},
  {&__pyx_n_s_NGS, __pyx_k_NGS, sizeof(__pyx_k_NGS), 0, 0, 1, 1},
  {&__pyx_n_s_NINFINITY, __pyx_k_NINFINITY, sizeof(__pyx_k_NINFINITY), 0, 0, 1, 1},
  {&__pyx_n_s_NLS, __pyx_k_NLS, sizeof(__pyx_k_NLS), 0, 0, 1, 1},
  {&__pyx_n_s_NM, __pyx_k_NM, sizeof(__pyx_k_NM), 0, 0, 1, 1},
  {&__pyx_n_s_NN, __pyx_k_NN, sizeof(__pyx_k_NN), 0, 0, 1, 1},
  {&__pyx_n_s_NO, __pyx_k_NO, sizeof(__pyx_k_NO), 0, 0, 1, 1},
  {&__pyx_n_s_NOFORMAT, __pyx_k_NOFORMAT, sizeof(__pyx_k_NOFORMAT), 0, 0, 1, 1},
  {&__pyx_n_s_NONE, __pyx_k_NONE, sizeof(__pyx_k_NONE), 0, 0, 1, 1},
  {&__pyx_n_s_NONLINEAR, __pyx_k_NONLINEAR, sizeof(__pyx_k_NONLINEAR), 0, 0, 1, 1},
  {&__pyx_n_s_NONZERO, __pyx_k_NONZERO, sizeof(__pyx_k_NONZERO), 0, 0, 1, 1},
  {&__pyx_n_s_NORMAL, __pyx_k_NORMAL, sizeof(__pyx_k_NORMAL), 0, 0, 1, 1},
  {&__pyx_n_s_NORMALHERMITIAN, __pyx_k_NORMALHERMITIAN, sizeof(__pyx_k_NORMALHERMITIAN), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_1, __pyx_k_NORM_1, sizeof(__pyx_k_NORM_1), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_1_AND_2, __pyx_k_NORM_1_AND_2, sizeof(__pyx_k_NORM_1_AND_2), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_2, __pyx_k_NORM_2, sizeof(__pyx_k_NORM_2), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_ALWAYS, __pyx_k_NORM_ALWAYS, sizeof(__pyx_k_NORM_ALWAYS), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_DEFAULT, __pyx_k_NORM_DEFAULT, sizeof(__pyx_k_NORM_DEFAULT), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_FINAL_ONLY, __pyx_k_NORM_FINAL_ONLY, sizeof(__pyx_k_NORM_FINAL_ONLY), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_FROBENIUS, __pyx_k_NORM_FROBENIUS, sizeof(__pyx_k_NORM_FROBENIUS), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_INFINITY, __pyx_k_NORM_INFINITY, sizeof(__pyx_k_NORM_INFINITY), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_INITIAL_FINAL_ONLY, __pyx_k_NORM_INITIAL_FINAL_ONLY, sizeof(__pyx_k_NORM_INITIAL_FINAL_ONLY), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_INITIAL_ONLY, __pyx_k_NORM_INITIAL_ONLY, sizeof(__pyx_k_NORM_INITIAL_ONLY), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_MAX, __pyx_k_NORM_MAX, sizeof(__pyx_k_NORM_MAX), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_NATURAL, __pyx_k_NORM_NATURAL, sizeof(__pyx_k_NORM_NATURAL), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_NONE, __pyx_k_NORM_NONE, sizeof(__pyx_k_NORM_NONE), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_PRECONDITIONED, __pyx_k_NORM_PRECONDITIONED, sizeof(__pyx_k_NORM_PRECONDITIONED), 0, 0, 1, 1},
  {&__pyx_n_s_NORM_UNPRECONDITIONED, __pyx_k_NORM_UNPRECONDITIONED, sizeof(__pyx_k_NORM_UNPRECONDITIONED), 0, 0, 1, 1},
  {&__pyx_n_s_NOT_SET_VALUES, __pyx_k_NOT_SET_VALUES, sizeof(__pyx_k_NOT_SET_VALUES), 0, 0, 1, 1},
  {&__pyx_n_s_NO_OFF_PROC_ENTRIES, __pyx_k_NO_OFF_PROC_ENTRIES, sizeof(__pyx_k_NO_OFF_PROC_ENTRIES), 0, 0, 1, 1},
  {&__pyx_n_s_NO_OFF_PROC_ZERO_ROWS, __pyx_k_NO_OFF_PROC_ZERO_ROWS, sizeof(__pyx_k_NO_OFF_PROC_ZERO_ROWS), 0, 0, 1, 1},
  {&__pyx_n_s_NRICHARDSON, __pyx_k_NRICHARDSON, sizeof(__pyx_k_NRICHARDSON), 0, 0, 1, 1},
  {&__pyx_n_s_NTL, __pyx_k_NTL, sizeof(__pyx_k_NTL), 0, 0, 1, 1},
  {&__pyx_n_s_NTR, __pyx_k_NTR, sizeof(__pyx_k_NTR), 0, 0, 1, 1},
  {&__pyx_n_s_NZ, __pyx_k_NZ, sizeof(__pyx_k_NZ), 0, 0, 1, 1},
  {&__pyx_n_s_NormSchedule, __pyx_k_NormSchedule, sizeof(__pyx_k_NormSchedule), 0, 0, 1, 1},
  {&__pyx_n_s_NormType, __pyx_k_NormType, sizeof(__pyx_k_NormType), 0, 0, 1, 1},
  {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 1, 1},
  {&__pyx_n_s_ODE_EXPLICIT, __pyx_k_ODE_EXPLICIT, sizeof(__pyx_k_ODE_EXPLICIT), 0, 0, 1, 1},
  {&__pyx_n_s_ODE_IMPLICIT, __pyx_k_ODE_IMPLICIT, sizeof(__pyx_k_ODE_IMPLICIT), 0, 0, 1, 1},
  {&__pyx_n_s_OWD, __pyx_k_OWD, sizeof(__pyx_k_OWD), 0, 0, 1, 1},
  {&__pyx_n_s_OWLQN, __pyx_k_OWLQN, sizeof(__pyx_k_OWLQN), 0, 0, 1, 1},
  {&__pyx_kp_s_Object_is_not_writable, __pyx_k_Object_is_not_writable, sizeof(__pyx_k_Object_is_not_writable), 0, 0, 1, 0},
  {&__pyx_n_s_Option, __pyx_k_Option, sizeof(__pyx_k_Option), 0, 0, 1, 1},
  {&__pyx_n_s_OrderingType, __pyx_k_OrderingType, sizeof(__pyx_k_OrderingType), 0, 0, 1, 1},
  {&__pyx_kp_s_Out_of_memory_Allocated_d_Used_b, __pyx_k_Out_of_memory_Allocated_d_Used_b, sizeof(__pyx_k_Out_of_memory_Allocated_d_Used_b), 0, 0, 1, 0},
  {&__pyx_n_s_P, __pyx_k_P, sizeof(__pyx_k_P), 0, 0, 1, 1},
  {&__pyx_n_s_P1, __pyx_k_P1, sizeof(__pyx_k_P1), 0, 0, 1, 1},
  {&__pyx_n_s_PARMETIS, __pyx_k_PARMETIS, sizeof(__pyx_k_PARMETIS), 0, 0, 1, 1},
  {&__pyx_n_s_PARMS, __pyx_k_PARMS, sizeof(__pyx_k_PARMS), 0, 0, 1, 1},
  {&__pyx_n_s_PATCH, __pyx_k_PATCH, sizeof(__pyx_k_PATCH), 0, 0, 1, 1},
  {&__pyx_n_s_PBJACOBI, __pyx_k_PBJACOBI, sizeof(__pyx_k_PBJACOBI), 0, 0, 1, 1},
  {&__pyx_n_s_PCASMType, __pyx_k_PCASMType, sizeof(__pyx_k_PCASMType), 0, 0, 1, 1},
  {&__pyx_n_s_PCCompositeType, __pyx_k_PCCompositeType, sizeof(__pyx_k_PCCompositeType), 0, 0, 1, 1},
  {&__pyx_n_s_PCFieldSplitSchurFactType, __pyx_k_PCFieldSplitSchurFactType, sizeof(__pyx_k_PCFieldSplitSchurFactType), 0, 0, 1, 1},
  {&__pyx_n_s_PCFieldSplitSchurPreType, __pyx_k_PCFieldSplitSchurPreType, sizeof(__pyx_k_PCFieldSplitSchurPreType), 0, 0, 1, 1},
  {&__pyx_n_s_PCGAMGType, __pyx_k_PCGAMGType, sizeof(__pyx_k_PCGAMGType), 0, 0, 1, 1},
  {&__pyx_n_s_PCGASMType, __pyx_k_PCGASMType, sizeof(__pyx_k_PCGASMType), 0, 0, 1, 1},
  {&__pyx_n_s_PCMGType, __pyx_k_PCMGType, sizeof(__pyx_k_PCMGType), 0, 0, 1, 1},
  {&__pyx_n_s_PCSide, __pyx_k_PCSide, sizeof(__pyx_k_PCSide), 0, 0, 1, 1},
  {&__pyx_n_s_PCType, __pyx_k_PCType, sizeof(__pyx_k_PCType), 0, 0, 1, 1},
  {&__pyx_n_s_PD, __pyx_k_PD, sizeof(__pyx_k_PD), 0, 0, 1, 1},
  {&__pyx_n_s_PERIODIC, __pyx_k_PERIODIC, sizeof(__pyx_k_PERIODIC), 0, 0, 1, 1},
  {&__pyx_kp_s_PETSc_Error_d, __pyx_k_PETSc_Error_d, sizeof(__pyx_k_PETSc_Error_d), 0, 0, 1, 0},
  {&__pyx_n_s_PFMG, __pyx_k_PFMG, sizeof(__pyx_k_PFMG), 0, 0, 1, 1},
  {&__pyx_n_s_PGMRES, __pyx_k_PGMRES, sizeof(__pyx_k_PGMRES), 0, 0, 1, 1},
  {&__pyx_n_s_PINFINITY, __pyx_k_PINFINITY, sizeof(__pyx_k_PINFINITY), 0, 0, 1, 1},
  {&__pyx_n_s_PIPECG, __pyx_k_PIPECG, sizeof(__pyx_k_PIPECG), 0, 0, 1, 1},
  {&__pyx_n_s_PIPECGRR, __pyx_k_PIPECGRR, sizeof(__pyx_k_PIPECGRR), 0, 0, 1, 1},
  {&__pyx_n_s_PIPECR, __pyx_k_PIPECR, sizeof(__pyx_k_PIPECR), 0, 0, 1, 1},
  {&__pyx_n_s_PIPEFCG, __pyx_k_PIPEFCG, sizeof(__pyx_k_PIPEFCG), 0, 0, 1, 1},
  {&__pyx_n_s_PIPEFGMRES, __pyx_k_PIPEFGMRES, sizeof(__pyx_k_PIPEFGMRES), 0, 0, 1, 1},
  {&__pyx_n_s_PIPEGCR, __pyx_k_PIPEGCR, sizeof(__pyx_k_PIPEGCR), 0, 0, 1, 1},
  {&__pyx_n_s_PLEX, __pyx_k_PLEX, sizeof(__pyx_k_PLEX), 0, 0, 1, 1},
  {&__pyx_n_s_POSITIVE_DEFINITE, __pyx_k_POSITIVE_DEFINITE, sizeof(__pyx_k_POSITIVE_DEFINITE), 0, 0, 1, 1},
  {&__pyx_n_s_POUNDERS, __pyx_k_POUNDERS, sizeof(__pyx_k_POUNDERS), 0, 0, 1, 1},
  {&__pyx_n_s_PREALLOCATOR, __pyx_k_PREALLOCATOR, sizeof(__pyx_k_PREALLOCATOR), 0, 0, 1, 1},
  {&__pyx_n_s_PRECONDITIONED, __pyx_k_PRECONDITIONED, sizeof(__pyx_k_PRECONDITIONED), 0, 0, 1, 1},
  {&__pyx_n_s_PREONLY, __pyx_k_PREONLY, sizeof(__pyx_k_PREONLY), 0, 0, 1, 1},
  {&__pyx_n_s_PSEUDO, __pyx_k_PSEUDO, sizeof(__pyx_k_PSEUDO), 0, 0, 1, 1},
  {&__pyx_n_s_PYTHON, __pyx_k_PYTHON, sizeof(__pyx_k_PYTHON), 0, 0, 1, 1},
  {&__pyx_n_s_PartitionerType, __pyx_k_PartitionerType, sizeof(__pyx_k_PartitionerType), 0, 0, 1, 1},
  {&__pyx_kp_u_Portable_Extensible_Toolkit_for, __pyx_k_Portable_Extensible_Toolkit_for, sizeof(__pyx_k_Portable_Extensible_Toolkit_for), 0, 1, 0, 0},
  {&__pyx_n_s_Print, __pyx_k_Print, sizeof(__pyx_k_Print), 0, 0, 1, 1},
  {&__pyx_n_s_ProblemType, __pyx_k_ProblemType, sizeof(__pyx_k_ProblemType), 0, 0, 1, 1},
  {&__pyx_n_s_Q0, __pyx_k_Q0, sizeof(__pyx_k_Q0), 0, 0, 1, 1},
  {&__pyx_n_s_Q1, __pyx_k_Q1, sizeof(__pyx_k_Q1), 0, 0, 1, 1},
  {&__pyx_n_s_QCG, __pyx_k_QCG, sizeof(__pyx_k_QCG), 0, 0, 1, 1},
  {&__pyx_n_s_QMD, __pyx_k_QMD, sizeof(__pyx_k_QMD), 0, 0, 1, 1},
  {&__pyx_n_s_QN, __pyx_k_QN, sizeof(__pyx_k_QN), 0, 0, 1, 1},
  {&__pyx_n_s_QUARTER, __pyx_k_QUARTER, sizeof(__pyx_k_QUARTER), 0, 0, 1, 1},
  {&__pyx_n_s_QUARTER_SIZE, __pyx_k_QUARTER_SIZE, sizeof(__pyx_k_QUARTER_SIZE), 0, 0, 1, 1},
  {&__pyx_n_s_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 0, 1, 1},
  {&__pyx_n_s_RAND, __pyx_k_RAND, sizeof(__pyx_k_RAND), 0, 0, 1, 1},
  {&__pyx_n_s_RAND48, __pyx_k_RAND48, sizeof(__pyx_k_RAND48), 0, 0, 1, 1},
  {&__pyx_n_s_RANDER48, __pyx_k_RANDER48, sizeof(__pyx_k_RANDER48), 0, 0, 1, 1},
  {&__pyx_n_s_RCM, __pyx_k_RCM, sizeof(__pyx_k_RCM), 0, 0, 1, 1},
  {&__pyx_n_s_READ, __pyx_k_READ, sizeof(__pyx_k_READ), 0, 0, 1, 1},
  {&__pyx_n_s_REDISTRIBUTE, __pyx_k_REDISTRIBUTE, sizeof(__pyx_k_REDISTRIBUTE), 0, 0, 1, 1},
  {&__pyx_n_s_REDUNDANT, __pyx_k_REDUNDANT, sizeof(__pyx_k_REDUNDANT), 0, 0, 1, 1},
  {&__pyx_n_s_RESTRICT, __pyx_k_RESTRICT, sizeof(__pyx_k_RESTRICT), 0, 0, 1, 1},
  {&__pyx_n_s_REVERSE, __pyx_k_REVERSE, sizeof(__pyx_k_REVERSE), 0, 0, 1, 1},
  {&__pyx_n_s_REVERSE_LOCAL, __pyx_k_REVERSE_LOCAL, sizeof(__pyx_k_REVERSE_LOCAL), 0, 0, 1, 1},
  {&__pyx_n_s_RICHARDSON, __pyx_k_RICHARDSON, sizeof(__pyx_k_RICHARDSON), 0, 0, 1, 1},
  {&__pyx_n_s_RIGHT, __pyx_k_RIGHT, sizeof(__pyx_k_RIGHT), 0, 0, 1, 1},
  {&__pyx_n_s_RK, __pyx_k_RK, sizeof(__pyx_k_RK), 0, 0, 1, 1},
  {&__pyx_n_s_ROSW, __pyx_k_ROSW, sizeof(__pyx_k_ROSW), 0, 0, 1, 1},
  {&__pyx_n_s_ROWLENGTH, __pyx_k_ROWLENGTH, sizeof(__pyx_k_ROWLENGTH), 0, 0, 1, 1},
  {&__pyx_n_s_ROW_ORIENTED, __pyx_k_ROW_ORIENTED, sizeof(__pyx_k_ROW_ORIENTED), 0, 0, 1, 1},
  {&__pyx_n_s_RUNGE_KUTTA, __pyx_k_RUNGE_KUTTA, sizeof(__pyx_k_RUNGE_KUTTA), 0, 0, 1, 1},
  {&__pyx_n_s_RandomType, __pyx_k_RandomType, sizeof(__pyx_k_RandomType), 0, 0, 1, 1},
  {&__pyx_n_s_RealType, __pyx_k_RealType, sizeof(__pyx_k_RealType), 0, 0, 1, 1},
  {&__pyx_n_s_Reason, __pyx_k_Reason, sizeof(__pyx_k_Reason), 0, 0, 1, 1},
  {&__pyx_n_s_Right, __pyx_k_Right, sizeof(__pyx_k_Right), 0, 0, 1, 1},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 0, 1, 1},
  {&__pyx_n_s_SACUSP, __pyx_k_SACUSP, sizeof(__pyx_k_SACUSP), 0, 0, 1, 1},
  {&__pyx_n_s_SACUSPPOLY, __pyx_k_SACUSPPOLY, sizeof(__pyx_k_SACUSPPOLY), 0, 0, 1, 1},
  {&__pyx_n_s_SAME, __pyx_k_SAME, sizeof(__pyx_k_SAME), 0, 0, 1, 1},
  {&__pyx_n_s_SAME_NONZERO_PATTERN, __pyx_k_SAME_NONZERO_PATTERN, sizeof(__pyx_k_SAME_NONZERO_PATTERN), 0, 0, 1, 1},
  {&__pyx_n_s_SAME_NZ, __pyx_k_SAME_NZ, sizeof(__pyx_k_SAME_NZ), 0, 0, 1, 1},
  {&__pyx_n_s_SAWS, __pyx_k_SAWS, sizeof(__pyx_k_SAWS), 0, 0, 1, 1},
  {&__pyx_n_s_SBAIJ, __pyx_k_SBAIJ, sizeof(__pyx_k_SBAIJ), 0, 0, 1, 1},
  {&__pyx_n_s_SBSTRM, __pyx_k_SBSTRM, sizeof(__pyx_k_SBSTRM), 0, 0, 1, 1},
  {&__pyx_n_s_SCATTER, __pyx_k_SCATTER, sizeof(__pyx_k_SCATTER), 0, 0, 1, 1},
  {&__pyx_n_s_SCATTER_FORWARD, __pyx_k_SCATTER_FORWARD, sizeof(__pyx_k_SCATTER_FORWARD), 0, 0, 1, 1},
  {&__pyx_n_s_SCATTER_FORWARD_LOCAL, __pyx_k_SCATTER_FORWARD_LOCAL, sizeof(__pyx_k_SCATTER_FORWARD_LOCAL), 0, 0, 1, 1},
  {&__pyx_n_s_SCATTER_LOCAL, __pyx_k_SCATTER_LOCAL, sizeof(__pyx_k_SCATTER_LOCAL), 0, 0, 1, 1},
  {&__pyx_n_s_SCATTER_REVERSE, __pyx_k_SCATTER_REVERSE, sizeof(__pyx_k_SCATTER_REVERSE), 0, 0, 1, 1},
  {&__pyx_n_s_SCATTER_REVERSE_LOCAL, __pyx_k_SCATTER_REVERSE_LOCAL, sizeof(__pyx_k_SCATTER_REVERSE_LOCAL), 0, 0, 1, 1},
  {&__pyx_n_s_SCHUR, __pyx_k_SCHUR, sizeof(__pyx_k_SCHUR), 0, 0, 1, 1},
  {&__pyx_n_s_SCHURCOMPLEMENT, __pyx_k_SCHURCOMPLEMENT, sizeof(__pyx_k_SCHURCOMPLEMENT), 0, 0, 1, 1},
  {&__pyx_n_s_SELF, __pyx_k_SELF, sizeof(__pyx_k_SELF), 0, 0, 1, 1},
  {&__pyx_n_s_SELFP, __pyx_k_SELFP, sizeof(__pyx_k_SELFP), 0, 0, 1, 1},
  {&__pyx_n_s_SEQ, __pyx_k_SEQ, sizeof(__pyx_k_SEQ), 0, 0, 1, 1},
  {&__pyx_n_s_SEQAIJ, __pyx_k_SEQAIJ, sizeof(__pyx_k_SEQAIJ), 0, 0, 1, 1},
  {&__pyx_n_s_SEQAIJCRL, __pyx_k_SEQAIJCRL, sizeof(__pyx_k_SEQAIJCRL), 0, 0, 1, 1},
  {&__pyx_n_s_SEQAIJCUSP, __pyx_k_SEQAIJCUSP, sizeof(__pyx_k_SEQAIJCUSP), 0, 0, 1, 1},
  {&__pyx_n_s_SEQAIJCUSPARSE, __pyx_k_SEQAIJCUSPARSE, sizeof(__pyx_k_SEQAIJCUSPARSE), 0, 0, 1, 1},
  {&__pyx_n_s_SEQAIJPERM, __pyx_k_SEQAIJPERM, sizeof(__pyx_k_SEQAIJPERM), 0, 0, 1, 1},
  {&__pyx_n_s_SEQAIJVIENNACL, __pyx_k_SEQAIJVIENNACL, sizeof(__pyx_k_SEQAIJVIENNACL), 0, 0, 1, 1},
  {&__pyx_n_s_SEQBAIJ, __pyx_k_SEQBAIJ, sizeof(__pyx_k_SEQBAIJ), 0, 0, 1, 1},
  {&__pyx_n_s_SEQBSTRM, __pyx_k_SEQBSTRM, sizeof(__pyx_k_SEQBSTRM), 0, 0, 1, 1},
  {&__pyx_n_s_SEQCUFFT, __pyx_k_SEQCUFFT, sizeof(__pyx_k_SEQCUFFT), 0, 0, 1, 1},
  {&__pyx_n_s_SEQCUSP, __pyx_k_SEQCUSP, sizeof(__pyx_k_SEQCUSP), 0, 0, 1, 1},
  {&__pyx_n_s_SEQDENSE, __pyx_k_SEQDENSE, sizeof(__pyx_k_SEQDENSE), 0, 0, 1, 1},
  {&__pyx_n_s_SEQMAIJ, __pyx_k_SEQMAIJ, sizeof(__pyx_k_SEQMAIJ), 0, 0, 1, 1},
  {&__pyx_n_s_SEQSBAIJ, __pyx_k_SEQSBAIJ, sizeof(__pyx_k_SEQSBAIJ), 0, 0, 1, 1},
  {&__pyx_n_s_SEQSBSTRM, __pyx_k_SEQSBSTRM, sizeof(__pyx_k_SEQSBSTRM), 0, 0, 1, 1},
  {&__pyx_n_s_SEQVIENNACL, __pyx_k_SEQVIENNACL, sizeof(__pyx_k_SEQVIENNACL), 0, 0, 1, 1},
  {&__pyx_n_s_SFType, __pyx_k_SFType, sizeof(__pyx_k_SFType), 0, 0, 1, 1},
  {&__pyx_n_s_SHARED, __pyx_k_SHARED, sizeof(__pyx_k_SHARED), 0, 0, 1, 1},
  {&__pyx_n_s_SHELL, __pyx_k_SHELL, sizeof(__pyx_k_SHELL), 0, 0, 1, 1},
  {&__pyx_n_s_SLICED, __pyx_k_SLICED, sizeof(__pyx_k_SLICED), 0, 0, 1, 1},
  {&__pyx_n_s_SNESConvergedReason, __pyx_k_SNESConvergedReason, sizeof(__pyx_k_SNESConvergedReason), 0, 0, 1, 1},
  {&__pyx_n_s_SNESNormSchedule, __pyx_k_SNESNormSchedule, sizeof(__pyx_k_SNESNormSchedule), 0, 0, 1, 1},
  {&__pyx_n_s_SNESType, __pyx_k_SNESType, sizeof(__pyx_k_SNESType), 0, 0, 1, 1},
  {&__pyx_n_s_SOCKET, __pyx_k_SOCKET, sizeof(__pyx_k_SOCKET), 0, 0, 1, 1},
  {&__pyx_n_s_SOR, __pyx_k_SOR, sizeof(__pyx_k_SOR), 0, 0, 1, 1},
  {&__pyx_n_s_SORType, __pyx_k_SORType, sizeof(__pyx_k_SORType), 0, 0, 1, 1},
  {&__pyx_n_s_SPAI, __pyx_k_SPAI, sizeof(__pyx_k_SPAI), 0, 0, 1, 1},
  {&__pyx_n_s_SPD, __pyx_k_SPD, sizeof(__pyx_k_SPD), 0, 0, 1, 1},
  {&__pyx_n_s_SPECIAL, __pyx_k_SPECIAL, sizeof(__pyx_k_SPECIAL), 0, 0, 1, 1},
  {&__pyx_n_s_SPECTRAL, __pyx_k_SPECTRAL, sizeof(__pyx_k_SPECTRAL), 0, 0, 1, 1},
  {&__pyx_n_s_SPRNG, __pyx_k_SPRNG, sizeof(__pyx_k_SPRNG), 0, 0, 1, 1},
  {&__pyx_n_s_SSFLS, __pyx_k_SSFLS, sizeof(__pyx_k_SSFLS), 0, 0, 1, 1},
  {&__pyx_n_s_SSILS, __pyx_k_SSILS, sizeof(__pyx_k_SSILS), 0, 0, 1, 1},
  {&__pyx_n_s_SSP, __pyx_k_SSP, sizeof(__pyx_k_SSP), 0, 0, 1, 1},
  {&__pyx_n_s_STANDARD, __pyx_k_STANDARD, sizeof(__pyx_k_STANDARD), 0, 0, 1, 1},
  {&__pyx_n_s_STAR, __pyx_k_STAR, sizeof(__pyx_k_STAR), 0, 0, 1, 1},
  {&__pyx_n_s_STCG, __pyx_k_STCG, sizeof(__pyx_k_STCG), 0, 0, 1, 1},
  {&__pyx_n_s_STDERR, __pyx_k_STDERR, sizeof(__pyx_k_STDERR), 0, 0, 1, 1},
  {&__pyx_n_s_STDOUT, __pyx_k_STDOUT, sizeof(__pyx_k_STDOUT), 0, 0, 1, 1},
  {&__pyx_n_s_STEPOVER, __pyx_k_STEPOVER, sizeof(__pyx_k_STEPOVER), 0, 0, 1, 1},
  {&__pyx_n_s_STRIDE, __pyx_k_STRIDE, sizeof(__pyx_k_STRIDE), 0, 0, 1, 1},
  {&__pyx_n_s_STRING, __pyx_k_STRING, sizeof(__pyx_k_STRING), 0, 0, 1, 1},
  {&__pyx_n_s_STRUCTURALLY_SYMMETRIC, __pyx_k_STRUCTURALLY_SYMMETRIC, sizeof(__pyx_k_STRUCTURALLY_SYMMETRIC), 0, 0, 1, 1},
  {&__pyx_n_s_SUBMATRIX, __pyx_k_SUBMATRIX, sizeof(__pyx_k_SUBMATRIX), 0, 0, 1, 1},
  {&__pyx_n_s_SUBSET, __pyx_k_SUBSET, sizeof(__pyx_k_SUBSET), 0, 0, 1, 1},
  {&__pyx_n_s_SUBSET_NONZERO_PATTERN, __pyx_k_SUBSET_NONZERO_PATTERN, sizeof(__pyx_k_SUBSET_NONZERO_PATTERN), 0, 0, 1, 1},
  {&__pyx_n_s_SUBSET_NZ, __pyx_k_SUBSET_NZ, sizeof(__pyx_k_SUBSET_NZ), 0, 0, 1, 1},
  {&__pyx_n_s_SUBSET_OFF_PROC_ENTRIES, __pyx_k_SUBSET_OFF_PROC_ENTRIES, sizeof(__pyx_k_SUBSET_OFF_PROC_ENTRIES), 0, 0, 1, 1},
  {&__pyx_n_s_SUNDIALS, __pyx_k_SUNDIALS, sizeof(__pyx_k_SUNDIALS), 0, 0, 1, 1},
  {&__pyx_n_s_SVD, __pyx_k_SVD, sizeof(__pyx_k_SVD), 0, 0, 1, 1},
  {&__pyx_n_s_SYMMETRIC, __pyx_k_SYMMETRIC, sizeof(__pyx_k_SYMMETRIC), 0, 0, 1, 1},
  {&__pyx_n_s_SYMMETRIC_MULTIPLICATIVE, __pyx_k_SYMMETRIC_MULTIPLICATIVE, sizeof(__pyx_k_SYMMETRIC_MULTIPLICATIVE), 0, 0, 1, 1},
  {&__pyx_n_s_SYMMETRY_ETERNAL, __pyx_k_SYMMETRY_ETERNAL, sizeof(__pyx_k_SYMMETRY_ETERNAL), 0, 0, 1, 1},
  {&__pyx_n_s_SYMMETRY_SWEEP, __pyx_k_SYMMETRY_SWEEP, sizeof(__pyx_k_SYMMETRY_SWEEP), 0, 0, 1, 1},
  {&__pyx_n_s_SYMMLQ, __pyx_k_SYMMLQ, sizeof(__pyx_k_SYMMLQ), 0, 0, 1, 1},
  {&__pyx_n_s_SYSPFMG, __pyx_k_SYSPFMG, sizeof(__pyx_k_SYSPFMG), 0, 0, 1, 1},
  {&__pyx_n_s_ScalarType, __pyx_k_ScalarType, sizeof(__pyx_k_ScalarType), 0, 0, 1, 1},
  {&__pyx_n_s_ScatterMode, __pyx_k_ScatterMode, sizeof(__pyx_k_ScatterMode), 0, 0, 1, 1},
  {&__pyx_n_s_SchurFactType, __pyx_k_SchurFactType, sizeof(__pyx_k_SchurFactType), 0, 0, 1, 1},
  {&__pyx_n_s_SchurPreType, __pyx_k_SchurPreType, sizeof(__pyx_k_SchurPreType), 0, 0, 1, 1},
  {&__pyx_n_s_Side, __pyx_k_Side, sizeof(__pyx_k_Side), 0, 0, 1, 1},
  {&__pyx_n_s_Size, __pyx_k_Size, sizeof(__pyx_k_Size), 0, 0, 1, 1},
  {&__pyx_n_s_Stage, __pyx_k_Stage, sizeof(__pyx_k_Stage), 0, 0, 1, 1},
  {&__pyx_n_s_Stencil, __pyx_k_Stencil, sizeof(__pyx_k_Stencil), 0, 0, 1, 1},
  {&__pyx_n_s_StencilType, __pyx_k_StencilType, sizeof(__pyx_k_StencilType), 0, 0, 1, 1},
  {&__pyx_n_s_Structure, __pyx_k_Structure, sizeof(__pyx_k_Structure), 0, 0, 1, 1},
  {&__pyx_n_s_SystemError, __pyx_k_SystemError, sizeof(__pyx_k_SystemError), 0, 0, 1, 1},
  {&__pyx_n_s_TAOConvergedReason, __pyx_k_TAOConvergedReason, sizeof(__pyx_k_TAOConvergedReason), 0, 0, 1, 1},
  {&__pyx_n_s_TAOType, __pyx_k_TAOType, sizeof(__pyx_k_TAOType), 0, 0, 1, 1},
  {&__pyx_kp_s_TAO_Solver_Termination_Reasons, __pyx_k_TAO_Solver_Termination_Reasons, sizeof(__pyx_k_TAO_Solver_Termination_Reasons), 0, 0, 1, 0},
  {&__pyx_kp_s_TAO_Solver_Types, __pyx_k_TAO_Solver_Types, sizeof(__pyx_k_TAO_Solver_Types), 0, 0, 1, 0},
  {&__pyx_n_s_TCQMR, __pyx_k_TCQMR, sizeof(__pyx_k_TCQMR), 0, 0, 1, 1},
  {&__pyx_n_s_TELESCOPE, __pyx_k_TELESCOPE, sizeof(__pyx_k_TELESCOPE), 0, 0, 1, 1},
  {&__pyx_n_s_TEST, __pyx_k_TEST, sizeof(__pyx_k_TEST), 0, 0, 1, 1},
  {&__pyx_n_s_TFQMR, __pyx_k_TFQMR, sizeof(__pyx_k_TFQMR), 0, 0, 1, 1},
  {&__pyx_n_s_TFS, __pyx_k_TFS, sizeof(__pyx_k_TFS), 0, 0, 1, 1},
  {&__pyx_n_s_TH, __pyx_k_TH, sizeof(__pyx_k_TH), 0, 0, 1, 1},
  {&__pyx_n_s_THETA, __pyx_k_THETA, sizeof(__pyx_k_THETA), 0, 0, 1, 1},
  {&__pyx_n_s_THIRD, __pyx_k_THIRD, sizeof(__pyx_k_THIRD), 0, 0, 1, 1},
  {&__pyx_n_s_THIRD_SIZE, __pyx_k_THIRD_SIZE, sizeof(__pyx_k_THIRD_SIZE), 0, 0, 1, 1},
  {&__pyx_n_s_TRANSPOSEMAT, __pyx_k_TRANSPOSEMAT, sizeof(__pyx_k_TRANSPOSEMAT), 0, 0, 1, 1},
  {&__pyx_n_s_TRON, __pyx_k_TRON, sizeof(__pyx_k_TRON), 0, 0, 1, 1},
  {&__pyx_n_s_TSConvergedReason, __pyx_k_TSConvergedReason, sizeof(__pyx_k_TSConvergedReason), 0, 0, 1, 1},
  {&__pyx_n_s_TSEquationType, __pyx_k_TSEquationType, sizeof(__pyx_k_TSEquationType), 0, 0, 1, 1},
  {&__pyx_n_s_TSExactFinalTime, __pyx_k_TSExactFinalTime, sizeof(__pyx_k_TSExactFinalTime), 0, 0, 1, 1},
  {&__pyx_n_s_TSIRM, __pyx_k_TSIRM, sizeof(__pyx_k_TSIRM), 0, 0, 1, 1},
  {&__pyx_n_s_TSProblemType, __pyx_k_TSProblemType, sizeof(__pyx_k_TSProblemType), 0, 0, 1, 1},
  {&__pyx_n_s_TSType, __pyx_k_TSType, sizeof(__pyx_k_TSType), 0, 0, 1, 1},
  {&__pyx_n_s_TWIST, __pyx_k_TWIST, sizeof(__pyx_k_TWIST), 0, 0, 1, 1},
  {&__pyx_n_s_Type, __pyx_k_Type, sizeof(__pyx_k_Type), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_U, __pyx_k_U, sizeof(__pyx_k_U), 0, 0, 1, 1},
  {&__pyx_n_s_UA, __pyx_k_UA, sizeof(__pyx_k_UA), 0, 0, 1, 1},
  {&__pyx_n_s_UNPRECONDITIONED, __pyx_k_UNPRECONDITIONED, sizeof(__pyx_k_UNPRECONDITIONED), 0, 0, 1, 1},
  {&__pyx_n_s_UNSPECIFIED, __pyx_k_UNSPECIFIED, sizeof(__pyx_k_UNSPECIFIED), 0, 0, 1, 1},
  {&__pyx_n_s_UNUSED_NONZERO_LOCATION_ERR, __pyx_k_UNUSED_NONZERO_LOCATION_ERR, sizeof(__pyx_k_UNUSED_NONZERO_LOCATION_ERR), 0, 0, 1, 1},
  {&__pyx_n_s_UPDATE, __pyx_k_UPDATE, sizeof(__pyx_k_UPDATE), 0, 0, 1, 1},
  {&__pyx_n_s_UPPER, __pyx_k_UPPER, sizeof(__pyx_k_UPPER), 0, 0, 1, 1},
  {&__pyx_n_s_USER, __pyx_k_USER, sizeof(__pyx_k_USER), 0, 0, 1, 1},
  {&__pyx_n_s_USE_HASH_TABLE, __pyx_k_USE_HASH_TABLE, sizeof(__pyx_k_USE_HASH_TABLE), 0, 0, 1, 1},
  {&__pyx_n_s_USE_INODES, __pyx_k_USE_INODES, sizeof(__pyx_k_USE_INODES), 0, 0, 1, 1},
  {&__pyx_n_s_V, __pyx_k_V, sizeof(__pyx_k_V), 0, 0, 1, 1},
  {&__pyx_n_s_VIENNACL, __pyx_k_VIENNACL, sizeof(__pyx_k_VIENNACL), 0, 0, 1, 1},
  {&__pyx_n_s_VINEWTONRSLS, __pyx_k_VINEWTONRSLS, sizeof(__pyx_k_VINEWTONRSLS), 0, 0, 1, 1},
  {&__pyx_n_s_VINEWTONSSLS, __pyx_k_VINEWTONSSLS, sizeof(__pyx_k_VINEWTONSSLS), 0, 0, 1, 1},
  {&__pyx_n_s_VTK, __pyx_k_VTK, sizeof(__pyx_k_VTK), 0, 0, 1, 1},
  {&__pyx_n_s_VTK_VTR, __pyx_k_VTK_VTR, sizeof(__pyx_k_VTK_VTR), 0, 0, 1, 1},
  {&__pyx_n_s_VTK_VTS, __pyx_k_VTK_VTS, sizeof(__pyx_k_VTK_VTS), 0, 0, 1, 1},
  {&__pyx_n_s_VTK_VTU, __pyx_k_VTK_VTU, sizeof(__pyx_k_VTK_VTU), 0, 0, 1, 1},
  {&__pyx_n_s_VU, __pyx_k_VU, sizeof(__pyx_k_VU), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_VecOption, __pyx_k_VecOption, sizeof(__pyx_k_VecOption), 0, 0, 1, 1},
  {&__pyx_n_s_VecType, __pyx_k_VecType, sizeof(__pyx_k_VecType), 0, 0, 1, 1},
  {&__pyx_kp_s_Vector_local_size_d_is_not_compa, __pyx_k_Vector_local_size_d_is_not_compa, sizeof(__pyx_k_Vector_local_size_d_is_not_compa), 0, 0, 1, 0},
  {&__pyx_n_s_ViewerFormat, __pyx_k_ViewerFormat, sizeof(__pyx_k_ViewerFormat), 0, 0, 1, 1},
  {&__pyx_n_s_ViewerType, __pyx_k_ViewerType, sizeof(__pyx_k_ViewerType), 0, 0, 1, 1},
  {&__pyx_n_s_W, __pyx_k_W, sizeof(__pyx_k_W), 0, 0, 1, 1},
  {&__pyx_n_s_WBM, __pyx_k_WBM, sizeof(__pyx_k_WBM), 0, 0, 1, 1},
  {&__pyx_n_s_WINDOW, __pyx_k_WINDOW, sizeof(__pyx_k_WINDOW), 0, 0, 1, 1},
  {&__pyx_n_s_WRITE, __pyx_k_WRITE, sizeof(__pyx_k_WRITE), 0, 0, 1, 1},
  {&__pyx_n_s_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 0, 1, 1},
  {&__pyx_n_s_ZERO_INITIAL_GUESS, __pyx_k_ZERO_INITIAL_GUESS, sizeof(__pyx_k_ZERO_INITIAL_GUESS), 0, 0, 1, 1},
  {&__pyx_kp_s__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 0},
  {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
  {&__pyx_kp_s__32, __pyx_k__32, sizeof(__pyx_k__32), 0, 0, 1, 0},
  {&__pyx_kp_b__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 0, 0},
  {&__pyx_kp_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 0},
  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  {&__pyx_kp_s_a_2, __pyx_k_a_2, sizeof(__pyx_k_a_2), 0, 0, 1, 0},
  {&__pyx_n_s_abort, __pyx_k_abort, sizeof(__pyx_k_abort), 0, 0, 1, 1},
  {&__pyx_kp_s_accessing_non_existent_buffer_se, __pyx_k_accessing_non_existent_buffer_se, sizeof(__pyx_k_accessing_non_existent_buffer_se), 0, 0, 1, 0},
  {&__pyx_n_s_addFlops, __pyx_k_addFlops, sizeof(__pyx_k_addFlops), 0, 0, 1, 1},
  {&__pyx_n_s_addv, __pyx_k_addv, sizeof(__pyx_k_addv), 0, 0, 1, 1},
  {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
  {&__pyx_n_s_alpha2, __pyx_k_alpha2, sizeof(__pyx_k_alpha2), 0, 0, 1, 1},
  {&__pyx_n_s_alpha_f, __pyx_k_alpha_f, sizeof(__pyx_k_alpha_f), 0, 0, 1, 1},
  {&__pyx_n_s_alpha_m, __pyx_k_alpha_m, sizeof(__pyx_k_alpha_m), 0, 0, 1, 1},
  {&__pyx_n_s_alphas, __pyx_k_alphas, sizeof(__pyx_k_alphas), 0, 0, 1, 1},
  {&__pyx_n_s_amount, __pyx_k_amount, sizeof(__pyx_k_amount), 0, 0, 1, 1},
  {&__pyx_n_s_app, __pyx_k_app, sizeof(__pyx_k_app), 0, 0, 1, 1},
  {&__pyx_n_s_appctx, __pyx_k_appctx, sizeof(__pyx_k_appctx), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_apply, __pyx_k_apply, sizeof(__pyx_k_apply), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
  {&__pyx_n_s_array_interface, __pyx_k_array_interface, sizeof(__pyx_k_array_interface), 0, 0, 1, 1},
  {&__pyx_kp_s_array_size_d_and_vector_local_si, __pyx_k_array_size_d_and_vector_local_si, sizeof(__pyx_k_array_size_d_and_vector_local_si), 0, 0, 1, 0},
  {&__pyx_kp_s_array_size_d_incompatible_with_v, __pyx_k_array_size_d_incompatible_with_v, sizeof(__pyx_k_array_size_d_incompatible_with_v), 0, 0, 1, 0},
  {&__pyx_n_s_array_w, __pyx_k_array_w, sizeof(__pyx_k_array_w), 0, 0, 1, 1},
  {&__pyx_n_s_asmtype, __pyx_k_asmtype, sizeof(__pyx_k_asmtype), 0, 0, 1, 1},
  {&__pyx_n_s_assemblies, __pyx_k_assemblies, sizeof(__pyx_k_assemblies), 0, 0, 1, 1},
  {&__pyx_n_s_assembly, __pyx_k_assembly, sizeof(__pyx_k_assembly), 0, 0, 1, 1},
  {&__pyx_n_s_atol, __pyx_k_atol, sizeof(__pyx_k_atol), 0, 0, 1, 1},
  {&__pyx_n_s_attr, __pyx_k_attr, sizeof(__pyx_k_attr), 0, 0, 1, 1},
  {&__pyx_n_s_au, __pyx_k_au, sizeof(__pyx_k_au), 0, 0, 1, 1},
  {&__pyx_n_s_author, __pyx_k_author, sizeof(__pyx_k_author), 0, 0, 1, 1},
  {&__pyx_n_s_authorinfo, __pyx_k_authorinfo, sizeof(__pyx_k_authorinfo), 0, 0, 1, 1},
  {&__pyx_n_s_axpy, __pyx_k_axpy, sizeof(__pyx_k_axpy), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_barrier, __pyx_k_barrier, sizeof(__pyx_k_barrier), 0, 0, 1, 1},
  {&__pyx_n_s_bcComps, __pyx_k_bcComps, sizeof(__pyx_k_bcComps), 0, 0, 1, 1},
  {&__pyx_n_s_bcField, __pyx_k_bcField, sizeof(__pyx_k_bcField), 0, 0, 1, 1},
  {&__pyx_n_s_bcPoints, __pyx_k_bcPoints, sizeof(__pyx_k_bcPoints), 0, 0, 1, 1},
  {&__pyx_kp_s_bcPoints_is_a_required_argument, __pyx_k_bcPoints_is_a_required_argument, sizeof(__pyx_k_bcPoints_is_a_required_argument), 0, 0, 1, 0},
  {&__pyx_n_s_begin, __pyx_k_begin, sizeof(__pyx_k_begin), 0, 0, 1, 1},
  {&__pyx_n_s_begin_args, __pyx_k_begin_args, sizeof(__pyx_k_begin_args), 0, 0, 1, 1},
  {&__pyx_n_s_begin_kargs, __pyx_k_begin_kargs, sizeof(__pyx_k_begin_kargs), 0, 0, 1, 1},
  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
  {&__pyx_n_s_block_size, __pyx_k_block_size, sizeof(__pyx_k_block_size), 0, 0, 1, 1},
  {&__pyx_kp_s_block_size_d_must_be_positive, __pyx_k_block_size_d_must_be_positive, sizeof(__pyx_k_block_size_d_must_be_positive), 0, 0, 1, 0},
  {&__pyx_kp_s_block_size_not_set, __pyx_k_block_size_not_set, sizeof(__pyx_k_block_size_not_set), 0, 0, 1, 0},
  {&__pyx_n_s_boundary, __pyx_k_boundary, sizeof(__pyx_k_boundary), 0, 0, 1, 1},
  {&__pyx_n_s_boundary_type, __pyx_k_boundary_type, sizeof(__pyx_k_boundary_type), 0, 0, 1, 1},
  {&__pyx_n_s_box, __pyx_k_box, sizeof(__pyx_k_box), 0, 0, 1, 1},
  {&__pyx_n_s_bs, __pyx_k_bs, sizeof(__pyx_k_bs), 0, 0, 1, 1},
  {&__pyx_n_s_bsize, __pyx_k_bsize, sizeof(__pyx_k_bsize), 0, 0, 1, 1},
  {&__pyx_n_s_buffer_w, __pyx_k_buffer_w, sizeof(__pyx_k_buffer_w), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_kp_s_c_d, __pyx_k_c_d, sizeof(__pyx_k_c_d), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_place_input_array_size_d, __pyx_k_cannot_place_input_array_size_d, sizeof(__pyx_k_cannot_place_input_array_size_d), 0, 0, 1, 0},
  {&__pyx_n_s_catol, __pyx_k_catol, sizeof(__pyx_k_catol), 0, 0, 1, 1},
  {&__pyx_n_s_cell, __pyx_k_cell, sizeof(__pyx_k_cell), 0, 0, 1, 1},
  {&__pyx_kp_s_cell_indices_must_have_two_dimen, __pyx_k_cell_indices_must_have_two_dimen, sizeof(__pyx_k_cell_indices_must_have_two_dimen), 0, 0, 1, 0},
  {&__pyx_n_s_cells, __pyx_k_cells, sizeof(__pyx_k_cells), 0, 0, 1, 1},
  {&__pyx_n_s_cgid, __pyx_k_cgid, sizeof(__pyx_k_cgid), 0, 0, 1, 1},
  {&__pyx_n_s_citation, __pyx_k_citation, sizeof(__pyx_k_citation), 0, 0, 1, 1},
  {&__pyx_n_s_cmap, __pyx_k_cmap, sizeof(__pyx_k_cmap), 0, 0, 1, 1},
  {&__pyx_n_s_coarsen, __pyx_k_coarsen, sizeof(__pyx_k_coarsen), 0, 0, 1, 1},
  {&__pyx_n_s_col, __pyx_k_col, sizeof(__pyx_k_col), 0, 0, 1, 1},
  {&__pyx_n_s_col_bsize, __pyx_k_col_bsize, sizeof(__pyx_k_col_bsize), 0, 0, 1, 1},
  {&__pyx_n_s_cols, __pyx_k_cols, sizeof(__pyx_k_cols), 0, 0, 1, 1},
  {&__pyx_n_s_column, __pyx_k_column, sizeof(__pyx_k_column), 0, 0, 1, 1},
  {&__pyx_kp_s_column_indices_must_have_two_dim, __pyx_k_column_indices_must_have_two_dim, sizeof(__pyx_k_column_indices_must_have_two_dim), 0, 0, 1, 0},
  {&__pyx_n_s_comm, __pyx_k_comm, sizeof(__pyx_k_comm), 0, 0, 1, 1},
  {&__pyx_n_s_comms, __pyx_k_comms, sizeof(__pyx_k_comms), 0, 0, 1, 1},
  {&__pyx_kp_s_communicator_not_owned, __pyx_k_communicator_not_owned, sizeof(__pyx_k_communicator_not_owned), 0, 0, 1, 0},
  {&__pyx_n_s_compressed, __pyx_k_compressed, sizeof(__pyx_k_compressed), 0, 0, 1, 1},
  {&__pyx_n_s_cone, __pyx_k_cone, sizeof(__pyx_k_cone), 0, 0, 1, 1},
  {&__pyx_n_s_coneOrientation, __pyx_k_coneOrientation, sizeof(__pyx_k_coneOrientation), 0, 0, 1, 1},
  {&__pyx_n_s_conePoint, __pyx_k_conePoint, sizeof(__pyx_k_conePoint), 0, 0, 1, 1},
  {&__pyx_n_s_conePos, __pyx_k_conePos, sizeof(__pyx_k_conePos), 0, 0, 1, 1},
  {&__pyx_n_s_constant, __pyx_k_constant, sizeof(__pyx_k_constant), 0, 0, 1, 1},
  {&__pyx_n_s_constraints, __pyx_k_constraints, sizeof(__pyx_k_constraints), 0, 0, 1, 1},
  {&__pyx_n_s_context, __pyx_k_context, sizeof(__pyx_k_context), 0, 0, 1, 1},
  {&__pyx_n_s_converged, __pyx_k_converged, sizeof(__pyx_k_converged), 0, 0, 1, 1},
  {&__pyx_n_s_coordinates, __pyx_k_coordinates, sizeof(__pyx_k_coordinates), 0, 0, 1, 1},
  {&__pyx_kp_s_coordinates_must_have_two_dimens, __pyx_k_coordinates_must_have_two_dimens, sizeof(__pyx_k_coordinates_must_have_two_dimens), 0, 0, 1, 0},
  {&__pyx_n_s_coords, __pyx_k_coords, sizeof(__pyx_k_coords), 0, 0, 1, 1},
  {&__pyx_kp_s_coords_vertices_must_have_two_di, __pyx_k_coords_vertices_must_have_two_di, sizeof(__pyx_k_coords_vertices_must_have_two_di), 0, 0, 1, 0},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
  {&__pyx_n_s_crank, __pyx_k_crank, sizeof(__pyx_k_crank), 0, 0, 1, 1},
  {&__pyx_n_s_createGlobalVec, __pyx_k_createGlobalVec, sizeof(__pyx_k_createGlobalVec), 0, 0, 1, 1},
  {&__pyx_n_s_createGlobalVector, __pyx_k_createGlobalVector, sizeof(__pyx_k_createGlobalVector), 0, 0, 1, 1},
  {&__pyx_n_s_createLabel, __pyx_k_createLabel, sizeof(__pyx_k_createLabel), 0, 0, 1, 1},
  {&__pyx_n_s_createLocalVec, __pyx_k_createLocalVec, sizeof(__pyx_k_createLocalVec), 0, 0, 1, 1},
  {&__pyx_n_s_createLocalVector, __pyx_k_createLocalVector, sizeof(__pyx_k_createLocalVector), 0, 0, 1, 1},
  {&__pyx_n_s_createMat, __pyx_k_createMat, sizeof(__pyx_k_createMat), 0, 0, 1, 1},
  {&__pyx_n_s_createMatrix, __pyx_k_createMatrix, sizeof(__pyx_k_createMatrix), 0, 0, 1, 1},
  {&__pyx_n_s_createNaturalVec, __pyx_k_createNaturalVec, sizeof(__pyx_k_createNaturalVec), 0, 0, 1, 1},
  {&__pyx_n_s_createNaturalVector, __pyx_k_createNaturalVector, sizeof(__pyx_k_createNaturalVector), 0, 0, 1, 1},
  {&__pyx_n_s_createVecLeft, __pyx_k_createVecLeft, sizeof(__pyx_k_createVecLeft), 0, 0, 1, 1},
  {&__pyx_n_s_createVecRight, __pyx_k_createVecRight, sizeof(__pyx_k_createVecRight), 0, 0, 1, 1},
  {&__pyx_n_s_createVecs, __pyx_k_createVecs, sizeof(__pyx_k_createVecs), 0, 0, 1, 1},
  {&__pyx_n_s_create_gvec, __pyx_k_create_gvec, sizeof(__pyx_k_create_gvec), 0, 0, 1, 1},
  {&__pyx_n_s_create_injection, __pyx_k_create_injection, sizeof(__pyx_k_create_injection), 0, 0, 1, 1},
  {&__pyx_n_s_create_interpolation, __pyx_k_create_interpolation, sizeof(__pyx_k_create_interpolation), 0, 0, 1, 1},
  {&__pyx_n_s_create_lvec, __pyx_k_create_lvec, sizeof(__pyx_k_create_lvec), 0, 0, 1, 1},
  {&__pyx_n_s_create_matrix, __pyx_k_create_matrix, sizeof(__pyx_k_create_matrix), 0, 0, 1, 1},
  {&__pyx_n_s_create_subdm, __pyx_k_create_subdm, sizeof(__pyx_k_create_subdm), 0, 0, 1, 1},
  {&__pyx_n_s_crtol, __pyx_k_crtol, sizeof(__pyx_k_crtol), 0, 0, 1, 1},
  {&__pyx_n_s_csize, __pyx_k_csize, sizeof(__pyx_k_csize), 0, 0, 1, 1},
  {&__pyx_n_s_csr, __pyx_k_csr, sizeof(__pyx_k_csr), 0, 0, 1, 1},
  {&__pyx_n_s_ctype, __pyx_k_ctype, sizeof(__pyx_k_ctype), 0, 0, 1, 1},
  {&__pyx_kp_s_d_s, __pyx_k_d_s, sizeof(__pyx_k_d_s), 0, 0, 1, 0},
  {&__pyx_n_s_da, __pyx_k_da, sizeof(__pyx_k_da), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_date, __pyx_k_date, sizeof(__pyx_k_date), 0, 0, 1, 1},
  {&__pyx_n_s_debugger, __pyx_k_debugger, sizeof(__pyx_k_debugger), 0, 0, 1, 1},
  {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  {&__pyx_n_s_decomp, __pyx_k_decomp, sizeof(__pyx_k_decomp), 0, 0, 1, 1},
  {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
  {&__pyx_n_s_delValue, __pyx_k_delValue, sizeof(__pyx_k_delValue), 0, 0, 1, 1},
  {&__pyx_n_s_design, __pyx_k_design, sizeof(__pyx_k_design), 0, 0, 1, 1},
  {&__pyx_n_s_destroy, __pyx_k_destroy, sizeof(__pyx_k_destroy), 0, 0, 1, 1},
  {&__pyx_n_s_devel, __pyx_k_devel, sizeof(__pyx_k_devel), 0, 0, 1, 1},
  {&__pyx_n_s_diag, __pyx_k_diag, sizeof(__pyx_k_diag), 0, 0, 1, 1},
  {&__pyx_n_s_diagonalScale, __pyx_k_diagonalScale, sizeof(__pyx_k_diagonalScale), 0, 0, 1, 1},
  {&__pyx_n_s_diagonal_fill, __pyx_k_diagonal_fill, sizeof(__pyx_k_diagonal_fill), 0, 0, 1, 1},
  {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 0, 0, 1, 1},
  {&__pyx_n_s_dims, __pyx_k_dims, sizeof(__pyx_k_dims), 0, 0, 1, 1},
  {&__pyx_n_s_display, __pyx_k_display, sizeof(__pyx_k_display), 0, 0, 1, 1},
  {&__pyx_n_s_divtol, __pyx_k_divtol, sizeof(__pyx_k_divtol), 0, 0, 1, 1},
  {&__pyx_n_s_dm, __pyx_k_dm, sizeof(__pyx_k_dm), 0, 0, 1, 1},
  {&__pyx_n_s_dm_type, __pyx_k_dm_type, sizeof(__pyx_k_dm_type), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_dof, __pyx_k_dof, sizeof(__pyx_k_dof), 0, 0, 1, 1},
  {&__pyx_n_s_drop, __pyx_k_drop, sizeof(__pyx_k_drop), 0, 0, 1, 1},
  {&__pyx_n_s_dt, __pyx_k_dt, sizeof(__pyx_k_dt), 0, 0, 1, 1},
  {&__pyx_n_s_dtcol, __pyx_k_dtcol, sizeof(__pyx_k_dtcol), 0, 0, 1, 1},
  {&__pyx_n_s_dtcount, __pyx_k_dtcount, sizeof(__pyx_k_dtcount), 0, 0, 1, 1},
  {&__pyx_n_s_duplicate, __pyx_k_duplicate, sizeof(__pyx_k_duplicate), 0, 0, 1, 1},
  {&__pyx_n_s_edges, __pyx_k_edges, sizeof(__pyx_k_edges), 0, 0, 1, 1},
  {&__pyx_n_s_elem_type, __pyx_k_elem_type, sizeof(__pyx_k_elem_type), 0, 0, 1, 1},
  {&__pyx_n_s_emacs, __pyx_k_emacs, sizeof(__pyx_k_emacs), 0, 0, 1, 1},
  {&__pyx_kp_s_empty_citation, __pyx_k_empty_citation, sizeof(__pyx_k_empty_citation), 0, 0, 1, 0},
  {&__pyx_kp_s_empty_name, __pyx_k_empty_name, sizeof(__pyx_k_empty_name), 0, 0, 1, 0},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  {&__pyx_n_s_end_args, __pyx_k_end_args, sizeof(__pyx_k_end_args), 0, 0, 1, 1},
  {&__pyx_n_s_end_kargs, __pyx_k_end_kargs, sizeof(__pyx_k_end_kargs), 0, 0, 1, 1},
  {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
  {&__pyx_n_s_entry, __pyx_k_entry, sizeof(__pyx_k_entry), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_eqtype, __pyx_k_eqtype, sizeof(__pyx_k_eqtype), 0, 0, 1, 1},
  {&__pyx_n_s_errhandler, __pyx_k_errhandler, sizeof(__pyx_k_errhandler), 0, 0, 1, 1},
  {&__pyx_kp_s_error_code_d, __pyx_k_error_code_d, sizeof(__pyx_k_error_code_d), 0, 0, 1, 0},
  {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
  {&__pyx_n_s_exoid, __pyx_k_exoid, sizeof(__pyx_k_exoid), 0, 0, 1, 1},
  {&__pyx_kp_s_expecting_a_C_contiguous_array, __pyx_k_expecting_a_C_contiguous_array, sizeof(__pyx_k_expecting_a_C_contiguous_array), 0, 0, 1, 0},
  {&__pyx_kp_s_expecting_tuple_list_or_dict, __pyx_k_expecting_tuple_list_or_dict, sizeof(__pyx_k_expecting_tuple_list_or_dict), 0, 0, 1, 0},
  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
  {&__pyx_n_s_faces, __pyx_k_faces, sizeof(__pyx_k_faces), 0, 0, 1, 1},
  {&__pyx_n_s_factor_mallocs, __pyx_k_factor_mallocs, sizeof(__pyx_k_factor_mallocs), 0, 0, 1, 1},
  {&__pyx_n_s_field, __pyx_k_field, sizeof(__pyx_k_field), 0, 0, 1, 1},
  {&__pyx_n_s_fieldName, __pyx_k_fieldName, sizeof(__pyx_k_fieldName), 0, 0, 1, 1},
  {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
  {&__pyx_n_s_fill, __pyx_k_fill, sizeof(__pyx_k_fill), 0, 0, 1, 1},
  {&__pyx_n_s_fill_ratio_given, __pyx_k_fill_ratio_given, sizeof(__pyx_k_fill_ratio_given), 0, 0, 1, 1},
  {&__pyx_n_s_fill_ratio_needed, __pyx_k_fill_ratio_needed, sizeof(__pyx_k_fill_ratio_needed), 0, 0, 1, 1},
  {&__pyx_n_s_finalize, __pyx_k_finalize, sizeof(__pyx_k_finalize), 0, 0, 1, 1},
  {&__pyx_n_s_first, __pyx_k_first, sizeof(__pyx_k_first), 0, 0, 1, 1},
  {&__pyx_n_s_flag, __pyx_k_flag, sizeof(__pyx_k_flag), 0, 0, 1, 1},
  {&__pyx_n_s_flops, __pyx_k_flops, sizeof(__pyx_k_flops), 0, 0, 1, 1},
  {&__pyx_n_s_flush, __pyx_k_flush, sizeof(__pyx_k_flush), 0, 0, 1, 1},
  {&__pyx_n_s_fnorm, __pyx_k_fnorm, sizeof(__pyx_k_fnorm), 0, 0, 1, 1},
  {&__pyx_n_s_force, __pyx_k_force, sizeof(__pyx_k_force), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_forward, __pyx_k_forward, sizeof(__pyx_k_forward), 0, 0, 1, 1},
  {&__pyx_n_s_function, __pyx_k_function, sizeof(__pyx_k_function), 0, 0, 1, 1},
  {&__pyx_n_s_g, __pyx_k_g, sizeof(__pyx_k_g), 0, 0, 1, 1},
  {&__pyx_n_s_gamgtype, __pyx_k_gamgtype, sizeof(__pyx_k_gamgtype), 0, 0, 1, 1},
  {&__pyx_n_s_gamma, __pyx_k_gamma, sizeof(__pyx_k_gamma), 0, 0, 1, 1},
  {&__pyx_n_s_gasmtype, __pyx_k_gasmtype, sizeof(__pyx_k_gasmtype), 0, 0, 1, 1},
  {&__pyx_n_s_gatol, __pyx_k_gatol, sizeof(__pyx_k_gatol), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_getActive, __pyx_k_getActive, sizeof(__pyx_k_getActive), 0, 0, 1, 1},
  {&__pyx_n_s_getActiveAll, __pyx_k_getActiveAll, sizeof(__pyx_k_getActiveAll), 0, 0, 1, 1},
  {&__pyx_n_s_getAppCtx, __pyx_k_getAppCtx, sizeof(__pyx_k_getAppCtx), 0, 0, 1, 1},
  {&__pyx_n_s_getArray, __pyx_k_getArray, sizeof(__pyx_k_getArray), 0, 0, 1, 1},
  {&__pyx_n_s_getBlockIndices, __pyx_k_getBlockIndices, sizeof(__pyx_k_getBlockIndices), 0, 0, 1, 1},
  {&__pyx_n_s_getBlockInfo, __pyx_k_getBlockInfo, sizeof(__pyx_k_getBlockInfo), 0, 0, 1, 1},
  {&__pyx_n_s_getBlockSize, __pyx_k_getBlockSize, sizeof(__pyx_k_getBlockSize), 0, 0, 1, 1},
  {&__pyx_n_s_getBlockSizes, __pyx_k_getBlockSizes, sizeof(__pyx_k_getBlockSizes), 0, 0, 1, 1},
  {&__pyx_n_s_getBoundaryType, __pyx_k_getBoundaryType, sizeof(__pyx_k_getBoundaryType), 0, 0, 1, 1},
  {&__pyx_n_s_getBuffer, __pyx_k_getBuffer, sizeof(__pyx_k_getBuffer), 0, 0, 1, 1},
  {&__pyx_n_s_getCPUTime, __pyx_k_getCPUTime, sizeof(__pyx_k_getCPUTime), 0, 0, 1, 1},
  {&__pyx_n_s_getClassId, __pyx_k_getClassId, sizeof(__pyx_k_getClassId), 0, 0, 1, 1},
  {&__pyx_n_s_getClassName, __pyx_k_getClassName, sizeof(__pyx_k_getClassName), 0, 0, 1, 1},
  {&__pyx_n_s_getComm, __pyx_k_getComm, sizeof(__pyx_k_getComm), 0, 0, 1, 1},
  {&__pyx_n_s_getConstraintTolerances, __pyx_k_getConstraintTolerances, sizeof(__pyx_k_getConstraintTolerances), 0, 0, 1, 1},
  {&__pyx_n_s_getConvergedReason, __pyx_k_getConvergedReason, sizeof(__pyx_k_getConvergedReason), 0, 0, 1, 1},
  {&__pyx_n_s_getConvergenceHistory, __pyx_k_getConvergenceHistory, sizeof(__pyx_k_getConvergenceHistory), 0, 0, 1, 1},
  {&__pyx_n_s_getCorners, __pyx_k_getCorners, sizeof(__pyx_k_getCorners), 0, 0, 1, 1},
  {&__pyx_n_s_getDM, __pyx_k_getDM, sizeof(__pyx_k_getDM), 0, 0, 1, 1},
  {&__pyx_n_s_getDefaultComm, __pyx_k_getDefaultComm, sizeof(__pyx_k_getDefaultComm), 0, 0, 1, 1},
  {&__pyx_n_s_getDim, __pyx_k_getDim, sizeof(__pyx_k_getDim), 0, 0, 1, 1},
  {&__pyx_n_s_getDimension, __pyx_k_getDimension, sizeof(__pyx_k_getDimension), 0, 0, 1, 1},
  {&__pyx_n_s_getDof, __pyx_k_getDof, sizeof(__pyx_k_getDof), 0, 0, 1, 1},
  {&__pyx_n_s_getEquationType, __pyx_k_getEquationType, sizeof(__pyx_k_getEquationType), 0, 0, 1, 1},
  {&__pyx_n_s_getFlops, __pyx_k_getFlops, sizeof(__pyx_k_getFlops), 0, 0, 1, 1},
  {&__pyx_n_s_getFunctionTolerances, __pyx_k_getFunctionTolerances, sizeof(__pyx_k_getFunctionTolerances), 0, 0, 1, 1},
  {&__pyx_n_s_getFunctionValue, __pyx_k_getFunctionValue, sizeof(__pyx_k_getFunctionValue), 0, 0, 1, 1},
  {&__pyx_n_s_getGhostCorners, __pyx_k_getGhostCorners, sizeof(__pyx_k_getGhostCorners), 0, 0, 1, 1},
  {&__pyx_n_s_getGhostRanges, __pyx_k_getGhostRanges, sizeof(__pyx_k_getGhostRanges), 0, 0, 1, 1},
  {&__pyx_n_s_getGradient, __pyx_k_getGradient, sizeof(__pyx_k_getGradient), 0, 0, 1, 1},
  {&__pyx_n_s_getGradientTolerances, __pyx_k_getGradientTolerances, sizeof(__pyx_k_getGradientTolerances), 0, 0, 1, 1},
  {&__pyx_n_s_getIndices, __pyx_k_getIndices, sizeof(__pyx_k_getIndices), 0, 0, 1, 1},
  {&__pyx_n_s_getInfo, __pyx_k_getInfo, sizeof(__pyx_k_getInfo), 0, 0, 1, 1},
  {&__pyx_n_s_getInitialGuessKnoll, __pyx_k_getInitialGuessKnoll, sizeof(__pyx_k_getInitialGuessKnoll), 0, 0, 1, 1},
  {&__pyx_n_s_getInitialGuessNonzero, __pyx_k_getInitialGuessNonzero, sizeof(__pyx_k_getInitialGuessNonzero), 0, 0, 1, 1},
  {&__pyx_n_s_getInterval, __pyx_k_getInterval, sizeof(__pyx_k_getInterval), 0, 0, 1, 1},
  {&__pyx_n_s_getIterationNumber, __pyx_k_getIterationNumber, sizeof(__pyx_k_getIterationNumber), 0, 0, 1, 1},
  {&__pyx_n_s_getKSP, __pyx_k_getKSP, sizeof(__pyx_k_getKSP), 0, 0, 1, 1},
  {&__pyx_n_s_getKSPFailures, __pyx_k_getKSPFailures, sizeof(__pyx_k_getKSPFailures), 0, 0, 1, 1},
  {&__pyx_n_s_getLinearSolveFailures, __pyx_k_getLinearSolveFailures, sizeof(__pyx_k_getLinearSolveFailures), 0, 0, 1, 1},
  {&__pyx_n_s_getLocalSize, __pyx_k_getLocalSize, sizeof(__pyx_k_getLocalSize), 0, 0, 1, 1},
  {&__pyx_n_s_getMatrix, __pyx_k_getMatrix, sizeof(__pyx_k_getMatrix), 0, 0, 1, 1},
  {&__pyx_n_s_getMaxFunctionEvaluations, __pyx_k_getMaxFunctionEvaluations, sizeof(__pyx_k_getMaxFunctionEvaluations), 0, 0, 1, 1},
  {&__pyx_n_s_getMaxKSPFailures, __pyx_k_getMaxKSPFailures, sizeof(__pyx_k_getMaxKSPFailures), 0, 0, 1, 1},
  {&__pyx_n_s_getMaxLinearSolveFailures, __pyx_k_getMaxLinearSolveFailures, sizeof(__pyx_k_getMaxLinearSolveFailures), 0, 0, 1, 1},
  {&__pyx_n_s_getMaxNonlinearStepFailures, __pyx_k_getMaxNonlinearStepFailures, sizeof(__pyx_k_getMaxNonlinearStepFailures), 0, 0, 1, 1},
  {&__pyx_n_s_getMaxStepFailures, __pyx_k_getMaxStepFailures, sizeof(__pyx_k_getMaxStepFailures), 0, 0, 1, 1},
  {&__pyx_n_s_getMaxSteps, __pyx_k_getMaxSteps, sizeof(__pyx_k_getMaxSteps), 0, 0, 1, 1},
  {&__pyx_n_s_getMaxTime, __pyx_k_getMaxTime, sizeof(__pyx_k_getMaxTime), 0, 0, 1, 1},
  {&__pyx_n_s_getNPC, __pyx_k_getNPC, sizeof(__pyx_k_getNPC), 0, 0, 1, 1},
  {&__pyx_n_s_getName, __pyx_k_getName, sizeof(__pyx_k_getName), 0, 0, 1, 1},
  {&__pyx_n_s_getNonlinearStepFailures, __pyx_k_getNonlinearStepFailures, sizeof(__pyx_k_getNonlinearStepFailures), 0, 0, 1, 1},
  {&__pyx_n_s_getNormType, __pyx_k_getNormType, sizeof(__pyx_k_getNormType), 0, 0, 1, 1},
  {&__pyx_n_s_getNumber, __pyx_k_getNumber, sizeof(__pyx_k_getNumber), 0, 0, 1, 1},
  {&__pyx_n_s_getNumberDM, __pyx_k_getNumberDM, sizeof(__pyx_k_getNumberDM), 0, 0, 1, 1},
  {&__pyx_n_s_getObjectiveValue, __pyx_k_getObjectiveValue, sizeof(__pyx_k_getObjectiveValue), 0, 0, 1, 1},
  {&__pyx_n_s_getOperators, __pyx_k_getOperators, sizeof(__pyx_k_getOperators), 0, 0, 1, 1},
  {&__pyx_n_s_getOptionsPrefix, __pyx_k_getOptionsPrefix, sizeof(__pyx_k_getOptionsPrefix), 0, 0, 1, 1},
  {&__pyx_n_s_getOwnershipRange, __pyx_k_getOwnershipRange, sizeof(__pyx_k_getOwnershipRange), 0, 0, 1, 1},
  {&__pyx_n_s_getOwnershipRanges, __pyx_k_getOwnershipRanges, sizeof(__pyx_k_getOwnershipRanges), 0, 0, 1, 1},
  {&__pyx_n_s_getPC, __pyx_k_getPC, sizeof(__pyx_k_getPC), 0, 0, 1, 1},
  {&__pyx_n_s_getPCSide, __pyx_k_getPCSide, sizeof(__pyx_k_getPCSide), 0, 0, 1, 1},
  {&__pyx_n_s_getProblemType, __pyx_k_getProblemType, sizeof(__pyx_k_getProblemType), 0, 0, 1, 1},
  {&__pyx_n_s_getProcSizes, __pyx_k_getProcSizes, sizeof(__pyx_k_getProcSizes), 0, 0, 1, 1},
  {&__pyx_n_s_getRanges, __pyx_k_getRanges, sizeof(__pyx_k_getRanges), 0, 0, 1, 1},
  {&__pyx_n_s_getRank, __pyx_k_getRank, sizeof(__pyx_k_getRank), 0, 0, 1, 1},
  {&__pyx_n_s_getRefCount, __pyx_k_getRefCount, sizeof(__pyx_k_getRefCount), 0, 0, 1, 1},
  {&__pyx_n_s_getResidualNorm, __pyx_k_getResidualNorm, sizeof(__pyx_k_getResidualNorm), 0, 0, 1, 1},
  {&__pyx_n_s_getRhs, __pyx_k_getRhs, sizeof(__pyx_k_getRhs), 0, 0, 1, 1},
  {&__pyx_n_s_getSNES, __pyx_k_getSNES, sizeof(__pyx_k_getSNES), 0, 0, 1, 1},
  {&__pyx_n_s_getSeed, __pyx_k_getSeed, sizeof(__pyx_k_getSeed), 0, 0, 1, 1},
  {&__pyx_n_s_getSize, __pyx_k_getSize, sizeof(__pyx_k_getSize), 0, 0, 1, 1},
  {&__pyx_n_s_getSizes, __pyx_k_getSizes, sizeof(__pyx_k_getSizes), 0, 0, 1, 1},
  {&__pyx_n_s_getSolution, __pyx_k_getSolution, sizeof(__pyx_k_getSolution), 0, 0, 1, 1},
  {&__pyx_n_s_getSolutionNorm, __pyx_k_getSolutionNorm, sizeof(__pyx_k_getSolutionNorm), 0, 0, 1, 1},
  {&__pyx_n_s_getSolutionUpdate, __pyx_k_getSolutionUpdate, sizeof(__pyx_k_getSolutionUpdate), 0, 0, 1, 1},
  {&__pyx_n_s_getStencil, __pyx_k_getStencil, sizeof(__pyx_k_getStencil), 0, 0, 1, 1},
  {&__pyx_n_s_getStencilType, __pyx_k_getStencilType, sizeof(__pyx_k_getStencilType), 0, 0, 1, 1},
  {&__pyx_n_s_getStencilWidth, __pyx_k_getStencilWidth, sizeof(__pyx_k_getStencilWidth), 0, 0, 1, 1},
  {&__pyx_n_s_getStepFailures, __pyx_k_getStepFailures, sizeof(__pyx_k_getStepFailures), 0, 0, 1, 1},
  {&__pyx_n_s_getStepNumber, __pyx_k_getStepNumber, sizeof(__pyx_k_getStepNumber), 0, 0, 1, 1},
  {&__pyx_n_s_getString, __pyx_k_getString, sizeof(__pyx_k_getString), 0, 0, 1, 1},
  {&__pyx_n_s_getTime, __pyx_k_getTime, sizeof(__pyx_k_getTime), 0, 0, 1, 1},
  {&__pyx_n_s_getTimeStep, __pyx_k_getTimeStep, sizeof(__pyx_k_getTimeStep), 0, 0, 1, 1},
  {&__pyx_n_s_getTolerances, __pyx_k_getTolerances, sizeof(__pyx_k_getTolerances), 0, 0, 1, 1},
  {&__pyx_n_s_getType, __pyx_k_getType, sizeof(__pyx_k_getType), 0, 0, 1, 1},
  {&__pyx_n_s_getUseEW, __pyx_k_getUseEW, sizeof(__pyx_k_getUseEW), 0, 0, 1, 1},
  {&__pyx_n_s_getUseFD, __pyx_k_getUseFD, sizeof(__pyx_k_getUseFD), 0, 0, 1, 1},
  {&__pyx_n_s_getUseMF, __pyx_k_getUseMF, sizeof(__pyx_k_getUseMF), 0, 0, 1, 1},
  {&__pyx_n_s_getValue, __pyx_k_getValue, sizeof(__pyx_k_getValue), 0, 0, 1, 1},
  {&__pyx_n_s_getVecLeft, __pyx_k_getVecLeft, sizeof(__pyx_k_getVecLeft), 0, 0, 1, 1},
  {&__pyx_n_s_getVecRight, __pyx_k_getVecRight, sizeof(__pyx_k_getVecRight), 0, 0, 1, 1},
  {&__pyx_n_s_getVecs, __pyx_k_getVecs, sizeof(__pyx_k_getVecs), 0, 0, 1, 1},
  {&__pyx_n_s_getVersion, __pyx_k_getVersion, sizeof(__pyx_k_getVersion), 0, 0, 1, 1},
  {&__pyx_n_s_getVersionInfo, __pyx_k_getVersionInfo, sizeof(__pyx_k_getVersionInfo), 0, 0, 1, 1},
  {&__pyx_n_s_getVisible, __pyx_k_getVisible, sizeof(__pyx_k_getVisible), 0, 0, 1, 1},
  {&__pyx_n_s_ghosted, __pyx_k_ghosted, sizeof(__pyx_k_ghosted), 0, 0, 1, 1},
  {&__pyx_n_s_ghosts, __pyx_k_ghosts, sizeof(__pyx_k_ghosts), 0, 0, 1, 1},
  {&__pyx_kp_s_ghosts_size_d_array_size_d_and_v, __pyx_k_ghosts_size_d_array_size_d_and_v, sizeof(__pyx_k_ghosts_size_d_array_size_d_and_v), 0, 0, 1, 0},
  {&__pyx_kp_s_global_size_d_not_divisible_by_b, __pyx_k_global_size_d_not_divisible_by_b, sizeof(__pyx_k_global_size_d_not_divisible_by_b), 0, 0, 1, 0},
  {&__pyx_n_s_globalsec, __pyx_k_globalsec, sizeof(__pyx_k_globalsec), 0, 0, 1, 1},
  {&__pyx_n_s_gradient, __pyx_k_gradient, sizeof(__pyx_k_gradient), 0, 0, 1, 1},
  {&__pyx_n_s_group, __pyx_k_group, sizeof(__pyx_k_group), 0, 0, 1, 1},
  {&__pyx_n_s_grtol, __pyx_k_grtol, sizeof(__pyx_k_grtol), 0, 0, 1, 1},
  {&__pyx_n_s_gtol, __pyx_k_gtol, sizeof(__pyx_k_gtol), 0, 0, 1, 1},
  {&__pyx_n_s_gttol, __pyx_k_gttol, sizeof(__pyx_k_gttol), 0, 0, 1, 1},
  {&__pyx_n_s_gv, __pyx_k_gv, sizeof(__pyx_k_gv), 0, 0, 1, 1},
  {&__pyx_n_s_gvec, __pyx_k_gvec, sizeof(__pyx_k_gvec), 0, 0, 1, 1},
  {&__pyx_n_s_handle, __pyx_k_handle, sizeof(__pyx_k_handle), 0, 0, 1, 1},
  {&__pyx_n_s_hasLabel, __pyx_k_hasLabel, sizeof(__pyx_k_hasLabel), 0, 0, 1, 1},
  {&__pyx_n_s_hasLagrange, __pyx_k_hasLagrange, sizeof(__pyx_k_hasLagrange), 0, 0, 1, 1},
  {&__pyx_n_s_hasName, __pyx_k_hasName, sizeof(__pyx_k_hasName), 0, 0, 1, 1},
  {&__pyx_n_s_hessian, __pyx_k_hessian, sizeof(__pyx_k_hessian), 0, 0, 1, 1},
  {&__pyx_kp_s_home_devel_petsc4py_3_7_0_src_P, __pyx_k_home_devel_petsc4py_3_7_0_src_P, sizeof(__pyx_k_home_devel_petsc4py_3_7_0_src_P), 0, 0, 1, 0},
  {&__pyx_kp_s_home_devel_petsc4py_3_7_0_src_P_2, __pyx_k_home_devel_petsc4py_3_7_0_src_P_2, sizeof(__pyx_k_home_devel_petsc4py_3_7_0_src_P_2), 0, 0, 1, 0},
  {&__pyx_n_s_hypretype, __pyx_k_hypretype, sizeof(__pyx_k_hypretype), 0, 0, 1, 1},
  {&__pyx_n_s_icntl, __pyx_k_icntl, sizeof(__pyx_k_icntl), 0, 0, 1, 1},
  {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1},
  {&__pyx_n_s_idxm, __pyx_k_idxm, sizeof(__pyx_k_idxm), 0, 0, 1, 1},
  {&__pyx_n_s_ierr, __pyx_k_ierr, sizeof(__pyx_k_ierr), 0, 0, 1, 1},
  {&__pyx_n_s_ignore, __pyx_k_ignore, sizeof(__pyx_k_ignore), 0, 0, 1, 1},
  {&__pyx_n_s_imag, __pyx_k_imag, sizeof(__pyx_k_imag), 0, 0, 1, 1},
  {&__pyx_n_s_imex, __pyx_k_imex, sizeof(__pyx_k_imex), 0, 0, 1, 1},
  {&__pyx_n_s_imode, __pyx_k_imode, sizeof(__pyx_k_imode), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_inblocks, __pyx_k_inblocks, sizeof(__pyx_k_inblocks), 0, 0, 1, 1},
  {&__pyx_kp_s_incompatible_array_sizes, __pyx_k_incompatible_array_sizes, sizeof(__pyx_k_incompatible_array_sizes), 0, 0, 1, 0},
  {&__pyx_kp_s_incompatible_array_sizes_ni_d_nj, __pyx_k_incompatible_array_sizes_ni_d_nj, sizeof(__pyx_k_incompatible_array_sizes_ni_d_nj), 0, 0, 1, 0},
  {&__pyx_kp_s_incompatible_array_sizes_ni_d_nv, __pyx_k_incompatible_array_sizes_ni_d_nv, sizeof(__pyx_k_incompatible_array_sizes_ni_d_nv), 0, 0, 1, 0},
  {&__pyx_kp_s_incompatible_array_sizes_ni_d_nv_2, __pyx_k_incompatible_array_sizes_ni_d_nv_2, sizeof(__pyx_k_incompatible_array_sizes_ni_d_nv_2), 0, 0, 1, 0},
  {&__pyx_kp_s_incompatible_array_sizes_nv_d, __pyx_k_incompatible_array_sizes_nv_d, sizeof(__pyx_k_incompatible_array_sizes_nv_d), 0, 0, 1, 0},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1},
  {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
  {&__pyx_n_s_infoAllow, __pyx_k_infoAllow, sizeof(__pyx_k_infoAllow), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_initial_time, __pyx_k_initial_time, sizeof(__pyx_k_initial_time), 0, 0, 1, 1},
  {&__pyx_n_s_initial_time_step, __pyx_k_initial_time_step, sizeof(__pyx_k_initial_time_step), 0, 0, 1, 1},
  {&__pyx_n_s_initialguess, __pyx_k_initialguess, sizeof(__pyx_k_initialguess), 0, 0, 1, 1},
  {&__pyx_n_s_initialize, __pyx_k_initialize, sizeof(__pyx_k_initialize), 0, 0, 1, 1},
  {&__pyx_kp_s_input_arrays_have_incompatible_s, __pyx_k_input_arrays_have_incompatible_s, sizeof(__pyx_k_input_arrays_have_incompatible_s), 0, 0, 1, 0},
  {&__pyx_n_s_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 0, 1, 1},
  {&__pyx_n_s_interp_type, __pyx_k_interp_type, sizeof(__pyx_k_interp_type), 0, 0, 1, 1},
  {&__pyx_n_s_interpolate, __pyx_k_interpolate, sizeof(__pyx_k_interpolate), 0, 0, 1, 1},
  {&__pyx_n_s_interval, __pyx_k_interval, sizeof(__pyx_k_interval), 0, 0, 1, 1},
  {&__pyx_n_s_invert, __pyx_k_invert, sizeof(__pyx_k_invert), 0, 0, 1, 1},
  {&__pyx_n_s_isAssembled, __pyx_k_isAssembled, sizeof(__pyx_k_isAssembled), 0, 0, 1, 1},
  {&__pyx_n_s_isFinalized, __pyx_k_isFinalized, sizeof(__pyx_k_isFinalized), 0, 0, 1, 1},
  {&__pyx_n_s_isHermitian, __pyx_k_isHermitian, sizeof(__pyx_k_isHermitian), 0, 0, 1, 1},
  {&__pyx_n_s_isIdentity, __pyx_k_isIdentity, sizeof(__pyx_k_isIdentity), 0, 0, 1, 1},
  {&__pyx_n_s_isInitialized, __pyx_k_isInitialized, sizeof(__pyx_k_isInitialized), 0, 0, 1, 1},
  {&__pyx_n_s_isPermutation, __pyx_k_isPermutation, sizeof(__pyx_k_isPermutation), 0, 0, 1, 1},
  {&__pyx_n_s_isSorted, __pyx_k_isSorted, sizeof(__pyx_k_isSorted), 0, 0, 1, 1},
  {&__pyx_n_s_isStructurallySymmetric, __pyx_k_isStructurallySymmetric, sizeof(__pyx_k_isStructurallySymmetric), 0, 0, 1, 1},
  {&__pyx_n_s_isSymmetric, __pyx_k_isSymmetric, sizeof(__pyx_k_isSymmetric), 0, 0, 1, 1},
  {&__pyx_n_s_is_from, __pyx_k_is_from, sizeof(__pyx_k_is_from), 0, 0, 1, 1},
  {&__pyx_n_s_is_to, __pyx_k_is_to, sizeof(__pyx_k_is_to), 0, 0, 1, 1},
  {&__pyx_n_s_is_type, __pyx_k_is_type, sizeof(__pyx_k_is_type), 0, 0, 1, 1},
  {&__pyx_n_s_iscol, __pyx_k_iscol, sizeof(__pyx_k_iscol), 0, 0, 1, 1},
  {&__pyx_n_s_iscols, __pyx_k_iscols, sizeof(__pyx_k_iscols), 0, 0, 1, 1},
  {&__pyx_n_s_iset, __pyx_k_iset, sizeof(__pyx_k_iset), 0, 0, 1, 1},
  {&__pyx_n_s_isets, __pyx_k_isets, sizeof(__pyx_k_isets), 0, 0, 1, 1},
  {&__pyx_n_s_isperm, __pyx_k_isperm, sizeof(__pyx_k_isperm), 0, 0, 1, 1},
  {&__pyx_n_s_isrow, __pyx_k_isrow, sizeof(__pyx_k_isrow), 0, 0, 1, 1},
  {&__pyx_n_s_isrows, __pyx_k_isrows, sizeof(__pyx_k_isrows), 0, 0, 1, 1},
  {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
  {&__pyx_n_s_its, __pyx_k_its, sizeof(__pyx_k_its), 0, 0, 1, 1},
  {&__pyx_n_s_ival, __pyx_k_ival, sizeof(__pyx_k_ival), 0, 0, 1, 1},
  {&__pyx_n_s_jacobian, __pyx_k_jacobian, sizeof(__pyx_k_jacobian), 0, 0, 1, 1},
  {&__pyx_n_s_jacobian_design, __pyx_k_jacobian_design, sizeof(__pyx_k_jacobian_design), 0, 0, 1, 1},
  {&__pyx_n_s_jacobian_state, __pyx_k_jacobian_state, sizeof(__pyx_k_jacobian_state), 0, 0, 1, 1},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_kargs, __pyx_k_kargs, sizeof(__pyx_k_kargs), 0, 0, 1, 1},
  {&__pyx_kp_s_key_d_cannot_register_s_already, __pyx_k_key_d_cannot_register_s_already, sizeof(__pyx_k_key_d_cannot_register_s_already), 0, 0, 1, 0},
  {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  {&__pyx_n_s_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 0, 0, 1, 1},
  {&__pyx_n_s_klass, __pyx_k_klass, sizeof(__pyx_k_klass), 0, 0, 1, 1},
  {&__pyx_n_s_ksp, __pyx_k_ksp, sizeof(__pyx_k_ksp), 0, 0, 1, 1},
  {&__pyx_n_s_ksp_type, __pyx_k_ksp_type, sizeof(__pyx_k_ksp_type), 0, 0, 1, 1},
  {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
  {&__pyx_n_s_label, __pyx_k_label, sizeof(__pyx_k_label), 0, 0, 1, 1},
  {&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1},
  {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
  {&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1},
  {&__pyx_n_s_levels, __pyx_k_levels, sizeof(__pyx_k_levels), 0, 0, 1, 1},
  {&__pyx_n_s_lgmap, __pyx_k_lgmap, sizeof(__pyx_k_lgmap), 0, 0, 1, 1},
  {&__pyx_n_s_linear_its, __pyx_k_linear_its, sizeof(__pyx_k_linear_its), 0, 0, 1, 1},
  {&__pyx_n_s_lits, __pyx_k_lits, sizeof(__pyx_k_lits), 0, 0, 1, 1},
  {&__pyx_n_s_local, __pyx_k_local, sizeof(__pyx_k_local), 0, 0, 1, 1},
  {&__pyx_kp_s_local_and_global_sizes_cannot_be, __pyx_k_local_and_global_sizes_cannot_be, sizeof(__pyx_k_local_and_global_sizes_cannot_be), 0, 0, 1, 0},
  {&__pyx_kp_s_local_size_d_not_divisible_by_bl, __pyx_k_local_size_d_not_divisible_by_bl, sizeof(__pyx_k_local_size_d_not_divisible_by_bl), 0, 0, 1, 0},
  {&__pyx_n_s_localsec, __pyx_k_localsec, sizeof(__pyx_k_localsec), 0, 0, 1, 1},
  {&__pyx_n_s_locs, __pyx_k_locs, sizeof(__pyx_k_locs), 0, 0, 1, 1},
  {&__pyx_n_s_logFlops, __pyx_k_logFlops, sizeof(__pyx_k_logFlops), 0, 0, 1, 1},
  {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
  {&__pyx_n_s_ltog, __pyx_k_ltog, sizeof(__pyx_k_ltog), 0, 0, 1, 1},
  {&__pyx_n_s_ltol, __pyx_k_ltol, sizeof(__pyx_k_ltol), 0, 0, 1, 1},
  {&__pyx_n_s_lv, __pyx_k_lv, sizeof(__pyx_k_lv), 0, 0, 1, 1},
  {&__pyx_n_s_lvecs, __pyx_k_lvecs, sizeof(__pyx_k_lvecs), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_major, __pyx_k_major, sizeof(__pyx_k_major), 0, 0, 1, 1},
  {&__pyx_n_s_mallocs, __pyx_k_mallocs, sizeof(__pyx_k_mallocs), 0, 0, 1, 1},
  {&__pyx_n_s_map_type, __pyx_k_map_type, sizeof(__pyx_k_map_type), 0, 0, 1, 1},
  {&__pyx_n_s_mat, __pyx_k_mat, sizeof(__pyx_k_mat), 0, 0, 1, 1},
  {&__pyx_n_s_matMult, __pyx_k_matMult, sizeof(__pyx_k_matMult), 0, 0, 1, 1},
  {&__pyx_n_s_mat_type, __pyx_k_mat_type, sizeof(__pyx_k_mat_type), 0, 0, 1, 1},
  {&__pyx_n_s_mats, __pyx_k_mats, sizeof(__pyx_k_mats), 0, 0, 1, 1},
  {&__pyx_n_s_max_fails, __pyx_k_max_fails, sizeof(__pyx_k_max_fails), 0, 0, 1, 1},
  {&__pyx_n_s_max_funcs, __pyx_k_max_funcs, sizeof(__pyx_k_max_funcs), 0, 0, 1, 1},
  {&__pyx_n_s_max_it, __pyx_k_max_it, sizeof(__pyx_k_max_it), 0, 0, 1, 1},
  {&__pyx_n_s_max_steps, __pyx_k_max_steps, sizeof(__pyx_k_max_steps), 0, 0, 1, 1},
  {&__pyx_n_s_max_time, __pyx_k_max_time, sizeof(__pyx_k_max_time), 0, 0, 1, 1},
  {&__pyx_n_s_memo, __pyx_k_memo, sizeof(__pyx_k_memo), 0, 0, 1, 1},
  {&__pyx_n_s_memory, __pyx_k_memory, sizeof(__pyx_k_memory), 0, 0, 1, 1},
  {&__pyx_n_s_messageLength, __pyx_k_messageLength, sizeof(__pyx_k_messageLength), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_mgtype, __pyx_k_mgtype, sizeof(__pyx_k_mgtype), 0, 0, 1, 1},
  {&__pyx_n_s_minor, __pyx_k_minor, sizeof(__pyx_k_minor), 0, 0, 1, 1},
  {&__pyx_n_s_mirror, __pyx_k_mirror, sizeof(__pyx_k_mirror), 0, 0, 1, 1},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_n_s_model, __pyx_k_model, sizeof(__pyx_k_model), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_monitor, __pyx_k_monitor, sizeof(__pyx_k_monitor), 0, 0, 1, 1},
  {&__pyx_n_s_mpi4py, __pyx_k_mpi4py, sizeof(__pyx_k_mpi4py), 0, 0, 1, 1},
  {&__pyx_kp_s_mpi4py_MPI, __pyx_k_mpi4py_MPI, sizeof(__pyx_k_mpi4py_MPI), 0, 0, 1, 0},
  {&__pyx_n_s_mpiabort, __pyx_k_mpiabort, sizeof(__pyx_k_mpiabort), 0, 0, 1, 1},
  {&__pyx_n_s_mult, __pyx_k_mult, sizeof(__pyx_k_mult), 0, 0, 1, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__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_ncycle, __pyx_k_ncycle, sizeof(__pyx_k_ncycle), 0, 0, 1, 1},
  {&__pyx_n_s_newsec, __pyx_k_newsec, sizeof(__pyx_k_newsec), 0, 0, 1, 1},
  {&__pyx_n_s_newvec, __pyx_k_newvec, sizeof(__pyx_k_newvec), 0, 0, 1, 1},
  {&__pyx_n_s_nleaves, __pyx_k_nleaves, sizeof(__pyx_k_nleaves), 0, 0, 1, 1},
  {&__pyx_n_s_nlevels, __pyx_k_nlevels, sizeof(__pyx_k_nlevels), 0, 0, 1, 1},
  {&__pyx_n_s_nlocal, __pyx_k_nlocal, sizeof(__pyx_k_nlocal), 0, 0, 1, 1},
  {&__pyx_n_s_nmax, __pyx_k_nmax, sizeof(__pyx_k_nmax), 0, 0, 1, 1},
  {&__pyx_n_s_nmin, __pyx_k_nmin, sizeof(__pyx_k_nmin), 0, 0, 1, 1},
  {&__pyx_n_s_nnz, __pyx_k_nnz, sizeof(__pyx_k_nnz), 0, 0, 1, 1},
  {&__pyx_n_s_none, __pyx_k_none, sizeof(__pyx_k_none), 0, 0, 1, 1},
  {&__pyx_n_s_nonzero, __pyx_k_nonzero, sizeof(__pyx_k_nonzero), 0, 0, 1, 1},
  {&__pyx_n_s_nonzero_2, __pyx_k_nonzero_2, sizeof(__pyx_k_nonzero_2), 0, 0, 1, 1},
  {&__pyx_n_s_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 0, 0, 1, 1},
  {&__pyx_n_s_norm_type, __pyx_k_norm_type, sizeof(__pyx_k_norm_type), 0, 0, 1, 1},
  {&__pyx_n_s_normsched, __pyx_k_normsched, sizeof(__pyx_k_normsched), 0, 0, 1, 1},
  {&__pyx_n_s_normtype, __pyx_k_normtype, sizeof(__pyx_k_normtype), 0, 0, 1, 1},
  {&__pyx_n_s_nroots, __pyx_k_nroots, sizeof(__pyx_k_nroots), 0, 0, 1, 1},
  {&__pyx_n_s_nsd, __pyx_k_nsd, sizeof(__pyx_k_nsd), 0, 0, 1, 1},
  {&__pyx_n_s_nsp, __pyx_k_nsp, sizeof(__pyx_k_nsp), 0, 0, 1, 1},
  {&__pyx_n_s_nsubcomm, __pyx_k_nsubcomm, sizeof(__pyx_k_nsubcomm), 0, 0, 1, 1},
  {&__pyx_kp_s_null_communicator, __pyx_k_null_communicator, sizeof(__pyx_k_null_communicator), 0, 0, 1, 0},
  {&__pyx_n_s_numComp, __pyx_k_numComp, sizeof(__pyx_k_numComp), 0, 0, 1, 1},
  {&__pyx_n_s_numDof, __pyx_k_numDof, sizeof(__pyx_k_numDof), 0, 0, 1, 1},
  {&__pyx_n_s_numFields, __pyx_k_numFields, sizeof(__pyx_k_numFields), 0, 0, 1, 1},
  {&__pyx_n_s_numMessages, __pyx_k_numMessages, sizeof(__pyx_k_numMessages), 0, 0, 1, 1},
  {&__pyx_n_s_numProcs, __pyx_k_numProcs, sizeof(__pyx_k_numProcs), 0, 0, 1, 1},
  {&__pyx_n_s_numReductions, __pyx_k_numReductions, sizeof(__pyx_k_numReductions), 0, 0, 1, 1},
  {&__pyx_kp_s_number_of_dimensions_d_and_numbe, __pyx_k_number_of_dimensions_d_and_numbe, sizeof(__pyx_k_number_of_dimensions_d_and_numbe), 0, 0, 1, 0},
  {&__pyx_n_s_numcells, __pyx_k_numcells, sizeof(__pyx_k_numcells), 0, 0, 1, 1},
  {&__pyx_n_s_nz_allocated, __pyx_k_nz_allocated, sizeof(__pyx_k_nz_allocated), 0, 0, 1, 1},
  {&__pyx_n_s_nz_unneeded, __pyx_k_nz_unneeded, sizeof(__pyx_k_nz_unneeded), 0, 0, 1, 1},
  {&__pyx_n_s_nz_used, __pyx_k_nz_used, sizeof(__pyx_k_nz_used), 0, 0, 1, 1},
  {&__pyx_n_s_nzdiag, __pyx_k_nzdiag, sizeof(__pyx_k_nzdiag), 0, 0, 1, 1},
  {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
  {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  {&__pyx_n_s_objective, __pyx_k_objective, sizeof(__pyx_k_objective), 0, 0, 1, 1},
  {&__pyx_n_s_objgrad, __pyx_k_objgrad, sizeof(__pyx_k_objgrad), 0, 0, 1, 1},
  {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1},
  {&__pyx_n_s_omega, __pyx_k_omega, sizeof(__pyx_k_omega), 0, 0, 1, 1},
  {&__pyx_kp_s_only_and, __pyx_k_only_and, sizeof(__pyx_k_only_and), 0, 0, 1, 0},
  {&__pyx_n_s_operators, __pyx_k_operators, sizeof(__pyx_k_operators), 0, 0, 1, 1},
  {&__pyx_n_s_option, __pyx_k_option, sizeof(__pyx_k_option), 0, 0, 1, 1},
  {&__pyx_kp_s_option_prefix_must_be_string, __pyx_k_option_prefix_must_be_string, sizeof(__pyx_k_option_prefix_must_be_string), 0, 0, 1, 0},
  {&__pyx_kp_s_option_prefix_should_not_have_sp, __pyx_k_option_prefix_should_not_have_sp, sizeof(__pyx_k_option_prefix_should_not_have_sp), 0, 0, 1, 0},
  {&__pyx_kp_s_option_prefix_should_not_start_w, __pyx_k_option_prefix_should_not_start_w, sizeof(__pyx_k_option_prefix_should_not_start_w), 0, 0, 1, 0},
  {&__pyx_n_s_options, __pyx_k_options, sizeof(__pyx_k_options), 0, 0, 1, 1},
  {&__pyx_n_s_opts, __pyx_k_opts, sizeof(__pyx_k_opts), 0, 0, 1, 1},
  {&__pyx_n_s_ord_type, __pyx_k_ord_type, sizeof(__pyx_k_ord_type), 0, 0, 1, 1},
  {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1},
  {&__pyx_n_s_orientation, __pyx_k_orientation, sizeof(__pyx_k_orientation), 0, 0, 1, 1},
  {&__pyx_n_s_otype, __pyx_k_otype, sizeof(__pyx_k_otype), 0, 0, 1, 1},
  {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1},
  {&__pyx_n_s_output, __pyx_k_output, sizeof(__pyx_k_output), 0, 0, 1, 1},
  {&__pyx_n_s_overlap, __pyx_k_overlap, sizeof(__pyx_k_overlap), 0, 0, 1, 1},
  {&__pyx_kp_s_ownership_range_size_d_and_numbe, __pyx_k_ownership_range_size_d_and_numbe, sizeof(__pyx_k_ownership_range_size_d_and_numbe), 0, 0, 1, 0},
  {&__pyx_n_s_ownership_ranges, __pyx_k_ownership_ranges, sizeof(__pyx_k_ownership_ranges), 0, 0, 1, 1},
  {&__pyx_n_s_ozz, __pyx_k_ozz, sizeof(__pyx_k_ozz), 0, 0, 1, 1},
  {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  {&__pyx_n_s_p1, __pyx_k_p1, sizeof(__pyx_k_p1), 0, 0, 1, 1},
  {&__pyx_n_s_pEnd, __pyx_k_pEnd, sizeof(__pyx_k_pEnd), 0, 0, 1, 1},
  {&__pyx_n_s_pStart, __pyx_k_pStart, sizeof(__pyx_k_pStart), 0, 0, 1, 1},
  {&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1},
  {&__pyx_n_s_part_type, __pyx_k_part_type, sizeof(__pyx_k_part_type), 0, 0, 1, 1},
  {&__pyx_n_s_patch, __pyx_k_patch, sizeof(__pyx_k_patch), 0, 0, 1, 1},
  {&__pyx_n_s_pc, __pyx_k_pc, sizeof(__pyx_k_pc), 0, 0, 1, 1},
  {&__pyx_n_s_pc_type, __pyx_k_pc_type, sizeof(__pyx_k_pc_type), 0, 0, 1, 1},
  {&__pyx_n_s_pd, __pyx_k_pd, sizeof(__pyx_k_pd), 0, 0, 1, 1},
  {&__pyx_n_s_periodic, __pyx_k_periodic, sizeof(__pyx_k_periodic), 0, 0, 1, 1},
  {&__pyx_n_s_perm, __pyx_k_perm, sizeof(__pyx_k_perm), 0, 0, 1, 1},
  {&__pyx_n_s_petsc, __pyx_k_petsc, sizeof(__pyx_k_petsc), 0, 0, 1, 1},
  {&__pyx_n_s_petsc4py_PETSc, __pyx_k_petsc4py_PETSc, sizeof(__pyx_k_petsc4py_PETSc), 0, 0, 1, 1},
  {&__pyx_n_s_point, __pyx_k_point, sizeof(__pyx_k_point), 0, 0, 1, 1},
  {&__pyx_n_s_points, __pyx_k_points, sizeof(__pyx_k_points), 0, 0, 1, 1},
  {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
  {&__pyx_n_s_popErrorHandler, __pyx_k_popErrorHandler, sizeof(__pyx_k_popErrorHandler), 0, 0, 1, 1},
  {&__pyx_n_s_position, __pyx_k_position, sizeof(__pyx_k_position), 0, 0, 1, 1},
  {&__pyx_n_s_positive_definite, __pyx_k_positive_definite, sizeof(__pyx_k_positive_definite), 0, 0, 1, 1},
  {&__pyx_n_s_poststep, __pyx_k_poststep, sizeof(__pyx_k_poststep), 0, 0, 1, 1},
  {&__pyx_n_s_pre, __pyx_k_pre, sizeof(__pyx_k_pre), 0, 0, 1, 1},
  {&__pyx_n_s_prefix, __pyx_k_prefix, sizeof(__pyx_k_prefix), 0, 0, 1, 1},
  {&__pyx_kp_s_prefix_s_name_s, __pyx_k_prefix_s_name_s, sizeof(__pyx_k_prefix_s_name_s), 0, 0, 1, 0},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_prestep, __pyx_k_prestep, sizeof(__pyx_k_prestep), 0, 0, 1, 1},
  {&__pyx_n_s_proc_sizes, __pyx_k_proc_sizes, sizeof(__pyx_k_proc_sizes), 0, 0, 1, 1},
  {&__pyx_n_s_ptype, __pyx_k_ptype, sizeof(__pyx_k_ptype), 0, 0, 1, 1},
  {&__pyx_n_s_push, __pyx_k_push, sizeof(__pyx_k_push), 0, 0, 1, 1},
  {&__pyx_n_s_pushErrorHandler, __pyx_k_pushErrorHandler, sizeof(__pyx_k_pushErrorHandler), 0, 0, 1, 1},
  {&__pyx_n_s_py_type, __pyx_k_py_type, sizeof(__pyx_k_py_type), 0, 0, 1, 1},
  {&__pyx_n_s_python, __pyx_k_python, sizeof(__pyx_k_python), 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_q0, __pyx_k_q0, sizeof(__pyx_k_q0), 0, 0, 1, 1},
  {&__pyx_n_s_q1, __pyx_k_q1, sizeof(__pyx_k_q1), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
  {&__pyx_kp_s_r_2, __pyx_k_r_2, sizeof(__pyx_k_r_2), 0, 0, 1, 0},
  {&__pyx_n_s_radius, __pyx_k_radius, sizeof(__pyx_k_radius), 0, 0, 1, 1},
  {&__pyx_n_s_random, __pyx_k_random, sizeof(__pyx_k_random), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_rank, __pyx_k_rank, sizeof(__pyx_k_rank), 0, 0, 1, 1},
  {&__pyx_n_s_readonly, __pyx_k_readonly, sizeof(__pyx_k_readonly), 0, 0, 1, 1},
  {&__pyx_kp_s_readonly_attribute, __pyx_k_readonly_attribute, sizeof(__pyx_k_readonly_attribute), 0, 0, 1, 0},
  {&__pyx_n_s_ready, __pyx_k_ready, sizeof(__pyx_k_ready), 0, 0, 1, 1},
  {&__pyx_n_s_real, __pyx_k_real, sizeof(__pyx_k_real), 0, 0, 1, 1},
  {&__pyx_n_s_reason, __pyx_k_reason, sizeof(__pyx_k_reason), 0, 0, 1, 1},
  {&__pyx_n_s_reciprocal, __pyx_k_reciprocal, sizeof(__pyx_k_reciprocal), 0, 0, 1, 1},
  {&__pyx_n_s_refine, __pyx_k_refine, sizeof(__pyx_k_refine), 0, 0, 1, 1},
  {&__pyx_n_s_refine_x, __pyx_k_refine_x, sizeof(__pyx_k_refine_x), 0, 0, 1, 1},
  {&__pyx_n_s_refine_y, __pyx_k_refine_y, sizeof(__pyx_k_refine_y), 0, 0, 1, 1},
  {&__pyx_n_s_refine_z, __pyx_k_refine_z, sizeof(__pyx_k_refine_z), 0, 0, 1, 1},
  {&__pyx_n_s_refinementLimit, __pyx_k_refinementLimit, sizeof(__pyx_k_refinementLimit), 0, 0, 1, 1},
  {&__pyx_n_s_refinementUniform, __pyx_k_refinementUniform, sizeof(__pyx_k_refinementUniform), 0, 0, 1, 1},
  {&__pyx_n_s_registerCitation, __pyx_k_registerCitation, sizeof(__pyx_k_registerCitation), 0, 0, 1, 1},
  {&__pyx_n_s_release, __pyx_k_release, sizeof(__pyx_k_release), 0, 0, 1, 1},
  {&__pyx_n_s_remote, __pyx_k_remote, sizeof(__pyx_k_remote), 0, 0, 1, 1},
  {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1},
  {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
  {&__pyx_n_s_repr, __pyx_k_repr, sizeof(__pyx_k_repr), 0, 0, 1, 1},
  {&__pyx_n_s_reset, __pyx_k_reset, sizeof(__pyx_k_reset), 0, 0, 1, 1},
  {&__pyx_n_s_restart, __pyx_k_restart, sizeof(__pyx_k_restart), 0, 0, 1, 1},
  {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
  {&__pyx_n_s_reuse, __pyx_k_reuse, sizeof(__pyx_k_reuse), 0, 0, 1, 1},
  {&__pyx_n_s_reverse, __pyx_k_reverse, sizeof(__pyx_k_reverse), 0, 0, 1, 1},
  {&__pyx_n_s_rhs, __pyx_k_rhs, sizeof(__pyx_k_rhs), 0, 0, 1, 1},
  {&__pyx_n_s_right, __pyx_k_right, sizeof(__pyx_k_right), 0, 0, 1, 1},
  {&__pyx_n_s_rmap, __pyx_k_rmap, sizeof(__pyx_k_rmap), 0, 0, 1, 1},
  {&__pyx_n_s_rnd_type, __pyx_k_rnd_type, sizeof(__pyx_k_rnd_type), 0, 0, 1, 1},
  {&__pyx_n_s_rnorm, __pyx_k_rnorm, sizeof(__pyx_k_rnorm), 0, 0, 1, 1},
  {&__pyx_n_s_row, __pyx_k_row, sizeof(__pyx_k_row), 0, 0, 1, 1},
  {&__pyx_n_s_row_bsize, __pyx_k_row_bsize, sizeof(__pyx_k_row_bsize), 0, 0, 1, 1},
  {&__pyx_kp_s_row_indices_must_have_two_dimens, __pyx_k_row_indices_must_have_two_dimens, sizeof(__pyx_k_row_indices_must_have_two_dimens), 0, 0, 1, 0},
  {&__pyx_n_s_rowmap, __pyx_k_rowmap, sizeof(__pyx_k_rowmap), 0, 0, 1, 1},
  {&__pyx_n_s_rows, __pyx_k_rows, sizeof(__pyx_k_rows), 0, 0, 1, 1},
  {&__pyx_n_s_rscale, __pyx_k_rscale, sizeof(__pyx_k_rscale), 0, 0, 1, 1},
  {&__pyx_n_s_rtol, __pyx_k_rtol, sizeof(__pyx_k_rtol), 0, 0, 1, 1},
  {&__pyx_n_s_rtol_0, __pyx_k_rtol_0, sizeof(__pyx_k_rtol_0), 0, 0, 1, 1},
  {&__pyx_n_s_rtol_max, __pyx_k_rtol_max, sizeof(__pyx_k_rtol_max), 0, 0, 1, 1},
  {&__pyx_n_s_rw, __pyx_k_rw, sizeof(__pyx_k_rw), 0, 0, 1, 1},
  {&__pyx_kp_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 0},
  {&__pyx_kp_s_s_line_d_in_s, __pyx_k_s_line_d_in_s, sizeof(__pyx_k_s_line_d_in_s), 0, 0, 1, 0},
  {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
  {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1},
  {&__pyx_n_s_scatter, __pyx_k_scatter, sizeof(__pyx_k_scatter), 0, 0, 1, 1},
  {&__pyx_n_s_sec, __pyx_k_sec, sizeof(__pyx_k_sec), 0, 0, 1, 1},
  {&__pyx_n_s_seconds, __pyx_k_seconds, sizeof(__pyx_k_seconds), 0, 0, 1, 1},
  {&__pyx_n_s_seed, __pyx_k_seed, sizeof(__pyx_k_seed), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_sep, __pyx_k_sep, sizeof(__pyx_k_sep), 0, 0, 1, 1},
  {&__pyx_n_s_separable, __pyx_k_separable, sizeof(__pyx_k_separable), 0, 0, 1, 1},
  {&__pyx_n_s_setActive, __pyx_k_setActive, sizeof(__pyx_k_setActive), 0, 0, 1, 1},
  {&__pyx_n_s_setActiveAll, __pyx_k_setActiveAll, sizeof(__pyx_k_setActiveAll), 0, 0, 1, 1},
  {&__pyx_n_s_setAppCtx, __pyx_k_setAppCtx, sizeof(__pyx_k_setAppCtx), 0, 0, 1, 1},
  {&__pyx_n_s_setConvergedReason, __pyx_k_setConvergedReason, sizeof(__pyx_k_setConvergedReason), 0, 0, 1, 1},
  {&__pyx_n_s_setDM, __pyx_k_setDM, sizeof(__pyx_k_setDM), 0, 0, 1, 1},
  {&__pyx_n_s_setDefaultComm, __pyx_k_setDefaultComm, sizeof(__pyx_k_setDefaultComm), 0, 0, 1, 1},
  {&__pyx_n_s_setDiagonal, __pyx_k_setDiagonal, sizeof(__pyx_k_setDiagonal), 0, 0, 1, 1},
  {&__pyx_n_s_setDimension, __pyx_k_setDimension, sizeof(__pyx_k_setDimension), 0, 0, 1, 1},
  {&__pyx_n_s_setEquationType, __pyx_k_setEquationType, sizeof(__pyx_k_setEquationType), 0, 0, 1, 1},
  {&__pyx_n_s_setFunctionTolerances, __pyx_k_setFunctionTolerances, sizeof(__pyx_k_setFunctionTolerances), 0, 0, 1, 1},
  {&__pyx_n_s_setInitialGuessKnoll, __pyx_k_setInitialGuessKnoll, sizeof(__pyx_k_setInitialGuessKnoll), 0, 0, 1, 1},
  {&__pyx_n_s_setInitialGuessNonzero, __pyx_k_setInitialGuessNonzero, sizeof(__pyx_k_setInitialGuessNonzero), 0, 0, 1, 1},
  {&__pyx_n_s_setInterval, __pyx_k_setInterval, sizeof(__pyx_k_setInterval), 0, 0, 1, 1},
  {&__pyx_n_s_setIterationNumber, __pyx_k_setIterationNumber, sizeof(__pyx_k_setIterationNumber), 0, 0, 1, 1},
  {&__pyx_n_s_setKSP, __pyx_k_setKSP, sizeof(__pyx_k_setKSP), 0, 0, 1, 1},
  {&__pyx_n_s_setMaxFunctionEvaluations, __pyx_k_setMaxFunctionEvaluations, sizeof(__pyx_k_setMaxFunctionEvaluations), 0, 0, 1, 1},
  {&__pyx_n_s_setMaxKSPFailures, __pyx_k_setMaxKSPFailures, sizeof(__pyx_k_setMaxKSPFailures), 0, 0, 1, 1},
  {&__pyx_n_s_setMaxLinearSolveFailures, __pyx_k_setMaxLinearSolveFailures, sizeof(__pyx_k_setMaxLinearSolveFailures), 0, 0, 1, 1},
  {&__pyx_n_s_setMaxNonlinearStepFailures, __pyx_k_setMaxNonlinearStepFailures, sizeof(__pyx_k_setMaxNonlinearStepFailures), 0, 0, 1, 1},
  {&__pyx_n_s_setMaxStepFailures, __pyx_k_setMaxStepFailures, sizeof(__pyx_k_setMaxStepFailures), 0, 0, 1, 1},
  {&__pyx_n_s_setMaxSteps, __pyx_k_setMaxSteps, sizeof(__pyx_k_setMaxSteps), 0, 0, 1, 1},
  {&__pyx_n_s_setMaxTime, __pyx_k_setMaxTime, sizeof(__pyx_k_setMaxTime), 0, 0, 1, 1},
  {&__pyx_n_s_setNPC, __pyx_k_setNPC, sizeof(__pyx_k_setNPC), 0, 0, 1, 1},
  {&__pyx_n_s_setName, __pyx_k_setName, sizeof(__pyx_k_setName), 0, 0, 1, 1},
  {&__pyx_n_s_setNormType, __pyx_k_setNormType, sizeof(__pyx_k_setNormType), 0, 0, 1, 1},
  {&__pyx_n_s_setOptionsPrefix, __pyx_k_setOptionsPrefix, sizeof(__pyx_k_setOptionsPrefix), 0, 0, 1, 1},
  {&__pyx_n_s_setPCSide, __pyx_k_setPCSide, sizeof(__pyx_k_setPCSide), 0, 0, 1, 1},
  {&__pyx_n_s_setParamsEW, __pyx_k_setParamsEW, sizeof(__pyx_k_setParamsEW), 0, 0, 1, 1},
  {&__pyx_n_s_setProblemType, __pyx_k_setProblemType, sizeof(__pyx_k_setProblemType), 0, 0, 1, 1},
  {&__pyx_n_s_setResidualNorm, __pyx_k_setResidualNorm, sizeof(__pyx_k_setResidualNorm), 0, 0, 1, 1},
  {&__pyx_n_s_setSeed, __pyx_k_setSeed, sizeof(__pyx_k_setSeed), 0, 0, 1, 1},
  {&__pyx_n_s_setSizes, __pyx_k_setSizes, sizeof(__pyx_k_setSizes), 0, 0, 1, 1},
  {&__pyx_n_s_setStepNumber, __pyx_k_setStepNumber, sizeof(__pyx_k_setStepNumber), 0, 0, 1, 1},
  {&__pyx_n_s_setTime, __pyx_k_setTime, sizeof(__pyx_k_setTime), 0, 0, 1, 1},
  {&__pyx_n_s_setTimeStep, __pyx_k_setTimeStep, sizeof(__pyx_k_setTimeStep), 0, 0, 1, 1},
  {&__pyx_n_s_setTolerances, __pyx_k_setTolerances, sizeof(__pyx_k_setTolerances), 0, 0, 1, 1},
  {&__pyx_n_s_setType, __pyx_k_setType, sizeof(__pyx_k_setType), 0, 0, 1, 1},
  {&__pyx_n_s_setUseEW, __pyx_k_setUseEW, sizeof(__pyx_k_setUseEW), 0, 0, 1, 1},
  {&__pyx_n_s_setUseFD, __pyx_k_setUseFD, sizeof(__pyx_k_setUseFD), 0, 0, 1, 1},
  {&__pyx_n_s_setUseMF, __pyx_k_setUseMF, sizeof(__pyx_k_setUseMF), 0, 0, 1, 1},
  {&__pyx_n_s_setValue, __pyx_k_setValue, sizeof(__pyx_k_setValue), 0, 0, 1, 1},
  {&__pyx_n_s_setVisible, __pyx_k_setVisible, sizeof(__pyx_k_setVisible), 0, 0, 1, 1},
  {&__pyx_n_s_setup, __pyx_k_setup, sizeof(__pyx_k_setup), 0, 0, 1, 1},
  {&__pyx_n_s_sf, __pyx_k_sf, sizeof(__pyx_k_sf), 0, 0, 1, 1},
  {&__pyx_n_s_sf_type, __pyx_k_sf_type, sizeof(__pyx_k_sf_type), 0, 0, 1, 1},
  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
  {&__pyx_n_s_shift, __pyx_k_shift, sizeof(__pyx_k_shift), 0, 0, 1, 1},
  {&__pyx_n_s_shift_type, __pyx_k_shift_type, sizeof(__pyx_k_shift_type), 0, 0, 1, 1},
  {&__pyx_n_s_shiftamount, __pyx_k_shiftamount, sizeof(__pyx_k_shiftamount), 0, 0, 1, 1},
  {&__pyx_n_s_shifttype, __pyx_k_shifttype, sizeof(__pyx_k_shifttype), 0, 0, 1, 1},
  {&__pyx_n_s_side, __pyx_k_side, sizeof(__pyx_k_side), 0, 0, 1, 1},
  {&__pyx_kp_s_side_r_not_understood, __pyx_k_side_r_not_understood, sizeof(__pyx_k_side_r_not_understood), 0, 0, 1, 0},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_kp_s_size_I_is_d_expected_d, __pyx_k_size_I_is_d_expected_d, sizeof(__pyx_k_size_I_is_d_expected_d), 0, 0, 1, 0},
  {&__pyx_kp_s_size_J_is_d_expected_d, __pyx_k_size_J_is_d_expected_d, sizeof(__pyx_k_size_J_is_d_expected_d), 0, 0, 1, 0},
  {&__pyx_kp_s_size_V_is_d_expected_d, __pyx_k_size_V_is_d_expected_d, sizeof(__pyx_k_size_V_is_d_expected_d), 0, 0, 1, 0},
  {&__pyx_kp_s_size_array_is_d_expected_dx_d_d, __pyx_k_size_array_is_d_expected_dx_d_d, sizeof(__pyx_k_size_array_is_d_expected_dx_d_d), 0, 0, 1, 0},
  {&__pyx_kp_s_size_d_nnz_is_d_expected_d, __pyx_k_size_d_nnz_is_d_expected_d, sizeof(__pyx_k_size_d_nnz_is_d_expected_d), 0, 0, 1, 0},
  {&__pyx_kp_s_size_o_nnz_is_d_expected_d, __pyx_k_size_o_nnz_is_d_expected_d, sizeof(__pyx_k_size_o_nnz_is_d_expected_d), 0, 0, 1, 0},
  {&__pyx_n_s_sizes, __pyx_k_sizes, sizeof(__pyx_k_sizes), 0, 0, 1, 1},
  {&__pyx_kp_s_sizes_array_should_have_d_entrie, __pyx_k_sizes_array_should_have_d_entrie, sizeof(__pyx_k_sizes_array_should_have_d_entrie), 0, 0, 1, 0},
  {&__pyx_n_s_sleep, __pyx_k_sleep, sizeof(__pyx_k_sleep), 0, 0, 1, 1},
  {&__pyx_n_s_smooths, __pyx_k_smooths, sizeof(__pyx_k_smooths), 0, 0, 1, 1},
  {&__pyx_n_s_snes, __pyx_k_snes, sizeof(__pyx_k_snes), 0, 0, 1, 1},
  {&__pyx_n_s_snes_type, __pyx_k_snes_type, sizeof(__pyx_k_snes_type), 0, 0, 1, 1},
  {&__pyx_n_s_solve, __pyx_k_solve, sizeof(__pyx_k_solve), 0, 0, 1, 1},
  {&__pyx_n_s_solver, __pyx_k_solver, sizeof(__pyx_k_solver), 0, 0, 1, 1},
  {&__pyx_n_s_sortype, __pyx_k_sortype, sizeof(__pyx_k_sortype), 0, 0, 1, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_n_s_splitOwnership, __pyx_k_splitOwnership, sizeof(__pyx_k_splitOwnership), 0, 0, 1, 1},
  {&__pyx_n_s_stage, __pyx_k_stage, sizeof(__pyx_k_stage), 0, 0, 1, 1},
  {&__pyx_n_s_star, __pyx_k_star, sizeof(__pyx_k_star), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_starts, __pyx_k_starts, sizeof(__pyx_k_starts), 0, 0, 1, 1},
  {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
  {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1},
  {&__pyx_n_s_stencil_type, __pyx_k_stencil_type, sizeof(__pyx_k_stencil_type), 0, 0, 1, 1},
  {&__pyx_n_s_stencil_width, __pyx_k_stencil_width, sizeof(__pyx_k_stencil_width), 0, 0, 1, 1},
  {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
  {&__pyx_n_s_step_number, __pyx_k_step_number, sizeof(__pyx_k_step_number), 0, 0, 1, 1},
  {&__pyx_n_s_stol, __pyx_k_stol, sizeof(__pyx_k_stol), 0, 0, 1, 1},
  {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1},
  {&__pyx_n_s_strides, __pyx_k_strides, sizeof(__pyx_k_strides), 0, 0, 1, 1},
  {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1},
  {&__pyx_n_s_structure, __pyx_k_structure, sizeof(__pyx_k_structure), 0, 0, 1, 1},
  {&__pyx_n_s_subcomm, __pyx_k_subcomm, sizeof(__pyx_k_subcomm), 0, 0, 1, 1},
  {&__pyx_n_s_submat, __pyx_k_submat, sizeof(__pyx_k_submat), 0, 0, 1, 1},
  {&__pyx_n_s_submats, __pyx_k_submats, sizeof(__pyx_k_submats), 0, 0, 1, 1},
  {&__pyx_n_s_subminor, __pyx_k_subminor, sizeof(__pyx_k_subminor), 0, 0, 1, 1},
  {&__pyx_n_s_subvec, __pyx_k_subvec, sizeof(__pyx_k_subvec), 0, 0, 1, 1},
  {&__pyx_n_s_supp, __pyx_k_supp, sizeof(__pyx_k_supp), 0, 0, 1, 1},
  {&__pyx_n_s_svalue, __pyx_k_svalue, sizeof(__pyx_k_svalue), 0, 0, 1, 1},
  {&__pyx_n_s_sx, __pyx_k_sx, sizeof(__pyx_k_sx), 0, 0, 1, 1},
  {&__pyx_n_s_symmetric, __pyx_k_symmetric, sizeof(__pyx_k_symmetric), 0, 0, 1, 1},
  {&__pyx_n_s_syncFlush, __pyx_k_syncFlush, sizeof(__pyx_k_syncFlush), 0, 0, 1, 1},
  {&__pyx_n_s_syncPrint, __pyx_k_syncPrint, sizeof(__pyx_k_syncPrint), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_tab, __pyx_k_tab, sizeof(__pyx_k_tab), 0, 0, 1, 1},
  {&__pyx_n_s_tao_type, __pyx_k_tao_type, sizeof(__pyx_k_tao_type), 0, 0, 1, 1},
  {&__pyx_n_s_tbline, __pyx_k_tbline, sizeof(__pyx_k_tbline), 0, 0, 1, 1},
  {&__pyx_n_s_tblist, __pyx_k_tblist, sizeof(__pyx_k_tblist), 0, 0, 1, 1},
  {&__pyx_n_s_theta, __pyx_k_theta, sizeof(__pyx_k_theta), 0, 0, 1, 1},
  {&__pyx_n_s_threshold, __pyx_k_threshold, sizeof(__pyx_k_threshold), 0, 0, 1, 1},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_s_time_step, __pyx_k_time_step, sizeof(__pyx_k_time_step), 0, 0, 1, 1},
  {&__pyx_n_s_timestep, __pyx_k_timestep, sizeof(__pyx_k_timestep), 0, 0, 1, 1},
  {&__pyx_n_s_title, __pyx_k_title, sizeof(__pyx_k_title), 0, 0, 1, 1},
  {&__pyx_n_s_toAll, __pyx_k_toAll, sizeof(__pyx_k_toAll), 0, 0, 1, 1},
  {&__pyx_n_s_toZero, __pyx_k_toZero, sizeof(__pyx_k_toZero), 0, 0, 1, 1},
  {&__pyx_n_s_tol, __pyx_k_tol, sizeof(__pyx_k_tol), 0, 0, 1, 1},
  {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_traceback_2, __pyx_k_traceback_2, sizeof(__pyx_k_traceback_2), 0, 0, 1, 1},
  {&__pyx_n_s_transpose, __pyx_k_transpose, sizeof(__pyx_k_transpose), 0, 0, 1, 1},
  {&__pyx_n_s_ts_type, __pyx_k_ts_type, sizeof(__pyx_k_ts_type), 0, 0, 1, 1},
  {&__pyx_n_s_twist, __pyx_k_twist, sizeof(__pyx_k_twist), 0, 0, 1, 1},
  {&__pyx_n_s_type_registry, __pyx_k_type_registry, sizeof(__pyx_k_type_registry), 0, 0, 1, 1},
  {&__pyx_n_s_typestr, __pyx_k_typestr, sizeof(__pyx_k_typestr), 0, 0, 1, 1},
  {&__pyx_n_s_u, __pyx_k_u, sizeof(__pyx_k_u), 0, 0, 1, 1},
  {&__pyx_n_s_ua, __pyx_k_ua, sizeof(__pyx_k_ua), 0, 0, 1, 1},
  {&__pyx_kp_s_unknown_boundary_type_s, __pyx_k_unknown_boundary_type_s, sizeof(__pyx_k_unknown_boundary_type_s), 0, 0, 1, 0},
  {&__pyx_kp_s_unknown_element_type_s, __pyx_k_unknown_element_type_s, sizeof(__pyx_k_unknown_element_type_s), 0, 0, 1, 0},
  {&__pyx_kp_s_unknown_error_handler_s, __pyx_k_unknown_error_handler_s, sizeof(__pyx_k_unknown_error_handler_s), 0, 0, 1, 0},
  {&__pyx_kp_s_unknown_interpolation_type_s, __pyx_k_unknown_interpolation_type_s, sizeof(__pyx_k_unknown_interpolation_type_s), 0, 0, 1, 0},
  {&__pyx_kp_s_unknown_options_s, __pyx_k_unknown_options_s, sizeof(__pyx_k_unknown_options_s), 0, 0, 1, 0},
  {&__pyx_kp_s_unknown_scatter_mode_s, __pyx_k_unknown_scatter_mode_s, sizeof(__pyx_k_unknown_scatter_mode_s), 0, 0, 1, 0},
  {&__pyx_kp_s_unknown_shift_type_s, __pyx_k_unknown_shift_type_s, sizeof(__pyx_k_unknown_shift_type_s), 0, 0, 1, 0},
  {&__pyx_kp_s_unknown_stencil_type_s, __pyx_k_unknown_stencil_type_s, sizeof(__pyx_k_unknown_stencil_type_s), 0, 0, 1, 0},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
  {&__pyx_n_s_useClosure, __pyx_k_useClosure, sizeof(__pyx_k_useClosure), 0, 0, 1, 1},
  {&__pyx_n_s_useCone, __pyx_k_useCone, sizeof(__pyx_k_useCone), 0, 0, 1, 1},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
  {&__pyx_kp_s_values_must_have_two_or_more_dim, __pyx_k_values_must_have_two_or_more_dim, sizeof(__pyx_k_values_must_have_two_or_more_dim), 0, 0, 1, 0},
  {&__pyx_n_s_varbounds, __pyx_k_varbounds, sizeof(__pyx_k_varbounds), 0, 0, 1, 1},
  {&__pyx_n_s_vec, __pyx_k_vec, sizeof(__pyx_k_vec), 0, 0, 1, 1},
  {&__pyx_n_s_vec_from, __pyx_k_vec_from, sizeof(__pyx_k_vec_from), 0, 0, 1, 1},
  {&__pyx_n_s_vec_to, __pyx_k_vec_to, sizeof(__pyx_k_vec_to), 0, 0, 1, 1},
  {&__pyx_n_s_vec_type, __pyx_k_vec_type, sizeof(__pyx_k_vec_type), 0, 0, 1, 1},
  {&__pyx_n_s_vecs, __pyx_k_vecs, sizeof(__pyx_k_vecs), 0, 0, 1, 1},
  {&__pyx_n_s_vectors, __pyx_k_vectors, sizeof(__pyx_k_vectors), 0, 0, 1, 1},
  {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
  {&__pyx_n_s_vg, __pyx_k_vg, sizeof(__pyx_k_vg), 0, 0, 1, 1},
  {&__pyx_n_s_view, __pyx_k_view, sizeof(__pyx_k_view), 0, 0, 1, 1},
  {&__pyx_n_s_viewer, __pyx_k_viewer, sizeof(__pyx_k_viewer), 0, 0, 1, 1},
  {&__pyx_n_s_vl, __pyx_k_vl, sizeof(__pyx_k_vl), 0, 0, 1, 1},
  {&__pyx_n_s_vlg, __pyx_k_vlg, sizeof(__pyx_k_vlg), 0, 0, 1, 1},
  {&__pyx_n_s_vn, __pyx_k_vn, sizeof(__pyx_k_vn), 0, 0, 1, 1},
  {&__pyx_n_s_vwr_type, __pyx_k_vwr_type, sizeof(__pyx_k_vwr_type), 0, 0, 1, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_kp_s_w_2, __pyx_k_w_2, sizeof(__pyx_k_w_2), 0, 0, 1, 0},
  {&__pyx_n_s_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_xdot, __pyx_k_xdot, sizeof(__pyx_k_xdot), 0, 0, 1, 1},
  {&__pyx_n_s_xl, __pyx_k_xl, sizeof(__pyx_k_xl), 0, 0, 1, 1},
  {&__pyx_n_s_xmax, __pyx_k_xmax, sizeof(__pyx_k_xmax), 0, 0, 1, 1},
  {&__pyx_n_s_xmin, __pyx_k_xmin, sizeof(__pyx_k_xmin), 0, 0, 1, 1},
  {&__pyx_n_s_xnorm, __pyx_k_xnorm, sizeof(__pyx_k_xnorm), 0, 0, 1, 1},
  {&__pyx_n_s_xu, __pyx_k_xu, sizeof(__pyx_k_xu), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_ymax, __pyx_k_ymax, sizeof(__pyx_k_ymax), 0, 0, 1, 1},
  {&__pyx_n_s_ymin, __pyx_k_ymin, sizeof(__pyx_k_ymin), 0, 0, 1, 1},
  {&__pyx_n_s_ynorm, __pyx_k_ynorm, sizeof(__pyx_k_ynorm), 0, 0, 1, 1},
  {&__pyx_n_s_zeropivot, __pyx_k_zeropivot, sizeof(__pyx_k_zeropivot), 0, 0, 1, 1},
  {&__pyx_n_s_zmax, __pyx_k_zmax, sizeof(__pyx_k_zmax), 0, 0, 1, 1},
  {&__pyx_n_s_zmin, __pyx_k_zmin, sizeof(__pyx_k_zmin), 0, 0, 1, 1},
  {&__pyx_n_s_zoz, __pyx_k_zoz, sizeof(__pyx_k_zoz), 0, 0, 1, 1},
  {&__pyx_n_s_zzo, __pyx_k_zzo, sizeof(__pyx_k_zzo), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 15, __pyx_L1_error)
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 3, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 70, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(3, 47, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(3, 69, __pyx_L1_error)
  __pyx_builtin_SystemError = __Pyx_GetBuiltinName(__pyx_n_s_SystemError); if (!__pyx_builtin_SystemError) __PYX_ERR(4, 204, __pyx_L1_error)
  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(5, 374, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(6, 540, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(7, 293, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(8, 299, __pyx_L1_error)
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(9, 23, __pyx_L1_error)
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(10, 38, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(11, 282, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "PETSc/petscopt.pxi":47
 *         prefix = prefix.getOptionsPrefix()
 *     elif not isinstance(prefix, str):
 *         raise TypeError('option prefix must be string')             # <<<<<<<<<<<<<<
 *     if not prefix:
 *         return None
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_option_prefix_must_be_string); if (unlikely(!__pyx_tuple_)) __PYX_ERR(3, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "PETSc/petscopt.pxi":50
 *     if not prefix:
 *         return None
 *     if prefix.count(' '):             # <<<<<<<<<<<<<<
 *         raise ValueError('option prefix should not have spaces')
 *     if prefix.startswith('-'):
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(3, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "PETSc/petscopt.pxi":51
 *         return None
 *     if prefix.count(' '):
 *         raise ValueError('option prefix should not have spaces')             # <<<<<<<<<<<<<<
 *     if prefix.startswith('-'):
 *         raise ValueError('option prefix should not start with a hypen')
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_option_prefix_should_not_have_sp); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(3, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "PETSc/petscopt.pxi":52
 *     if prefix.count(' '):
 *         raise ValueError('option prefix should not have spaces')
 *     if prefix.startswith('-'):             # <<<<<<<<<<<<<<
 *         raise ValueError('option prefix should not start with a hypen')
 *     return prefix
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s__5); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(3, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "PETSc/petscopt.pxi":53
 *         raise ValueError('option prefix should not have spaces')
 *     if prefix.startswith('-'):
 *         raise ValueError('option prefix should not start with a hypen')             # <<<<<<<<<<<<<<
 *     return prefix
 * 
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_option_prefix_should_not_start_w); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(3, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "PETSc/petscopt.pxi":176
 *     if not iskey(key):
 *         return None
 *     key = key[1:]             # <<<<<<<<<<<<<<
 *     if key[0] == '-':
 *         key = key[1:]
 */
  __pyx_slice__8 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(3, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__8);
  __Pyx_GIVEREF(__pyx_slice__8);

  /* "PETSc/petscopt.pxi":178
 *     key = key[1:]
 *     if key[0] == '-':
 *         key = key[1:]             # <<<<<<<<<<<<<<
 *     if not key.startswith(prefix):
 *         return None
 */
  __pyx_slice__9 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__9)) __PYX_ERR(3, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__9);
  __Pyx_GIVEREF(__pyx_slice__9);

  /* "PETSc/petscmpi.pxi":88
 * 
 * cdef inline int comm_size(MPI_Comm comm) except ? -1:
 *     if comm == MPI_COMM_NULL: raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *     cdef int size = 0
 *     CHKERR( MPI_Comm_size(comm, &size) )
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_null_communicator); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(13, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "PETSc/petscmpi.pxi":94
 * 
 * cdef inline int comm_rank(MPI_Comm comm) except ? -1:
 *     if comm == MPI_COMM_NULL: raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *     cdef int rank = 0
 *     CHKERR( MPI_Comm_rank(comm, &rank) )
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_null_communicator); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(13, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "PETSc/petscsys.pxi":79
 *     if (bs < 1): raise ValueError(
 *         "block size %d must be positive" % toInt(bs))
 *     if n==PETSC_DECIDE and N==PETSC_DECIDE: raise ValueError(             # <<<<<<<<<<<<<<
 *         "local and global sizes cannot be both 'DECIDE'")
 *     if (n > 0) and (n % bs): raise ValueError(
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_local_and_global_sizes_cannot_be); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(14, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "PETSc/petscis.pxi":204
 * 
 *     def __getreadbuffer__(self, Py_ssize_t idx, void **p):
 *         if idx != 0: raise SystemError(             # <<<<<<<<<<<<<<
 *             "accessing non-existent buffer segment")
 *         return self.getbuffer(p)
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_accessing_non_existent_buffer_se); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(4, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "PETSc/petscvec.pxi":505
 * 
 *     def __getreadbuffer__(self, Py_ssize_t idx, void **p):
 *         if idx != 0: raise SystemError(             # <<<<<<<<<<<<<<
 *             "accessing non-existent buffer segment")
 *         return self.getbuffer(p)
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_accessing_non_existent_buffer_se); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(5, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "PETSc/petscvec.pxi":510
 * 
 *     def __getwritebuffer__(self, Py_ssize_t idx, void **p):
 *         if idx != 0: raise SystemError(             # <<<<<<<<<<<<<<
 *             "accessing non-existent buffer segment")
 *         if self.readonly: raise TypeError(
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_accessing_non_existent_buffer_se); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(5, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "PETSc/petscvec.pxi":512
 *         if idx != 0: raise SystemError(
 *             "accessing non-existent buffer segment")
 *         if self.readonly: raise TypeError(             # <<<<<<<<<<<<<<
 *             "Object is not writable.")
 *         return self.getbuffer(p)
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Object_is_not_writable); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(5, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "PETSc/petscmat.pxi":473
 *     elif isinstance(other, Vec):
 *         diag = other.copy()
 *         diag.scale(-1)             # <<<<<<<<<<<<<<
 *         self.setDiagonal(diag, PETSC_ADD_VALUES)
 *         diag.destroy()
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(6, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "PETSc/petscmat.pxi":532
 * cdef Mat mat_rsub(Mat self, other):
 *     cdef Mat mat = <Mat> mat_sub(self, other)
 *     mat.scale(-1)             # <<<<<<<<<<<<<<
 *     return mat
 * 
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(6, 532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "PETSc/petscmat.pxi":797
 *         ("row indices must have two dimensions: "
 *          "rows.ndim=%d") % (PyArray_NDIM(ai)) )
 *     elif not PyArray_ISCONTIGUOUS(ai): raise ValueError(             # <<<<<<<<<<<<<<
 *         "expecting a C-contiguous array")
 *     if PyArray_NDIM(aj) != 2: raise ValueError(
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_expecting_a_C_contiguous_array); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(6, 797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "PETSc/petscmat.pxi":802
 *         ("column indices must have two dimensions: "
 *          "cols.ndim=%d") % (PyArray_NDIM(aj)) )
 *     elif not PyArray_ISCONTIGUOUS(aj): raise ValueError(             # <<<<<<<<<<<<<<
 *         "expecting a C-contiguous array")
 *     if PyArray_NDIM(av) < 2: raise ValueError(
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_expecting_a_C_contiguous_array); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(6, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "PETSc/petscmat.pxi":807
 *         ("values must have two or more dimensions: "
 *          "vals.ndim=%d") % (PyArray_NDIM(av)) )
 *     elif not PyArray_ISCONTIGUOUS(av): raise ValueError(             # <<<<<<<<<<<<<<
 *         "expecting a C-contiguous array")
 *     # check various shapes
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_expecting_a_C_contiguous_array); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(6, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "PETSc/petscmat.pxi":943
 *     cdef dict options = dict(opts)
 *     #
 *     cdef fill = options.pop('fill', None)             # <<<<<<<<<<<<<<
 *     if fill is not None:
 *         info.fill = asReal(fill)
 */
  __pyx_tuple__23 = PyTuple_Pack(2, __pyx_n_s_fill, Py_None); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(6, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "PETSc/petscmat.pxi":947
 *         info.fill = asReal(fill)
 *     #
 *     cdef zeropivot = options.pop('zeropivot', None)             # <<<<<<<<<<<<<<
 *     if zeropivot is not None:
 *         info.zeropivot = asReal(zeropivot)
 */
  __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_s_zeropivot, Py_None); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(6, 947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "PETSc/petscmat.pxi":951
 *         info.zeropivot = asReal(zeropivot)
 *     #
 *     cdef levels = options.pop('levels', None)             # <<<<<<<<<<<<<<
 *     if levels is not None:
 *         info.levels  = <PetscReal>asInt(levels)
 */
  __pyx_tuple__25 = PyTuple_Pack(2, __pyx_n_s_levels, Py_None); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(6, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "PETSc/petscmat.pxi":954
 *     if levels is not None:
 *         info.levels  = <PetscReal>asInt(levels)
 *     cdef diagonal_fill = options.pop('diagonal_fill', None)             # <<<<<<<<<<<<<<
 *     if diagonal_fill is not None:
 *         info.diagonal_fill = <PetscReal>(<bint>diagonal_fill)
 */
  __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_diagonal_fill, Py_None); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(6, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "PETSc/petscmat.pxi":958
 *         info.diagonal_fill = <PetscReal>(<bint>diagonal_fill)
 *     #
 *     cdef dt = options.pop('dt', None)             # <<<<<<<<<<<<<<
 *     if dt is not None:
 *         info.dt = asReal(dt)
 */
  __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_s_dt, Py_None); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(6, 958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "PETSc/petscmat.pxi":961
 *     if dt is not None:
 *         info.dt = asReal(dt)
 *     cdef dtcol = options.pop('dtcol', None)             # <<<<<<<<<<<<<<
 *     if dtcol is not None:
 *         info.dtcol = asReal(dtcol)
 */
  __pyx_tuple__28 = PyTuple_Pack(2, __pyx_n_s_dtcol, Py_None); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(6, 961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "PETSc/petscmat.pxi":964
 *     if dtcol is not None:
 *         info.dtcol = asReal(dtcol)
 *     cdef dtcount = options.pop('dtcount', None)             # <<<<<<<<<<<<<<
 *     if dtcount is not None:
 *         info.dtcount = <PetscReal>asInt(dtcount)
 */
  __pyx_tuple__29 = PyTuple_Pack(2, __pyx_n_s_dtcount, Py_None); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(6, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "PETSc/petscmat.pxi":972
 *         info.usedt = <PetscReal>PETSC_TRUE
 *     #
 *     cdef shifttype = options.pop('shifttype', None)             # <<<<<<<<<<<<<<
 *     if shifttype is not None:
 *         info.shifttype = <PetscReal>matfactorshifttype(shifttype)
 */
  __pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_s_shifttype, Py_None); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(6, 972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "PETSc/petscmat.pxi":975
 *     if shifttype is not None:
 *         info.shifttype = <PetscReal>matfactorshifttype(shifttype)
 *     cdef shiftamount = options.pop('shiftamount', None)             # <<<<<<<<<<<<<<
 *     if shiftamount is not None:
 *         info.shiftamount = asReal(shiftamount)
 */
  __pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_s_shiftamount, Py_None); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(6, 975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "PETSc/Sys.pyx":27
 *                 out.append(date)
 *             if author:
 *                 author = bytes2str(cauthorinfo).split('\n')             # <<<<<<<<<<<<<<
 *                 author = [s.strip() for s in author if s]
 *                 out.append(author)
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s__32); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(25, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "PETSc/Sys.pyx":41
 *         cdef const_char *cdate = PETSC_VERSION_DATE
 *         cdef const_char *cauthorinfo = PETSC_AUTHOR_INFO
 *         author = bytes2str(cauthorinfo).split('\n')             # <<<<<<<<<<<<<<
 *         author = [s.strip() for s in author if s]
 *         return dict(major      = cmajor,
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s__32); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(25, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "PETSc/Sys.pyx":73
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_WORLD)
 *         if ccomm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *         global PETSC_COMM_DEFAULT
 *         PETSC_COMM_DEFAULT = ccomm
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_null_communicator); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(25, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "PETSc/Sys.pyx":86
 *         cdef object end = kargs.get('end', '\n')
 *         if comm_rank(ccomm) == 0:
 *             if not args: args = ('',)             # <<<<<<<<<<<<<<
 *             format = ['%s', sep] * len(args)
 *             format[-1] = end
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s__10); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(25, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "PETSc/Sys.pyx":103
 *         cdef object end = kargs.get('end', '\n')
 *         cdef object flush = kargs.get('flush', False)
 *         if not args: args = ('',)             # <<<<<<<<<<<<<<
 *         format = ['%s', sep] * len(args)
 *         format[-1] = end
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s__10); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(25, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "PETSc/Sys.pyx":175
 *     @classmethod
 *     def registerCitation(cls, citation):
 *         if not citation: raise ValueError("empty citation")             # <<<<<<<<<<<<<<
 *         cdef const_char *cit = NULL
 *         citation = str2bytes(citation, &cit)
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_empty_citation); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(25, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "PETSc/Log.pyx":7
 *     @classmethod
 *     def Stage(cls, name):
 *         if not name: raise ValueError("empty name")             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_empty_name); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(26, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "PETSc/Log.pyx":21
 *     @classmethod
 *     def Class(cls, name):
 *         if not name: raise ValueError("empty name")             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_empty_name); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(26, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "PETSc/Log.pyx":35
 *     @classmethod
 *     def Event(cls, name, klass=None):
 *         if not name: raise ValueError("empty name")             # <<<<<<<<<<<<<<
 *         cdef const_char *cname = NULL
 *         name = str2bytes(name, &cname)
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_empty_name); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(26, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "PETSc/Log.pyx":133
 *         def __set__(self, value):
 *             <void>self; <void>value; # unused
 *             raise TypeError("readonly attribute")             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_readonly_attribute); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(26, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "PETSc/Log.pyx":213
 *         def __set__(self, value):
 *             <void>self; <void>value; # unused
 *             raise TypeError("readonly attribute")             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_readonly_attribute); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(26, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "PETSc/Log.pyx":308
 *         def __set__(self, value):
 *             <void>self; <void>value; # unused
 *             raise TypeError("readonly attribute")             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_readonly_attribute); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(26, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "PETSc/Comm.pyx":25
 *         if not isinstance(self,  Comm): return NotImplemented
 *         if not isinstance(other, Comm): return NotImplemented
 *         if op!=2 and op!=3: raise TypeError("only '==' and '!='")             # <<<<<<<<<<<<<<
 *         cdef Comm s = self
 *         cdef Comm o = other
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_only_and); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(9, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "PETSc/Comm.pyx":48
 *         if self.comm == MPI_COMM_NULL: return
 *         if not self.isdup:
 *             raise ValueError("communicator not owned")             # <<<<<<<<<<<<<<
 *         CHKERR( PetscCommDestroy(&self.comm) )
 *         self.comm = MPI_COMM_NULL
 */
  __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_communicator_not_owned); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(9, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "PETSc/Comm.pyx":56
 *     def duplicate(self):
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm newcomm = MPI_COMM_NULL
 *         CHKERR( PetscCommDuplicate(self.comm, &newcomm, NULL) )
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_null_communicator); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(9, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "PETSc/Comm.pyx":67
 *     def getSize(self):
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *         cdef int size=0
 *         MPI_Comm_size(self.comm, &size)
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_null_communicator); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(9, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "PETSc/Comm.pyx":74
 *     def getRank(self):
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *         cdef int rank=0
 *         MPI_Comm_rank(self.comm, &rank)
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_null_communicator); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(9, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "PETSc/Comm.pyx":81
 *     def barrier(self):
 *         if self.comm == MPI_COMM_NULL:
 *             raise ValueError("null communicator")             # <<<<<<<<<<<<<<
 *         MPI_Barrier(self.comm)
 * 
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_kp_s_null_communicator); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(9, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "PETSc/Object.pyx":21
 *         if   op == 2: return (s.obj[0] == o.obj[0])
 *         elif op == 3: return (s.obj[0] != o.obj[0])
 *         else: raise TypeError("only '==' and '!='")             # <<<<<<<<<<<<<<
 * 
 *     def __nonzero__(self):
 */
  __pyx_tuple__51 = PyTuple_Pack(1, __pyx_kp_s_only_and); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(10, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "PETSc/Vec.pyx":406
 *             CHKERR( VecCUSPGetCUDAArrayWrite(self.vec, &hdl) )
 *         else:
 *             raise ValueError("Invalid mode: expected 'rw', 'r', or 'w'")             # <<<<<<<<<<<<<<
 *         return <Py_uintptr_t>hdl
 * 
 */
  __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_s_Invalid_mode_expected_rw_r_or_w); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(30, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);

  /* "PETSc/Vec.pyx":420
 *             CHKERR( VecCUSPRestoreCUDAArrayWrite(self.vec, &hdl) )
 *         else:
 *             raise ValueError("Invalid mode: expected 'rw', 'r', or 'w'")             # <<<<<<<<<<<<<<
 * 
 *     def duplicate(self, array=None):
 */
  __pyx_tuple__53 = PyTuple_Pack(1, __pyx_kp_s_Invalid_mode_expected_rw_r_or_w); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(30, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "PETSc/Vec.pyx":860
 *         "Vec buffer (read-only)"
 *         def __get__(self):
 *             return self.getBuffer(True)             # <<<<<<<<<<<<<<
 * 
 *     property array_w:
 */
  __pyx_tuple__54 = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(30, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);

  /* "PETSc/Vec.pyx":868
 *         def __set__(self, value):
 *             cdef buf = self.getBuffer()
 *             with buf as array: array[:] = value             # <<<<<<<<<<<<<<
 * 
 *     property array_r:
 */
  __pyx_slice__55 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__55)) __PYX_ERR(30, 868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__55);
  __Pyx_GIVEREF(__pyx_slice__55);
  __pyx_tuple__56 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(30, 868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "PETSc/Vec.pyx":873
 *         "Vec array (read-only)"
 *         def __get__(self):
 *             return self.getArray(True)             # <<<<<<<<<<<<<<
 * 
 *     property buffer:
 */
  __pyx_tuple__57 = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(30, 873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "PETSc/Mat.pyx":1055
 *         cdef ndarray ibdiag = array_s(m*bs, cibdiag)
 *         ibdiag.shape = (toInt(m//bs), toInt(bs), toInt(bs))
 *         return ibdiag.transpose(0, 2, 1)             # <<<<<<<<<<<<<<
 * 
 *     # null space
 */
  __pyx_tuple__58 = PyTuple_Pack(3, __pyx_int_0, __pyx_int_2, __pyx_int_1); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(33, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "PETSc/SNES.pyx":179
 *         if comms is not None:
 *             if clevels != <PetscInt>len(comms):
 *                 raise ValueError("Must provide as many communicators as levels")             # <<<<<<<<<<<<<<
 *             CHKERR( PetscMalloc(sizeof(MPI_Comm)*<size_t>clevels, &ccomms) )
 *             try:
 */
  __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_s_Must_provide_as_many_communicato); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(36, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "PETSc/TAO.pyx":575
 *                 self.setFunctionTolerances(**value)
 *             else:
 *                 raise TypeError("expecting tuple/list or dict")             # <<<<<<<<<<<<<<
 * 
 *     property gtol:
 */
  __pyx_tuple__60 = PyTuple_Pack(1, __pyx_kp_s_expecting_tuple_list_or_dict); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(38, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "PETSc/TAO.pyx":586
 *                 self.getGradientTolerances(**value)
 *             else:
 *                 raise TypeError("expecting tuple/list or dict")             # <<<<<<<<<<<<<<
 * 
 *     property ctol:
 */
  __pyx_tuple__61 = PyTuple_Pack(1, __pyx_kp_s_expecting_tuple_list_or_dict); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(38, 586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "PETSc/TAO.pyx":597
 *                 self.getConstraintTolerances(**value)
 *             else:
 *                 raise TypeError("expecting tuple/list or dict")             # <<<<<<<<<<<<<<
 * 
 *     # --- iteration ---
 */
  __pyx_tuple__62 = PyTuple_Pack(1, __pyx_kp_s_expecting_tuple_list_or_dict); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(38, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "PETSc/DMPlex.pyx":335
 *         finally:
 *             CHKERR( DMPlexRestoreTransitiveClosure(self.dm, cp, cuseCone, &numPoints, &points) )
 *         return out[::2],out[1::2]             # <<<<<<<<<<<<<<
 * 
 *     def vecGetClosure(self, Section sec, Vec vec, p):
 */
  __pyx_slice__63 = PySlice_New(Py_None, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__63)) __PYX_ERR(42, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__63);
  __Pyx_GIVEREF(__pyx_slice__63);
  __pyx_slice__64 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__64)) __PYX_ERR(42, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__64);
  __Pyx_GIVEREF(__pyx_slice__64);

  /* "PETSc/DMPlex.pyx":480
 *                     bcpoints[i] = (<IS?>bcPoints[<Py_ssize_t>i]).iset
 *             else:
 *                 raise ValueError("bcPoints is a required argument")             # <<<<<<<<<<<<<<
 *         else:
 *             assert bcComps  is None
 */
  __pyx_tuple__65 = PyTuple_Pack(1, __pyx_kp_s_bcPoints_is_a_required_argument); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(42, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);

  /* "PETSc/Partitioner.pyx":61
 *                                  numProcs, toInt(nsize))
 *             if points is None:
 *                 raise ValueError("Must provide both sizes and points arrays")             # <<<<<<<<<<<<<<
 *         if points is not None:
 *             points = iarray_i(points, NULL, &cpoints)
 */
  __pyx_tuple__66 = PyTuple_Pack(1, __pyx_kp_s_Must_provide_both_sizes_and_poin); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(46, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);

  /* "PETSc/PETSc.pyx":212
 *         return n
 *     #
 *     del tbl[1:] # clear any previous stuff             # <<<<<<<<<<<<<<
 *     if n == PETSC_ERR_MEM: # special case
 *         PetscMallocGetCurrentUsage(&mem)
 */
  __pyx_slice__67 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__67)) __PYX_ERR(11, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__67);
  __Pyx_GIVEREF(__pyx_slice__67);

  /* "PETSc/Error.pyx":7
 *     _traceback_ = []
 * 
 *     def __init__(self, int ierr=0):             # <<<<<<<<<<<<<<
 *         self.ierr = ierr
 *         RuntimeError.__init__(self, self.ierr)
 */
  __pyx_tuple__68 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_ierr); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);
  __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_devel_petsc4py_3_7_0_src_P, __pyx_n_s_init, 7, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(1, 7, __pyx_L1_error)

  /* "PETSc/Error.pyx":11
 *         RuntimeError.__init__(self, self.ierr)
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         cdef int ierr = self.ierr
 *         return ierr != 0
 */
  __pyx_tuple__70 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_ierr); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(1, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);
  __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_devel_petsc4py_3_7_0_src_P, __pyx_n_s_nonzero_2, 11, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(1, 11, __pyx_L1_error)

  /* "PETSc/Error.pyx":15
 *         return ierr != 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'PETSc.Error(%d)' % self.ierr
 * 
 */
  __pyx_tuple__72 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(1, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);
  __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_devel_petsc4py_3_7_0_src_P, __pyx_n_s_repr, 15, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(1, 15, __pyx_L1_error)

  /* "PETSc/Error.pyx":18
 *         return 'PETSc.Error(%d)' % self.ierr
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef int csize=1, crank=0
 *         if not (<int>PetscFinalizeCalled):
 */
  __pyx_tuple__74 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_csize, __pyx_n_s_crank, __pyx_n_s_width, __pyx_n_s_rank, __pyx_n_s_tblist, __pyx_n_s_entry, __pyx_n_s_tbline); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(1, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);
  __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_devel_petsc4py_3_7_0_src_P, __pyx_n_s_str, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(1, 18, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":417
 * # --------------------------------------------------------------------
 * 
 * def _initialize(args=None, comm=None):             # <<<<<<<<<<<<<<
 *     global tracebacklist
 *     Error._traceback_ = tracebacklist
 */
  __pyx_tuple__76 = PyTuple_Pack(3, __pyx_n_s_args, __pyx_n_s_comm, __pyx_n_s_ready); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(11, 417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);
  __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_devel_petsc4py_3_7_0_src_P_2, __pyx_n_s_initialize, 417, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(11, 417, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":433
 *     PETSC_COMM_DEFAULT = PETSC_COMM_WORLD
 * 
 * def _finalize():             # <<<<<<<<<<<<<<
 *     finalize()
 *     #
 */
  __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_devel_petsc4py_3_7_0_src_P_2, __pyx_n_s_finalize, 433, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(11, 433, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyList_Type_pop.type = (PyObject*)&PyList_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(48, 1, __pyx_L1_error);
  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(48, 1, __pyx_L1_error)
  __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) __PYX_ERR(48, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(48, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(48, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(48, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(48, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(48, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initPETSc(void); /*proto*/
PyMODINIT_FUNC initPETSc(void)
#else
PyMODINIT_FUNC PyInit_PETSc(void); /*proto*/
PyMODINIT_FUNC PyInit_PETSc(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  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;
  __Pyx_RefNannyDeclarations
  #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_PETSc(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(48, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(48, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(48, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(48, 1, __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 PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("PETSc", __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(48, 1, __pyx_L1_error)
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(48, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(48, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(48, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(48, 1, __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(48, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_petsc4py__PETSc) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(48, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "petsc4py.PETSc")) {
      if (unlikely(PyDict_SetItemString(modules, "petsc4py.PETSc", __pyx_m) < 0)) __PYX_ERR(48, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  /*--- Global init code ---*/
  __pyx_v_8petsc4py_5PETSc_PetscError = Py_None; Py_INCREF(Py_None);
  __pyx_v_8petsc4py_5PETSc_citations_registry = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_8petsc4py_5PETSc_stage_registry = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_8petsc4py_5PETSc_class_registry = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_8petsc4py_5PETSc_event_registry = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_8petsc4py_5PETSc___COMM_NULL__ = ((struct PyPetscCommObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8petsc4py_5PETSc___COMM_SELF__ = ((struct PyPetscCommObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8petsc4py_5PETSc___COMM_WORLD__ = ((struct PyPetscCommObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8petsc4py_5PETSc_type_registry = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_8petsc4py_5PETSc_tracebacklist = Py_None; Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("GetComm", (void (*)(void))__pyx_f_8petsc4py_5PETSc_GetComm, "MPI_Comm (PyObject *, MPI_Comm)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("GetCommDefault", (void (*)(void))__pyx_f_8petsc4py_5PETSc_GetCommDefault, "MPI_Comm (void)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscType_Register", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscType_Register, "int (int, PyTypeObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscType_Lookup", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscType_Lookup, "PyTypeObject *(int)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscError_Set", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscError_Set, "int (int)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscComm_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscComm_New, "PyObject *(MPI_Comm)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscComm_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscComm_Get, "MPI_Comm (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscComm_GetPtr", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscComm_GetPtr, "MPI_Comm *(PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscObject_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscObject_New, "PyObject *(PetscObject)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscObject_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscObject_Get, "PetscObject (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscObject_GetPtr", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscObject_GetPtr, "PetscObject *(PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscViewer_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscViewer_New, "PyObject *(PetscViewer)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscViewer_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscViewer_Get, "PetscViewer (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscRandom_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscRandom_New, "PyObject *(PetscRandom)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscRandom_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscRandom_Get, "PetscRandom (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscIS_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscIS_New, "PyObject *(IS)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscIS_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscIS_Get, "IS (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscLGMap_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscLGMap_New, "PyObject *(ISLocalToGlobalMapping)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscLGMap_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscLGMap_Get, "ISLocalToGlobalMapping (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscSF_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscSF_New, "PyObject *(PetscSF)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscSF_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscSF_Get, "PetscSF (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscVec_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscVec_New, "PyObject *(Vec)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscVec_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscVec_Get, "Vec (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscScatter_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscScatter_New, "PyObject *(VecScatter)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscScatter_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscScatter_Get, "VecScatter (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscSection_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscSection_New, "PyObject *(PetscSection)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscSection_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscSection_Get, "PetscSection (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscMat_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscMat_New, "PyObject *(Mat)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscMat_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscMat_Get, "Mat (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscPC_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscPC_New, "PyObject *(PC)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscPC_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscPC_Get, "PC (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscKSP_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscKSP_New, "PyObject *(KSP)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscKSP_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscKSP_Get, "KSP (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscSNES_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscSNES_New, "PyObject *(SNES)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscSNES_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscSNES_Get, "SNES (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscTS_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscTS_New, "PyObject *(TS)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscTS_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscTS_Get, "TS (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscTAO_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscTAO_New, "PyObject *(Tao)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscTAO_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscTAO_Get, "Tao (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscAO_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscAO_New, "PyObject *(AO)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscAO_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscAO_Get, "AO (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscDM_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscDM_New, "PyObject *(DM)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscDM_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscDM_Get, "DM (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscPartitioner_New", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscPartitioner_New, "PyObject *(PetscPartitioner)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("PyPetscPartitioner_Get", (void (*)(void))__pyx_f_8petsc4py_5PETSc_PyPetscPartitioner_Get, "PetscPartitioner (PyObject *)") < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  /*--- Type init code ---*/
  if (PyType_Ready(&PyPetscComm_Type) < 0) __PYX_ERR(9, 3, __pyx_L1_error)
  PyPetscComm_Type.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "Comm", (PyObject *)&PyPetscComm_Type) < 0) __PYX_ERR(9, 3, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc_Comm = &PyPetscComm_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_Object = &__pyx_vtable_8petsc4py_5PETSc_Object;
  __pyx_vtable_8petsc4py_5PETSc_Object.get_attr = (PyObject *(*)(struct PyPetscObjectObject *, char *))__pyx_f_8petsc4py_5PETSc_6Object_get_attr;
  __pyx_vtable_8petsc4py_5PETSc_Object.set_attr = (PyObject *(*)(struct PyPetscObjectObject *, char *, PyObject *))__pyx_f_8petsc4py_5PETSc_6Object_set_attr;
  __pyx_vtable_8petsc4py_5PETSc_Object.get_dict = (PyObject *(*)(struct PyPetscObjectObject *))__pyx_f_8petsc4py_5PETSc_6Object_get_dict;
  if (PyType_Ready(&PyPetscObject_Type) < 0) __PYX_ERR(10, 3, __pyx_L1_error)
  PyPetscObject_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscObject_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_Object) < 0) __PYX_ERR(10, 3, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Object", (PyObject *)&PyPetscObject_Type) < 0) __PYX_ERR(10, 3, __pyx_L1_error)
  if (PyPetscObject_Type.tp_weaklistoffset == 0) PyPetscObject_Type.tp_weaklistoffset = offsetof(struct PyPetscObjectObject, __weakref__);
  __pyx_ptype_8petsc4py_5PETSc_Object = &PyPetscObject_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_Viewer = &__pyx_vtable_8petsc4py_5PETSc_Viewer;
  __pyx_vtable_8petsc4py_5PETSc_Viewer.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscViewer_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscViewer_Type) < 0) __PYX_ERR(27, 74, __pyx_L1_error)
  PyPetscViewer_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscViewer_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_Viewer) < 0) __PYX_ERR(27, 74, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Viewer", (PyObject *)&PyPetscViewer_Type) < 0) __PYX_ERR(27, 74, __pyx_L1_error)
  if (PyPetscViewer_Type.tp_weaklistoffset == 0) PyPetscViewer_Type.tp_weaklistoffset = offsetof(struct PyPetscViewerObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_Viewer = &PyPetscViewer_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_Random = &__pyx_vtable_8petsc4py_5PETSc_Random;
  __pyx_vtable_8petsc4py_5PETSc_Random.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscRandom_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscRandom_Type) < 0) __PYX_ERR(28, 11, __pyx_L1_error)
  PyPetscRandom_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscRandom_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_Random) < 0) __PYX_ERR(28, 11, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Random", (PyObject *)&PyPetscRandom_Type) < 0) __PYX_ERR(28, 11, __pyx_L1_error)
  if (PyPetscRandom_Type.tp_weaklistoffset == 0) PyPetscRandom_Type.tp_weaklistoffset = offsetof(struct PyPetscRandomObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_Random = &PyPetscRandom_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_IS = &__pyx_vtable_8petsc4py_5PETSc_IS;
  __pyx_vtable_8petsc4py_5PETSc_IS.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscIS_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscIS_Type) < 0) __PYX_ERR(29, 10, __pyx_L1_error)
  PyPetscIS_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscIS_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_IS) < 0) __PYX_ERR(29, 10, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "IS", (PyObject *)&PyPetscIS_Type) < 0) __PYX_ERR(29, 10, __pyx_L1_error)
  if (PyPetscIS_Type.tp_weaklistoffset == 0) PyPetscIS_Type.tp_weaklistoffset = offsetof(struct PyPetscISObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_IS = &PyPetscIS_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_LGMap = &__pyx_vtable_8petsc4py_5PETSc_LGMap;
  __pyx_vtable_8petsc4py_5PETSc_LGMap.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscLGMap_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscLGMap_Type) < 0) __PYX_ERR(29, 350, __pyx_L1_error)
  PyPetscLGMap_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscLGMap_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_LGMap) < 0) __PYX_ERR(29, 350, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "LGMap", (PyObject *)&PyPetscLGMap_Type) < 0) __PYX_ERR(29, 350, __pyx_L1_error)
  if (PyPetscLGMap_Type.tp_weaklistoffset == 0) PyPetscLGMap_Type.tp_weaklistoffset = offsetof(struct PyPetscLGMapObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_LGMap = &PyPetscLGMap_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_SF = &__pyx_vtable_8petsc4py_5PETSc_SF;
  __pyx_vtable_8petsc4py_5PETSc_SF.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscSF_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscSF_Type) < 0) __PYX_ERR(45, 9, __pyx_L1_error)
  PyPetscSF_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscSF_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_SF) < 0) __PYX_ERR(45, 9, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "SF", (PyObject *)&PyPetscSF_Type) < 0) __PYX_ERR(45, 9, __pyx_L1_error)
  if (PyPetscSF_Type.tp_weaklistoffset == 0) PyPetscSF_Type.tp_weaklistoffset = offsetof(struct PyPetscSFObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_SF = &PyPetscSF_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_Vec = &__pyx_vtable_8petsc4py_5PETSc_Vec;
  __pyx_vtable_8petsc4py_5PETSc_Vec.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscVec_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscVec_Type) < 0) __PYX_ERR(30, 25, __pyx_L1_error)
  PyPetscVec_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscVec_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_Vec) < 0) __PYX_ERR(30, 25, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Vec", (PyObject *)&PyPetscVec_Type) < 0) __PYX_ERR(30, 25, __pyx_L1_error)
  if (PyPetscVec_Type.tp_weaklistoffset == 0) PyPetscVec_Type.tp_weaklistoffset = offsetof(struct PyPetscVecObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_Vec = &PyPetscVec_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_Scatter = &__pyx_vtable_8petsc4py_5PETSc_Scatter;
  __pyx_vtable_8petsc4py_5PETSc_Scatter.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscScatter_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscScatter_Type) < 0) __PYX_ERR(31, 3, __pyx_L1_error)
  PyPetscScatter_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscScatter_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_Scatter) < 0) __PYX_ERR(31, 3, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Scatter", (PyObject *)&PyPetscScatter_Type) < 0) __PYX_ERR(31, 3, __pyx_L1_error)
  if (PyPetscScatter_Type.tp_weaklistoffset == 0) PyPetscScatter_Type.tp_weaklistoffset = offsetof(struct PyPetscScatterObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_Scatter = &PyPetscScatter_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_Section = &__pyx_vtable_8petsc4py_5PETSc_Section;
  __pyx_vtable_8petsc4py_5PETSc_Section.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscSection_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscSection_Type) < 0) __PYX_ERR(32, 3, __pyx_L1_error)
  PyPetscSection_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscSection_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_Section) < 0) __PYX_ERR(32, 3, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Section", (PyObject *)&PyPetscSection_Type) < 0) __PYX_ERR(32, 3, __pyx_L1_error)
  if (PyPetscSection_Type.tp_weaklistoffset == 0) PyPetscSection_Type.tp_weaklistoffset = offsetof(struct PyPetscSectionObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_Section = &PyPetscSection_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_Mat = &__pyx_vtable_8petsc4py_5PETSc_Mat;
  __pyx_vtable_8petsc4py_5PETSc_Mat.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscMat_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscMat_Type) < 0) __PYX_ERR(33, 148, __pyx_L1_error)
  PyPetscMat_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscMat_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_Mat) < 0) __PYX_ERR(33, 148, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Mat", (PyObject *)&PyPetscMat_Type) < 0) __PYX_ERR(33, 148, __pyx_L1_error)
  if (PyPetscMat_Type.tp_weaklistoffset == 0) PyPetscMat_Type.tp_weaklistoffset = offsetof(struct PyPetscMatObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_Mat = &PyPetscMat_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_NullSpace = &__pyx_vtable_8petsc4py_5PETSc_NullSpace;
  __pyx_vtable_8petsc4py_5PETSc_NullSpace.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscNullSpace_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscNullSpace_Type) < 0) __PYX_ERR(33, 1461, __pyx_L1_error)
  PyPetscNullSpace_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscNullSpace_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_NullSpace) < 0) __PYX_ERR(33, 1461, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "NullSpace", (PyObject *)&PyPetscNullSpace_Type) < 0) __PYX_ERR(33, 1461, __pyx_L1_error)
  if (PyPetscNullSpace_Type.tp_weaklistoffset == 0) PyPetscNullSpace_Type.tp_weaklistoffset = offsetof(struct PyPetscNullSpaceObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_NullSpace = &PyPetscNullSpace_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_PC = &__pyx_vtable_8petsc4py_5PETSc_PC;
  __pyx_vtable_8petsc4py_5PETSc_PC.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscPC_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscPC_Type) < 0) __PYX_ERR(34, 104, __pyx_L1_error)
  PyPetscPC_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscPC_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_PC) < 0) __PYX_ERR(34, 104, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "PC", (PyObject *)&PyPetscPC_Type) < 0) __PYX_ERR(34, 104, __pyx_L1_error)
  if (PyPetscPC_Type.tp_weaklistoffset == 0) PyPetscPC_Type.tp_weaklistoffset = offsetof(struct PyPetscPCObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_PC = &PyPetscPC_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_KSP = &__pyx_vtable_8petsc4py_5PETSc_KSP;
  __pyx_vtable_8petsc4py_5PETSc_KSP.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscKSP_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscKSP_Type) < 0) __PYX_ERR(35, 86, __pyx_L1_error)
  PyPetscKSP_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscKSP_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_KSP) < 0) __PYX_ERR(35, 86, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "KSP", (PyObject *)&PyPetscKSP_Type) < 0) __PYX_ERR(35, 86, __pyx_L1_error)
  if (PyPetscKSP_Type.tp_weaklistoffset == 0) PyPetscKSP_Type.tp_weaklistoffset = offsetof(struct PyPetscKSPObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_KSP = &PyPetscKSP_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_SNES = &__pyx_vtable_8petsc4py_5PETSc_SNES;
  __pyx_vtable_8petsc4py_5PETSc_SNES.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscSNES_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscSNES_Type) < 0) __PYX_ERR(36, 61, __pyx_L1_error)
  PyPetscSNES_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscSNES_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_SNES) < 0) __PYX_ERR(36, 61, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "SNES", (PyObject *)&PyPetscSNES_Type) < 0) __PYX_ERR(36, 61, __pyx_L1_error)
  if (PyPetscSNES_Type.tp_weaklistoffset == 0) PyPetscSNES_Type.tp_weaklistoffset = offsetof(struct PyPetscSNESObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_SNES = &PyPetscSNES_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_TS = &__pyx_vtable_8petsc4py_5PETSc_TS;
  __pyx_vtable_8petsc4py_5PETSc_TS.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscTS_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscTS_Type) < 0) __PYX_ERR(37, 69, __pyx_L1_error)
  PyPetscTS_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscTS_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_TS) < 0) __PYX_ERR(37, 69, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "TS", (PyObject *)&PyPetscTS_Type) < 0) __PYX_ERR(37, 69, __pyx_L1_error)
  if (PyPetscTS_Type.tp_weaklistoffset == 0) PyPetscTS_Type.tp_weaklistoffset = offsetof(struct PyPetscTSObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_TS = &PyPetscTS_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_TAO = &__pyx_vtable_8petsc4py_5PETSc_TAO;
  __pyx_vtable_8petsc4py_5PETSc_TAO.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscTAO_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscTAO_Type) < 0) __PYX_ERR(38, 53, __pyx_L1_error)
  PyPetscTAO_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscTAO_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_TAO) < 0) __PYX_ERR(38, 53, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "TAO", (PyObject *)&PyPetscTAO_Type) < 0) __PYX_ERR(38, 53, __pyx_L1_error)
  if (PyPetscTAO_Type.tp_weaklistoffset == 0) PyPetscTAO_Type.tp_weaklistoffset = offsetof(struct PyPetscTAOObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_TAO = &PyPetscTAO_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_AO = &__pyx_vtable_8petsc4py_5PETSc_AO;
  __pyx_vtable_8petsc4py_5PETSc_AO.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscAO_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscAO_Type) < 0) __PYX_ERR(39, 11, __pyx_L1_error)
  PyPetscAO_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscAO_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_AO) < 0) __PYX_ERR(39, 11, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "AO", (PyObject *)&PyPetscAO_Type) < 0) __PYX_ERR(39, 11, __pyx_L1_error)
  if (PyPetscAO_Type.tp_weaklistoffset == 0) PyPetscAO_Type.tp_weaklistoffset = offsetof(struct PyPetscAOObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_AO = &PyPetscAO_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_DM = &__pyx_vtable_8petsc4py_5PETSc_DM;
  __pyx_vtable_8petsc4py_5PETSc_DM.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscDM_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscDM_Type) < 0) __PYX_ERR(40, 24, __pyx_L1_error)
  PyPetscDM_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscDM_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_DM) < 0) __PYX_ERR(40, 24, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "DM", (PyObject *)&PyPetscDM_Type) < 0) __PYX_ERR(40, 24, __pyx_L1_error)
  if (PyPetscDM_Type.tp_weaklistoffset == 0) PyPetscDM_Type.tp_weaklistoffset = offsetof(struct PyPetscDMObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_DM = &PyPetscDM_Type;
  __pyx_vtabptr_8petsc4py_5PETSc_Partitioner = &__pyx_vtable_8petsc4py_5PETSc_Partitioner;
  __pyx_vtable_8petsc4py_5PETSc_Partitioner.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Object;
  PyPetscPartitioner_Type.tp_base = __pyx_ptype_8petsc4py_5PETSc_Object;
  if (PyType_Ready(&PyPetscPartitioner_Type) < 0) __PYX_ERR(46, 10, __pyx_L1_error)
  PyPetscPartitioner_Type.tp_print = 0;
  if (__Pyx_SetVtable(PyPetscPartitioner_Type.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_Partitioner) < 0) __PYX_ERR(46, 10, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Partitioner", (PyObject *)&PyPetscPartitioner_Type) < 0) __PYX_ERR(46, 10, __pyx_L1_error)
  if (PyPetscPartitioner_Type.tp_weaklistoffset == 0) PyPetscPartitioner_Type.tp_weaklistoffset = offsetof(struct PyPetscPartitionerObject, __pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_Partitioner = &PyPetscPartitioner_Type;
  __pyx_ptype_8petsc4py_5PETSc_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_8petsc4py_5PETSc_dtype)) __PYX_ERR(12, 9, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_8petsc4py_5PETSc_ndarray)) __PYX_ERR(12, 12, __pyx_L1_error)
  __pyx_vtabptr_8petsc4py_5PETSc__IS_buffer = &__pyx_vtable_8petsc4py_5PETSc__IS_buffer;
  __pyx_vtable_8petsc4py_5PETSc__IS_buffer.acquire = (int (*)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *))__pyx_f_8petsc4py_5PETSc_10_IS_buffer_acquire;
  __pyx_vtable_8petsc4py_5PETSc__IS_buffer.release = (int (*)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *))__pyx_f_8petsc4py_5PETSc_10_IS_buffer_release;
  __pyx_vtable_8petsc4py_5PETSc__IS_buffer.acquirebuffer = (int (*)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *, Py_buffer *, int))__pyx_f_8petsc4py_5PETSc_10_IS_buffer_acquirebuffer;
  __pyx_vtable_8petsc4py_5PETSc__IS_buffer.releasebuffer = (int (*)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *, Py_buffer *))__pyx_f_8petsc4py_5PETSc_10_IS_buffer_releasebuffer;
  __pyx_vtable_8petsc4py_5PETSc__IS_buffer.enter = (PyObject *(*)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *))__pyx_f_8petsc4py_5PETSc_10_IS_buffer_enter;
  __pyx_vtable_8petsc4py_5PETSc__IS_buffer.exit = (PyObject *(*)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *))__pyx_f_8petsc4py_5PETSc_10_IS_buffer_exit;
  __pyx_vtable_8petsc4py_5PETSc__IS_buffer.getbuffer = (Py_ssize_t (*)(struct __pyx_obj_8petsc4py_5PETSc__IS_buffer *, void **))__pyx_f_8petsc4py_5PETSc_10_IS_buffer_getbuffer;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc__IS_buffer) < 0) __PYX_ERR(4, 113, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc__IS_buffer.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8petsc4py_5PETSc__IS_buffer.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc__IS_buffer) < 0) __PYX_ERR(4, 113, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "_IS_buffer", (PyObject *)&__pyx_type_8petsc4py_5PETSc__IS_buffer) < 0) __PYX_ERR(4, 113, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc__IS_buffer = &__pyx_type_8petsc4py_5PETSc__IS_buffer;
  __pyx_vtabptr_8petsc4py_5PETSc__Vec_buffer = &__pyx_vtable_8petsc4py_5PETSc__Vec_buffer;
  __pyx_vtable_8petsc4py_5PETSc__Vec_buffer.acquire = (int (*)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *))__pyx_f_8petsc4py_5PETSc_11_Vec_buffer_acquire;
  __pyx_vtable_8petsc4py_5PETSc__Vec_buffer.release = (int (*)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *))__pyx_f_8petsc4py_5PETSc_11_Vec_buffer_release;
  __pyx_vtable_8petsc4py_5PETSc__Vec_buffer.acquirebuffer = (int (*)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *, Py_buffer *, int))__pyx_f_8petsc4py_5PETSc_11_Vec_buffer_acquirebuffer;
  __pyx_vtable_8petsc4py_5PETSc__Vec_buffer.releasebuffer = (int (*)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *, Py_buffer *))__pyx_f_8petsc4py_5PETSc_11_Vec_buffer_releasebuffer;
  __pyx_vtable_8petsc4py_5PETSc__Vec_buffer.enter = (PyObject *(*)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *))__pyx_f_8petsc4py_5PETSc_11_Vec_buffer_enter;
  __pyx_vtable_8petsc4py_5PETSc__Vec_buffer.exit = (PyObject *(*)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *))__pyx_f_8petsc4py_5PETSc_11_Vec_buffer_exit;
  __pyx_vtable_8petsc4py_5PETSc__Vec_buffer.getbuffer = (Py_ssize_t (*)(struct __pyx_obj_8petsc4py_5PETSc__Vec_buffer *, void **))__pyx_f_8petsc4py_5PETSc_11_Vec_buffer_getbuffer;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc__Vec_buffer) < 0) __PYX_ERR(5, 413, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc__Vec_buffer.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8petsc4py_5PETSc__Vec_buffer.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc__Vec_buffer) < 0) __PYX_ERR(5, 413, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "_Vec_buffer", (PyObject *)&__pyx_type_8petsc4py_5PETSc__Vec_buffer) < 0) __PYX_ERR(5, 413, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc__Vec_buffer = &__pyx_type_8petsc4py_5PETSc__Vec_buffer;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc__Vec_LocalForm) < 0) __PYX_ERR(5, 533, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc__Vec_LocalForm.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "_Vec_LocalForm", (PyObject *)&__pyx_type_8petsc4py_5PETSc__Vec_LocalForm) < 0) __PYX_ERR(5, 533, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc__Vec_LocalForm = &__pyx_type_8petsc4py_5PETSc__Vec_LocalForm;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc__Mat_Stencil) < 0) __PYX_ERR(6, 1017, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc__Mat_Stencil.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "_Mat_Stencil", (PyObject *)&__pyx_type_8petsc4py_5PETSc__Mat_Stencil) < 0) __PYX_ERR(6, 1017, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc__Mat_Stencil = &__pyx_type_8petsc4py_5PETSc__Mat_Stencil;
  __pyx_vtabptr_8petsc4py_5PETSc__DMDA_Vec_array = &__pyx_vtable_8petsc4py_5PETSc__DMDA_Vec_array;
  __pyx_vtable_8petsc4py_5PETSc__DMDA_Vec_array.acquire = (int (*)(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *))__pyx_f_8petsc4py_5PETSc_15_DMDA_Vec_array_acquire;
  __pyx_vtable_8petsc4py_5PETSc__DMDA_Vec_array.release = (int (*)(struct __pyx_obj_8petsc4py_5PETSc__DMDA_Vec_array *))__pyx_f_8petsc4py_5PETSc_15_DMDA_Vec_array_release;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc__DMDA_Vec_array) < 0) __PYX_ERR(7, 198, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc__DMDA_Vec_array.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8petsc4py_5PETSc__DMDA_Vec_array.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc__DMDA_Vec_array) < 0) __PYX_ERR(7, 198, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "_DMDA_Vec_array", (PyObject *)&__pyx_type_8petsc4py_5PETSc__DMDA_Vec_array) < 0) __PYX_ERR(7, 198, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc__DMDA_Vec_array = &__pyx_type_8petsc4py_5PETSc__DMDA_Vec_array;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc__DMComposite_access) < 0) __PYX_ERR(23, 17, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc__DMComposite_access.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "_DMComposite_access", (PyObject *)&__pyx_type_8petsc4py_5PETSc__DMComposite_access) < 0) __PYX_ERR(23, 17, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc__DMComposite_access = &__pyx_type_8petsc4py_5PETSc__DMComposite_access;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc_Options) < 0) __PYX_ERR(24, 3, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc_Options.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "Options", (PyObject *)&__pyx_type_8petsc4py_5PETSc_Options) < 0) __PYX_ERR(24, 3, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc_Options = &__pyx_type_8petsc4py_5PETSc_Options;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc_Sys) < 0) __PYX_ERR(25, 3, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc_Sys.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "Sys", (PyObject *)&__pyx_type_8petsc4py_5PETSc_Sys) < 0) __PYX_ERR(25, 3, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc_Sys = &__pyx_type_8petsc4py_5PETSc_Sys;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc_Log) < 0) __PYX_ERR(26, 3, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc_Log.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "Log", (PyObject *)&__pyx_type_8petsc4py_5PETSc_Log) < 0) __PYX_ERR(26, 3, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc_Log = &__pyx_type_8petsc4py_5PETSc_Log;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc_LogStage) < 0) __PYX_ERR(26, 95, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc_LogStage.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "LogStage", (PyObject *)&__pyx_type_8petsc4py_5PETSc_LogStage) < 0) __PYX_ERR(26, 95, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc_LogStage = &__pyx_type_8petsc4py_5PETSc_LogStage;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc_LogClass) < 0) __PYX_ERR(26, 191, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc_LogClass.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "LogClass", (PyObject *)&__pyx_type_8petsc4py_5PETSc_LogClass) < 0) __PYX_ERR(26, 191, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc_LogClass = &__pyx_type_8petsc4py_5PETSc_LogClass;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc_LogEvent) < 0) __PYX_ERR(26, 253, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc_LogEvent.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "LogEvent", (PyObject *)&__pyx_type_8petsc4py_5PETSc_LogEvent) < 0) __PYX_ERR(26, 253, __pyx_L1_error)
  __pyx_ptype_8petsc4py_5PETSc_LogEvent = &__pyx_type_8petsc4py_5PETSc_LogEvent;
  __pyx_vtabptr_8petsc4py_5PETSc_ViewerHDF5 = &__pyx_vtable_8petsc4py_5PETSc_ViewerHDF5;
  __pyx_vtable_8petsc4py_5PETSc_ViewerHDF5.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_Viewer;
  __pyx_type_8petsc4py_5PETSc_ViewerHDF5.tp_base = __pyx_ptype_8petsc4py_5PETSc_Viewer;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc_ViewerHDF5) < 0) __PYX_ERR(27, 322, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc_ViewerHDF5.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8petsc4py_5PETSc_ViewerHDF5.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_ViewerHDF5) < 0) __PYX_ERR(27, 322, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "ViewerHDF5", (PyObject *)&__pyx_type_8petsc4py_5PETSc_ViewerHDF5) < 0) __PYX_ERR(27, 322, __pyx_L1_error)
  if (__pyx_type_8petsc4py_5PETSc_ViewerHDF5.tp_weaklistoffset == 0) __pyx_type_8petsc4py_5PETSc_ViewerHDF5.tp_weaklistoffset = offsetof(struct __pyx_obj_8petsc4py_5PETSc_ViewerHDF5, __pyx_base.__pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_ViewerHDF5 = &__pyx_type_8petsc4py_5PETSc_ViewerHDF5;
  __pyx_vtabptr_8petsc4py_5PETSc_DMDA = &__pyx_vtable_8petsc4py_5PETSc_DMDA;
  __pyx_vtable_8petsc4py_5PETSc_DMDA.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_DM;
  __pyx_type_8petsc4py_5PETSc_DMDA.tp_base = __pyx_ptype_8petsc4py_5PETSc_DM;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc_DMDA) < 0) __PYX_ERR(41, 17, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc_DMDA.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8petsc4py_5PETSc_DMDA.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_DMDA) < 0) __PYX_ERR(41, 17, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "DMDA", (PyObject *)&__pyx_type_8petsc4py_5PETSc_DMDA) < 0) __PYX_ERR(41, 17, __pyx_L1_error)
  if (__pyx_type_8petsc4py_5PETSc_DMDA.tp_weaklistoffset == 0) __pyx_type_8petsc4py_5PETSc_DMDA.tp_weaklistoffset = offsetof(struct __pyx_obj_8petsc4py_5PETSc_DMDA, __pyx_base.__pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_DMDA = &__pyx_type_8petsc4py_5PETSc_DMDA;
  __pyx_vtabptr_8petsc4py_5PETSc_DMPlex = &__pyx_vtable_8petsc4py_5PETSc_DMPlex;
  __pyx_vtable_8petsc4py_5PETSc_DMPlex.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_DM;
  __pyx_type_8petsc4py_5PETSc_DMPlex.tp_base = __pyx_ptype_8petsc4py_5PETSc_DM;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc_DMPlex) < 0) __PYX_ERR(42, 3, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc_DMPlex.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8petsc4py_5PETSc_DMPlex.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_DMPlex) < 0) __PYX_ERR(42, 3, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "DMPlex", (PyObject *)&__pyx_type_8petsc4py_5PETSc_DMPlex) < 0) __PYX_ERR(42, 3, __pyx_L1_error)
  if (__pyx_type_8petsc4py_5PETSc_DMPlex.tp_weaklistoffset == 0) __pyx_type_8petsc4py_5PETSc_DMPlex.tp_weaklistoffset = offsetof(struct __pyx_obj_8petsc4py_5PETSc_DMPlex, __pyx_base.__pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_DMPlex = &__pyx_type_8petsc4py_5PETSc_DMPlex;
  __pyx_vtabptr_8petsc4py_5PETSc_DMComposite = &__pyx_vtable_8petsc4py_5PETSc_DMComposite;
  __pyx_vtable_8petsc4py_5PETSc_DMComposite.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_DM;
  __pyx_type_8petsc4py_5PETSc_DMComposite.tp_base = __pyx_ptype_8petsc4py_5PETSc_DM;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc_DMComposite) < 0) __PYX_ERR(43, 3, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc_DMComposite.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8petsc4py_5PETSc_DMComposite.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_DMComposite) < 0) __PYX_ERR(43, 3, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "DMComposite", (PyObject *)&__pyx_type_8petsc4py_5PETSc_DMComposite) < 0) __PYX_ERR(43, 3, __pyx_L1_error)
  if (__pyx_type_8petsc4py_5PETSc_DMComposite.tp_weaklistoffset == 0) __pyx_type_8petsc4py_5PETSc_DMComposite.tp_weaklistoffset = offsetof(struct __pyx_obj_8petsc4py_5PETSc_DMComposite, __pyx_base.__pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_DMComposite = &__pyx_type_8petsc4py_5PETSc_DMComposite;
  __pyx_vtabptr_8petsc4py_5PETSc_DMShell = &__pyx_vtable_8petsc4py_5PETSc_DMShell;
  __pyx_vtable_8petsc4py_5PETSc_DMShell.__pyx_base = *__pyx_vtabptr_8petsc4py_5PETSc_DM;
  __pyx_type_8petsc4py_5PETSc_DMShell.tp_base = __pyx_ptype_8petsc4py_5PETSc_DM;
  if (PyType_Ready(&__pyx_type_8petsc4py_5PETSc_DMShell) < 0) __PYX_ERR(44, 1, __pyx_L1_error)
  __pyx_type_8petsc4py_5PETSc_DMShell.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8petsc4py_5PETSc_DMShell.tp_dict, __pyx_vtabptr_8petsc4py_5PETSc_DMShell) < 0) __PYX_ERR(44, 1, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "DMShell", (PyObject *)&__pyx_type_8petsc4py_5PETSc_DMShell) < 0) __PYX_ERR(44, 1, __pyx_L1_error)
  if (__pyx_type_8petsc4py_5PETSc_DMShell.tp_weaklistoffset == 0) __pyx_type_8petsc4py_5PETSc_DMShell.tp_weaklistoffset = offsetof(struct __pyx_obj_8petsc4py_5PETSc_DMShell, __pyx_base.__pyx_base.__weakref__);
  __pyx_ptype_8petsc4py_5PETSc_DMShell = &__pyx_type_8petsc4py_5PETSc_DMShell;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(48, 1, __pyx_L1_error)
  #endif

  /* "PETSc/PETSc.pyx":47
 *     void *PyExc_RuntimeError
 * 
 * cdef object PetscError = <object>PyExc_RuntimeError             # <<<<<<<<<<<<<<
 * 
 * cdef inline int SETERR(int ierr) with gil:
 */
  __pyx_t_1 = ((PyObject *)PyExc_RuntimeError);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_8petsc4py_5PETSc_PetscError);
  __Pyx_DECREF_SET(__pyx_v_8petsc4py_5PETSc_PetscError, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/PETSc.pyx":106
 * include "arraynpy.pxi"
 * 
 * import_array()             # <<<<<<<<<<<<<<
 * 
 * IntType     = PyArray_TypeObjectFromType(NPY_PETSC_INT)
 */
  __pyx_t_2 = _import_array(); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(11, 106, __pyx_L1_error)

  /* "PETSc/PETSc.pyx":108
 * import_array()
 * 
 * IntType     = PyArray_TypeObjectFromType(NPY_PETSC_INT)             # <<<<<<<<<<<<<<
 * RealType    = PyArray_TypeObjectFromType(NPY_PETSC_REAL)
 * ScalarType  = PyArray_TypeObjectFromType(NPY_PETSC_SCALAR)
 */
  __pyx_t_1 = PyArray_TypeObjectFromType(NPY_PETSC_INT); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_IntType, __pyx_t_1) < 0) __PYX_ERR(11, 108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/PETSc.pyx":109
 * 
 * IntType     = PyArray_TypeObjectFromType(NPY_PETSC_INT)
 * RealType    = PyArray_TypeObjectFromType(NPY_PETSC_REAL)             # <<<<<<<<<<<<<<
 * ScalarType  = PyArray_TypeObjectFromType(NPY_PETSC_SCALAR)
 * ComplexType = PyArray_TypeObjectFromType(NPY_PETSC_COMPLEX)
 */
  __pyx_t_1 = PyArray_TypeObjectFromType(NPY_PETSC_REAL); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RealType, __pyx_t_1) < 0) __PYX_ERR(11, 109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/PETSc.pyx":110
 * IntType     = PyArray_TypeObjectFromType(NPY_PETSC_INT)
 * RealType    = PyArray_TypeObjectFromType(NPY_PETSC_REAL)
 * ScalarType  = PyArray_TypeObjectFromType(NPY_PETSC_SCALAR)             # <<<<<<<<<<<<<<
 * ComplexType = PyArray_TypeObjectFromType(NPY_PETSC_COMPLEX)
 * 
 */
  __pyx_t_1 = PyArray_TypeObjectFromType(NPY_PETSC_SCALAR); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ScalarType, __pyx_t_1) < 0) __PYX_ERR(11, 110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/PETSc.pyx":111
 * RealType    = PyArray_TypeObjectFromType(NPY_PETSC_REAL)
 * ScalarType  = PyArray_TypeObjectFromType(NPY_PETSC_SCALAR)
 * ComplexType = PyArray_TypeObjectFromType(NPY_PETSC_COMPLEX)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_1 = PyArray_TypeObjectFromType(NPY_PETSC_COMPLEX); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ComplexType, __pyx_t_1) < 0) __PYX_ERR(11, 111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/PETSc.pyx":145
 * # --------------------------------------------------------------------
 * 
 * __doc__ = u"""             # <<<<<<<<<<<<<<
 * Portable, Extensible Toolkit for Scientific Computation
 * """
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_doc, __pyx_kp_u_Portable_Extensible_Toolkit_for) < 0) __PYX_ERR(11, 145, __pyx_L1_error)

  /* "PETSc/Const.pyx":3
 * # --------------------------------------------------------------------
 * 
 * DECIDE    = PETSC_DECIDE             # <<<<<<<<<<<<<<
 * DEFAULT   = PETSC_DEFAULT
 * DETERMINE = PETSC_DETERMINE
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(PETSC_DECIDE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DECIDE, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Const.pyx":4
 * 
 * DECIDE    = PETSC_DECIDE
 * DEFAULT   = PETSC_DEFAULT             # <<<<<<<<<<<<<<
 * DETERMINE = PETSC_DETERMINE
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(PETSC_DEFAULT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Const.pyx":5
 * DECIDE    = PETSC_DECIDE
 * DEFAULT   = PETSC_DEFAULT
 * DETERMINE = PETSC_DETERMINE             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(PETSC_DETERMINE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DETERMINE, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Const.pyx":9
 * # --------------------------------------------------------------------
 * 
 * INFINITY  = toReal(PETSC_INFINITY)             # <<<<<<<<<<<<<<
 * NINFINITY = toReal(PETSC_NINFINITY)
 * PINFINITY = toReal(PETSC_INFINITY)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toReal(PETSC_INFINITY); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_INFINITY, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Const.pyx":10
 * 
 * INFINITY  = toReal(PETSC_INFINITY)
 * NINFINITY = toReal(PETSC_NINFINITY)             # <<<<<<<<<<<<<<
 * PINFINITY = toReal(PETSC_INFINITY)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toReal(PETSC_NINFINITY); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NINFINITY, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Const.pyx":11
 * INFINITY  = toReal(PETSC_INFINITY)
 * NINFINITY = toReal(PETSC_NINFINITY)
 * PINFINITY = toReal(PETSC_INFINITY)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_toReal(PETSC_INFINITY); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PINFINITY, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Const.pyx":15
 * # --------------------------------------------------------------------
 * 
 * class InsertMode(object):             # <<<<<<<<<<<<<<
 *     # native
 *     NOT_SET_VALUES    = PETSC_NOT_SET_VALUES
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_1, __pyx_n_s_InsertMode, __pyx_n_s_InsertMode, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Const.pyx":17
 * class InsertMode(object):
 *     # native
 *     NOT_SET_VALUES    = PETSC_NOT_SET_VALUES             # <<<<<<<<<<<<<<
 *     INSERT_VALUES     = PETSC_INSERT_VALUES
 *     ADD_VALUES        = PETSC_ADD_VALUES
 */
  __pyx_t_5 = __Pyx_PyInt_From_InsertMode(NOT_SET_VALUES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NOT_SET_VALUES, __pyx_t_5) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":18
 *     # native
 *     NOT_SET_VALUES    = PETSC_NOT_SET_VALUES
 *     INSERT_VALUES     = PETSC_INSERT_VALUES             # <<<<<<<<<<<<<<
 *     ADD_VALUES        = PETSC_ADD_VALUES
 *     MAX_VALUES        = PETSC_MAX_VALUES
 */
  __pyx_t_5 = __Pyx_PyInt_From_InsertMode(INSERT_VALUES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INSERT_VALUES, __pyx_t_5) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":19
 *     NOT_SET_VALUES    = PETSC_NOT_SET_VALUES
 *     INSERT_VALUES     = PETSC_INSERT_VALUES
 *     ADD_VALUES        = PETSC_ADD_VALUES             # <<<<<<<<<<<<<<
 *     MAX_VALUES        = PETSC_MAX_VALUES
 *     INSERT_ALL_VALUES = PETSC_INSERT_ALL_VALUES
 */
  __pyx_t_5 = __Pyx_PyInt_From_InsertMode(ADD_VALUES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ADD_VALUES, __pyx_t_5) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":20
 *     INSERT_VALUES     = PETSC_INSERT_VALUES
 *     ADD_VALUES        = PETSC_ADD_VALUES
 *     MAX_VALUES        = PETSC_MAX_VALUES             # <<<<<<<<<<<<<<
 *     INSERT_ALL_VALUES = PETSC_INSERT_ALL_VALUES
 *     ADD_ALL_VALUES    = PETSC_ADD_ALL_VALUES
 */
  __pyx_t_5 = __Pyx_PyInt_From_InsertMode(MAX_VALUES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MAX_VALUES, __pyx_t_5) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":21
 *     ADD_VALUES        = PETSC_ADD_VALUES
 *     MAX_VALUES        = PETSC_MAX_VALUES
 *     INSERT_ALL_VALUES = PETSC_INSERT_ALL_VALUES             # <<<<<<<<<<<<<<
 *     ADD_ALL_VALUES    = PETSC_ADD_ALL_VALUES
 *     INSERT_BC_VALUES  = PETSC_INSERT_BC_VALUES
 */
  __pyx_t_5 = __Pyx_PyInt_From_InsertMode(INSERT_ALL_VALUES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INSERT_ALL_VALUES, __pyx_t_5) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":22
 *     MAX_VALUES        = PETSC_MAX_VALUES
 *     INSERT_ALL_VALUES = PETSC_INSERT_ALL_VALUES
 *     ADD_ALL_VALUES    = PETSC_ADD_ALL_VALUES             # <<<<<<<<<<<<<<
 *     INSERT_BC_VALUES  = PETSC_INSERT_BC_VALUES
 *     ADD_BC_VALUES     = PETSC_ADD_BC_VALUES
 */
  __pyx_t_5 = __Pyx_PyInt_From_InsertMode(ADD_ALL_VALUES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ADD_ALL_VALUES, __pyx_t_5) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":23
 *     INSERT_ALL_VALUES = PETSC_INSERT_ALL_VALUES
 *     ADD_ALL_VALUES    = PETSC_ADD_ALL_VALUES
 *     INSERT_BC_VALUES  = PETSC_INSERT_BC_VALUES             # <<<<<<<<<<<<<<
 *     ADD_BC_VALUES     = PETSC_ADD_BC_VALUES
 *     # aliases
 */
  __pyx_t_5 = __Pyx_PyInt_From_InsertMode(INSERT_BC_VALUES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INSERT_BC_VALUES, __pyx_t_5) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":24
 *     ADD_ALL_VALUES    = PETSC_ADD_ALL_VALUES
 *     INSERT_BC_VALUES  = PETSC_INSERT_BC_VALUES
 *     ADD_BC_VALUES     = PETSC_ADD_BC_VALUES             # <<<<<<<<<<<<<<
 *     # aliases
 *     INSERT     = INSERT_VALUES
 */
  __pyx_t_5 = __Pyx_PyInt_From_InsertMode(ADD_BC_VALUES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ADD_BC_VALUES, __pyx_t_5) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":26
 *     ADD_BC_VALUES     = PETSC_ADD_BC_VALUES
 *     # aliases
 *     INSERT     = INSERT_VALUES             # <<<<<<<<<<<<<<
 *     ADD        = ADD_VALUES
 *     MAX        = MAX_VALUES
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_INSERT_VALUES);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_INSERT_VALUES);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INSERT, __pyx_t_5) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":27
 *     # aliases
 *     INSERT     = INSERT_VALUES
 *     ADD        = ADD_VALUES             # <<<<<<<<<<<<<<
 *     MAX        = MAX_VALUES
 *     INSERT_ALL = INSERT_ALL_VALUES
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_ADD_VALUES);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ADD_VALUES);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ADD, __pyx_t_5) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":28
 *     INSERT     = INSERT_VALUES
 *     ADD        = ADD_VALUES
 *     MAX        = MAX_VALUES             # <<<<<<<<<<<<<<
 *     INSERT_ALL = INSERT_ALL_VALUES
 *     ADD_ALL    = ADD_ALL_VALUES
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_MAX_VALUES);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_VALUES);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MAX, __pyx_t_5) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":29
 *     ADD        = ADD_VALUES
 *     MAX        = MAX_VALUES
 *     INSERT_ALL = INSERT_ALL_VALUES             # <<<<<<<<<<<<<<
 *     ADD_ALL    = ADD_ALL_VALUES
 *     INSERT_BC  = INSERT_BC_VALUES
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_INSERT_ALL_VALUES);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_INSERT_ALL_VALUES);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INSERT_ALL, __pyx_t_5) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":30
 *     MAX        = MAX_VALUES
 *     INSERT_ALL = INSERT_ALL_VALUES
 *     ADD_ALL    = ADD_ALL_VALUES             # <<<<<<<<<<<<<<
 *     INSERT_BC  = INSERT_BC_VALUES
 *     ADD_BC     = ADD_BC_VALUES
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_ADD_ALL_VALUES);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ADD_ALL_VALUES);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ADD_ALL, __pyx_t_5) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":31
 *     INSERT_ALL = INSERT_ALL_VALUES
 *     ADD_ALL    = ADD_ALL_VALUES
 *     INSERT_BC  = INSERT_BC_VALUES             # <<<<<<<<<<<<<<
 *     ADD_BC     = ADD_BC_VALUES
 * 
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_INSERT_BC_VALUES);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_INSERT_BC_VALUES);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INSERT_BC, __pyx_t_5) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":32
 *     ADD_ALL    = ADD_ALL_VALUES
 *     INSERT_BC  = INSERT_BC_VALUES
 *     ADD_BC     = ADD_BC_VALUES             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_ADD_BC_VALUES);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ADD_BC_VALUES);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ADD_BC, __pyx_t_5) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":15
 * # --------------------------------------------------------------------
 * 
 * class InsertMode(object):             # <<<<<<<<<<<<<<
 *     # native
 *     NOT_SET_VALUES    = PETSC_NOT_SET_VALUES
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_InsertMode, __pyx_t_1, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_InsertMode, __pyx_t_5) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Const.pyx":36
 * # --------------------------------------------------------------------
 * 
 * class ScatterMode(object):             # <<<<<<<<<<<<<<
 *     # native
 *     SCATTER_FORWARD       = PETSC_SCATTER_FORWARD
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_1, __pyx_n_s_ScatterMode, __pyx_n_s_ScatterMode, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Const.pyx":38
 * class ScatterMode(object):
 *     # native
 *     SCATTER_FORWARD       = PETSC_SCATTER_FORWARD             # <<<<<<<<<<<<<<
 *     SCATTER_REVERSE       = PETSC_SCATTER_REVERSE
 *     SCATTER_FORWARD_LOCAL = PETSC_SCATTER_FORWARD_LOCAL
 */
  __pyx_t_5 = __Pyx_PyInt_From_ScatterMode(SCATTER_FORWARD); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SCATTER_FORWARD, __pyx_t_5) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":39
 *     # native
 *     SCATTER_FORWARD       = PETSC_SCATTER_FORWARD
 *     SCATTER_REVERSE       = PETSC_SCATTER_REVERSE             # <<<<<<<<<<<<<<
 *     SCATTER_FORWARD_LOCAL = PETSC_SCATTER_FORWARD_LOCAL
 *     SCATTER_REVERSE_LOCAL = PETSC_SCATTER_REVERSE_LOCAL
 */
  __pyx_t_5 = __Pyx_PyInt_From_ScatterMode(SCATTER_REVERSE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SCATTER_REVERSE, __pyx_t_5) < 0) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":40
 *     SCATTER_FORWARD       = PETSC_SCATTER_FORWARD
 *     SCATTER_REVERSE       = PETSC_SCATTER_REVERSE
 *     SCATTER_FORWARD_LOCAL = PETSC_SCATTER_FORWARD_LOCAL             # <<<<<<<<<<<<<<
 *     SCATTER_REVERSE_LOCAL = PETSC_SCATTER_REVERSE_LOCAL
 *     SCATTER_LOCAL         = PETSC_SCATTER_LOCAL
 */
  __pyx_t_5 = __Pyx_PyInt_From_ScatterMode(SCATTER_FORWARD_LOCAL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SCATTER_FORWARD_LOCAL, __pyx_t_5) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":41
 *     SCATTER_REVERSE       = PETSC_SCATTER_REVERSE
 *     SCATTER_FORWARD_LOCAL = PETSC_SCATTER_FORWARD_LOCAL
 *     SCATTER_REVERSE_LOCAL = PETSC_SCATTER_REVERSE_LOCAL             # <<<<<<<<<<<<<<
 *     SCATTER_LOCAL         = PETSC_SCATTER_LOCAL
 *     # aliases
 */
  __pyx_t_5 = __Pyx_PyInt_From_ScatterMode(SCATTER_REVERSE_LOCAL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SCATTER_REVERSE_LOCAL, __pyx_t_5) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":42
 *     SCATTER_FORWARD_LOCAL = PETSC_SCATTER_FORWARD_LOCAL
 *     SCATTER_REVERSE_LOCAL = PETSC_SCATTER_REVERSE_LOCAL
 *     SCATTER_LOCAL         = PETSC_SCATTER_LOCAL             # <<<<<<<<<<<<<<
 *     # aliases
 *     FORWARD       = SCATTER_FORWARD
 */
  __pyx_t_5 = __Pyx_PyInt_From_ScatterMode(SCATTER_LOCAL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SCATTER_LOCAL, __pyx_t_5) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":44
 *     SCATTER_LOCAL         = PETSC_SCATTER_LOCAL
 *     # aliases
 *     FORWARD       = SCATTER_FORWARD             # <<<<<<<<<<<<<<
 *     REVERSE       = SCATTER_REVERSE
 *     FORWARD_LOCAL = SCATTER_FORWARD_LOCAL
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_SCATTER_FORWARD);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_SCATTER_FORWARD);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FORWARD, __pyx_t_5) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":45
 *     # aliases
 *     FORWARD       = SCATTER_FORWARD
 *     REVERSE       = SCATTER_REVERSE             # <<<<<<<<<<<<<<
 *     FORWARD_LOCAL = SCATTER_FORWARD_LOCAL
 *     REVERSE_LOCAL = SCATTER_REVERSE_LOCAL
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_SCATTER_REVERSE);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_SCATTER_REVERSE);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_REVERSE, __pyx_t_5) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":46
 *     FORWARD       = SCATTER_FORWARD
 *     REVERSE       = SCATTER_REVERSE
 *     FORWARD_LOCAL = SCATTER_FORWARD_LOCAL             # <<<<<<<<<<<<<<
 *     REVERSE_LOCAL = SCATTER_REVERSE_LOCAL
 * 
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_SCATTER_FORWARD_LOCAL);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_SCATTER_FORWARD_LOCAL);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FORWARD_LOCAL, __pyx_t_5) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":47
 *     REVERSE       = SCATTER_REVERSE
 *     FORWARD_LOCAL = SCATTER_FORWARD_LOCAL
 *     REVERSE_LOCAL = SCATTER_REVERSE_LOCAL             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_SCATTER_REVERSE_LOCAL);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_SCATTER_REVERSE_LOCAL);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_REVERSE_LOCAL, __pyx_t_5) < 0) __PYX_ERR(0, 47, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":36
 * # --------------------------------------------------------------------
 * 
 * class ScatterMode(object):             # <<<<<<<<<<<<<<
 *     # native
 *     SCATTER_FORWARD       = PETSC_SCATTER_FORWARD
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_ScatterMode, __pyx_t_1, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ScatterMode, __pyx_t_5) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Const.pyx":51
 * # --------------------------------------------------------------------
 * 
 * class NormType(object):             # <<<<<<<<<<<<<<
 *     # native
 *     NORM_1         = PETSC_NORM_1
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_1, __pyx_n_s_NormType, __pyx_n_s_NormType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Const.pyx":53
 * class NormType(object):
 *     # native
 *     NORM_1         = PETSC_NORM_1             # <<<<<<<<<<<<<<
 *     NORM_2         = PETSC_NORM_2
 *     NORM_1_AND_2   = PETSC_NORM_1_AND_2
 */
  __pyx_t_5 = __Pyx_PyInt_From_NormType(NORM_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_1, __pyx_t_5) < 0) __PYX_ERR(0, 53, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":54
 *     # native
 *     NORM_1         = PETSC_NORM_1
 *     NORM_2         = PETSC_NORM_2             # <<<<<<<<<<<<<<
 *     NORM_1_AND_2   = PETSC_NORM_1_AND_2
 *     NORM_FROBENIUS = PETSC_NORM_FROBENIUS
 */
  __pyx_t_5 = __Pyx_PyInt_From_NormType(NORM_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_2, __pyx_t_5) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":55
 *     NORM_1         = PETSC_NORM_1
 *     NORM_2         = PETSC_NORM_2
 *     NORM_1_AND_2   = PETSC_NORM_1_AND_2             # <<<<<<<<<<<<<<
 *     NORM_FROBENIUS = PETSC_NORM_FROBENIUS
 *     NORM_INFINITY  = PETSC_NORM_INFINITY
 */
  __pyx_t_5 = __Pyx_PyInt_From_NormType(NORM_1_AND_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_1_AND_2, __pyx_t_5) < 0) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":56
 *     NORM_2         = PETSC_NORM_2
 *     NORM_1_AND_2   = PETSC_NORM_1_AND_2
 *     NORM_FROBENIUS = PETSC_NORM_FROBENIUS             # <<<<<<<<<<<<<<
 *     NORM_INFINITY  = PETSC_NORM_INFINITY
 *     NORM_MAX       = PETSC_NORM_MAX
 */
  __pyx_t_5 = __Pyx_PyInt_From_NormType(NORM_FROBENIUS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_FROBENIUS, __pyx_t_5) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":57
 *     NORM_1_AND_2   = PETSC_NORM_1_AND_2
 *     NORM_FROBENIUS = PETSC_NORM_FROBENIUS
 *     NORM_INFINITY  = PETSC_NORM_INFINITY             # <<<<<<<<<<<<<<
 *     NORM_MAX       = PETSC_NORM_MAX
 *     # aliases
 */
  __pyx_t_5 = __Pyx_PyInt_From_NormType(NORM_INFINITY); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_INFINITY, __pyx_t_5) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":58
 *     NORM_FROBENIUS = PETSC_NORM_FROBENIUS
 *     NORM_INFINITY  = PETSC_NORM_INFINITY
 *     NORM_MAX       = PETSC_NORM_MAX             # <<<<<<<<<<<<<<
 *     # aliases
 *     N1        = NORM_1
 */
  __pyx_t_5 = __Pyx_PyInt_From_NormType(NORM_MAX); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_MAX, __pyx_t_5) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":60
 *     NORM_MAX       = PETSC_NORM_MAX
 *     # aliases
 *     N1        = NORM_1             # <<<<<<<<<<<<<<
 *     N2        = NORM_2
 *     N12       = NORM_1_AND_2
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_1);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_1);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_N1, __pyx_t_5) < 0) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":61
 *     # aliases
 *     N1        = NORM_1
 *     N2        = NORM_2             # <<<<<<<<<<<<<<
 *     N12       = NORM_1_AND_2
 *     MAX       = NORM_MAX
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_2);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_2);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_N2, __pyx_t_5) < 0) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":62
 *     N1        = NORM_1
 *     N2        = NORM_2
 *     N12       = NORM_1_AND_2             # <<<<<<<<<<<<<<
 *     MAX       = NORM_MAX
 *     FROBENIUS = NORM_FROBENIUS
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_1_AND_2);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_1_AND_2);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_N12, __pyx_t_5) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":63
 *     N2        = NORM_2
 *     N12       = NORM_1_AND_2
 *     MAX       = NORM_MAX             # <<<<<<<<<<<<<<
 *     FROBENIUS = NORM_FROBENIUS
 *     INFINITY  = NORM_INFINITY
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_MAX);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_MAX);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MAX, __pyx_t_5) < 0) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":64
 *     N12       = NORM_1_AND_2
 *     MAX       = NORM_MAX
 *     FROBENIUS = NORM_FROBENIUS             # <<<<<<<<<<<<<<
 *     INFINITY  = NORM_INFINITY
 *     # extra aliases
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_FROBENIUS);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_FROBENIUS);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FROBENIUS, __pyx_t_5) < 0) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":65
 *     MAX       = NORM_MAX
 *     FROBENIUS = NORM_FROBENIUS
 *     INFINITY  = NORM_INFINITY             # <<<<<<<<<<<<<<
 *     # extra aliases
 *     FRB = FROBENIUS
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_INFINITY);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_INFINITY);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INFINITY, __pyx_t_5) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":67
 *     INFINITY  = NORM_INFINITY
 *     # extra aliases
 *     FRB = FROBENIUS             # <<<<<<<<<<<<<<
 *     INF = INFINITY
 * 
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_FROBENIUS);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_FROBENIUS);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FRB, __pyx_t_5) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":68
 *     # extra aliases
 *     FRB = FROBENIUS
 *     INF = INFINITY             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_INFINITY);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_INFINITY);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INF, __pyx_t_5) < 0) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Const.pyx":51
 * # --------------------------------------------------------------------
 * 
 * class NormType(object):             # <<<<<<<<<<<<<<
 *     # native
 *     NORM_1         = PETSC_NORM_1
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_NormType, __pyx_t_1, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NormType, __pyx_t_5) < 0) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Error.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class Error(RuntimeError):             # <<<<<<<<<<<<<<
 * 
 *     _traceback_ = []
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_RuntimeError);
  __Pyx_GIVEREF(__pyx_builtin_RuntimeError);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_RuntimeError);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_1, __pyx_n_s_Error, __pyx_n_s_Error, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Error.pyx":5
 * class Error(RuntimeError):
 * 
 *     _traceback_ = []             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, int ierr=0):
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_traceback, __pyx_t_5) < 0) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Error.pyx":7
 *     _traceback_ = []
 * 
 *     def __init__(self, int ierr=0):             # <<<<<<<<<<<<<<
 *         self.ierr = ierr
 *         RuntimeError.__init__(self, self.ierr)
 */
  __pyx_t_5 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7, __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 = 0;
  __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8petsc4py_5PETSc_5Error_1__init__, 0, __pyx_n_s_Error___init, NULL, __pyx_n_s_petsc4py_PETSc, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_init, __pyx_t_5) < 0) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Error.pyx":11
 *         RuntimeError.__init__(self, self.ierr)
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         cdef int ierr = self.ierr
 *         return ierr != 0
 */
  __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8petsc4py_5PETSc_5Error_3__nonzero__, 0, __pyx_n_s_Error___nonzero, NULL, __pyx_n_s_petsc4py_PETSc, __pyx_d, ((PyObject *)__pyx_codeobj__71)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_nonzero_2, __pyx_t_5) < 0) __PYX_ERR(1, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Error.pyx":15
 *         return ierr != 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'PETSc.Error(%d)' % self.ierr
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8petsc4py_5PETSc_5Error_5__repr__, 0, __pyx_n_s_Error___repr, NULL, __pyx_n_s_petsc4py_PETSc, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_repr, __pyx_t_5) < 0) __PYX_ERR(1, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Error.pyx":18
 *         return 'PETSc.Error(%d)' % self.ierr
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef int csize=1, crank=0
 *         if not (<int>PetscFinalizeCalled):
 */
  __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8petsc4py_5PETSc_5Error_7__str__, 0, __pyx_n_s_Error___str, NULL, __pyx_n_s_petsc4py_PETSc, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_str, __pyx_t_5) < 0) __PYX_ERR(1, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Error.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class Error(RuntimeError):             # <<<<<<<<<<<<<<
 * 
 *     _traceback_ = []
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_Error, __pyx_t_1, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Error, __pyx_t_5) < 0) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Sys.pyx":6
 * 
 *     @classmethod
 *     def getVersion(cls, patch=False, devel=False,             # <<<<<<<<<<<<<<
 *                    date=False, author=False):
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_getVersion); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Sys.pyx":5
 * cdef class Sys:
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def getVersion(cls, patch=False, devel=False,
 *                    date=False, author=False):
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_getVersion, __pyx_t_3) < 0) __PYX_ERR(25, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":33
 * 
 *     @classmethod
 *     def getVersionInfo(cls):             # <<<<<<<<<<<<<<
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 *         cdef int cminor = PETSC_VERSION_MINOR
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_getVersionInfo); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Sys.pyx":32
 *         return tuple(out)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def getVersionInfo(cls):
 *         cdef int cmajor = PETSC_VERSION_MAJOR
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_getVersionInfo, __pyx_t_1) < 0) __PYX_ERR(25, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":54
 * 
 *     @classmethod
 *     def isInitialized(cls):             # <<<<<<<<<<<<<<
 *         return <bint>PetscInitializeCalled
 * 
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_isInitialized); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Sys.pyx":53
 *     # --- xxx ---
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def isInitialized(cls):
 *         return <bint>PetscInitializeCalled
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_isInitialized, __pyx_t_3) < 0) __PYX_ERR(25, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":58
 * 
 *     @classmethod
 *     def isFinalized(cls):             # <<<<<<<<<<<<<<
 *         return <bint>PetscFinalizeCalled
 * 
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_isFinalized); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Sys.pyx":57
 *         return <bint>PetscInitializeCalled
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def isFinalized(cls):
 *         return <bint>PetscFinalizeCalled
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_isFinalized, __pyx_t_1) < 0) __PYX_ERR(25, 58, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":64
 * 
 *     @classmethod
 *     def getDefaultComm(cls):             # <<<<<<<<<<<<<<
 *         cdef Comm comm = Comm()
 *         comm.comm = PETSC_COMM_DEFAULT
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_getDefaultComm); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Sys.pyx":63
 *     # --- xxx ---
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def getDefaultComm(cls):
 *         cdef Comm comm = Comm()
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_getDefaultComm, __pyx_t_3) < 0) __PYX_ERR(25, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":70
 * 
 *     @classmethod
 *     def setDefaultComm(cls, comm):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_WORLD)
 *         if ccomm == MPI_COMM_NULL:
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_setDefaultComm); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Sys.pyx":69
 *         return comm
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def setDefaultComm(cls, comm):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_WORLD)
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_setDefaultComm, __pyx_t_1) < 0) __PYX_ERR(25, 70, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":80
 * 
 *     @classmethod
 *     def Print(cls, *args, **kargs):             # <<<<<<<<<<<<<<
 *         cdef object comm = kargs.get('comm', None)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_Print); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Sys.pyx":79
 *     # --- xxx ---
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def Print(cls, *args, **kargs):
 *         cdef object comm = kargs.get('comm', None)
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_Print, __pyx_t_3) < 0) __PYX_ERR(25, 80, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":97
 * 
 *     @classmethod
 *     def syncPrint(cls, *args, **kargs):             # <<<<<<<<<<<<<<
 *         cdef object comm = kargs.get('comm', None)
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_syncPrint); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Sys.pyx":96
 *         CHKERR( PetscPrintf(ccomm, m) )
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def syncPrint(cls, *args, **kargs):
 *         cdef object comm = kargs.get('comm', None)
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_syncPrint, __pyx_t_1) < 0) __PYX_ERR(25, 97, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":113
 * 
 *     @classmethod
 *     def syncFlush(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         CHKERR( PetscSynchronizedFlush(ccomm, PETSC_STDOUT) )
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_syncFlush); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Sys.pyx":112
 *         if flush: CHKERR( PetscSynchronizedFlush(ccomm, PETSC_STDOUT) )
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def syncFlush(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_syncFlush, __pyx_t_3) < 0) __PYX_ERR(25, 113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":120
 * 
 *     @classmethod
 *     def splitOwnership(cls, size, bsize=None, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef PetscInt bs=0, n=0, N=0
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_splitOwnership); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Sys.pyx":119
 *     # --- xxx ---
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def splitOwnership(cls, size, bsize=None, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_splitOwnership, __pyx_t_1) < 0) __PYX_ERR(25, 120, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":133
 * 
 *     @classmethod
 *     def sleep(cls, seconds=1):             # <<<<<<<<<<<<<<
 *         cdef int s = seconds
 *         CHKERR( PetscSleep(s) )
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_sleep); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Sys.pyx":132
 *         return (toInt(n), toInt(N))
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def sleep(cls, seconds=1):
 *         cdef int s = seconds
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_sleep, __pyx_t_3) < 0) __PYX_ERR(25, 133, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":140
 * 
 *     @classmethod
 *     def pushErrorHandler(cls, errhandler):             # <<<<<<<<<<<<<<
 *         cdef PetscErrorHandlerFunction handler = NULL
 *         if errhandler == "python":
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_pushErrorHandler); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Sys.pyx":139
 *     # --- xxx ---
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def pushErrorHandler(cls, errhandler):
 *         cdef PetscErrorHandlerFunction handler = NULL
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_pushErrorHandler, __pyx_t_1) < 0) __PYX_ERR(25, 140, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":164
 * 
 *     @classmethod
 *     def popErrorHandler(cls):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscPopErrorHandler() )
 * 
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_popErrorHandler); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Sys.pyx":163
 * 
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def popErrorHandler(cls):
 *         CHKERR( PetscPopErrorHandler() )
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_popErrorHandler, __pyx_t_3) < 0) __PYX_ERR(25, 164, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":168
 * 
 *     @classmethod
 *     def infoAllow(cls, flag):             # <<<<<<<<<<<<<<
 *         cdef PetscBool tval = PETSC_FALSE
 *         if flag: tval = PETSC_TRUE
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_infoAllow); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Sys.pyx":167
 *         CHKERR( PetscPopErrorHandler() )
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def infoAllow(cls, flag):
 *         cdef PetscBool tval = PETSC_FALSE
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_infoAllow, __pyx_t_1) < 0) __PYX_ERR(25, 168, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":174
 * 
 *     @classmethod
 *     def registerCitation(cls, citation):             # <<<<<<<<<<<<<<
 *         if not citation: raise ValueError("empty citation")
 *         cdef const_char *cit = NULL
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys, __pyx_n_s_registerCitation); if (unlikely(!__pyx_t_1)) __PYX_ERR(25, 174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Sys.pyx":173
 *         CHKERR( PetscInfoAllow(tval, NULL) )
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def registerCitation(cls, citation):
 *         if not citation: raise ValueError("empty citation")
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Sys->tp_dict, __pyx_n_s_registerCitation, __pyx_t_3) < 0) __PYX_ERR(25, 174, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Sys);

  /* "PETSc/Sys.pyx":182
 *         set_citation(citation, <bint>set)
 * 
 * cdef dict citations_registry = { }             # <<<<<<<<<<<<<<
 * 
 * cdef PetscBool get_citation(object citation):
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(25, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_XGOTREF(__pyx_v_8petsc4py_5PETSc_citations_registry);
  __Pyx_DECREF_SET(__pyx_v_8petsc4py_5PETSc_citations_registry, ((PyObject*)__pyx_t_3));
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/Log.pyx":6
 * 
 *     @classmethod
 *     def Stage(cls, name):             # <<<<<<<<<<<<<<
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log, __pyx_n_s_Stage); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Log.pyx":5
 * cdef class Log:
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def Stage(cls, name):
 *         if not name: raise ValueError("empty name")
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log->tp_dict, __pyx_n_s_Stage, __pyx_t_1) < 0) __PYX_ERR(26, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Log);

  /* "PETSc/Log.pyx":20
 * 
 *     @classmethod
 *     def Class(cls, name):             # <<<<<<<<<<<<<<
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log, __pyx_n_s_Class); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Log.pyx":19
 *         return stage
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def Class(cls, name):
 *         if not name: raise ValueError("empty name")
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log->tp_dict, __pyx_n_s_Class, __pyx_t_3) < 0) __PYX_ERR(26, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Log);

  /* "PETSc/Log.pyx":34
 * 
 *     @classmethod
 *     def Event(cls, name, klass=None):             # <<<<<<<<<<<<<<
 *         if not name: raise ValueError("empty name")
 *         cdef const_char *cname = NULL
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log, __pyx_n_s_Event); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Log.pyx":33
 *         return klass
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def Event(cls, name, klass=None):
 *         if not name: raise ValueError("empty name")
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log->tp_dict, __pyx_n_s_Event, __pyx_t_1) < 0) __PYX_ERR(26, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Log);

  /* "PETSc/Log.pyx":50
 * 
 *     @classmethod
 *     def begin(cls, all=False):             # <<<<<<<<<<<<<<
 *         if all: CHKERR( PetscLogAllBegin() )
 *         else:   CHKERR( PetscLogDefaultBegin() )
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log, __pyx_n_s_begin); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Log.pyx":49
 *         return event
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def begin(cls, all=False):
 *         if all: CHKERR( PetscLogAllBegin() )
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log->tp_dict, __pyx_n_s_begin, __pyx_t_3) < 0) __PYX_ERR(26, 50, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Log);

  /* "PETSc/Log.pyx":55
 * 
 *     @classmethod
 *     def view(cls, Viewer viewer=None):             # <<<<<<<<<<<<<<
 *         cdef PetscViewer vwr = NULL
 *         if viewer is not None: vwr = viewer.vwr
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log, __pyx_n_s_view); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Log.pyx":54
 *         else:   CHKERR( PetscLogDefaultBegin() )
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def view(cls, Viewer viewer=None):
 *         cdef PetscViewer vwr = NULL
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log->tp_dict, __pyx_n_s_view, __pyx_t_1) < 0) __PYX_ERR(26, 55, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Log);

  /* "PETSc/Log.pyx":62
 * 
 *     @classmethod
 *     def destroy(cls):             # <<<<<<<<<<<<<<
 *         CHKERR( PetscLogDestroy() )
 * 
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log, __pyx_n_s_destroy); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Log.pyx":61
 *         CHKERR( PetscLogView(vwr) )
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def destroy(cls):
 *         CHKERR( PetscLogDestroy() )
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log->tp_dict, __pyx_n_s_destroy, __pyx_t_3) < 0) __PYX_ERR(26, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Log);

  /* "PETSc/Log.pyx":66
 * 
 *     @classmethod
 *     def logFlops(cls, flops):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble cflops=flops
 *         CHKERR( PetscLogFlops(cflops) )
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log, __pyx_n_s_logFlops); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Log.pyx":65
 *         CHKERR( PetscLogDestroy() )
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def logFlops(cls, flops):
 *         cdef PetscLogDouble cflops=flops
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log->tp_dict, __pyx_n_s_logFlops, __pyx_t_1) < 0) __PYX_ERR(26, 66, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Log);

  /* "PETSc/Log.pyx":71
 * 
 *     @classmethod
 *     def addFlops(cls, flops):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble cflops=flops
 *         CHKERR( PetscLogFlops(cflops) )
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log, __pyx_n_s_addFlops); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Log.pyx":70
 *         CHKERR( PetscLogFlops(cflops) )
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def addFlops(cls, flops):
 *         cdef PetscLogDouble cflops=flops
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log->tp_dict, __pyx_n_s_addFlops, __pyx_t_3) < 0) __PYX_ERR(26, 71, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Log);

  /* "PETSc/Log.pyx":76
 * 
 *     @classmethod
 *     def getFlops(cls):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble cflops=0
 *         CHKERR( PetscGetFlops(&cflops) )
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log, __pyx_n_s_getFlops); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Log.pyx":75
 *         CHKERR( PetscLogFlops(cflops) )
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def getFlops(cls):
 *         cdef PetscLogDouble cflops=0
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log->tp_dict, __pyx_n_s_getFlops, __pyx_t_1) < 0) __PYX_ERR(26, 76, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Log);

  /* "PETSc/Log.pyx":82
 * 
 *     @classmethod
 *     def getTime(cls):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble wctime=0
 *         CHKERR( PetscTime(&wctime) )
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log, __pyx_n_s_getTime); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Log.pyx":81
 *         return cflops
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def getTime(cls):
 *         cdef PetscLogDouble wctime=0
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log->tp_dict, __pyx_n_s_getTime, __pyx_t_3) < 0) __PYX_ERR(26, 82, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Log);

  /* "PETSc/Log.pyx":88
 * 
 *     @classmethod
 *     def getCPUTime(cls):             # <<<<<<<<<<<<<<
 *         cdef PetscLogDouble cputime=0
 *         CHKERR( PetscGetCPUTime(&cputime) )
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log, __pyx_n_s_getCPUTime); if (unlikely(!__pyx_t_3)) __PYX_ERR(26, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Log.pyx":87
 *         return wctime
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def getCPUTime(cls):
 *         cdef PetscLogDouble cputime=0
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Log->tp_dict, __pyx_n_s_getCPUTime, __pyx_t_1) < 0) __PYX_ERR(26, 88, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Log);

  /* "PETSc/Log.pyx":178
 * 
 * 
 * cdef dict stage_registry = { }             # <<<<<<<<<<<<<<
 * 
 * cdef LogStage get_LogStage(object name):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_8petsc4py_5PETSc_stage_registry);
  __Pyx_DECREF_SET(__pyx_v_8petsc4py_5PETSc_stage_registry, ((PyObject*)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":240
 * 
 * 
 * cdef dict class_registry = { }             # <<<<<<<<<<<<<<
 * 
 * cdef LogClass get_LogClass(object name):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_8petsc4py_5PETSc_class_registry);
  __Pyx_DECREF_SET(__pyx_v_8petsc4py_5PETSc_class_registry, ((PyObject*)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Log.pyx":358
 *         return info
 * 
 * cdef dict event_registry = { }             # <<<<<<<<<<<<<<
 * 
 * cdef LogEvent get_LogEvent(object name):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(26, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_8petsc4py_5PETSc_event_registry);
  __Pyx_DECREF_SET(__pyx_v_8petsc4py_5PETSc_event_registry, ((PyObject*)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Comm.pyx":109
 *     # --- mpi4py compatibility API ---
 * 
 *     Free     = destroy             # <<<<<<<<<<<<<<
 *     Clone    = duplicate
 *     Dup      = duplicate
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm, __pyx_n_s_destroy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm->tp_dict, __pyx_n_s_Free, __pyx_t_1) < 0) __PYX_ERR(9, 109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Comm);

  /* "PETSc/Comm.pyx":110
 * 
 *     Free     = destroy
 *     Clone    = duplicate             # <<<<<<<<<<<<<<
 *     Dup      = duplicate
 *     Get_size = getSize
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm, __pyx_n_s_duplicate); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm->tp_dict, __pyx_n_s_Clone, __pyx_t_1) < 0) __PYX_ERR(9, 110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Comm);

  /* "PETSc/Comm.pyx":111
 *     Free     = destroy
 *     Clone    = duplicate
 *     Dup      = duplicate             # <<<<<<<<<<<<<<
 *     Get_size = getSize
 *     Get_rank = getRank
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm, __pyx_n_s_duplicate); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm->tp_dict, __pyx_n_s_Dup, __pyx_t_1) < 0) __PYX_ERR(9, 111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Comm);

  /* "PETSc/Comm.pyx":112
 *     Clone    = duplicate
 *     Dup      = duplicate
 *     Get_size = getSize             # <<<<<<<<<<<<<<
 *     Get_rank = getRank
 *     Barrier  = barrier
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm, __pyx_n_s_getSize); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm->tp_dict, __pyx_n_s_Get_size, __pyx_t_1) < 0) __PYX_ERR(9, 112, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Comm);

  /* "PETSc/Comm.pyx":113
 *     Dup      = duplicate
 *     Get_size = getSize
 *     Get_rank = getRank             # <<<<<<<<<<<<<<
 *     Barrier  = barrier
 * 
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm, __pyx_n_s_getRank); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm->tp_dict, __pyx_n_s_Get_rank, __pyx_t_1) < 0) __PYX_ERR(9, 113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Comm);

  /* "PETSc/Comm.pyx":114
 *     Get_size = getSize
 *     Get_rank = getRank
 *     Barrier  = barrier             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm, __pyx_n_s_barrier); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm->tp_dict, __pyx_n_s_Barrier, __pyx_t_1) < 0) __PYX_ERR(9, 114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Comm);

  /* "PETSc/Comm.pyx":118
 * # --------------------------------------------------------------------
 * 
 * cdef Comm __COMM_NULL__  = Comm()             # <<<<<<<<<<<<<<
 * cdef Comm __COMM_SELF__  = Comm()
 * cdef Comm __COMM_WORLD__ = Comm()
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(((PyObject *)__pyx_v_8petsc4py_5PETSc___COMM_NULL__));
  __Pyx_DECREF_SET(__pyx_v_8petsc4py_5PETSc___COMM_NULL__, ((struct PyPetscCommObject *)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Comm.pyx":119
 * 
 * cdef Comm __COMM_NULL__  = Comm()
 * cdef Comm __COMM_SELF__  = Comm()             # <<<<<<<<<<<<<<
 * cdef Comm __COMM_WORLD__ = Comm()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(((PyObject *)__pyx_v_8petsc4py_5PETSc___COMM_SELF__));
  __Pyx_DECREF_SET(__pyx_v_8petsc4py_5PETSc___COMM_SELF__, ((struct PyPetscCommObject *)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Comm.pyx":120
 * cdef Comm __COMM_NULL__  = Comm()
 * cdef Comm __COMM_SELF__  = Comm()
 * cdef Comm __COMM_WORLD__ = Comm()             # <<<<<<<<<<<<<<
 * 
 * COMM_NULL  = __COMM_NULL__
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Comm), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(((PyObject *)__pyx_v_8petsc4py_5PETSc___COMM_WORLD__));
  __Pyx_DECREF_SET(__pyx_v_8petsc4py_5PETSc___COMM_WORLD__, ((struct PyPetscCommObject *)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Comm.pyx":122
 * cdef Comm __COMM_WORLD__ = Comm()
 * 
 * COMM_NULL  = __COMM_NULL__             # <<<<<<<<<<<<<<
 * COMM_SELF  = __COMM_SELF__
 * COMM_WORLD = __COMM_WORLD__
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_COMM_NULL, ((PyObject *)__pyx_v_8petsc4py_5PETSc___COMM_NULL__)) < 0) __PYX_ERR(9, 122, __pyx_L1_error)

  /* "PETSc/Comm.pyx":123
 * 
 * COMM_NULL  = __COMM_NULL__
 * COMM_SELF  = __COMM_SELF__             # <<<<<<<<<<<<<<
 * COMM_WORLD = __COMM_WORLD__
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_COMM_SELF, ((PyObject *)__pyx_v_8petsc4py_5PETSc___COMM_SELF__)) < 0) __PYX_ERR(9, 123, __pyx_L1_error)

  /* "PETSc/Comm.pyx":124
 * COMM_NULL  = __COMM_NULL__
 * COMM_SELF  = __COMM_SELF__
 * COMM_WORLD = __COMM_WORLD__             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_COMM_WORLD, ((PyObject *)__pyx_v_8petsc4py_5PETSc___COMM_WORLD__)) < 0) __PYX_ERR(9, 124, __pyx_L1_error)

  /* "PETSc/Comm.pyx":128
 * # --------------------------------------------------------------------
 * 
 * cdef MPI_Comm PETSC_COMM_DEFAULT = MPI_COMM_NULL             # <<<<<<<<<<<<<<
 * 
 * cdef MPI_Comm GetComm(object comm, MPI_Comm defv) except *:
 */
  __pyx_v_8petsc4py_5PETSc_PETSC_COMM_DEFAULT = MPI_COMM_NULL;

  /* "PETSc/Object.pyx":242
 * include "cyclicgc.pxi"
 * 
 * cdef dict type_registry = { 0 : None }             # <<<<<<<<<<<<<<
 * __type_registry__ = type_registry
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_0, Py_None) < 0) __PYX_ERR(10, 242, __pyx_L1_error)
  __Pyx_XGOTREF(__pyx_v_8petsc4py_5PETSc_type_registry);
  __Pyx_DECREF_SET(__pyx_v_8petsc4py_5PETSc_type_registry, ((PyObject*)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "PETSc/Object.pyx":243
 * 
 * cdef dict type_registry = { 0 : None }
 * __type_registry__ = type_registry             # <<<<<<<<<<<<<<
 * 
 * cdef int PyPetscType_Register(int classid, type cls) except -1:
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_type_registry, __pyx_v_8petsc4py_5PETSc_type_registry) < 0) __PYX_ERR(10, 243, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class ViewerType(object):             # <<<<<<<<<<<<<<
 *     SOCKET      = S_(PETSCVIEWERSOCKET)
 *     ASCII       = S_(PETSCVIEWERASCII)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_1, __pyx_n_s_ViewerType, __pyx_n_s_ViewerType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(27, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Viewer.pyx":4
 * 
 * class ViewerType(object):
 *     SOCKET      = S_(PETSCVIEWERSOCKET)             # <<<<<<<<<<<<<<
 *     ASCII       = S_(PETSCVIEWERASCII)
 *     BINARY      = S_(PETSCVIEWERBINARY)
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_S_(PETSCVIEWERSOCKET); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SOCKET, __pyx_t_5) < 0) __PYX_ERR(27, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":5
 * class ViewerType(object):
 *     SOCKET      = S_(PETSCVIEWERSOCKET)
 *     ASCII       = S_(PETSCVIEWERASCII)             # <<<<<<<<<<<<<<
 *     BINARY      = S_(PETSCVIEWERBINARY)
 *     STRING      = S_(PETSCVIEWERSTRING)
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_S_(PETSCVIEWERASCII); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII, __pyx_t_5) < 0) __PYX_ERR(27, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":6
 *     SOCKET      = S_(PETSCVIEWERSOCKET)
 *     ASCII       = S_(PETSCVIEWERASCII)
 *     BINARY      = S_(PETSCVIEWERBINARY)             # <<<<<<<<<<<<<<
 *     STRING      = S_(PETSCVIEWERSTRING)
 *     DRAW        = S_(PETSCVIEWERDRAW)
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_S_(PETSCVIEWERBINARY); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BINARY, __pyx_t_5) < 0) __PYX_ERR(27, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":7
 *     ASCII       = S_(PETSCVIEWERASCII)
 *     BINARY      = S_(PETSCVIEWERBINARY)
 *     STRING      = S_(PETSCVIEWERSTRING)             # <<<<<<<<<<<<<<
 *     DRAW        = S_(PETSCVIEWERDRAW)
 *     VU          = S_(PETSCVIEWERVU)
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_S_(PETSCVIEWERSTRING); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_STRING, __pyx_t_5) < 0) __PYX_ERR(27, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":8
 *     BINARY      = S_(PETSCVIEWERBINARY)
 *     STRING      = S_(PETSCVIEWERSTRING)
 *     DRAW        = S_(PETSCVIEWERDRAW)             # <<<<<<<<<<<<<<
 *     VU          = S_(PETSCVIEWERVU)
 *     MATHEMATICA = S_(PETSCVIEWERMATHEMATICA)
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_S_(PETSCVIEWERDRAW); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DRAW, __pyx_t_5) < 0) __PYX_ERR(27, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":9
 *     STRING      = S_(PETSCVIEWERSTRING)
 *     DRAW        = S_(PETSCVIEWERDRAW)
 *     VU          = S_(PETSCVIEWERVU)             # <<<<<<<<<<<<<<
 *     MATHEMATICA = S_(PETSCVIEWERMATHEMATICA)
 *     HDF5        = S_(PETSCVIEWERHDF5)
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_S_(PETSCVIEWERVU); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_VU, __pyx_t_5) < 0) __PYX_ERR(27, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":10
 *     DRAW        = S_(PETSCVIEWERDRAW)
 *     VU          = S_(PETSCVIEWERVU)
 *     MATHEMATICA = S_(PETSCVIEWERMATHEMATICA)             # <<<<<<<<<<<<<<
 *     HDF5        = S_(PETSCVIEWERHDF5)
 *     NETCDF      = S_(PETSCVIEWERNETCDF)
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_S_(PETSCVIEWERMATHEMATICA); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MATHEMATICA, __pyx_t_5) < 0) __PYX_ERR(27, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":11
 *     VU          = S_(PETSCVIEWERVU)
 *     MATHEMATICA = S_(PETSCVIEWERMATHEMATICA)
 *     HDF5        = S_(PETSCVIEWERHDF5)             # <<<<<<<<<<<<<<
 *     NETCDF      = S_(PETSCVIEWERNETCDF)
 *     VTK         = S_(PETSCVIEWERVTK)
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_S_(PETSCVIEWERHDF5); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_HDF5, __pyx_t_5) < 0) __PYX_ERR(27, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":12
 *     MATHEMATICA = S_(PETSCVIEWERMATHEMATICA)
 *     HDF5        = S_(PETSCVIEWERHDF5)
 *     NETCDF      = S_(PETSCVIEWERNETCDF)             # <<<<<<<<<<<<<<
 *     VTK         = S_(PETSCVIEWERVTK)
 *     MATLAB      = S_(PETSCVIEWERMATLAB)
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_S_(PETSCVIEWERNETCDF); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NETCDF, __pyx_t_5) < 0) __PYX_ERR(27, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":13
 *     HDF5        = S_(PETSCVIEWERHDF5)
 *     NETCDF      = S_(PETSCVIEWERNETCDF)
 *     VTK         = S_(PETSCVIEWERVTK)             # <<<<<<<<<<<<<<
 *     MATLAB      = S_(PETSCVIEWERMATLAB)
 *     SAWS        = S_(PETSCVIEWERSAWS)
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_S_(PETSCVIEWERVTK); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_VTK, __pyx_t_5) < 0) __PYX_ERR(27, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":14
 *     NETCDF      = S_(PETSCVIEWERNETCDF)
 *     VTK         = S_(PETSCVIEWERVTK)
 *     MATLAB      = S_(PETSCVIEWERMATLAB)             # <<<<<<<<<<<<<<
 *     SAWS        = S_(PETSCVIEWERSAWS)
 * 
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_S_(PETSCVIEWERMATLAB); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MATLAB, __pyx_t_5) < 0) __PYX_ERR(27, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":15
 *     VTK         = S_(PETSCVIEWERVTK)
 *     MATLAB      = S_(PETSCVIEWERMATLAB)
 *     SAWS        = S_(PETSCVIEWERSAWS)             # <<<<<<<<<<<<<<
 * 
 * class ViewerFormat(object):
 */
  __pyx_t_5 = __pyx_f_8petsc4py_5PETSc_S_(PETSCVIEWERSAWS); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SAWS, __pyx_t_5) < 0) __PYX_ERR(27, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class ViewerType(object):             # <<<<<<<<<<<<<<
 *     SOCKET      = S_(PETSCVIEWERSOCKET)
 *     ASCII       = S_(PETSCVIEWERASCII)
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_ViewerType, __pyx_t_1, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ViewerType, __pyx_t_5) < 0) __PYX_ERR(27, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Viewer.pyx":17
 *     SAWS        = S_(PETSCVIEWERSAWS)
 * 
 * class ViewerFormat(object):             # <<<<<<<<<<<<<<
 *     DEFAULT           = PETSC_VIEWER_DEFAULT
 *     ASCII_MATLAB      = PETSC_VIEWER_ASCII_MATLAB
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_1, __pyx_n_s_ViewerFormat, __pyx_n_s_ViewerFormat, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(27, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Viewer.pyx":18
 * 
 * class ViewerFormat(object):
 *     DEFAULT           = PETSC_VIEWER_DEFAULT             # <<<<<<<<<<<<<<
 *     ASCII_MATLAB      = PETSC_VIEWER_ASCII_MATLAB
 *     ASCII_MATHEMATICA = PETSC_VIEWER_ASCII_MATHEMATICA
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_DEFAULT); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DEFAULT, __pyx_t_5) < 0) __PYX_ERR(27, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":19
 * class ViewerFormat(object):
 *     DEFAULT           = PETSC_VIEWER_DEFAULT
 *     ASCII_MATLAB      = PETSC_VIEWER_ASCII_MATLAB             # <<<<<<<<<<<<<<
 *     ASCII_MATHEMATICA = PETSC_VIEWER_ASCII_MATHEMATICA
 *     ASCII_IMPL        = PETSC_VIEWER_ASCII_IMPL
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_MATLAB); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_MATLAB, __pyx_t_5) < 0) __PYX_ERR(27, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":20
 *     DEFAULT           = PETSC_VIEWER_DEFAULT
 *     ASCII_MATLAB      = PETSC_VIEWER_ASCII_MATLAB
 *     ASCII_MATHEMATICA = PETSC_VIEWER_ASCII_MATHEMATICA             # <<<<<<<<<<<<<<
 *     ASCII_IMPL        = PETSC_VIEWER_ASCII_IMPL
 *     ASCII_INFO        = PETSC_VIEWER_ASCII_INFO
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_MATHEMATICA); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_MATHEMATICA, __pyx_t_5) < 0) __PYX_ERR(27, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":21
 *     ASCII_MATLAB      = PETSC_VIEWER_ASCII_MATLAB
 *     ASCII_MATHEMATICA = PETSC_VIEWER_ASCII_MATHEMATICA
 *     ASCII_IMPL        = PETSC_VIEWER_ASCII_IMPL             # <<<<<<<<<<<<<<
 *     ASCII_INFO        = PETSC_VIEWER_ASCII_INFO
 *     ASCII_INFO_DETAIL = PETSC_VIEWER_ASCII_INFO_DETAIL
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_IMPL); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_IMPL, __pyx_t_5) < 0) __PYX_ERR(27, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":22
 *     ASCII_MATHEMATICA = PETSC_VIEWER_ASCII_MATHEMATICA
 *     ASCII_IMPL        = PETSC_VIEWER_ASCII_IMPL
 *     ASCII_INFO        = PETSC_VIEWER_ASCII_INFO             # <<<<<<<<<<<<<<
 *     ASCII_INFO_DETAIL = PETSC_VIEWER_ASCII_INFO_DETAIL
 *     ASCII_COMMON      = PETSC_VIEWER_ASCII_COMMON
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_INFO); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_INFO, __pyx_t_5) < 0) __PYX_ERR(27, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":23
 *     ASCII_IMPL        = PETSC_VIEWER_ASCII_IMPL
 *     ASCII_INFO        = PETSC_VIEWER_ASCII_INFO
 *     ASCII_INFO_DETAIL = PETSC_VIEWER_ASCII_INFO_DETAIL             # <<<<<<<<<<<<<<
 *     ASCII_COMMON      = PETSC_VIEWER_ASCII_COMMON
 *     ASCII_SYMMODU     = PETSC_VIEWER_ASCII_SYMMODU
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_INFO_DETAIL); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_INFO_DETAIL, __pyx_t_5) < 0) __PYX_ERR(27, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":24
 *     ASCII_INFO        = PETSC_VIEWER_ASCII_INFO
 *     ASCII_INFO_DETAIL = PETSC_VIEWER_ASCII_INFO_DETAIL
 *     ASCII_COMMON      = PETSC_VIEWER_ASCII_COMMON             # <<<<<<<<<<<<<<
 *     ASCII_SYMMODU     = PETSC_VIEWER_ASCII_SYMMODU
 *     ASCII_INDEX       = PETSC_VIEWER_ASCII_INDEX
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_COMMON); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_COMMON, __pyx_t_5) < 0) __PYX_ERR(27, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":25
 *     ASCII_INFO_DETAIL = PETSC_VIEWER_ASCII_INFO_DETAIL
 *     ASCII_COMMON      = PETSC_VIEWER_ASCII_COMMON
 *     ASCII_SYMMODU     = PETSC_VIEWER_ASCII_SYMMODU             # <<<<<<<<<<<<<<
 *     ASCII_INDEX       = PETSC_VIEWER_ASCII_INDEX
 *     ASCII_DENSE       = PETSC_VIEWER_ASCII_DENSE
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_SYMMODU); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_SYMMODU, __pyx_t_5) < 0) __PYX_ERR(27, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":26
 *     ASCII_COMMON      = PETSC_VIEWER_ASCII_COMMON
 *     ASCII_SYMMODU     = PETSC_VIEWER_ASCII_SYMMODU
 *     ASCII_INDEX       = PETSC_VIEWER_ASCII_INDEX             # <<<<<<<<<<<<<<
 *     ASCII_DENSE       = PETSC_VIEWER_ASCII_DENSE
 *     ASCII_MATRIXMARKET= PETSC_VIEWER_ASCII_MATRIXMARKET
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_INDEX); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_INDEX, __pyx_t_5) < 0) __PYX_ERR(27, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":27
 *     ASCII_SYMMODU     = PETSC_VIEWER_ASCII_SYMMODU
 *     ASCII_INDEX       = PETSC_VIEWER_ASCII_INDEX
 *     ASCII_DENSE       = PETSC_VIEWER_ASCII_DENSE             # <<<<<<<<<<<<<<
 *     ASCII_MATRIXMARKET= PETSC_VIEWER_ASCII_MATRIXMARKET
 *     ASCII_VTK         = PETSC_VIEWER_ASCII_VTK
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_DENSE); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_DENSE, __pyx_t_5) < 0) __PYX_ERR(27, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":28
 *     ASCII_INDEX       = PETSC_VIEWER_ASCII_INDEX
 *     ASCII_DENSE       = PETSC_VIEWER_ASCII_DENSE
 *     ASCII_MATRIXMARKET= PETSC_VIEWER_ASCII_MATRIXMARKET             # <<<<<<<<<<<<<<
 *     ASCII_VTK         = PETSC_VIEWER_ASCII_VTK
 *     ASCII_VTK_CELL    = PETSC_VIEWER_ASCII_VTK_CELL
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_MATRIXMARKET); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_MATRIXMARKET, __pyx_t_5) < 0) __PYX_ERR(27, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":29
 *     ASCII_DENSE       = PETSC_VIEWER_ASCII_DENSE
 *     ASCII_MATRIXMARKET= PETSC_VIEWER_ASCII_MATRIXMARKET
 *     ASCII_VTK         = PETSC_VIEWER_ASCII_VTK             # <<<<<<<<<<<<<<
 *     ASCII_VTK_CELL    = PETSC_VIEWER_ASCII_VTK_CELL
 *     ASCII_VTK_COORDS  = PETSC_VIEWER_ASCII_VTK_COORDS
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_VTK); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_VTK, __pyx_t_5) < 0) __PYX_ERR(27, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":30
 *     ASCII_MATRIXMARKET= PETSC_VIEWER_ASCII_MATRIXMARKET
 *     ASCII_VTK         = PETSC_VIEWER_ASCII_VTK
 *     ASCII_VTK_CELL    = PETSC_VIEWER_ASCII_VTK_CELL             # <<<<<<<<<<<<<<
 *     ASCII_VTK_COORDS  = PETSC_VIEWER_ASCII_VTK_COORDS
 *     ASCII_PCICE       = PETSC_VIEWER_ASCII_PCICE
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_VTK_CELL); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_VTK_CELL, __pyx_t_5) < 0) __PYX_ERR(27, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":31
 *     ASCII_VTK         = PETSC_VIEWER_ASCII_VTK
 *     ASCII_VTK_CELL    = PETSC_VIEWER_ASCII_VTK_CELL
 *     ASCII_VTK_COORDS  = PETSC_VIEWER_ASCII_VTK_COORDS             # <<<<<<<<<<<<<<
 *     ASCII_PCICE       = PETSC_VIEWER_ASCII_PCICE
 *     ASCII_PYTHON      = PETSC_VIEWER_ASCII_PYTHON
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_VTK_COORDS); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_VTK_COORDS, __pyx_t_5) < 0) __PYX_ERR(27, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":32
 *     ASCII_VTK_CELL    = PETSC_VIEWER_ASCII_VTK_CELL
 *     ASCII_VTK_COORDS  = PETSC_VIEWER_ASCII_VTK_COORDS
 *     ASCII_PCICE       = PETSC_VIEWER_ASCII_PCICE             # <<<<<<<<<<<<<<
 *     ASCII_PYTHON      = PETSC_VIEWER_ASCII_PYTHON
 *     ASCII_FACTOR_INFO = PETSC_VIEWER_ASCII_FACTOR_INFO
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_PCICE); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_PCICE, __pyx_t_5) < 0) __PYX_ERR(27, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":33
 *     ASCII_VTK_COORDS  = PETSC_VIEWER_ASCII_VTK_COORDS
 *     ASCII_PCICE       = PETSC_VIEWER_ASCII_PCICE
 *     ASCII_PYTHON      = PETSC_VIEWER_ASCII_PYTHON             # <<<<<<<<<<<<<<
 *     ASCII_FACTOR_INFO = PETSC_VIEWER_ASCII_FACTOR_INFO
 *     ASCII_LATEX       = PETSC_VIEWER_ASCII_LATEX
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_PYTHON); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_PYTHON, __pyx_t_5) < 0) __PYX_ERR(27, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":34
 *     ASCII_PCICE       = PETSC_VIEWER_ASCII_PCICE
 *     ASCII_PYTHON      = PETSC_VIEWER_ASCII_PYTHON
 *     ASCII_FACTOR_INFO = PETSC_VIEWER_ASCII_FACTOR_INFO             # <<<<<<<<<<<<<<
 *     ASCII_LATEX       = PETSC_VIEWER_ASCII_LATEX
 *     ASCII_XML         = PETSC_VIEWER_ASCII_XML
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_FACTOR_INFO); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_FACTOR_INFO, __pyx_t_5) < 0) __PYX_ERR(27, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":35
 *     ASCII_PYTHON      = PETSC_VIEWER_ASCII_PYTHON
 *     ASCII_FACTOR_INFO = PETSC_VIEWER_ASCII_FACTOR_INFO
 *     ASCII_LATEX       = PETSC_VIEWER_ASCII_LATEX             # <<<<<<<<<<<<<<
 *     ASCII_XML         = PETSC_VIEWER_ASCII_XML
 *     DRAW_BASIC        = PETSC_VIEWER_DRAW_BASIC
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_LATEX); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_LATEX, __pyx_t_5) < 0) __PYX_ERR(27, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":36
 *     ASCII_FACTOR_INFO = PETSC_VIEWER_ASCII_FACTOR_INFO
 *     ASCII_LATEX       = PETSC_VIEWER_ASCII_LATEX
 *     ASCII_XML         = PETSC_VIEWER_ASCII_XML             # <<<<<<<<<<<<<<
 *     DRAW_BASIC        = PETSC_VIEWER_DRAW_BASIC
 *     DRAW_LG           = PETSC_VIEWER_DRAW_LG
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_ASCII_XML); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASCII_XML, __pyx_t_5) < 0) __PYX_ERR(27, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":37
 *     ASCII_LATEX       = PETSC_VIEWER_ASCII_LATEX
 *     ASCII_XML         = PETSC_VIEWER_ASCII_XML
 *     DRAW_BASIC        = PETSC_VIEWER_DRAW_BASIC             # <<<<<<<<<<<<<<
 *     DRAW_LG           = PETSC_VIEWER_DRAW_LG
 *     DRAW_CONTOUR      = PETSC_VIEWER_DRAW_CONTOUR
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_DRAW_BASIC); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DRAW_BASIC, __pyx_t_5) < 0) __PYX_ERR(27, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":38
 *     ASCII_XML         = PETSC_VIEWER_ASCII_XML
 *     DRAW_BASIC        = PETSC_VIEWER_DRAW_BASIC
 *     DRAW_LG           = PETSC_VIEWER_DRAW_LG             # <<<<<<<<<<<<<<
 *     DRAW_CONTOUR      = PETSC_VIEWER_DRAW_CONTOUR
 *     DRAW_PORTS        = PETSC_VIEWER_DRAW_PORTS
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_DRAW_LG); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DRAW_LG, __pyx_t_5) < 0) __PYX_ERR(27, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":39
 *     DRAW_BASIC        = PETSC_VIEWER_DRAW_BASIC
 *     DRAW_LG           = PETSC_VIEWER_DRAW_LG
 *     DRAW_CONTOUR      = PETSC_VIEWER_DRAW_CONTOUR             # <<<<<<<<<<<<<<
 *     DRAW_PORTS        = PETSC_VIEWER_DRAW_PORTS
 *     VTK_VTS           = PETSC_VIEWER_VTK_VTS
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_DRAW_CONTOUR); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DRAW_CONTOUR, __pyx_t_5) < 0) __PYX_ERR(27, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":40
 *     DRAW_LG           = PETSC_VIEWER_DRAW_LG
 *     DRAW_CONTOUR      = PETSC_VIEWER_DRAW_CONTOUR
 *     DRAW_PORTS        = PETSC_VIEWER_DRAW_PORTS             # <<<<<<<<<<<<<<
 *     VTK_VTS           = PETSC_VIEWER_VTK_VTS
 *     VTK_VTR           = PETSC_VIEWER_VTK_VTR
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_DRAW_PORTS); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DRAW_PORTS, __pyx_t_5) < 0) __PYX_ERR(27, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":41
 *     DRAW_CONTOUR      = PETSC_VIEWER_DRAW_CONTOUR
 *     DRAW_PORTS        = PETSC_VIEWER_DRAW_PORTS
 *     VTK_VTS           = PETSC_VIEWER_VTK_VTS             # <<<<<<<<<<<<<<
 *     VTK_VTR           = PETSC_VIEWER_VTK_VTR
 *     VTK_VTU           = PETSC_VIEWER_VTK_VTU
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_VTK_VTS); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_VTK_VTS, __pyx_t_5) < 0) __PYX_ERR(27, 41, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":42
 *     DRAW_PORTS        = PETSC_VIEWER_DRAW_PORTS
 *     VTK_VTS           = PETSC_VIEWER_VTK_VTS
 *     VTK_VTR           = PETSC_VIEWER_VTK_VTR             # <<<<<<<<<<<<<<
 *     VTK_VTU           = PETSC_VIEWER_VTK_VTU
 *     BINARY_MATLAB     = PETSC_VIEWER_BINARY_MATLAB
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_VTK_VTR); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_VTK_VTR, __pyx_t_5) < 0) __PYX_ERR(27, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":43
 *     VTK_VTS           = PETSC_VIEWER_VTK_VTS
 *     VTK_VTR           = PETSC_VIEWER_VTK_VTR
 *     VTK_VTU           = PETSC_VIEWER_VTK_VTU             # <<<<<<<<<<<<<<
 *     BINARY_MATLAB     = PETSC_VIEWER_BINARY_MATLAB
 *     NATIVE            = PETSC_VIEWER_NATIVE
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_VTK_VTU); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_VTK_VTU, __pyx_t_5) < 0) __PYX_ERR(27, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":44
 *     VTK_VTR           = PETSC_VIEWER_VTK_VTR
 *     VTK_VTU           = PETSC_VIEWER_VTK_VTU
 *     BINARY_MATLAB     = PETSC_VIEWER_BINARY_MATLAB             # <<<<<<<<<<<<<<
 *     NATIVE            = PETSC_VIEWER_NATIVE
 *     HDF5_VIZ          = PETSC_VIEWER_HDF5_VIZ
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_BINARY_MATLAB); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BINARY_MATLAB, __pyx_t_5) < 0) __PYX_ERR(27, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":45
 *     VTK_VTU           = PETSC_VIEWER_VTK_VTU
 *     BINARY_MATLAB     = PETSC_VIEWER_BINARY_MATLAB
 *     NATIVE            = PETSC_VIEWER_NATIVE             # <<<<<<<<<<<<<<
 *     HDF5_VIZ          = PETSC_VIEWER_HDF5_VIZ
 *     NOFORMAT          = PETSC_VIEWER_NOFORMAT
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_NATIVE); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NATIVE, __pyx_t_5) < 0) __PYX_ERR(27, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":46
 *     BINARY_MATLAB     = PETSC_VIEWER_BINARY_MATLAB
 *     NATIVE            = PETSC_VIEWER_NATIVE
 *     HDF5_VIZ          = PETSC_VIEWER_HDF5_VIZ             # <<<<<<<<<<<<<<
 *     NOFORMAT          = PETSC_VIEWER_NOFORMAT
 * 
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_HDF5_VIZ); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_HDF5_VIZ, __pyx_t_5) < 0) __PYX_ERR(27, 46, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":47
 *     NATIVE            = PETSC_VIEWER_NATIVE
 *     HDF5_VIZ          = PETSC_VIEWER_HDF5_VIZ
 *     NOFORMAT          = PETSC_VIEWER_NOFORMAT             # <<<<<<<<<<<<<<
 * 
 * class FileMode(object):
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscViewerFormat(PETSC_VIEWER_NOFORMAT); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NOFORMAT, __pyx_t_5) < 0) __PYX_ERR(27, 47, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":17
 *     SAWS        = S_(PETSCVIEWERSAWS)
 * 
 * class ViewerFormat(object):             # <<<<<<<<<<<<<<
 *     DEFAULT           = PETSC_VIEWER_DEFAULT
 *     ASCII_MATLAB      = PETSC_VIEWER_ASCII_MATLAB
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_ViewerFormat, __pyx_t_1, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ViewerFormat, __pyx_t_5) < 0) __PYX_ERR(27, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Viewer.pyx":49
 *     NOFORMAT          = PETSC_VIEWER_NOFORMAT
 * 
 * class FileMode(object):             # <<<<<<<<<<<<<<
 *     # native
 *     READ          = PETSC_FILE_MODE_READ
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_1, __pyx_n_s_FileMode, __pyx_n_s_FileMode, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(27, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Viewer.pyx":51
 * class FileMode(object):
 *     # native
 *     READ          = PETSC_FILE_MODE_READ             # <<<<<<<<<<<<<<
 *     WRITE         = PETSC_FILE_MODE_WRITE
 *     APPEND        = PETSC_FILE_MODE_APPEND
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscFileMode(FILE_MODE_READ); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_READ, __pyx_t_5) < 0) __PYX_ERR(27, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":52
 *     # native
 *     READ          = PETSC_FILE_MODE_READ
 *     WRITE         = PETSC_FILE_MODE_WRITE             # <<<<<<<<<<<<<<
 *     APPEND        = PETSC_FILE_MODE_APPEND
 *     UPDATE        = PETSC_FILE_MODE_UPDATE
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscFileMode(FILE_MODE_WRITE); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_WRITE, __pyx_t_5) < 0) __PYX_ERR(27, 52, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":53
 *     READ          = PETSC_FILE_MODE_READ
 *     WRITE         = PETSC_FILE_MODE_WRITE
 *     APPEND        = PETSC_FILE_MODE_APPEND             # <<<<<<<<<<<<<<
 *     UPDATE        = PETSC_FILE_MODE_UPDATE
 *     APPEND_UPDATE = PETSC_FILE_MODE_APPEND_UPDATE
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscFileMode(FILE_MODE_APPEND); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_APPEND, __pyx_t_5) < 0) __PYX_ERR(27, 53, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":54
 *     WRITE         = PETSC_FILE_MODE_WRITE
 *     APPEND        = PETSC_FILE_MODE_APPEND
 *     UPDATE        = PETSC_FILE_MODE_UPDATE             # <<<<<<<<<<<<<<
 *     APPEND_UPDATE = PETSC_FILE_MODE_APPEND_UPDATE
 *     # aliases
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscFileMode(FILE_MODE_UPDATE); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_UPDATE, __pyx_t_5) < 0) __PYX_ERR(27, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":55
 *     APPEND        = PETSC_FILE_MODE_APPEND
 *     UPDATE        = PETSC_FILE_MODE_UPDATE
 *     APPEND_UPDATE = PETSC_FILE_MODE_APPEND_UPDATE             # <<<<<<<<<<<<<<
 *     # aliases
 *     R, W, A, U = READ, WRITE, APPEND, UPDATE
 */
  __pyx_t_5 = __Pyx_PyInt_From_PetscFileMode(FILE_MODE_APPEND_UPDATE); if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_APPEND_UPDATE, __pyx_t_5) < 0) __PYX_ERR(27, 55, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "PETSc/Viewer.pyx":57
 *     APPEND_UPDATE = PETSC_FILE_MODE_APPEND_UPDATE
 *     # aliases
 *     R, W, A, U = READ, WRITE, APPEND, UPDATE             # <<<<<<<<<<<<<<
 *     AU = UA    = APPEND_UPDATE
 * 
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_READ);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_READ);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(27, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_WRITE);
  if (unlikely(!__pyx_t_6)) {
    PyErr_Clear();
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_WRITE);
  }
  if (unlikely(!__pyx_t_6)) __PYX_ERR(27, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_APPEND);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_APPEND);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(27, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_UPDATE);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_UPDATE);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(27, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_R, __pyx_t_5) < 0) __PYX_ERR(27, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_W, __pyx_t_6) < 0) __PYX_ERR(27, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_A, __pyx_t_7) < 0) __PYX_ERR(27, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_U, __pyx_t_8) < 0) __PYX_ERR(27, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Viewer.pyx":58
 *     # aliases
 *     R, W, A, U = READ, WRITE, APPEND, UPDATE
 *     AU = UA    = APPEND_UPDATE             # <<<<<<<<<<<<<<
 * 
 * class DrawSize(object):
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_APPEND_UPDATE);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_APPEND_UPDATE);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(27, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_AU, __pyx_t_8) < 0) __PYX_ERR(27, 58, __pyx_L1_error)
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_UA, __pyx_t_8) < 0) __PYX_ERR(27, 58, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Viewer.pyx":49
 *     NOFORMAT          = PETSC_VIEWER_NOFORMAT
 * 
 * class FileMode(object):             # <<<<<<<<<<<<<<
 *     # native
 *     READ          = PETSC_FILE_MODE_READ
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_FileMode, __pyx_t_1, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(27, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileMode, __pyx_t_8) < 0) __PYX_ERR(27, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Viewer.pyx":60
 *     AU = UA    = APPEND_UPDATE
 * 
 * class DrawSize(object):             # <<<<<<<<<<<<<<
 *     # native
 *     FULL_SIZE    = PETSC_DRAW_FULL_SIZE
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_1, __pyx_n_s_DrawSize, __pyx_n_s_DrawSize, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(27, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Viewer.pyx":62
 * class DrawSize(object):
 *     # native
 *     FULL_SIZE    = PETSC_DRAW_FULL_SIZE             # <<<<<<<<<<<<<<
 *     HALF_SIZE    = PETSC_DRAW_HALF_SIZE
 *     THIRD_SIZE   = PETSC_DRAW_THIRD_SIZE
 */
  __pyx_t_8 = __Pyx_PyInt_From_int(PETSC_DRAW_FULL_SIZE); if (unlikely(!__pyx_t_8)) __PYX_ERR(27, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FULL_SIZE, __pyx_t_8) < 0) __PYX_ERR(27, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Viewer.pyx":63
 *     # native
 *     FULL_SIZE    = PETSC_DRAW_FULL_SIZE
 *     HALF_SIZE    = PETSC_DRAW_HALF_SIZE             # <<<<<<<<<<<<<<
 *     THIRD_SIZE   = PETSC_DRAW_THIRD_SIZE
 *     QUARTER_SIZE = PETSC_DRAW_QUARTER_SIZE
 */
  __pyx_t_8 = __Pyx_PyInt_From_int(PETSC_DRAW_HALF_SIZE); if (unlikely(!__pyx_t_8)) __PYX_ERR(27, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_HALF_SIZE, __pyx_t_8) < 0) __PYX_ERR(27, 63, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Viewer.pyx":64
 *     FULL_SIZE    = PETSC_DRAW_FULL_SIZE
 *     HALF_SIZE    = PETSC_DRAW_HALF_SIZE
 *     THIRD_SIZE   = PETSC_DRAW_THIRD_SIZE             # <<<<<<<<<<<<<<
 *     QUARTER_SIZE = PETSC_DRAW_QUARTER_SIZE
 *     # aliases
 */
  __pyx_t_8 = __Pyx_PyInt_From_int(PETSC_DRAW_THIRD_SIZE); if (unlikely(!__pyx_t_8)) __PYX_ERR(27, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_THIRD_SIZE, __pyx_t_8) < 0) __PYX_ERR(27, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Viewer.pyx":65
 *     HALF_SIZE    = PETSC_DRAW_HALF_SIZE
 *     THIRD_SIZE   = PETSC_DRAW_THIRD_SIZE
 *     QUARTER_SIZE = PETSC_DRAW_QUARTER_SIZE             # <<<<<<<<<<<<<<
 *     # aliases
 *     FULL    = FULL_SIZE
 */
  __pyx_t_8 = __Pyx_PyInt_From_int(PETSC_DRAW_QUARTER_SIZE); if (unlikely(!__pyx_t_8)) __PYX_ERR(27, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_QUARTER_SIZE, __pyx_t_8) < 0) __PYX_ERR(27, 65, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Viewer.pyx":67
 *     QUARTER_SIZE = PETSC_DRAW_QUARTER_SIZE
 *     # aliases
 *     FULL    = FULL_SIZE             # <<<<<<<<<<<<<<
 *     HALF    = HALF_SIZE
 *     THIRD   = THIRD_SIZE
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_FULL_SIZE);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_FULL_SIZE);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(27, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FULL, __pyx_t_8) < 0) __PYX_ERR(27, 67, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Viewer.pyx":68
 *     # aliases
 *     FULL    = FULL_SIZE
 *     HALF    = HALF_SIZE             # <<<<<<<<<<<<<<
 *     THIRD   = THIRD_SIZE
 *     QUARTER = QUARTER_SIZE
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_HALF_SIZE);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_HALF_SIZE);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(27, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_HALF, __pyx_t_8) < 0) __PYX_ERR(27, 68, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Viewer.pyx":69
 *     FULL    = FULL_SIZE
 *     HALF    = HALF_SIZE
 *     THIRD   = THIRD_SIZE             # <<<<<<<<<<<<<<
 *     QUARTER = QUARTER_SIZE
 * 
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_THIRD_SIZE);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_THIRD_SIZE);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(27, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_THIRD, __pyx_t_8) < 0) __PYX_ERR(27, 69, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Viewer.pyx":70
 *     HALF    = HALF_SIZE
 *     THIRD   = THIRD_SIZE
 *     QUARTER = QUARTER_SIZE             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_QUARTER_SIZE);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_QUARTER_SIZE);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(27, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_QUARTER, __pyx_t_8) < 0) __PYX_ERR(27, 70, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Viewer.pyx":60
 *     AU = UA    = APPEND_UPDATE
 * 
 * class DrawSize(object):             # <<<<<<<<<<<<<<
 *     # native
 *     FULL_SIZE    = PETSC_DRAW_FULL_SIZE
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_DrawSize, __pyx_t_1, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(27, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DrawSize, __pyx_t_8) < 0) __PYX_ERR(27, 60, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/Viewer.pyx":76
 * cdef class Viewer(Object):
 * 
 *     Type   = ViewerType             # <<<<<<<<<<<<<<
 *     Format = ViewerFormat
 *     Mode   = FileMode
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ViewerType); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer->tp_dict, __pyx_n_s_Type, __pyx_t_1) < 0) __PYX_ERR(27, 76, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Viewer);

  /* "PETSc/Viewer.pyx":77
 * 
 *     Type   = ViewerType
 *     Format = ViewerFormat             # <<<<<<<<<<<<<<
 *     Mode   = FileMode
 *     Size   = DrawSize
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ViewerFormat); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer->tp_dict, __pyx_n_s_Format, __pyx_t_1) < 0) __PYX_ERR(27, 77, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Viewer);

  /* "PETSc/Viewer.pyx":78
 *     Type   = ViewerType
 *     Format = ViewerFormat
 *     Mode   = FileMode             # <<<<<<<<<<<<<<
 *     Size   = DrawSize
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_FileMode); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer->tp_dict, __pyx_n_s_Mode, __pyx_t_1) < 0) __PYX_ERR(27, 78, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Viewer);

  /* "PETSc/Viewer.pyx":79
 *     Format = ViewerFormat
 *     Mode   = FileMode
 *     Size   = DrawSize             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DrawSize); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer->tp_dict, __pyx_n_s_Size, __pyx_t_1) < 0) __PYX_ERR(27, 79, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Viewer);

  /* "PETSc/Viewer.pyx":234
 * 
 *     @classmethod
 *     def STDOUT(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer, __pyx_n_s_STDOUT); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Viewer.pyx":233
 *         CHKERR( PetscViewerPopFormat(self.vwr) )
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def STDOUT(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer->tp_dict, __pyx_n_s_STDOUT, __pyx_t_3) < 0) __PYX_ERR(27, 234, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Viewer);

  /* "PETSc/Viewer.pyx":242
 * 
 *     @classmethod
 *     def STDERR(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer, __pyx_n_s_STDERR); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Viewer.pyx":241
 *         return viewer
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def STDERR(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer->tp_dict, __pyx_n_s_STDERR, __pyx_t_1) < 0) __PYX_ERR(27, 242, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Viewer);

  /* "PETSc/Viewer.pyx":250
 * 
 *     @classmethod
 *     def ASCII(cls, name, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef const_char *cname = NULL
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer, __pyx_n_s_ASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Viewer.pyx":249
 *         return viewer
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def ASCII(cls, name, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer->tp_dict, __pyx_n_s_ASCII, __pyx_t_3) < 0) __PYX_ERR(27, 250, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Viewer);

  /* "PETSc/Viewer.pyx":259
 * 
 *     @classmethod
 *     def BINARY(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer, __pyx_n_s_BINARY); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Viewer.pyx":258
 *         return viewer
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def BINARY(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer->tp_dict, __pyx_n_s_BINARY, __pyx_t_1) < 0) __PYX_ERR(27, 259, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Viewer);

  /* "PETSc/Viewer.pyx":267
 * 
 *     @classmethod
 *     def DRAW(cls, comm=None):             # <<<<<<<<<<<<<<
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 *         cdef Viewer viewer = Viewer()
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer, __pyx_n_s_DRAW); if (unlikely(!__pyx_t_1)) __PYX_ERR(27, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Viewer.pyx":266
 *         return viewer
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def DRAW(cls, comm=None):
 *         cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT)
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(27, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Viewer->tp_dict, __pyx_n_s_DRAW, __pyx_t_3) < 0) __PYX_ERR(27, 267, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Viewer);

  /* "PETSc/Viewer.pyx":363
 * # --------------------------------------------------------------------
 * 
 * del ViewerType             # <<<<<<<<<<<<<<
 * del ViewerFormat
 * del FileMode
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_ViewerType) < 0) __PYX_ERR(27, 363, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":364
 * 
 * del ViewerType
 * del ViewerFormat             # <<<<<<<<<<<<<<
 * del FileMode
 * del DrawSize
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_ViewerFormat) < 0) __PYX_ERR(27, 364, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":365
 * del ViewerType
 * del ViewerFormat
 * del FileMode             # <<<<<<<<<<<<<<
 * del DrawSize
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_FileMode) < 0) __PYX_ERR(27, 365, __pyx_L1_error)

  /* "PETSc/Viewer.pyx":366
 * del ViewerFormat
 * del FileMode
 * del DrawSize             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_DrawSize) < 0) __PYX_ERR(27, 366, __pyx_L1_error)

  /* "PETSc/Random.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class RandomType(object):             # <<<<<<<<<<<<<<
 *     RAND     = S_(PETSCRAND)
 *     RAND48   = S_(PETSCRAND48)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(28, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(28, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_RandomType, __pyx_n_s_RandomType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(28, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Random.pyx":4
 * 
 * class RandomType(object):
 *     RAND     = S_(PETSCRAND)             # <<<<<<<<<<<<<<
 *     RAND48   = S_(PETSCRAND48)
 *     SPRNG    = S_(PETSCSPRNG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PETSCRAND); if (unlikely(!__pyx_t_8)) __PYX_ERR(28, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_RAND, __pyx_t_8) < 0) __PYX_ERR(28, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Random.pyx":5
 * class RandomType(object):
 *     RAND     = S_(PETSCRAND)
 *     RAND48   = S_(PETSCRAND48)             # <<<<<<<<<<<<<<
 *     SPRNG    = S_(PETSCSPRNG)
 *     RANDER48 = S_(PETSCRANDER48)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PETSCRAND48); if (unlikely(!__pyx_t_8)) __PYX_ERR(28, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_RAND48, __pyx_t_8) < 0) __PYX_ERR(28, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Random.pyx":6
 *     RAND     = S_(PETSCRAND)
 *     RAND48   = S_(PETSCRAND48)
 *     SPRNG    = S_(PETSCSPRNG)             # <<<<<<<<<<<<<<
 *     RANDER48 = S_(PETSCRANDER48)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PETSCSPRNG); if (unlikely(!__pyx_t_8)) __PYX_ERR(28, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SPRNG, __pyx_t_8) < 0) __PYX_ERR(28, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Random.pyx":7
 *     RAND48   = S_(PETSCRAND48)
 *     SPRNG    = S_(PETSCSPRNG)
 *     RANDER48 = S_(PETSCRANDER48)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PETSCRANDER48); if (unlikely(!__pyx_t_8)) __PYX_ERR(28, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_RANDER48, __pyx_t_8) < 0) __PYX_ERR(28, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Random.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class RandomType(object):             # <<<<<<<<<<<<<<
 *     RAND     = S_(PETSCRAND)
 *     RAND48   = S_(PETSCRAND48)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_RandomType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(28, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RandomType, __pyx_t_8) < 0) __PYX_ERR(28, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/Random.pyx":13
 * cdef class Random(Object):
 * 
 *     Type = RandomType             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_RandomType); if (unlikely(!__pyx_t_3)) __PYX_ERR(28, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Random->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(28, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Random);

  /* "PETSc/Random.pyx":100
 * # --------------------------------------------------------------------
 * 
 * del RandomType             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_RandomType) < 0) __PYX_ERR(28, 100, __pyx_L1_error)

  /* "PETSc/IS.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class ISType(object):             # <<<<<<<<<<<<<<
 *     GENERAL = S_(ISGENERAL)
 *     BLOCK   = S_(ISBLOCK)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(29, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_ISType, __pyx_n_s_ISType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(29, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/IS.pyx":4
 * 
 * class ISType(object):
 *     GENERAL = S_(ISGENERAL)             # <<<<<<<<<<<<<<
 *     BLOCK   = S_(ISBLOCK)
 *     STRIDE  = S_(ISSTRIDE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(ISGENERAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(29, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GENERAL, __pyx_t_8) < 0) __PYX_ERR(29, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/IS.pyx":5
 * class ISType(object):
 *     GENERAL = S_(ISGENERAL)
 *     BLOCK   = S_(ISBLOCK)             # <<<<<<<<<<<<<<
 *     STRIDE  = S_(ISSTRIDE)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(ISBLOCK); if (unlikely(!__pyx_t_8)) __PYX_ERR(29, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BLOCK, __pyx_t_8) < 0) __PYX_ERR(29, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/IS.pyx":6
 *     GENERAL = S_(ISGENERAL)
 *     BLOCK   = S_(ISBLOCK)
 *     STRIDE  = S_(ISSTRIDE)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(ISSTRIDE); if (unlikely(!__pyx_t_8)) __PYX_ERR(29, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_STRIDE, __pyx_t_8) < 0) __PYX_ERR(29, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/IS.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class ISType(object):             # <<<<<<<<<<<<<<
 *     GENERAL = S_(ISGENERAL)
 *     BLOCK   = S_(ISBLOCK)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_ISType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(29, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ISType, __pyx_t_8) < 0) __PYX_ERR(29, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/IS.pyx":12
 * cdef class IS(Object):
 * 
 *     Type = ISType             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ISType); if (unlikely(!__pyx_t_3)) __PYX_ERR(29, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_IS->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(29, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_IS);

  /* "PETSc/IS.pyx":343
 * 
 * 
 * class GLMapType(object):             # <<<<<<<<<<<<<<
 *     MASK = PETSC_IS_GTOLM_MASK
 *     DROP = PETSC_IS_GTOLM_DROP
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(29, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(29, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_GLMapType, __pyx_n_s_GLMapType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(29, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/IS.pyx":344
 * 
 * class GLMapType(object):
 *     MASK = PETSC_IS_GTOLM_MASK             # <<<<<<<<<<<<<<
 *     DROP = PETSC_IS_GTOLM_DROP
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_ISGlobalToLocalMappingType(IS_GTOLM_MASK); if (unlikely(!__pyx_t_8)) __PYX_ERR(29, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MASK, __pyx_t_8) < 0) __PYX_ERR(29, 344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/IS.pyx":345
 * class GLMapType(object):
 *     MASK = PETSC_IS_GTOLM_MASK
 *     DROP = PETSC_IS_GTOLM_DROP             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_ISGlobalToLocalMappingType(IS_GTOLM_DROP); if (unlikely(!__pyx_t_8)) __PYX_ERR(29, 345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DROP, __pyx_t_8) < 0) __PYX_ERR(29, 345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/IS.pyx":343
 * 
 * 
 * class GLMapType(object):             # <<<<<<<<<<<<<<
 *     MASK = PETSC_IS_GTOLM_MASK
 *     DROP = PETSC_IS_GTOLM_DROP
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_GLMapType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(29, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_GLMapType, __pyx_t_8) < 0) __PYX_ERR(29, 343, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/IS.pyx":352
 * cdef class LGMap(Object):
 * 
 *     MapType = GLMapType             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_GLMapType); if (unlikely(!__pyx_t_3)) __PYX_ERR(29, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_LGMap->tp_dict, __pyx_n_s_MapType, __pyx_t_3) < 0) __PYX_ERR(29, 352, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_LGMap);

  /* "PETSc/IS.pyx":556
 * # --------------------------------------------------------------------
 * 
 * del ISType             # <<<<<<<<<<<<<<
 * del GLMapType
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_ISType) < 0) __PYX_ERR(29, 556, __pyx_L1_error)

  /* "PETSc/IS.pyx":557
 * 
 * del ISType
 * del GLMapType             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_GLMapType) < 0) __PYX_ERR(29, 557, __pyx_L1_error)

  /* "PETSc/Vec.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class VecType(object):             # <<<<<<<<<<<<<<
 *     SEQ        = S_(VECSEQ)
 *     MPI        = S_(VECMPI)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_VecType, __pyx_n_s_VecType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Vec.pyx":4
 * 
 * class VecType(object):
 *     SEQ        = S_(VECSEQ)             # <<<<<<<<<<<<<<
 *     MPI        = S_(VECMPI)
 *     STANDARD   = S_(VECSTANDARD)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECSEQ); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQ, __pyx_t_8) < 0) __PYX_ERR(30, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":5
 * class VecType(object):
 *     SEQ        = S_(VECSEQ)
 *     MPI        = S_(VECMPI)             # <<<<<<<<<<<<<<
 *     STANDARD   = S_(VECSTANDARD)
 *     SHARED     = S_(VECSHARED)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECMPI); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPI, __pyx_t_8) < 0) __PYX_ERR(30, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":6
 *     SEQ        = S_(VECSEQ)
 *     MPI        = S_(VECMPI)
 *     STANDARD   = S_(VECSTANDARD)             # <<<<<<<<<<<<<<
 *     SHARED     = S_(VECSHARED)
 *     SEQCUSP    = S_(VECSEQCUSP)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECSTANDARD); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_STANDARD, __pyx_t_8) < 0) __PYX_ERR(30, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":7
 *     MPI        = S_(VECMPI)
 *     STANDARD   = S_(VECSTANDARD)
 *     SHARED     = S_(VECSHARED)             # <<<<<<<<<<<<<<
 *     SEQCUSP    = S_(VECSEQCUSP)
 *     MPICUSP    = S_(VECMPICUSP)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECSHARED); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SHARED, __pyx_t_8) < 0) __PYX_ERR(30, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":8
 *     STANDARD   = S_(VECSTANDARD)
 *     SHARED     = S_(VECSHARED)
 *     SEQCUSP    = S_(VECSEQCUSP)             # <<<<<<<<<<<<<<
 *     MPICUSP    = S_(VECMPICUSP)
 *     CUSP       = S_(VECCUSP)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECSEQCUSP); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQCUSP, __pyx_t_8) < 0) __PYX_ERR(30, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":9
 *     SHARED     = S_(VECSHARED)
 *     SEQCUSP    = S_(VECSEQCUSP)
 *     MPICUSP    = S_(VECMPICUSP)             # <<<<<<<<<<<<<<
 *     CUSP       = S_(VECCUSP)
 *     SEQVIENNACL= S_(VECSEQVIENNACL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECMPICUSP); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPICUSP, __pyx_t_8) < 0) __PYX_ERR(30, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":10
 *     SEQCUSP    = S_(VECSEQCUSP)
 *     MPICUSP    = S_(VECMPICUSP)
 *     CUSP       = S_(VECCUSP)             # <<<<<<<<<<<<<<
 *     SEQVIENNACL= S_(VECSEQVIENNACL)
 *     MPIVIENNACL= S_(VECMPIVIENNACL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECCUSP); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CUSP, __pyx_t_8) < 0) __PYX_ERR(30, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":11
 *     MPICUSP    = S_(VECMPICUSP)
 *     CUSP       = S_(VECCUSP)
 *     SEQVIENNACL= S_(VECSEQVIENNACL)             # <<<<<<<<<<<<<<
 *     MPIVIENNACL= S_(VECMPIVIENNACL)
 *     VIENNACL   = S_(VECVIENNACL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECSEQVIENNACL); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQVIENNACL, __pyx_t_8) < 0) __PYX_ERR(30, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":12
 *     CUSP       = S_(VECCUSP)
 *     SEQVIENNACL= S_(VECSEQVIENNACL)
 *     MPIVIENNACL= S_(VECMPIVIENNACL)             # <<<<<<<<<<<<<<
 *     VIENNACL   = S_(VECVIENNACL)
 *     SEQCUSP    = S_(VECSEQCUDA)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECMPIVIENNACL); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPIVIENNACL, __pyx_t_8) < 0) __PYX_ERR(30, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":13
 *     SEQVIENNACL= S_(VECSEQVIENNACL)
 *     MPIVIENNACL= S_(VECMPIVIENNACL)
 *     VIENNACL   = S_(VECVIENNACL)             # <<<<<<<<<<<<<<
 *     SEQCUSP    = S_(VECSEQCUDA)
 *     MPICUSP    = S_(VECMPICUDA)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECVIENNACL); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_VIENNACL, __pyx_t_8) < 0) __PYX_ERR(30, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":14
 *     MPIVIENNACL= S_(VECMPIVIENNACL)
 *     VIENNACL   = S_(VECVIENNACL)
 *     SEQCUSP    = S_(VECSEQCUDA)             # <<<<<<<<<<<<<<
 *     MPICUSP    = S_(VECMPICUDA)
 *     CUSP       = S_(VECCUDA)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECSEQCUDA); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQCUSP, __pyx_t_8) < 0) __PYX_ERR(30, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":15
 *     VIENNACL   = S_(VECVIENNACL)
 *     SEQCUSP    = S_(VECSEQCUDA)
 *     MPICUSP    = S_(VECMPICUDA)             # <<<<<<<<<<<<<<
 *     CUSP       = S_(VECCUDA)
 *     NEST       = S_(VECNEST)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECMPICUDA); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPICUSP, __pyx_t_8) < 0) __PYX_ERR(30, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":16
 *     SEQCUSP    = S_(VECSEQCUDA)
 *     MPICUSP    = S_(VECMPICUDA)
 *     CUSP       = S_(VECCUDA)             # <<<<<<<<<<<<<<
 *     NEST       = S_(VECNEST)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECCUDA); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CUSP, __pyx_t_8) < 0) __PYX_ERR(30, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":17
 *     MPICUSP    = S_(VECMPICUDA)
 *     CUSP       = S_(VECCUDA)
 *     NEST       = S_(VECNEST)             # <<<<<<<<<<<<<<
 * 
 * class VecOption(object):
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(VECNEST); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NEST, __pyx_t_8) < 0) __PYX_ERR(30, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class VecType(object):             # <<<<<<<<<<<<<<
 *     SEQ        = S_(VECSEQ)
 *     MPI        = S_(VECMPI)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_VecType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_VecType, __pyx_t_8) < 0) __PYX_ERR(30, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/Vec.pyx":19
 *     NEST       = S_(VECNEST)
 * 
 * class VecOption(object):             # <<<<<<<<<<<<<<
 *     IGNORE_OFF_PROC_ENTRIES = VEC_IGNORE_OFF_PROC_ENTRIES
 *     IGNORE_NEGATIVE_INDICES = VEC_IGNORE_NEGATIVE_INDICES
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(30, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_VecOption, __pyx_n_s_VecOption, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Vec.pyx":20
 * 
 * class VecOption(object):
 *     IGNORE_OFF_PROC_ENTRIES = VEC_IGNORE_OFF_PROC_ENTRIES             # <<<<<<<<<<<<<<
 *     IGNORE_NEGATIVE_INDICES = VEC_IGNORE_NEGATIVE_INDICES
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_VecOption(VEC_IGNORE_OFF_PROC_ENTRIES); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_IGNORE_OFF_PROC_ENTRIES, __pyx_t_8) < 0) __PYX_ERR(30, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":21
 * class VecOption(object):
 *     IGNORE_OFF_PROC_ENTRIES = VEC_IGNORE_OFF_PROC_ENTRIES
 *     IGNORE_NEGATIVE_INDICES = VEC_IGNORE_NEGATIVE_INDICES             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = __Pyx_PyInt_From_VecOption(VEC_IGNORE_NEGATIVE_INDICES); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_IGNORE_NEGATIVE_INDICES, __pyx_t_8) < 0) __PYX_ERR(30, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Vec.pyx":19
 *     NEST       = S_(VECNEST)
 * 
 * class VecOption(object):             # <<<<<<<<<<<<<<
 *     IGNORE_OFF_PROC_ENTRIES = VEC_IGNORE_OFF_PROC_ENTRIES
 *     IGNORE_NEGATIVE_INDICES = VEC_IGNORE_NEGATIVE_INDICES
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_VecOption, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(30, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_VecOption, __pyx_t_8) < 0) __PYX_ERR(30, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/Vec.pyx":27
 * cdef class Vec(Object):
 * 
 *     Type = VecType             # <<<<<<<<<<<<<<
 *     Option = VecOption
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_VecType); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(30, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Vec);

  /* "PETSc/Vec.pyx":28
 * 
 *     Type = VecType
 *     Option = VecOption             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_VecOption); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Vec->tp_dict, __pyx_n_s_Option, __pyx_t_3) < 0) __PYX_ERR(30, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Vec);

  /* "PETSc/Vec.pyx":894
 * # --------------------------------------------------------------------
 * 
 * del VecType             # <<<<<<<<<<<<<<
 * del VecOption
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_VecType) < 0) __PYX_ERR(30, 894, __pyx_L1_error)

  /* "PETSc/Vec.pyx":895
 * 
 * del VecType
 * del VecOption             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_VecOption) < 0) __PYX_ERR(30, 895, __pyx_L1_error)

  /* "PETSc/Scatter.pyx":5
 * cdef class Scatter(Object):
 * 
 *     Mode = ScatterMode             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ScatterMode); if (unlikely(!__pyx_t_3)) __PYX_ERR(31, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Scatter->tp_dict, __pyx_n_s_Mode, __pyx_t_3) < 0) __PYX_ERR(31, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Scatter);

  /* "PETSc/Scatter.pyx":44
 * 
 *     @classmethod
 *     def toAll(cls, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef Scatter scatter = Scatter()
 *         cdef Vec ovec = Vec()
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Scatter, __pyx_n_s_toAll); if (unlikely(!__pyx_t_3)) __PYX_ERR(31, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/Scatter.pyx":43
 *         return scatter
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def toAll(cls, Vec vec not None):
 *         cdef Scatter scatter = Scatter()
 */
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(31, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Scatter->tp_dict, __pyx_n_s_toAll, __pyx_t_1) < 0) __PYX_ERR(31, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Scatter);

  /* "PETSc/Scatter.pyx":52
 * 
 *     @classmethod
 *     def toZero(cls, Vec vec not None):             # <<<<<<<<<<<<<<
 *         cdef Scatter scatter = Scatter()
 *         cdef Vec ovec = Vec()
 */
  __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Scatter, __pyx_n_s_toZero); if (unlikely(!__pyx_t_1)) __PYX_ERR(31, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "PETSc/Scatter.pyx":51
 *         return (scatter, ovec)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def toZero(cls, Vec vec not None):
 *         cdef Scatter scatter = Scatter()
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(31, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Scatter->tp_dict, __pyx_n_s_toZero, __pyx_t_3) < 0) __PYX_ERR(31, 52, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Scatter);

  /* "PETSc/Mat.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class MatType(object):             # <<<<<<<<<<<<<<
 *     SAME            = S_(MATSAME)
 *     MAIJ            = S_(MATMAIJ)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_MatType, __pyx_n_s_MatType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Mat.pyx":4
 * 
 * class MatType(object):
 *     SAME            = S_(MATSAME)             # <<<<<<<<<<<<<<
 *     MAIJ            = S_(MATMAIJ)
 *     SEQMAIJ         = S_(MATSEQMAIJ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSAME); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SAME, __pyx_t_8) < 0) __PYX_ERR(33, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":5
 * class MatType(object):
 *     SAME            = S_(MATSAME)
 *     MAIJ            = S_(MATMAIJ)             # <<<<<<<<<<<<<<
 *     SEQMAIJ         = S_(MATSEQMAIJ)
 *     MPIMAIJ         = S_(MATMPIMAIJ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMAIJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MAIJ, __pyx_t_8) < 0) __PYX_ERR(33, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":6
 *     SAME            = S_(MATSAME)
 *     MAIJ            = S_(MATMAIJ)
 *     SEQMAIJ         = S_(MATSEQMAIJ)             # <<<<<<<<<<<<<<
 *     MPIMAIJ         = S_(MATMPIMAIJ)
 *     IS              = S_(MATIS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQMAIJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQMAIJ, __pyx_t_8) < 0) __PYX_ERR(33, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":7
 *     MAIJ            = S_(MATMAIJ)
 *     SEQMAIJ         = S_(MATSEQMAIJ)
 *     MPIMAIJ         = S_(MATMPIMAIJ)             # <<<<<<<<<<<<<<
 *     IS              = S_(MATIS)
 *     AIJ             = S_(MATAIJ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPIMAIJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPIMAIJ, __pyx_t_8) < 0) __PYX_ERR(33, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":8
 *     SEQMAIJ         = S_(MATSEQMAIJ)
 *     MPIMAIJ         = S_(MATMPIMAIJ)
 *     IS              = S_(MATIS)             # <<<<<<<<<<<<<<
 *     AIJ             = S_(MATAIJ)
 *     SEQAIJ          = S_(MATSEQAIJ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATIS); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_IS, __pyx_t_8) < 0) __PYX_ERR(33, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":9
 *     MPIMAIJ         = S_(MATMPIMAIJ)
 *     IS              = S_(MATIS)
 *     AIJ             = S_(MATAIJ)             # <<<<<<<<<<<<<<
 *     SEQAIJ          = S_(MATSEQAIJ)
 *     MPIAIJ          = S_(MATMPIAIJ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATAIJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_AIJ, __pyx_t_8) < 0) __PYX_ERR(33, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":10
 *     IS              = S_(MATIS)
 *     AIJ             = S_(MATAIJ)
 *     SEQAIJ          = S_(MATSEQAIJ)             # <<<<<<<<<<<<<<
 *     MPIAIJ          = S_(MATMPIAIJ)
 *     AIJCRL          = S_(MATAIJCRL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQAIJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQAIJ, __pyx_t_8) < 0) __PYX_ERR(33, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":11
 *     AIJ             = S_(MATAIJ)
 *     SEQAIJ          = S_(MATSEQAIJ)
 *     MPIAIJ          = S_(MATMPIAIJ)             # <<<<<<<<<<<<<<
 *     AIJCRL          = S_(MATAIJCRL)
 *     SEQAIJCRL       = S_(MATSEQAIJCRL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPIAIJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPIAIJ, __pyx_t_8) < 0) __PYX_ERR(33, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":12
 *     SEQAIJ          = S_(MATSEQAIJ)
 *     MPIAIJ          = S_(MATMPIAIJ)
 *     AIJCRL          = S_(MATAIJCRL)             # <<<<<<<<<<<<<<
 *     SEQAIJCRL       = S_(MATSEQAIJCRL)
 *     MPIAIJCRL       = S_(MATMPIAIJCRL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATAIJCRL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_AIJCRL, __pyx_t_8) < 0) __PYX_ERR(33, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":13
 *     MPIAIJ          = S_(MATMPIAIJ)
 *     AIJCRL          = S_(MATAIJCRL)
 *     SEQAIJCRL       = S_(MATSEQAIJCRL)             # <<<<<<<<<<<<<<
 *     MPIAIJCRL       = S_(MATMPIAIJCRL)
 *     AIJCUSP         = S_(MATAIJCUSP)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQAIJCRL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQAIJCRL, __pyx_t_8) < 0) __PYX_ERR(33, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":14
 *     AIJCRL          = S_(MATAIJCRL)
 *     SEQAIJCRL       = S_(MATSEQAIJCRL)
 *     MPIAIJCRL       = S_(MATMPIAIJCRL)             # <<<<<<<<<<<<<<
 *     AIJCUSP         = S_(MATAIJCUSP)
 *     SEQAIJCUSP      = S_(MATSEQAIJCUSP)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPIAIJCRL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPIAIJCRL, __pyx_t_8) < 0) __PYX_ERR(33, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":15
 *     SEQAIJCRL       = S_(MATSEQAIJCRL)
 *     MPIAIJCRL       = S_(MATMPIAIJCRL)
 *     AIJCUSP         = S_(MATAIJCUSP)             # <<<<<<<<<<<<<<
 *     SEQAIJCUSP      = S_(MATSEQAIJCUSP)
 *     MPIAIJCUSP      = S_(MATMPIAIJCUSP)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATAIJCUSP); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_AIJCUSP, __pyx_t_8) < 0) __PYX_ERR(33, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":16
 *     MPIAIJCRL       = S_(MATMPIAIJCRL)
 *     AIJCUSP         = S_(MATAIJCUSP)
 *     SEQAIJCUSP      = S_(MATSEQAIJCUSP)             # <<<<<<<<<<<<<<
 *     MPIAIJCUSP      = S_(MATMPIAIJCUSP)
 *     AIJCUSPARSE     = S_(MATAIJCUSPARSE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQAIJCUSP); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQAIJCUSP, __pyx_t_8) < 0) __PYX_ERR(33, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":17
 *     AIJCUSP         = S_(MATAIJCUSP)
 *     SEQAIJCUSP      = S_(MATSEQAIJCUSP)
 *     MPIAIJCUSP      = S_(MATMPIAIJCUSP)             # <<<<<<<<<<<<<<
 *     AIJCUSPARSE     = S_(MATAIJCUSPARSE)
 *     SEQAIJCUSPARSE  = S_(MATSEQAIJCUSPARSE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPIAIJCUSP); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPIAIJCUSP, __pyx_t_8) < 0) __PYX_ERR(33, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":18
 *     SEQAIJCUSP      = S_(MATSEQAIJCUSP)
 *     MPIAIJCUSP      = S_(MATMPIAIJCUSP)
 *     AIJCUSPARSE     = S_(MATAIJCUSPARSE)             # <<<<<<<<<<<<<<
 *     SEQAIJCUSPARSE  = S_(MATSEQAIJCUSPARSE)
 *     MPIAIJCUSPARSE  = S_(MATMPIAIJCUSPARSE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATAIJCUSPARSE); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_AIJCUSPARSE, __pyx_t_8) < 0) __PYX_ERR(33, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":19
 *     MPIAIJCUSP      = S_(MATMPIAIJCUSP)
 *     AIJCUSPARSE     = S_(MATAIJCUSPARSE)
 *     SEQAIJCUSPARSE  = S_(MATSEQAIJCUSPARSE)             # <<<<<<<<<<<<<<
 *     MPIAIJCUSPARSE  = S_(MATMPIAIJCUSPARSE)
 *     AIJVIENNACL     = S_(MATAIJVIENNACL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQAIJCUSPARSE); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQAIJCUSPARSE, __pyx_t_8) < 0) __PYX_ERR(33, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":20
 *     AIJCUSPARSE     = S_(MATAIJCUSPARSE)
 *     SEQAIJCUSPARSE  = S_(MATSEQAIJCUSPARSE)
 *     MPIAIJCUSPARSE  = S_(MATMPIAIJCUSPARSE)             # <<<<<<<<<<<<<<
 *     AIJVIENNACL     = S_(MATAIJVIENNACL)
 *     SEQAIJVIENNACL  = S_(MATSEQAIJVIENNACL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPIAIJCUSPARSE); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPIAIJCUSPARSE, __pyx_t_8) < 0) __PYX_ERR(33, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":21
 *     SEQAIJCUSPARSE  = S_(MATSEQAIJCUSPARSE)
 *     MPIAIJCUSPARSE  = S_(MATMPIAIJCUSPARSE)
 *     AIJVIENNACL     = S_(MATAIJVIENNACL)             # <<<<<<<<<<<<<<
 *     SEQAIJVIENNACL  = S_(MATSEQAIJVIENNACL)
 *     MPIAIJVIENNACL  = S_(MATMPIAIJVIENNACL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATAIJVIENNACL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_AIJVIENNACL, __pyx_t_8) < 0) __PYX_ERR(33, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":22
 *     MPIAIJCUSPARSE  = S_(MATMPIAIJCUSPARSE)
 *     AIJVIENNACL     = S_(MATAIJVIENNACL)
 *     SEQAIJVIENNACL  = S_(MATSEQAIJVIENNACL)             # <<<<<<<<<<<<<<
 *     MPIAIJVIENNACL  = S_(MATMPIAIJVIENNACL)
 *     AIJPERM         = S_(MATAIJPERM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQAIJVIENNACL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQAIJVIENNACL, __pyx_t_8) < 0) __PYX_ERR(33, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":23
 *     AIJVIENNACL     = S_(MATAIJVIENNACL)
 *     SEQAIJVIENNACL  = S_(MATSEQAIJVIENNACL)
 *     MPIAIJVIENNACL  = S_(MATMPIAIJVIENNACL)             # <<<<<<<<<<<<<<
 *     AIJPERM         = S_(MATAIJPERM)
 *     SEQAIJPERM      = S_(MATSEQAIJPERM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPIAIJVIENNACL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPIAIJVIENNACL, __pyx_t_8) < 0) __PYX_ERR(33, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":24
 *     SEQAIJVIENNACL  = S_(MATSEQAIJVIENNACL)
 *     MPIAIJVIENNACL  = S_(MATMPIAIJVIENNACL)
 *     AIJPERM         = S_(MATAIJPERM)             # <<<<<<<<<<<<<<
 *     SEQAIJPERM      = S_(MATSEQAIJPERM)
 *     MPIAIJPERM      = S_(MATMPIAIJPERM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATAIJPERM); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_AIJPERM, __pyx_t_8) < 0) __PYX_ERR(33, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":25
 *     MPIAIJVIENNACL  = S_(MATMPIAIJVIENNACL)
 *     AIJPERM         = S_(MATAIJPERM)
 *     SEQAIJPERM      = S_(MATSEQAIJPERM)             # <<<<<<<<<<<<<<
 *     MPIAIJPERM      = S_(MATMPIAIJPERM)
 *     SHELL           = S_(MATSHELL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQAIJPERM); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQAIJPERM, __pyx_t_8) < 0) __PYX_ERR(33, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":26
 *     AIJPERM         = S_(MATAIJPERM)
 *     SEQAIJPERM      = S_(MATSEQAIJPERM)
 *     MPIAIJPERM      = S_(MATMPIAIJPERM)             # <<<<<<<<<<<<<<
 *     SHELL           = S_(MATSHELL)
 *     DENSE           = S_(MATDENSE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPIAIJPERM); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPIAIJPERM, __pyx_t_8) < 0) __PYX_ERR(33, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":27
 *     SEQAIJPERM      = S_(MATSEQAIJPERM)
 *     MPIAIJPERM      = S_(MATMPIAIJPERM)
 *     SHELL           = S_(MATSHELL)             # <<<<<<<<<<<<<<
 *     DENSE           = S_(MATDENSE)
 *     SEQDENSE        = S_(MATSEQDENSE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSHELL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SHELL, __pyx_t_8) < 0) __PYX_ERR(33, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":28
 *     MPIAIJPERM      = S_(MATMPIAIJPERM)
 *     SHELL           = S_(MATSHELL)
 *     DENSE           = S_(MATDENSE)             # <<<<<<<<<<<<<<
 *     SEQDENSE        = S_(MATSEQDENSE)
 *     MPIDENSE        = S_(MATMPIDENSE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATDENSE); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DENSE, __pyx_t_8) < 0) __PYX_ERR(33, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":29
 *     SHELL           = S_(MATSHELL)
 *     DENSE           = S_(MATDENSE)
 *     SEQDENSE        = S_(MATSEQDENSE)             # <<<<<<<<<<<<<<
 *     MPIDENSE        = S_(MATMPIDENSE)
 *     ELEMENTAL       = S_(MATELEMENTAL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQDENSE); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQDENSE, __pyx_t_8) < 0) __PYX_ERR(33, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":30
 *     DENSE           = S_(MATDENSE)
 *     SEQDENSE        = S_(MATSEQDENSE)
 *     MPIDENSE        = S_(MATMPIDENSE)             # <<<<<<<<<<<<<<
 *     ELEMENTAL       = S_(MATELEMENTAL)
 *     BAIJ            = S_(MATBAIJ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPIDENSE); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPIDENSE, __pyx_t_8) < 0) __PYX_ERR(33, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":31
 *     SEQDENSE        = S_(MATSEQDENSE)
 *     MPIDENSE        = S_(MATMPIDENSE)
 *     ELEMENTAL       = S_(MATELEMENTAL)             # <<<<<<<<<<<<<<
 *     BAIJ            = S_(MATBAIJ)
 *     SEQBAIJ         = S_(MATSEQBAIJ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATELEMENTAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ELEMENTAL, __pyx_t_8) < 0) __PYX_ERR(33, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":32
 *     MPIDENSE        = S_(MATMPIDENSE)
 *     ELEMENTAL       = S_(MATELEMENTAL)
 *     BAIJ            = S_(MATBAIJ)             # <<<<<<<<<<<<<<
 *     SEQBAIJ         = S_(MATSEQBAIJ)
 *     MPIBAIJ         = S_(MATMPIBAIJ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATBAIJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BAIJ, __pyx_t_8) < 0) __PYX_ERR(33, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":33
 *     ELEMENTAL       = S_(MATELEMENTAL)
 *     BAIJ            = S_(MATBAIJ)
 *     SEQBAIJ         = S_(MATSEQBAIJ)             # <<<<<<<<<<<<<<
 *     MPIBAIJ         = S_(MATMPIBAIJ)
 *     MPIADJ          = S_(MATMPIADJ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQBAIJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQBAIJ, __pyx_t_8) < 0) __PYX_ERR(33, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":34
 *     BAIJ            = S_(MATBAIJ)
 *     SEQBAIJ         = S_(MATSEQBAIJ)
 *     MPIBAIJ         = S_(MATMPIBAIJ)             # <<<<<<<<<<<<<<
 *     MPIADJ          = S_(MATMPIADJ)
 *     SBAIJ           = S_(MATSBAIJ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPIBAIJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPIBAIJ, __pyx_t_8) < 0) __PYX_ERR(33, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":35
 *     SEQBAIJ         = S_(MATSEQBAIJ)
 *     MPIBAIJ         = S_(MATMPIBAIJ)
 *     MPIADJ          = S_(MATMPIADJ)             # <<<<<<<<<<<<<<
 *     SBAIJ           = S_(MATSBAIJ)
 *     SEQSBAIJ        = S_(MATSEQSBAIJ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPIADJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPIADJ, __pyx_t_8) < 0) __PYX_ERR(33, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":36
 *     MPIBAIJ         = S_(MATMPIBAIJ)
 *     MPIADJ          = S_(MATMPIADJ)
 *     SBAIJ           = S_(MATSBAIJ)             # <<<<<<<<<<<<<<
 *     SEQSBAIJ        = S_(MATSEQSBAIJ)
 *     MPISBAIJ        = S_(MATMPISBAIJ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSBAIJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SBAIJ, __pyx_t_8) < 0) __PYX_ERR(33, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":37
 *     MPIADJ          = S_(MATMPIADJ)
 *     SBAIJ           = S_(MATSBAIJ)
 *     SEQSBAIJ        = S_(MATSEQSBAIJ)             # <<<<<<<<<<<<<<
 *     MPISBAIJ        = S_(MATMPISBAIJ)
 *     SEQBSTRM        = S_(MATSEQBSTRM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQSBAIJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQSBAIJ, __pyx_t_8) < 0) __PYX_ERR(33, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":38
 *     SBAIJ           = S_(MATSBAIJ)
 *     SEQSBAIJ        = S_(MATSEQSBAIJ)
 *     MPISBAIJ        = S_(MATMPISBAIJ)             # <<<<<<<<<<<<<<
 *     SEQBSTRM        = S_(MATSEQBSTRM)
 *     MPIBSTRM        = S_(MATMPIBSTRM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPISBAIJ); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPISBAIJ, __pyx_t_8) < 0) __PYX_ERR(33, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":39
 *     SEQSBAIJ        = S_(MATSEQSBAIJ)
 *     MPISBAIJ        = S_(MATMPISBAIJ)
 *     SEQBSTRM        = S_(MATSEQBSTRM)             # <<<<<<<<<<<<<<
 *     MPIBSTRM        = S_(MATMPIBSTRM)
 *     BSTRM           = S_(MATBSTRM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQBSTRM); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQBSTRM, __pyx_t_8) < 0) __PYX_ERR(33, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":40
 *     MPISBAIJ        = S_(MATMPISBAIJ)
 *     SEQBSTRM        = S_(MATSEQBSTRM)
 *     MPIBSTRM        = S_(MATMPIBSTRM)             # <<<<<<<<<<<<<<
 *     BSTRM           = S_(MATBSTRM)
 *     SEQSBSTRM       = S_(MATSEQSBSTRM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPIBSTRM); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPIBSTRM, __pyx_t_8) < 0) __PYX_ERR(33, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":41
 *     SEQBSTRM        = S_(MATSEQBSTRM)
 *     MPIBSTRM        = S_(MATMPIBSTRM)
 *     BSTRM           = S_(MATBSTRM)             # <<<<<<<<<<<<<<
 *     SEQSBSTRM       = S_(MATSEQSBSTRM)
 *     MPISBSTRM       = S_(MATMPISBSTRM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATBSTRM); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BSTRM, __pyx_t_8) < 0) __PYX_ERR(33, 41, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":42
 *     MPIBSTRM        = S_(MATMPIBSTRM)
 *     BSTRM           = S_(MATBSTRM)
 *     SEQSBSTRM       = S_(MATSEQSBSTRM)             # <<<<<<<<<<<<<<
 *     MPISBSTRM       = S_(MATMPISBSTRM)
 *     SBSTRM          = S_(MATSBSTRM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQSBSTRM); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQSBSTRM, __pyx_t_8) < 0) __PYX_ERR(33, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":43
 *     BSTRM           = S_(MATBSTRM)
 *     SEQSBSTRM       = S_(MATSEQSBSTRM)
 *     MPISBSTRM       = S_(MATMPISBSTRM)             # <<<<<<<<<<<<<<
 *     SBSTRM          = S_(MATSBSTRM)
 *     DAAD            = S_(MATDAAD)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMPISBSTRM); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MPISBSTRM, __pyx_t_8) < 0) __PYX_ERR(33, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":44
 *     SEQSBSTRM       = S_(MATSEQSBSTRM)
 *     MPISBSTRM       = S_(MATMPISBSTRM)
 *     SBSTRM          = S_(MATSBSTRM)             # <<<<<<<<<<<<<<
 *     DAAD            = S_(MATDAAD)
 *     MFFD            = S_(MATMFFD)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSBSTRM); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SBSTRM, __pyx_t_8) < 0) __PYX_ERR(33, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":45
 *     MPISBSTRM       = S_(MATMPISBSTRM)
 *     SBSTRM          = S_(MATSBSTRM)
 *     DAAD            = S_(MATDAAD)             # <<<<<<<<<<<<<<
 *     MFFD            = S_(MATMFFD)
 *     NORMAL          = S_(MATNORMAL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATDAAD); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DAAD, __pyx_t_8) < 0) __PYX_ERR(33, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":46
 *     SBSTRM          = S_(MATSBSTRM)
 *     DAAD            = S_(MATDAAD)
 *     MFFD            = S_(MATMFFD)             # <<<<<<<<<<<<<<
 *     NORMAL          = S_(MATNORMAL)
 *     NORMALHERMITIAN = S_(MATNORMALHERMITIAN)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATMFFD); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MFFD, __pyx_t_8) < 0) __PYX_ERR(33, 46, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":47
 *     DAAD            = S_(MATDAAD)
 *     MFFD            = S_(MATMFFD)
 *     NORMAL          = S_(MATNORMAL)             # <<<<<<<<<<<<<<
 *     NORMALHERMITIAN = S_(MATNORMALHERMITIAN)
 *     LRC             = S_(MATLRC)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATNORMAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORMAL, __pyx_t_8) < 0) __PYX_ERR(33, 47, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":48
 *     MFFD            = S_(MATMFFD)
 *     NORMAL          = S_(MATNORMAL)
 *     NORMALHERMITIAN = S_(MATNORMALHERMITIAN)             # <<<<<<<<<<<<<<
 *     LRC             = S_(MATLRC)
 *     SCATTER         = S_(MATSCATTER)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATNORMALHERMITIAN); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORMALHERMITIAN, __pyx_t_8) < 0) __PYX_ERR(33, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":49
 *     NORMAL          = S_(MATNORMAL)
 *     NORMALHERMITIAN = S_(MATNORMALHERMITIAN)
 *     LRC             = S_(MATLRC)             # <<<<<<<<<<<<<<
 *     SCATTER         = S_(MATSCATTER)
 *     BLOCKMAT        = S_(MATBLOCKMAT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATLRC); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LRC, __pyx_t_8) < 0) __PYX_ERR(33, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":50
 *     NORMALHERMITIAN = S_(MATNORMALHERMITIAN)
 *     LRC             = S_(MATLRC)
 *     SCATTER         = S_(MATSCATTER)             # <<<<<<<<<<<<<<
 *     BLOCKMAT        = S_(MATBLOCKMAT)
 *     COMPOSITE       = S_(MATCOMPOSITE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSCATTER); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SCATTER, __pyx_t_8) < 0) __PYX_ERR(33, 50, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":51
 *     LRC             = S_(MATLRC)
 *     SCATTER         = S_(MATSCATTER)
 *     BLOCKMAT        = S_(MATBLOCKMAT)             # <<<<<<<<<<<<<<
 *     COMPOSITE       = S_(MATCOMPOSITE)
 *     FFT             = S_(MATFFT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATBLOCKMAT); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BLOCKMAT, __pyx_t_8) < 0) __PYX_ERR(33, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":52
 *     SCATTER         = S_(MATSCATTER)
 *     BLOCKMAT        = S_(MATBLOCKMAT)
 *     COMPOSITE       = S_(MATCOMPOSITE)             # <<<<<<<<<<<<<<
 *     FFT             = S_(MATFFT)
 *     FFTW            = S_(MATFFTW)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATCOMPOSITE); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_COMPOSITE, __pyx_t_8) < 0) __PYX_ERR(33, 52, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":53
 *     BLOCKMAT        = S_(MATBLOCKMAT)
 *     COMPOSITE       = S_(MATCOMPOSITE)
 *     FFT             = S_(MATFFT)             # <<<<<<<<<<<<<<
 *     FFTW            = S_(MATFFTW)
 *     SEQCUFFT        = S_(MATSEQCUFFT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATFFT); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FFT, __pyx_t_8) < 0) __PYX_ERR(33, 53, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":54
 *     COMPOSITE       = S_(MATCOMPOSITE)
 *     FFT             = S_(MATFFT)
 *     FFTW            = S_(MATFFTW)             # <<<<<<<<<<<<<<
 *     SEQCUFFT        = S_(MATSEQCUFFT)
 *     TRANSPOSEMAT    = S_(MATTRANSPOSEMAT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATFFTW); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FFTW, __pyx_t_8) < 0) __PYX_ERR(33, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":55
 *     FFT             = S_(MATFFT)
 *     FFTW            = S_(MATFFTW)
 *     SEQCUFFT        = S_(MATSEQCUFFT)             # <<<<<<<<<<<<<<
 *     TRANSPOSEMAT    = S_(MATTRANSPOSEMAT)
 *     PYTHON          = S_(MATPYTHON)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSEQCUFFT); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SEQCUFFT, __pyx_t_8) < 0) __PYX_ERR(33, 55, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":56
 *     FFTW            = S_(MATFFTW)
 *     SEQCUFFT        = S_(MATSEQCUFFT)
 *     TRANSPOSEMAT    = S_(MATTRANSPOSEMAT)             # <<<<<<<<<<<<<<
 *     PYTHON          = S_(MATPYTHON)
 *     SCHURCOMPLEMENT = S_(MATSCHURCOMPLEMENT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATTRANSPOSEMAT); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_TRANSPOSEMAT, __pyx_t_8) < 0) __PYX_ERR(33, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":57
 *     SEQCUFFT        = S_(MATSEQCUFFT)
 *     TRANSPOSEMAT    = S_(MATTRANSPOSEMAT)
 *     PYTHON          = S_(MATPYTHON)             # <<<<<<<<<<<<<<
 *     SCHURCOMPLEMENT = S_(MATSCHURCOMPLEMENT)
 *     HYPRESTRUCT     = S_(MATHYPRESTRUCT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATPYTHON); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PYTHON, __pyx_t_8) < 0) __PYX_ERR(33, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":58
 *     TRANSPOSEMAT    = S_(MATTRANSPOSEMAT)
 *     PYTHON          = S_(MATPYTHON)
 *     SCHURCOMPLEMENT = S_(MATSCHURCOMPLEMENT)             # <<<<<<<<<<<<<<
 *     HYPRESTRUCT     = S_(MATHYPRESTRUCT)
 *     HYPRESSTRUCT    = S_(MATHYPRESSTRUCT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSCHURCOMPLEMENT); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SCHURCOMPLEMENT, __pyx_t_8) < 0) __PYX_ERR(33, 58, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":59
 *     PYTHON          = S_(MATPYTHON)
 *     SCHURCOMPLEMENT = S_(MATSCHURCOMPLEMENT)
 *     HYPRESTRUCT     = S_(MATHYPRESTRUCT)             # <<<<<<<<<<<<<<
 *     HYPRESSTRUCT    = S_(MATHYPRESSTRUCT)
 *     SUBMATRIX       = S_(MATSUBMATRIX)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATHYPRESTRUCT); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_HYPRESTRUCT, __pyx_t_8) < 0) __PYX_ERR(33, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":60
 *     SCHURCOMPLEMENT = S_(MATSCHURCOMPLEMENT)
 *     HYPRESTRUCT     = S_(MATHYPRESTRUCT)
 *     HYPRESSTRUCT    = S_(MATHYPRESSTRUCT)             # <<<<<<<<<<<<<<
 *     SUBMATRIX       = S_(MATSUBMATRIX)
 *     LOCALREF        = S_(MATLOCALREF)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATHYPRESSTRUCT); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_HYPRESSTRUCT, __pyx_t_8) < 0) __PYX_ERR(33, 60, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":61
 *     HYPRESTRUCT     = S_(MATHYPRESTRUCT)
 *     HYPRESSTRUCT    = S_(MATHYPRESSTRUCT)
 *     SUBMATRIX       = S_(MATSUBMATRIX)             # <<<<<<<<<<<<<<
 *     LOCALREF        = S_(MATLOCALREF)
 *     NEST            = S_(MATNEST)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATSUBMATRIX); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SUBMATRIX, __pyx_t_8) < 0) __PYX_ERR(33, 61, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":62
 *     HYPRESSTRUCT    = S_(MATHYPRESSTRUCT)
 *     SUBMATRIX       = S_(MATSUBMATRIX)
 *     LOCALREF        = S_(MATLOCALREF)             # <<<<<<<<<<<<<<
 *     NEST            = S_(MATNEST)
 *     PREALLOCATOR    = S_(MATPREALLOCATOR)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATLOCALREF); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LOCALREF, __pyx_t_8) < 0) __PYX_ERR(33, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":63
 *     SUBMATRIX       = S_(MATSUBMATRIX)
 *     LOCALREF        = S_(MATLOCALREF)
 *     NEST            = S_(MATNEST)             # <<<<<<<<<<<<<<
 *     PREALLOCATOR    = S_(MATPREALLOCATOR)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATNEST); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NEST, __pyx_t_8) < 0) __PYX_ERR(33, 63, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":64
 *     LOCALREF        = S_(MATLOCALREF)
 *     NEST            = S_(MATNEST)
 *     PREALLOCATOR    = S_(MATPREALLOCATOR)             # <<<<<<<<<<<<<<
 * 
 * class MatOption(object):
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATPREALLOCATOR); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PREALLOCATOR, __pyx_t_8) < 0) __PYX_ERR(33, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class MatType(object):             # <<<<<<<<<<<<<<
 *     SAME            = S_(MATSAME)
 *     MAIJ            = S_(MATMAIJ)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_MatType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MatType, __pyx_t_8) < 0) __PYX_ERR(33, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/Mat.pyx":66
 *     PREALLOCATOR    = S_(MATPREALLOCATOR)
 * 
 * class MatOption(object):             # <<<<<<<<<<<<<<
 *     UNUSED_NONZERO_LOCATION_ERR = MAT_UNUSED_NONZERO_LOCATION_ERR
 *     ROW_ORIENTED                = MAT_ROW_ORIENTED
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_MatOption, __pyx_n_s_MatOption, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Mat.pyx":67
 * 
 * class MatOption(object):
 *     UNUSED_NONZERO_LOCATION_ERR = MAT_UNUSED_NONZERO_LOCATION_ERR             # <<<<<<<<<<<<<<
 *     ROW_ORIENTED                = MAT_ROW_ORIENTED
 *     SYMMETRIC                   = MAT_SYMMETRIC
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_UNUSED_NONZERO_LOCATION_ERR); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_UNUSED_NONZERO_LOCATION_ERR, __pyx_t_8) < 0) __PYX_ERR(33, 67, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":68
 * class MatOption(object):
 *     UNUSED_NONZERO_LOCATION_ERR = MAT_UNUSED_NONZERO_LOCATION_ERR
 *     ROW_ORIENTED                = MAT_ROW_ORIENTED             # <<<<<<<<<<<<<<
 *     SYMMETRIC                   = MAT_SYMMETRIC
 *     STRUCTURALLY_SYMMETRIC      = MAT_STRUCTURALLY_SYMMETRIC
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_ROW_ORIENTED); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ROW_ORIENTED, __pyx_t_8) < 0) __PYX_ERR(33, 68, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":69
 *     UNUSED_NONZERO_LOCATION_ERR = MAT_UNUSED_NONZERO_LOCATION_ERR
 *     ROW_ORIENTED                = MAT_ROW_ORIENTED
 *     SYMMETRIC                   = MAT_SYMMETRIC             # <<<<<<<<<<<<<<
 *     STRUCTURALLY_SYMMETRIC      = MAT_STRUCTURALLY_SYMMETRIC
 *     NEW_DIAGONALS               = MAT_NEW_DIAGONALS
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_SYMMETRIC); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SYMMETRIC, __pyx_t_8) < 0) __PYX_ERR(33, 69, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":70
 *     ROW_ORIENTED                = MAT_ROW_ORIENTED
 *     SYMMETRIC                   = MAT_SYMMETRIC
 *     STRUCTURALLY_SYMMETRIC      = MAT_STRUCTURALLY_SYMMETRIC             # <<<<<<<<<<<<<<
 *     NEW_DIAGONALS               = MAT_NEW_DIAGONALS
 *     IGNORE_OFF_PROC_ENTRIES     = MAT_IGNORE_OFF_PROC_ENTRIES
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_STRUCTURALLY_SYMMETRIC); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_STRUCTURALLY_SYMMETRIC, __pyx_t_8) < 0) __PYX_ERR(33, 70, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":71
 *     SYMMETRIC                   = MAT_SYMMETRIC
 *     STRUCTURALLY_SYMMETRIC      = MAT_STRUCTURALLY_SYMMETRIC
 *     NEW_DIAGONALS               = MAT_NEW_DIAGONALS             # <<<<<<<<<<<<<<
 *     IGNORE_OFF_PROC_ENTRIES     = MAT_IGNORE_OFF_PROC_ENTRIES
 *     USE_HASH_TABLE              = MAT_USE_HASH_TABLE
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_NEW_DIAGONALS); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NEW_DIAGONALS, __pyx_t_8) < 0) __PYX_ERR(33, 71, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":72
 *     STRUCTURALLY_SYMMETRIC      = MAT_STRUCTURALLY_SYMMETRIC
 *     NEW_DIAGONALS               = MAT_NEW_DIAGONALS
 *     IGNORE_OFF_PROC_ENTRIES     = MAT_IGNORE_OFF_PROC_ENTRIES             # <<<<<<<<<<<<<<
 *     USE_HASH_TABLE              = MAT_USE_HASH_TABLE
 *     KEEP_NONZERO_PATTERN        = MAT_KEEP_NONZERO_PATTERN
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_IGNORE_OFF_PROC_ENTRIES); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_IGNORE_OFF_PROC_ENTRIES, __pyx_t_8) < 0) __PYX_ERR(33, 72, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":73
 *     NEW_DIAGONALS               = MAT_NEW_DIAGONALS
 *     IGNORE_OFF_PROC_ENTRIES     = MAT_IGNORE_OFF_PROC_ENTRIES
 *     USE_HASH_TABLE              = MAT_USE_HASH_TABLE             # <<<<<<<<<<<<<<
 *     KEEP_NONZERO_PATTERN        = MAT_KEEP_NONZERO_PATTERN
 *     IGNORE_ZERO_ENTRIES         = MAT_IGNORE_ZERO_ENTRIES
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_USE_HASH_TABLE); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_USE_HASH_TABLE, __pyx_t_8) < 0) __PYX_ERR(33, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":74
 *     IGNORE_OFF_PROC_ENTRIES     = MAT_IGNORE_OFF_PROC_ENTRIES
 *     USE_HASH_TABLE              = MAT_USE_HASH_TABLE
 *     KEEP_NONZERO_PATTERN        = MAT_KEEP_NONZERO_PATTERN             # <<<<<<<<<<<<<<
 *     IGNORE_ZERO_ENTRIES         = MAT_IGNORE_ZERO_ENTRIES
 *     USE_INODES                  = MAT_USE_INODES
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_KEEP_NONZERO_PATTERN); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_KEEP_NONZERO_PATTERN, __pyx_t_8) < 0) __PYX_ERR(33, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":75
 *     USE_HASH_TABLE              = MAT_USE_HASH_TABLE
 *     KEEP_NONZERO_PATTERN        = MAT_KEEP_NONZERO_PATTERN
 *     IGNORE_ZERO_ENTRIES         = MAT_IGNORE_ZERO_ENTRIES             # <<<<<<<<<<<<<<
 *     USE_INODES                  = MAT_USE_INODES
 *     HERMITIAN                   = MAT_HERMITIAN
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_IGNORE_ZERO_ENTRIES); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_IGNORE_ZERO_ENTRIES, __pyx_t_8) < 0) __PYX_ERR(33, 75, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":76
 *     KEEP_NONZERO_PATTERN        = MAT_KEEP_NONZERO_PATTERN
 *     IGNORE_ZERO_ENTRIES         = MAT_IGNORE_ZERO_ENTRIES
 *     USE_INODES                  = MAT_USE_INODES             # <<<<<<<<<<<<<<
 *     HERMITIAN                   = MAT_HERMITIAN
 *     SYMMETRY_ETERNAL            = MAT_SYMMETRY_ETERNAL
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_USE_INODES); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_USE_INODES, __pyx_t_8) < 0) __PYX_ERR(33, 76, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":77
 *     IGNORE_ZERO_ENTRIES         = MAT_IGNORE_ZERO_ENTRIES
 *     USE_INODES                  = MAT_USE_INODES
 *     HERMITIAN                   = MAT_HERMITIAN             # <<<<<<<<<<<<<<
 *     SYMMETRY_ETERNAL            = MAT_SYMMETRY_ETERNAL
 *     NEW_NONZERO_LOCATION_ERR    = MAT_NEW_NONZERO_LOCATION_ERR
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_HERMITIAN); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_HERMITIAN, __pyx_t_8) < 0) __PYX_ERR(33, 77, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":78
 *     USE_INODES                  = MAT_USE_INODES
 *     HERMITIAN                   = MAT_HERMITIAN
 *     SYMMETRY_ETERNAL            = MAT_SYMMETRY_ETERNAL             # <<<<<<<<<<<<<<
 *     NEW_NONZERO_LOCATION_ERR    = MAT_NEW_NONZERO_LOCATION_ERR
 *     IGNORE_LOWER_TRIANGULAR     = MAT_IGNORE_LOWER_TRIANGULAR
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_SYMMETRY_ETERNAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SYMMETRY_ETERNAL, __pyx_t_8) < 0) __PYX_ERR(33, 78, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":79
 *     HERMITIAN                   = MAT_HERMITIAN
 *     SYMMETRY_ETERNAL            = MAT_SYMMETRY_ETERNAL
 *     NEW_NONZERO_LOCATION_ERR    = MAT_NEW_NONZERO_LOCATION_ERR             # <<<<<<<<<<<<<<
 *     IGNORE_LOWER_TRIANGULAR     = MAT_IGNORE_LOWER_TRIANGULAR
 *     ERROR_LOWER_TRIANGULAR      = MAT_ERROR_LOWER_TRIANGULAR
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_NEW_NONZERO_LOCATION_ERR); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NEW_NONZERO_LOCATION_ERR, __pyx_t_8) < 0) __PYX_ERR(33, 79, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":80
 *     SYMMETRY_ETERNAL            = MAT_SYMMETRY_ETERNAL
 *     NEW_NONZERO_LOCATION_ERR    = MAT_NEW_NONZERO_LOCATION_ERR
 *     IGNORE_LOWER_TRIANGULAR     = MAT_IGNORE_LOWER_TRIANGULAR             # <<<<<<<<<<<<<<
 *     ERROR_LOWER_TRIANGULAR      = MAT_ERROR_LOWER_TRIANGULAR
 *     GETROW_UPPERTRIANGULAR      = MAT_GETROW_UPPERTRIANGULAR
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_IGNORE_LOWER_TRIANGULAR); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_IGNORE_LOWER_TRIANGULAR, __pyx_t_8) < 0) __PYX_ERR(33, 80, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":81
 *     NEW_NONZERO_LOCATION_ERR    = MAT_NEW_NONZERO_LOCATION_ERR
 *     IGNORE_LOWER_TRIANGULAR     = MAT_IGNORE_LOWER_TRIANGULAR
 *     ERROR_LOWER_TRIANGULAR      = MAT_ERROR_LOWER_TRIANGULAR             # <<<<<<<<<<<<<<
 *     GETROW_UPPERTRIANGULAR      = MAT_GETROW_UPPERTRIANGULAR
 *     SPD                         = MAT_SPD
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_ERROR_LOWER_TRIANGULAR); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ERROR_LOWER_TRIANGULAR, __pyx_t_8) < 0) __PYX_ERR(33, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":82
 *     IGNORE_LOWER_TRIANGULAR     = MAT_IGNORE_LOWER_TRIANGULAR
 *     ERROR_LOWER_TRIANGULAR      = MAT_ERROR_LOWER_TRIANGULAR
 *     GETROW_UPPERTRIANGULAR      = MAT_GETROW_UPPERTRIANGULAR             # <<<<<<<<<<<<<<
 *     SPD                         = MAT_SPD
 *     NO_OFF_PROC_ZERO_ROWS       = MAT_NO_OFF_PROC_ZERO_ROWS
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_GETROW_UPPERTRIANGULAR); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GETROW_UPPERTRIANGULAR, __pyx_t_8) < 0) __PYX_ERR(33, 82, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":83
 *     ERROR_LOWER_TRIANGULAR      = MAT_ERROR_LOWER_TRIANGULAR
 *     GETROW_UPPERTRIANGULAR      = MAT_GETROW_UPPERTRIANGULAR
 *     SPD                         = MAT_SPD             # <<<<<<<<<<<<<<
 *     NO_OFF_PROC_ZERO_ROWS       = MAT_NO_OFF_PROC_ZERO_ROWS
 *     NO_OFF_PROC_ENTRIES         = MAT_NO_OFF_PROC_ENTRIES
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_SPD); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SPD, __pyx_t_8) < 0) __PYX_ERR(33, 83, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":84
 *     GETROW_UPPERTRIANGULAR      = MAT_GETROW_UPPERTRIANGULAR
 *     SPD                         = MAT_SPD
 *     NO_OFF_PROC_ZERO_ROWS       = MAT_NO_OFF_PROC_ZERO_ROWS             # <<<<<<<<<<<<<<
 *     NO_OFF_PROC_ENTRIES         = MAT_NO_OFF_PROC_ENTRIES
 *     NEW_NONZERO_LOCATIONS       = MAT_NEW_NONZERO_LOCATIONS
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_NO_OFF_PROC_ZERO_ROWS); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NO_OFF_PROC_ZERO_ROWS, __pyx_t_8) < 0) __PYX_ERR(33, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":85
 *     SPD                         = MAT_SPD
 *     NO_OFF_PROC_ZERO_ROWS       = MAT_NO_OFF_PROC_ZERO_ROWS
 *     NO_OFF_PROC_ENTRIES         = MAT_NO_OFF_PROC_ENTRIES             # <<<<<<<<<<<<<<
 *     NEW_NONZERO_LOCATIONS       = MAT_NEW_NONZERO_LOCATIONS
 *     NEW_NONZERO_ALLOCATION_ERR  = MAT_NEW_NONZERO_ALLOCATION_ERR
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_NO_OFF_PROC_ENTRIES); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NO_OFF_PROC_ENTRIES, __pyx_t_8) < 0) __PYX_ERR(33, 85, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":86
 *     NO_OFF_PROC_ZERO_ROWS       = MAT_NO_OFF_PROC_ZERO_ROWS
 *     NO_OFF_PROC_ENTRIES         = MAT_NO_OFF_PROC_ENTRIES
 *     NEW_NONZERO_LOCATIONS       = MAT_NEW_NONZERO_LOCATIONS             # <<<<<<<<<<<<<<
 *     NEW_NONZERO_ALLOCATION_ERR  = MAT_NEW_NONZERO_ALLOCATION_ERR
 *     SUBSET_OFF_PROC_ENTRIES     = MAT_SUBSET_OFF_PROC_ENTRIES
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_NEW_NONZERO_LOCATIONS); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NEW_NONZERO_LOCATIONS, __pyx_t_8) < 0) __PYX_ERR(33, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":87
 *     NO_OFF_PROC_ENTRIES         = MAT_NO_OFF_PROC_ENTRIES
 *     NEW_NONZERO_LOCATIONS       = MAT_NEW_NONZERO_LOCATIONS
 *     NEW_NONZERO_ALLOCATION_ERR  = MAT_NEW_NONZERO_ALLOCATION_ERR             # <<<<<<<<<<<<<<
 *     SUBSET_OFF_PROC_ENTRIES     = MAT_SUBSET_OFF_PROC_ENTRIES
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_NEW_NONZERO_ALLOCATION_ERR); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NEW_NONZERO_ALLOCATION_ERR, __pyx_t_8) < 0) __PYX_ERR(33, 87, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":88
 *     NEW_NONZERO_LOCATIONS       = MAT_NEW_NONZERO_LOCATIONS
 *     NEW_NONZERO_ALLOCATION_ERR  = MAT_NEW_NONZERO_ALLOCATION_ERR
 *     SUBSET_OFF_PROC_ENTRIES     = MAT_SUBSET_OFF_PROC_ENTRIES             # <<<<<<<<<<<<<<
 * 
 * class MatAssemblyType(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatOption(MAT_SUBSET_OFF_PROC_ENTRIES); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SUBSET_OFF_PROC_ENTRIES, __pyx_t_8) < 0) __PYX_ERR(33, 88, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":66
 *     PREALLOCATOR    = S_(MATPREALLOCATOR)
 * 
 * class MatOption(object):             # <<<<<<<<<<<<<<
 *     UNUSED_NONZERO_LOCATION_ERR = MAT_UNUSED_NONZERO_LOCATION_ERR
 *     ROW_ORIENTED                = MAT_ROW_ORIENTED
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_MatOption, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MatOption, __pyx_t_8) < 0) __PYX_ERR(33, 66, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/Mat.pyx":90
 *     SUBSET_OFF_PROC_ENTRIES     = MAT_SUBSET_OFF_PROC_ENTRIES
 * 
 * class MatAssemblyType(object):             # <<<<<<<<<<<<<<
 *     # native
 *     FINAL_ASSEMBLY = MAT_FINAL_ASSEMBLY
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_MatAssemblyType, __pyx_n_s_MatAssemblyType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Mat.pyx":92
 * class MatAssemblyType(object):
 *     # native
 *     FINAL_ASSEMBLY = MAT_FINAL_ASSEMBLY             # <<<<<<<<<<<<<<
 *     FLUSH_ASSEMBLY = MAT_FLUSH_ASSEMBLY
 *     # aliases
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatAssemblyType(MAT_FINAL_ASSEMBLY); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FINAL_ASSEMBLY, __pyx_t_8) < 0) __PYX_ERR(33, 92, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":93
 *     # native
 *     FINAL_ASSEMBLY = MAT_FINAL_ASSEMBLY
 *     FLUSH_ASSEMBLY = MAT_FLUSH_ASSEMBLY             # <<<<<<<<<<<<<<
 *     # aliases
 *     FINAL = FINAL_ASSEMBLY
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatAssemblyType(MAT_FLUSH_ASSEMBLY); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FLUSH_ASSEMBLY, __pyx_t_8) < 0) __PYX_ERR(33, 93, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":95
 *     FLUSH_ASSEMBLY = MAT_FLUSH_ASSEMBLY
 *     # aliases
 *     FINAL = FINAL_ASSEMBLY             # <<<<<<<<<<<<<<
 *     FLUSH = FLUSH_ASSEMBLY
 * 
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_FINAL_ASSEMBLY);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_FINAL_ASSEMBLY);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FINAL, __pyx_t_8) < 0) __PYX_ERR(33, 95, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":96
 *     # aliases
 *     FINAL = FINAL_ASSEMBLY
 *     FLUSH = FLUSH_ASSEMBLY             # <<<<<<<<<<<<<<
 * 
 * class MatInfoType(object):
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_FLUSH_ASSEMBLY);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_FLUSH_ASSEMBLY);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FLUSH, __pyx_t_8) < 0) __PYX_ERR(33, 96, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":90
 *     SUBSET_OFF_PROC_ENTRIES     = MAT_SUBSET_OFF_PROC_ENTRIES
 * 
 * class MatAssemblyType(object):             # <<<<<<<<<<<<<<
 *     # native
 *     FINAL_ASSEMBLY = MAT_FINAL_ASSEMBLY
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_MatAssemblyType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MatAssemblyType, __pyx_t_8) < 0) __PYX_ERR(33, 90, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/Mat.pyx":98
 *     FLUSH = FLUSH_ASSEMBLY
 * 
 * class MatInfoType(object):             # <<<<<<<<<<<<<<
 *     LOCAL = MAT_LOCAL
 *     GLOBAL_MAX = MAT_GLOBAL_MAX
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_MatInfoType, __pyx_n_s_MatInfoType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Mat.pyx":99
 * 
 * class MatInfoType(object):
 *     LOCAL = MAT_LOCAL             # <<<<<<<<<<<<<<
 *     GLOBAL_MAX = MAT_GLOBAL_MAX
 *     GLOBAL_SUM = MAT_GLOBAL_SUM
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatInfoType(MAT_LOCAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LOCAL, __pyx_t_8) < 0) __PYX_ERR(33, 99, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":100
 * class MatInfoType(object):
 *     LOCAL = MAT_LOCAL
 *     GLOBAL_MAX = MAT_GLOBAL_MAX             # <<<<<<<<<<<<<<
 *     GLOBAL_SUM = MAT_GLOBAL_SUM
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatInfoType(MAT_GLOBAL_MAX); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GLOBAL_MAX, __pyx_t_8) < 0) __PYX_ERR(33, 100, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":101
 *     LOCAL = MAT_LOCAL
 *     GLOBAL_MAX = MAT_GLOBAL_MAX
 *     GLOBAL_SUM = MAT_GLOBAL_SUM             # <<<<<<<<<<<<<<
 * 
 * class MatStructure(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatInfoType(MAT_GLOBAL_SUM); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GLOBAL_SUM, __pyx_t_8) < 0) __PYX_ERR(33, 101, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":98
 *     FLUSH = FLUSH_ASSEMBLY
 * 
 * class MatInfoType(object):             # <<<<<<<<<<<<<<
 *     LOCAL = MAT_LOCAL
 *     GLOBAL_MAX = MAT_GLOBAL_MAX
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_MatInfoType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MatInfoType, __pyx_t_8) < 0) __PYX_ERR(33, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/Mat.pyx":103
 *     GLOBAL_SUM = MAT_GLOBAL_SUM
 * 
 * class MatStructure(object):             # <<<<<<<<<<<<<<
 *     # native
 *     SAME_NONZERO_PATTERN      = MAT_SAME_NONZERO_PATTERN
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_MatStructure, __pyx_n_s_MatStructure, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Mat.pyx":105
 * class MatStructure(object):
 *     # native
 *     SAME_NONZERO_PATTERN      = MAT_SAME_NONZERO_PATTERN             # <<<<<<<<<<<<<<
 *     DIFFERENT_NONZERO_PATTERN = MAT_DIFFERENT_NONZERO_PATTERN
 *     SUBSET_NONZERO_PATTERN    = MAT_SUBSET_NONZERO_PATTERN
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatStructure(SAME_NONZERO_PATTERN); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SAME_NONZERO_PATTERN, __pyx_t_8) < 0) __PYX_ERR(33, 105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":106
 *     # native
 *     SAME_NONZERO_PATTERN      = MAT_SAME_NONZERO_PATTERN
 *     DIFFERENT_NONZERO_PATTERN = MAT_DIFFERENT_NONZERO_PATTERN             # <<<<<<<<<<<<<<
 *     SUBSET_NONZERO_PATTERN    = MAT_SUBSET_NONZERO_PATTERN
 *     # aliases
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatStructure(DIFFERENT_NONZERO_PATTERN); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIFFERENT_NONZERO_PATTERN, __pyx_t_8) < 0) __PYX_ERR(33, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":107
 *     SAME_NONZERO_PATTERN      = MAT_SAME_NONZERO_PATTERN
 *     DIFFERENT_NONZERO_PATTERN = MAT_DIFFERENT_NONZERO_PATTERN
 *     SUBSET_NONZERO_PATTERN    = MAT_SUBSET_NONZERO_PATTERN             # <<<<<<<<<<<<<<
 *     # aliases
 *     SAME      = SAME_NZ      = SAME_NONZERO_PATTERN
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatStructure(SUBSET_NONZERO_PATTERN); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SUBSET_NONZERO_PATTERN, __pyx_t_8) < 0) __PYX_ERR(33, 107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":109
 *     SUBSET_NONZERO_PATTERN    = MAT_SUBSET_NONZERO_PATTERN
 *     # aliases
 *     SAME      = SAME_NZ      = SAME_NONZERO_PATTERN             # <<<<<<<<<<<<<<
 *     SUBSET    = SUBSET_NZ    = SUBSET_NONZERO_PATTERN
 *     DIFFERENT = DIFFERENT_NZ = DIFFERENT_NONZERO_PATTERN
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_SAME_NONZERO_PATTERN);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_SAME_NONZERO_PATTERN);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SAME, __pyx_t_8) < 0) __PYX_ERR(33, 109, __pyx_L1_error)
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SAME_NZ, __pyx_t_8) < 0) __PYX_ERR(33, 109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":110
 *     # aliases
 *     SAME      = SAME_NZ      = SAME_NONZERO_PATTERN
 *     SUBSET    = SUBSET_NZ    = SUBSET_NONZERO_PATTERN             # <<<<<<<<<<<<<<
 *     DIFFERENT = DIFFERENT_NZ = DIFFERENT_NONZERO_PATTERN
 * 
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_SUBSET_NONZERO_PATTERN);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_SUBSET_NONZERO_PATTERN);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SUBSET, __pyx_t_8) < 0) __PYX_ERR(33, 110, __pyx_L1_error)
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SUBSET_NZ, __pyx_t_8) < 0) __PYX_ERR(33, 110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":111
 *     SAME      = SAME_NZ      = SAME_NONZERO_PATTERN
 *     SUBSET    = SUBSET_NZ    = SUBSET_NONZERO_PATTERN
 *     DIFFERENT = DIFFERENT_NZ = DIFFERENT_NONZERO_PATTERN             # <<<<<<<<<<<<<<
 * 
 * class MatOrderingType(object):
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_DIFFERENT_NONZERO_PATTERN);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_DIFFERENT_NONZERO_PATTERN);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIFFERENT, __pyx_t_8) < 0) __PYX_ERR(33, 111, __pyx_L1_error)
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIFFERENT_NZ, __pyx_t_8) < 0) __PYX_ERR(33, 111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":103
 *     GLOBAL_SUM = MAT_GLOBAL_SUM
 * 
 * class MatStructure(object):             # <<<<<<<<<<<<<<
 *     # native
 *     SAME_NONZERO_PATTERN      = MAT_SAME_NONZERO_PATTERN
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_MatStructure, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MatStructure, __pyx_t_8) < 0) __PYX_ERR(33, 103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/Mat.pyx":113
 *     DIFFERENT = DIFFERENT_NZ = DIFFERENT_NONZERO_PATTERN
 * 
 * class MatOrderingType(object):             # <<<<<<<<<<<<<<
 *     NATURAL     = S_(MATORDERINGNATURAL)
 *     ND          = S_(MATORDERINGND)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_MatOrderingType, __pyx_n_s_MatOrderingType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Mat.pyx":114
 * 
 * class MatOrderingType(object):
 *     NATURAL     = S_(MATORDERINGNATURAL)             # <<<<<<<<<<<<<<
 *     ND          = S_(MATORDERINGND)
 *     OWD         = S_(MATORDERING1WD)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATORDERINGNATURAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NATURAL, __pyx_t_8) < 0) __PYX_ERR(33, 114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":115
 * class MatOrderingType(object):
 *     NATURAL     = S_(MATORDERINGNATURAL)
 *     ND          = S_(MATORDERINGND)             # <<<<<<<<<<<<<<
 *     OWD         = S_(MATORDERING1WD)
 *     RCM         = S_(MATORDERINGRCM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATORDERINGND); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ND, __pyx_t_8) < 0) __PYX_ERR(33, 115, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":116
 *     NATURAL     = S_(MATORDERINGNATURAL)
 *     ND          = S_(MATORDERINGND)
 *     OWD         = S_(MATORDERING1WD)             # <<<<<<<<<<<<<<
 *     RCM         = S_(MATORDERINGRCM)
 *     QMD         = S_(MATORDERINGQMD)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATORDERING1WD); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_OWD, __pyx_t_8) < 0) __PYX_ERR(33, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":117
 *     ND          = S_(MATORDERINGND)
 *     OWD         = S_(MATORDERING1WD)
 *     RCM         = S_(MATORDERINGRCM)             # <<<<<<<<<<<<<<
 *     QMD         = S_(MATORDERINGQMD)
 *     ROWLENGTH   = S_(MATORDERINGROWLENGTH)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATORDERINGRCM); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_RCM, __pyx_t_8) < 0) __PYX_ERR(33, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":118
 *     OWD         = S_(MATORDERING1WD)
 *     RCM         = S_(MATORDERINGRCM)
 *     QMD         = S_(MATORDERINGQMD)             # <<<<<<<<<<<<<<
 *     ROWLENGTH   = S_(MATORDERINGROWLENGTH)
 *     WBM         = S_(MATORDERINGWBM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATORDERINGQMD); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_QMD, __pyx_t_8) < 0) __PYX_ERR(33, 118, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":119
 *     RCM         = S_(MATORDERINGRCM)
 *     QMD         = S_(MATORDERINGQMD)
 *     ROWLENGTH   = S_(MATORDERINGROWLENGTH)             # <<<<<<<<<<<<<<
 *     WBM         = S_(MATORDERINGWBM)
 *     SPECTRAL    = S_(MATORDERINGSPECTRAL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATORDERINGROWLENGTH); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ROWLENGTH, __pyx_t_8) < 0) __PYX_ERR(33, 119, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":120
 *     QMD         = S_(MATORDERINGQMD)
 *     ROWLENGTH   = S_(MATORDERINGROWLENGTH)
 *     WBM         = S_(MATORDERINGWBM)             # <<<<<<<<<<<<<<
 *     SPECTRAL    = S_(MATORDERINGSPECTRAL)
 *     AMD         = S_(MATORDERINGAMD)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATORDERINGWBM); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_WBM, __pyx_t_8) < 0) __PYX_ERR(33, 120, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":121
 *     ROWLENGTH   = S_(MATORDERINGROWLENGTH)
 *     WBM         = S_(MATORDERINGWBM)
 *     SPECTRAL    = S_(MATORDERINGSPECTRAL)             # <<<<<<<<<<<<<<
 *     AMD         = S_(MATORDERINGAMD)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATORDERINGSPECTRAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SPECTRAL, __pyx_t_8) < 0) __PYX_ERR(33, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":122
 *     WBM         = S_(MATORDERINGWBM)
 *     SPECTRAL    = S_(MATORDERINGSPECTRAL)
 *     AMD         = S_(MATORDERINGAMD)             # <<<<<<<<<<<<<<
 * 
 * class MatFactorShiftType(object):
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(MATORDERINGAMD); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_AMD, __pyx_t_8) < 0) __PYX_ERR(33, 122, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":113
 *     DIFFERENT = DIFFERENT_NZ = DIFFERENT_NONZERO_PATTERN
 * 
 * class MatOrderingType(object):             # <<<<<<<<<<<<<<
 *     NATURAL     = S_(MATORDERINGNATURAL)
 *     ND          = S_(MATORDERINGND)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_MatOrderingType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MatOrderingType, __pyx_t_8) < 0) __PYX_ERR(33, 113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/Mat.pyx":124
 *     AMD         = S_(MATORDERINGAMD)
 * 
 * class MatFactorShiftType(object):             # <<<<<<<<<<<<<<
 *     # native
 *     NONE              = MAT_SHIFT_NONE
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_MatFactorShiftType, __pyx_n_s_MatFactorShiftType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Mat.pyx":126
 * class MatFactorShiftType(object):
 *     # native
 *     NONE              = MAT_SHIFT_NONE             # <<<<<<<<<<<<<<
 *     NONZERO           = MAT_SHIFT_NONZERO
 *     POSITIVE_DEFINITE = MAT_SHIFT_POSITIVE_DEFINITE
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatFactorShiftType(MAT_SHIFT_NONE); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NONE, __pyx_t_8) < 0) __PYX_ERR(33, 126, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":127
 *     # native
 *     NONE              = MAT_SHIFT_NONE
 *     NONZERO           = MAT_SHIFT_NONZERO             # <<<<<<<<<<<<<<
 *     POSITIVE_DEFINITE = MAT_SHIFT_POSITIVE_DEFINITE
 *     INBLOCKS          = MAT_SHIFT_INBLOCKS
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatFactorShiftType(MAT_SHIFT_NONZERO); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NONZERO, __pyx_t_8) < 0) __PYX_ERR(33, 127, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":128
 *     NONE              = MAT_SHIFT_NONE
 *     NONZERO           = MAT_SHIFT_NONZERO
 *     POSITIVE_DEFINITE = MAT_SHIFT_POSITIVE_DEFINITE             # <<<<<<<<<<<<<<
 *     INBLOCKS          = MAT_SHIFT_INBLOCKS
 *     # aliases
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatFactorShiftType(MAT_SHIFT_POSITIVE_DEFINITE); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_POSITIVE_DEFINITE, __pyx_t_8) < 0) __PYX_ERR(33, 128, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":129
 *     NONZERO           = MAT_SHIFT_NONZERO
 *     POSITIVE_DEFINITE = MAT_SHIFT_POSITIVE_DEFINITE
 *     INBLOCKS          = MAT_SHIFT_INBLOCKS             # <<<<<<<<<<<<<<
 *     # aliases
 *     NZ = MAT_SHIFT_NONZERO
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatFactorShiftType(MAT_SHIFT_INBLOCKS); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INBLOCKS, __pyx_t_8) < 0) __PYX_ERR(33, 129, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":131
 *     INBLOCKS          = MAT_SHIFT_INBLOCKS
 *     # aliases
 *     NZ = MAT_SHIFT_NONZERO             # <<<<<<<<<<<<<<
 *     PD = MAT_SHIFT_POSITIVE_DEFINITE
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatFactorShiftType(MAT_SHIFT_NONZERO); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NZ, __pyx_t_8) < 0) __PYX_ERR(33, 131, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":132
 *     # aliases
 *     NZ = MAT_SHIFT_NONZERO
 *     PD = MAT_SHIFT_POSITIVE_DEFINITE             # <<<<<<<<<<<<<<
 * 
 * class MatSORType(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatFactorShiftType(MAT_SHIFT_POSITIVE_DEFINITE); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PD, __pyx_t_8) < 0) __PYX_ERR(33, 132, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":124
 *     AMD         = S_(MATORDERINGAMD)
 * 
 * class MatFactorShiftType(object):             # <<<<<<<<<<<<<<
 *     # native
 *     NONE              = MAT_SHIFT_NONE
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_MatFactorShiftType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MatFactorShiftType, __pyx_t_8) < 0) __PYX_ERR(33, 124, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/Mat.pyx":134
 *     PD = MAT_SHIFT_POSITIVE_DEFINITE
 * 
 * class MatSORType(object):             # <<<<<<<<<<<<<<
 *     FORWARD_SWEEP         = SOR_FORWARD_SWEEP
 *     BACKWARD_SWEEP        = SOR_BACKWARD_SWEEP
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(33, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_MatSORType, __pyx_n_s_MatSORType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(33, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Mat.pyx":135
 * 
 * class MatSORType(object):
 *     FORWARD_SWEEP         = SOR_FORWARD_SWEEP             # <<<<<<<<<<<<<<
 *     BACKWARD_SWEEP        = SOR_BACKWARD_SWEEP
 *     SYMMETRY_SWEEP        = SOR_SYMMETRIC_SWEEP
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatSORType(SOR_FORWARD_SWEEP); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FORWARD_SWEEP, __pyx_t_8) < 0) __PYX_ERR(33, 135, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":136
 * class MatSORType(object):
 *     FORWARD_SWEEP         = SOR_FORWARD_SWEEP
 *     BACKWARD_SWEEP        = SOR_BACKWARD_SWEEP             # <<<<<<<<<<<<<<
 *     SYMMETRY_SWEEP        = SOR_SYMMETRIC_SWEEP
 *     LOCAL_FORWARD_SWEEP   = SOR_LOCAL_FORWARD_SWEEP
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatSORType(SOR_BACKWARD_SWEEP); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BACKWARD_SWEEP, __pyx_t_8) < 0) __PYX_ERR(33, 136, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":137
 *     FORWARD_SWEEP         = SOR_FORWARD_SWEEP
 *     BACKWARD_SWEEP        = SOR_BACKWARD_SWEEP
 *     SYMMETRY_SWEEP        = SOR_SYMMETRIC_SWEEP             # <<<<<<<<<<<<<<
 *     LOCAL_FORWARD_SWEEP   = SOR_LOCAL_FORWARD_SWEEP
 *     LOCAL_BACKWARD_SWEEP  = SOR_LOCAL_BACKWARD_SWEEP
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatSORType(SOR_SYMMETRIC_SWEEP); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SYMMETRY_SWEEP, __pyx_t_8) < 0) __PYX_ERR(33, 137, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":138
 *     BACKWARD_SWEEP        = SOR_BACKWARD_SWEEP
 *     SYMMETRY_SWEEP        = SOR_SYMMETRIC_SWEEP
 *     LOCAL_FORWARD_SWEEP   = SOR_LOCAL_FORWARD_SWEEP             # <<<<<<<<<<<<<<
 *     LOCAL_BACKWARD_SWEEP  = SOR_LOCAL_BACKWARD_SWEEP
 *     LOCAL_SYMMETRIC_SWEEP = SOR_LOCAL_SYMMETRIC_SWEEP
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatSORType(SOR_LOCAL_FORWARD_SWEEP); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LOCAL_FORWARD_SWEEP, __pyx_t_8) < 0) __PYX_ERR(33, 138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":139
 *     SYMMETRY_SWEEP        = SOR_SYMMETRIC_SWEEP
 *     LOCAL_FORWARD_SWEEP   = SOR_LOCAL_FORWARD_SWEEP
 *     LOCAL_BACKWARD_SWEEP  = SOR_LOCAL_BACKWARD_SWEEP             # <<<<<<<<<<<<<<
 *     LOCAL_SYMMETRIC_SWEEP = SOR_LOCAL_SYMMETRIC_SWEEP
 *     ZERO_INITIAL_GUESS    = SOR_ZERO_INITIAL_GUESS
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatSORType(SOR_LOCAL_BACKWARD_SWEEP); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LOCAL_BACKWARD_SWEEP, __pyx_t_8) < 0) __PYX_ERR(33, 139, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":140
 *     LOCAL_FORWARD_SWEEP   = SOR_LOCAL_FORWARD_SWEEP
 *     LOCAL_BACKWARD_SWEEP  = SOR_LOCAL_BACKWARD_SWEEP
 *     LOCAL_SYMMETRIC_SWEEP = SOR_LOCAL_SYMMETRIC_SWEEP             # <<<<<<<<<<<<<<
 *     ZERO_INITIAL_GUESS    = SOR_ZERO_INITIAL_GUESS
 *     EISENSTAT             = SOR_EISENSTAT
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatSORType(SOR_LOCAL_SYMMETRIC_SWEEP); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LOCAL_SYMMETRIC_SWEEP, __pyx_t_8) < 0) __PYX_ERR(33, 140, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":141
 *     LOCAL_BACKWARD_SWEEP  = SOR_LOCAL_BACKWARD_SWEEP
 *     LOCAL_SYMMETRIC_SWEEP = SOR_LOCAL_SYMMETRIC_SWEEP
 *     ZERO_INITIAL_GUESS    = SOR_ZERO_INITIAL_GUESS             # <<<<<<<<<<<<<<
 *     EISENSTAT             = SOR_EISENSTAT
 *     APPLY_UPPER           = SOR_APPLY_UPPER
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatSORType(SOR_ZERO_INITIAL_GUESS); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ZERO_INITIAL_GUESS, __pyx_t_8) < 0) __PYX_ERR(33, 141, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":142
 *     LOCAL_SYMMETRIC_SWEEP = SOR_LOCAL_SYMMETRIC_SWEEP
 *     ZERO_INITIAL_GUESS    = SOR_ZERO_INITIAL_GUESS
 *     EISENSTAT             = SOR_EISENSTAT             # <<<<<<<<<<<<<<
 *     APPLY_UPPER           = SOR_APPLY_UPPER
 *     APPLY_LOWER           = SOR_APPLY_LOWER
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatSORType(SOR_EISENSTAT); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_EISENSTAT, __pyx_t_8) < 0) __PYX_ERR(33, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":143
 *     ZERO_INITIAL_GUESS    = SOR_ZERO_INITIAL_GUESS
 *     EISENSTAT             = SOR_EISENSTAT
 *     APPLY_UPPER           = SOR_APPLY_UPPER             # <<<<<<<<<<<<<<
 *     APPLY_LOWER           = SOR_APPLY_LOWER
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatSORType(SOR_APPLY_UPPER); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_APPLY_UPPER, __pyx_t_8) < 0) __PYX_ERR(33, 143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":144
 *     EISENSTAT             = SOR_EISENSTAT
 *     APPLY_UPPER           = SOR_APPLY_UPPER
 *     APPLY_LOWER           = SOR_APPLY_LOWER             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = __Pyx_PyInt_From_MatSORType(SOR_APPLY_LOWER); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_APPLY_LOWER, __pyx_t_8) < 0) __PYX_ERR(33, 144, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Mat.pyx":134
 *     PD = MAT_SHIFT_POSITIVE_DEFINITE
 * 
 * class MatSORType(object):             # <<<<<<<<<<<<<<
 *     FORWARD_SWEEP         = SOR_FORWARD_SWEEP
 *     BACKWARD_SWEEP        = SOR_BACKWARD_SWEEP
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_MatSORType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(33, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MatSORType, __pyx_t_8) < 0) __PYX_ERR(33, 134, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/Mat.pyx":150
 * cdef class Mat(Object):
 * 
 *     Type            = MatType             # <<<<<<<<<<<<<<
 *     Option          = MatOption
 *     AssemblyType    = MatAssemblyType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MatType); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(33, 150, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Mat);

  /* "PETSc/Mat.pyx":151
 * 
 *     Type            = MatType
 *     Option          = MatOption             # <<<<<<<<<<<<<<
 *     AssemblyType    = MatAssemblyType
 *     InfoType        = MatInfoType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MatOption); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat->tp_dict, __pyx_n_s_Option, __pyx_t_3) < 0) __PYX_ERR(33, 151, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Mat);

  /* "PETSc/Mat.pyx":152
 *     Type            = MatType
 *     Option          = MatOption
 *     AssemblyType    = MatAssemblyType             # <<<<<<<<<<<<<<
 *     InfoType        = MatInfoType
 *     Structure       = MatStructure
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MatAssemblyType); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat->tp_dict, __pyx_n_s_AssemblyType, __pyx_t_3) < 0) __PYX_ERR(33, 152, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Mat);

  /* "PETSc/Mat.pyx":153
 *     Option          = MatOption
 *     AssemblyType    = MatAssemblyType
 *     InfoType        = MatInfoType             # <<<<<<<<<<<<<<
 *     Structure       = MatStructure
 *     OrderingType    = MatOrderingType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MatInfoType); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat->tp_dict, __pyx_n_s_InfoType, __pyx_t_3) < 0) __PYX_ERR(33, 153, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Mat);

  /* "PETSc/Mat.pyx":154
 *     AssemblyType    = MatAssemblyType
 *     InfoType        = MatInfoType
 *     Structure       = MatStructure             # <<<<<<<<<<<<<<
 *     OrderingType    = MatOrderingType
 *     FactorShiftType = MatFactorShiftType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MatStructure); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat->tp_dict, __pyx_n_s_Structure, __pyx_t_3) < 0) __PYX_ERR(33, 154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Mat);

  /* "PETSc/Mat.pyx":155
 *     InfoType        = MatInfoType
 *     Structure       = MatStructure
 *     OrderingType    = MatOrderingType             # <<<<<<<<<<<<<<
 *     FactorShiftType = MatFactorShiftType
 *     SORType         = MatSORType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MatOrderingType); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat->tp_dict, __pyx_n_s_OrderingType, __pyx_t_3) < 0) __PYX_ERR(33, 155, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Mat);

  /* "PETSc/Mat.pyx":156
 *     Structure       = MatStructure
 *     OrderingType    = MatOrderingType
 *     FactorShiftType = MatFactorShiftType             # <<<<<<<<<<<<<<
 *     SORType         = MatSORType
 *     #
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MatFactorShiftType); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat->tp_dict, __pyx_n_s_FactorShiftType, __pyx_t_3) < 0) __PYX_ERR(33, 156, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Mat);

  /* "PETSc/Mat.pyx":157
 *     OrderingType    = MatOrderingType
 *     FactorShiftType = MatFactorShiftType
 *     SORType         = MatSORType             # <<<<<<<<<<<<<<
 *     #
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MatSORType); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat->tp_dict, __pyx_n_s_SORType, __pyx_t_3) < 0) __PYX_ERR(33, 157, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Mat);

  /* "PETSc/Mat.pyx":883
 *     #
 * 
 *     Stencil = _Mat_Stencil             # <<<<<<<<<<<<<<
 * 
 *     def setStencil(self, dims, starts=None, dof=1):
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat->tp_dict, __pyx_n_s_Stencil, ((PyObject *)__pyx_ptype_8petsc4py_5PETSc__Mat_Stencil)) < 0) __PYX_ERR(33, 883, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Mat);

  /* "PETSc/Mat.pyx":996
 *         return vecl
 * 
 *     getVecs = createVecs             # <<<<<<<<<<<<<<
 *     getVecRight = createVecRight
 *     getVecLeft = createVecLeft
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat, __pyx_n_s_createVecs); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat->tp_dict, __pyx_n_s_getVecs, __pyx_t_3) < 0) __PYX_ERR(33, 996, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Mat);

  /* "PETSc/Mat.pyx":997
 * 
 *     getVecs = createVecs
 *     getVecRight = createVecRight             # <<<<<<<<<<<<<<
 *     getVecLeft = createVecLeft
 * 
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat, __pyx_n_s_createVecRight); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat->tp_dict, __pyx_n_s_getVecRight, __pyx_t_3) < 0) __PYX_ERR(33, 997, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Mat);

  /* "PETSc/Mat.pyx":998
 *     getVecs = createVecs
 *     getVecRight = createVecRight
 *     getVecLeft = createVecLeft             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat, __pyx_n_s_createVecLeft); if (unlikely(!__pyx_t_3)) __PYX_ERR(33, 998, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Mat->tp_dict, __pyx_n_s_getVecLeft, __pyx_t_3) < 0) __PYX_ERR(33, 998, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Mat);

  /* "PETSc/Mat.pyx":1543
 * # --------------------------------------------------------------------
 * 
 * del MatType             # <<<<<<<<<<<<<<
 * del MatOption
 * del MatAssemblyType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_MatType) < 0) __PYX_ERR(33, 1543, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1544
 * 
 * del MatType
 * del MatOption             # <<<<<<<<<<<<<<
 * del MatAssemblyType
 * del MatInfoType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_MatOption) < 0) __PYX_ERR(33, 1544, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1545
 * del MatType
 * del MatOption
 * del MatAssemblyType             # <<<<<<<<<<<<<<
 * del MatInfoType
 * del MatStructure
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_MatAssemblyType) < 0) __PYX_ERR(33, 1545, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1546
 * del MatOption
 * del MatAssemblyType
 * del MatInfoType             # <<<<<<<<<<<<<<
 * del MatStructure
 * del MatOrderingType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_MatInfoType) < 0) __PYX_ERR(33, 1546, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1547
 * del MatAssemblyType
 * del MatInfoType
 * del MatStructure             # <<<<<<<<<<<<<<
 * del MatOrderingType
 * del MatFactorShiftType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_MatStructure) < 0) __PYX_ERR(33, 1547, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1548
 * del MatInfoType
 * del MatStructure
 * del MatOrderingType             # <<<<<<<<<<<<<<
 * del MatFactorShiftType
 * del MatSORType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_MatOrderingType) < 0) __PYX_ERR(33, 1548, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1549
 * del MatStructure
 * del MatOrderingType
 * del MatFactorShiftType             # <<<<<<<<<<<<<<
 * del MatSORType
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_MatFactorShiftType) < 0) __PYX_ERR(33, 1549, __pyx_L1_error)

  /* "PETSc/Mat.pyx":1550
 * del MatOrderingType
 * del MatFactorShiftType
 * del MatSORType             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_MatSORType) < 0) __PYX_ERR(33, 1550, __pyx_L1_error)

  /* "PETSc/PC.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class PCType(object):             # <<<<<<<<<<<<<<
 *     # native
 *     NONE         = S_(PCNONE)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_PCType, __pyx_n_s_PCType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/PC.pyx":5
 * class PCType(object):
 *     # native
 *     NONE         = S_(PCNONE)             # <<<<<<<<<<<<<<
 *     JACOBI       = S_(PCJACOBI)
 *     SOR          = S_(PCSOR)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCNONE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NONE, __pyx_t_8) < 0) __PYX_ERR(34, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":6
 *     # native
 *     NONE         = S_(PCNONE)
 *     JACOBI       = S_(PCJACOBI)             # <<<<<<<<<<<<<<
 *     SOR          = S_(PCSOR)
 *     LU           = S_(PCLU)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCJACOBI); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_JACOBI, __pyx_t_8) < 0) __PYX_ERR(34, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":7
 *     NONE         = S_(PCNONE)
 *     JACOBI       = S_(PCJACOBI)
 *     SOR          = S_(PCSOR)             # <<<<<<<<<<<<<<
 *     LU           = S_(PCLU)
 *     SHELL        = S_(PCSHELL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCSOR); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SOR, __pyx_t_8) < 0) __PYX_ERR(34, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":8
 *     JACOBI       = S_(PCJACOBI)
 *     SOR          = S_(PCSOR)
 *     LU           = S_(PCLU)             # <<<<<<<<<<<<<<
 *     SHELL        = S_(PCSHELL)
 *     BJACOBI      = S_(PCBJACOBI)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCLU); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LU, __pyx_t_8) < 0) __PYX_ERR(34, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":9
 *     SOR          = S_(PCSOR)
 *     LU           = S_(PCLU)
 *     SHELL        = S_(PCSHELL)             # <<<<<<<<<<<<<<
 *     BJACOBI      = S_(PCBJACOBI)
 *     MG           = S_(PCMG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCSHELL); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SHELL, __pyx_t_8) < 0) __PYX_ERR(34, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":10
 *     LU           = S_(PCLU)
 *     SHELL        = S_(PCSHELL)
 *     BJACOBI      = S_(PCBJACOBI)             # <<<<<<<<<<<<<<
 *     MG           = S_(PCMG)
 *     EISENSTAT    = S_(PCEISENSTAT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCBJACOBI); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BJACOBI, __pyx_t_8) < 0) __PYX_ERR(34, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":11
 *     SHELL        = S_(PCSHELL)
 *     BJACOBI      = S_(PCBJACOBI)
 *     MG           = S_(PCMG)             # <<<<<<<<<<<<<<
 *     EISENSTAT    = S_(PCEISENSTAT)
 *     ILU          = S_(PCILU)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCMG); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MG, __pyx_t_8) < 0) __PYX_ERR(34, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":12
 *     BJACOBI      = S_(PCBJACOBI)
 *     MG           = S_(PCMG)
 *     EISENSTAT    = S_(PCEISENSTAT)             # <<<<<<<<<<<<<<
 *     ILU          = S_(PCILU)
 *     ICC          = S_(PCICC)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCEISENSTAT); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_EISENSTAT, __pyx_t_8) < 0) __PYX_ERR(34, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":13
 *     MG           = S_(PCMG)
 *     EISENSTAT    = S_(PCEISENSTAT)
 *     ILU          = S_(PCILU)             # <<<<<<<<<<<<<<
 *     ICC          = S_(PCICC)
 *     ASM          = S_(PCASM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCILU); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ILU, __pyx_t_8) < 0) __PYX_ERR(34, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":14
 *     EISENSTAT    = S_(PCEISENSTAT)
 *     ILU          = S_(PCILU)
 *     ICC          = S_(PCICC)             # <<<<<<<<<<<<<<
 *     ASM          = S_(PCASM)
 *     GASM         = S_(PCGASM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCICC); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ICC, __pyx_t_8) < 0) __PYX_ERR(34, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":15
 *     ILU          = S_(PCILU)
 *     ICC          = S_(PCICC)
 *     ASM          = S_(PCASM)             # <<<<<<<<<<<<<<
 *     GASM         = S_(PCGASM)
 *     KSP          = S_(PCKSP)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCASM); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASM, __pyx_t_8) < 0) __PYX_ERR(34, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":16
 *     ICC          = S_(PCICC)
 *     ASM          = S_(PCASM)
 *     GASM         = S_(PCGASM)             # <<<<<<<<<<<<<<
 *     KSP          = S_(PCKSP)
 *     COMPOSITE    = S_(PCCOMPOSITE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCGASM); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GASM, __pyx_t_8) < 0) __PYX_ERR(34, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":17
 *     ASM          = S_(PCASM)
 *     GASM         = S_(PCGASM)
 *     KSP          = S_(PCKSP)             # <<<<<<<<<<<<<<
 *     COMPOSITE    = S_(PCCOMPOSITE)
 *     REDUNDANT    = S_(PCREDUNDANT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCKSP); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_KSP, __pyx_t_8) < 0) __PYX_ERR(34, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":18
 *     GASM         = S_(PCGASM)
 *     KSP          = S_(PCKSP)
 *     COMPOSITE    = S_(PCCOMPOSITE)             # <<<<<<<<<<<<<<
 *     REDUNDANT    = S_(PCREDUNDANT)
 *     SPAI         = S_(PCSPAI)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCCOMPOSITE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_COMPOSITE, __pyx_t_8) < 0) __PYX_ERR(34, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":19
 *     KSP          = S_(PCKSP)
 *     COMPOSITE    = S_(PCCOMPOSITE)
 *     REDUNDANT    = S_(PCREDUNDANT)             # <<<<<<<<<<<<<<
 *     SPAI         = S_(PCSPAI)
 *     NN           = S_(PCNN)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCREDUNDANT); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_REDUNDANT, __pyx_t_8) < 0) __PYX_ERR(34, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":20
 *     COMPOSITE    = S_(PCCOMPOSITE)
 *     REDUNDANT    = S_(PCREDUNDANT)
 *     SPAI         = S_(PCSPAI)             # <<<<<<<<<<<<<<
 *     NN           = S_(PCNN)
 *     CHOLESKY     = S_(PCCHOLESKY)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCSPAI); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SPAI, __pyx_t_8) < 0) __PYX_ERR(34, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":21
 *     REDUNDANT    = S_(PCREDUNDANT)
 *     SPAI         = S_(PCSPAI)
 *     NN           = S_(PCNN)             # <<<<<<<<<<<<<<
 *     CHOLESKY     = S_(PCCHOLESKY)
 *     PBJACOBI     = S_(PCPBJACOBI)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCNN); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NN, __pyx_t_8) < 0) __PYX_ERR(34, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":22
 *     SPAI         = S_(PCSPAI)
 *     NN           = S_(PCNN)
 *     CHOLESKY     = S_(PCCHOLESKY)             # <<<<<<<<<<<<<<
 *     PBJACOBI     = S_(PCPBJACOBI)
 *     MAT          = S_(PCMAT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCCHOLESKY); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CHOLESKY, __pyx_t_8) < 0) __PYX_ERR(34, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":23
 *     NN           = S_(PCNN)
 *     CHOLESKY     = S_(PCCHOLESKY)
 *     PBJACOBI     = S_(PCPBJACOBI)             # <<<<<<<<<<<<<<
 *     MAT          = S_(PCMAT)
 *     HYPRE        = S_(PCHYPRE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCPBJACOBI); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PBJACOBI, __pyx_t_8) < 0) __PYX_ERR(34, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":24
 *     CHOLESKY     = S_(PCCHOLESKY)
 *     PBJACOBI     = S_(PCPBJACOBI)
 *     MAT          = S_(PCMAT)             # <<<<<<<<<<<<<<
 *     HYPRE        = S_(PCHYPRE)
 *     PARMS        = S_(PCPARMS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCMAT); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MAT, __pyx_t_8) < 0) __PYX_ERR(34, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":25
 *     PBJACOBI     = S_(PCPBJACOBI)
 *     MAT          = S_(PCMAT)
 *     HYPRE        = S_(PCHYPRE)             # <<<<<<<<<<<<<<
 *     PARMS        = S_(PCPARMS)
 *     FIELDSPLIT   = S_(PCFIELDSPLIT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCHYPRE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_HYPRE, __pyx_t_8) < 0) __PYX_ERR(34, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":26
 *     MAT          = S_(PCMAT)
 *     HYPRE        = S_(PCHYPRE)
 *     PARMS        = S_(PCPARMS)             # <<<<<<<<<<<<<<
 *     FIELDSPLIT   = S_(PCFIELDSPLIT)
 *     TFS          = S_(PCTFS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCPARMS); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PARMS, __pyx_t_8) < 0) __PYX_ERR(34, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":27
 *     HYPRE        = S_(PCHYPRE)
 *     PARMS        = S_(PCPARMS)
 *     FIELDSPLIT   = S_(PCFIELDSPLIT)             # <<<<<<<<<<<<<<
 *     TFS          = S_(PCTFS)
 *     ML           = S_(PCML)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCFIELDSPLIT); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FIELDSPLIT, __pyx_t_8) < 0) __PYX_ERR(34, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":28
 *     PARMS        = S_(PCPARMS)
 *     FIELDSPLIT   = S_(PCFIELDSPLIT)
 *     TFS          = S_(PCTFS)             # <<<<<<<<<<<<<<
 *     ML           = S_(PCML)
 *     GALERKIN     = S_(PCGALERKIN)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCTFS); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_TFS, __pyx_t_8) < 0) __PYX_ERR(34, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":29
 *     FIELDSPLIT   = S_(PCFIELDSPLIT)
 *     TFS          = S_(PCTFS)
 *     ML           = S_(PCML)             # <<<<<<<<<<<<<<
 *     GALERKIN     = S_(PCGALERKIN)
 *     EXOTIC       = S_(PCEXOTIC)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCML); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ML, __pyx_t_8) < 0) __PYX_ERR(34, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":30
 *     TFS          = S_(PCTFS)
 *     ML           = S_(PCML)
 *     GALERKIN     = S_(PCGALERKIN)             # <<<<<<<<<<<<<<
 *     EXOTIC       = S_(PCEXOTIC)
 *     CP           = S_(PCCP)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCGALERKIN); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GALERKIN, __pyx_t_8) < 0) __PYX_ERR(34, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":31
 *     ML           = S_(PCML)
 *     GALERKIN     = S_(PCGALERKIN)
 *     EXOTIC       = S_(PCEXOTIC)             # <<<<<<<<<<<<<<
 *     CP           = S_(PCCP)
 *     BFBT         = S_(PCBFBT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCEXOTIC); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_EXOTIC, __pyx_t_8) < 0) __PYX_ERR(34, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":32
 *     GALERKIN     = S_(PCGALERKIN)
 *     EXOTIC       = S_(PCEXOTIC)
 *     CP           = S_(PCCP)             # <<<<<<<<<<<<<<
 *     BFBT         = S_(PCBFBT)
 *     LSC          = S_(PCLSC)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCCP); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CP, __pyx_t_8) < 0) __PYX_ERR(34, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":33
 *     EXOTIC       = S_(PCEXOTIC)
 *     CP           = S_(PCCP)
 *     BFBT         = S_(PCBFBT)             # <<<<<<<<<<<<<<
 *     LSC          = S_(PCLSC)
 *     PYTHON       = S_(PCPYTHON)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCBFBT); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BFBT, __pyx_t_8) < 0) __PYX_ERR(34, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":34
 *     CP           = S_(PCCP)
 *     BFBT         = S_(PCBFBT)
 *     LSC          = S_(PCLSC)             # <<<<<<<<<<<<<<
 *     PYTHON       = S_(PCPYTHON)
 *     PFMG         = S_(PCPFMG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCLSC); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LSC, __pyx_t_8) < 0) __PYX_ERR(34, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":35
 *     BFBT         = S_(PCBFBT)
 *     LSC          = S_(PCLSC)
 *     PYTHON       = S_(PCPYTHON)             # <<<<<<<<<<<<<<
 *     PFMG         = S_(PCPFMG)
 *     SYSPFMG      = S_(PCSYSPFMG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCPYTHON); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PYTHON, __pyx_t_8) < 0) __PYX_ERR(34, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":36
 *     LSC          = S_(PCLSC)
 *     PYTHON       = S_(PCPYTHON)
 *     PFMG         = S_(PCPFMG)             # <<<<<<<<<<<<<<
 *     SYSPFMG      = S_(PCSYSPFMG)
 *     REDISTRIBUTE = S_(PCREDISTRIBUTE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCPFMG); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PFMG, __pyx_t_8) < 0) __PYX_ERR(34, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":37
 *     PYTHON       = S_(PCPYTHON)
 *     PFMG         = S_(PCPFMG)
 *     SYSPFMG      = S_(PCSYSPFMG)             # <<<<<<<<<<<<<<
 *     REDISTRIBUTE = S_(PCREDISTRIBUTE)
 *     SVD          = S_(PCSVD)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCSYSPFMG); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SYSPFMG, __pyx_t_8) < 0) __PYX_ERR(34, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":38
 *     PFMG         = S_(PCPFMG)
 *     SYSPFMG      = S_(PCSYSPFMG)
 *     REDISTRIBUTE = S_(PCREDISTRIBUTE)             # <<<<<<<<<<<<<<
 *     SVD          = S_(PCSVD)
 *     GAMG         = S_(PCGAMG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCREDISTRIBUTE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_REDISTRIBUTE, __pyx_t_8) < 0) __PYX_ERR(34, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":39
 *     SYSPFMG      = S_(PCSYSPFMG)
 *     REDISTRIBUTE = S_(PCREDISTRIBUTE)
 *     SVD          = S_(PCSVD)             # <<<<<<<<<<<<<<
 *     GAMG         = S_(PCGAMG)
 *     SACUSP       = S_(PCSACUSP)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCSVD); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SVD, __pyx_t_8) < 0) __PYX_ERR(34, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":40
 *     REDISTRIBUTE = S_(PCREDISTRIBUTE)
 *     SVD          = S_(PCSVD)
 *     GAMG         = S_(PCGAMG)             # <<<<<<<<<<<<<<
 *     SACUSP       = S_(PCSACUSP)
 *     SACUSPPOLY   = S_(PCSACUSPPOLY)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCGAMG); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GAMG, __pyx_t_8) < 0) __PYX_ERR(34, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":41
 *     SVD          = S_(PCSVD)
 *     GAMG         = S_(PCGAMG)
 *     SACUSP       = S_(PCSACUSP)             # <<<<<<<<<<<<<<
 *     SACUSPPOLY   = S_(PCSACUSPPOLY)
 *     BICGSTABCUSP = S_(PCBICGSTABCUSP)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCSACUSP); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SACUSP, __pyx_t_8) < 0) __PYX_ERR(34, 41, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":42
 *     GAMG         = S_(PCGAMG)
 *     SACUSP       = S_(PCSACUSP)
 *     SACUSPPOLY   = S_(PCSACUSPPOLY)             # <<<<<<<<<<<<<<
 *     BICGSTABCUSP = S_(PCBICGSTABCUSP)
 *     AINVCUSP     = S_(PCAINVCUSP)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCSACUSPPOLY); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SACUSPPOLY, __pyx_t_8) < 0) __PYX_ERR(34, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":43
 *     SACUSP       = S_(PCSACUSP)
 *     SACUSPPOLY   = S_(PCSACUSPPOLY)
 *     BICGSTABCUSP = S_(PCBICGSTABCUSP)             # <<<<<<<<<<<<<<
 *     AINVCUSP     = S_(PCAINVCUSP)
 *     BDDC         = S_(PCBDDC)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCBICGSTABCUSP); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BICGSTABCUSP, __pyx_t_8) < 0) __PYX_ERR(34, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":44
 *     SACUSPPOLY   = S_(PCSACUSPPOLY)
 *     BICGSTABCUSP = S_(PCBICGSTABCUSP)
 *     AINVCUSP     = S_(PCAINVCUSP)             # <<<<<<<<<<<<<<
 *     BDDC         = S_(PCBDDC)
 *     KACZMARZ     = S_(PCKACZMARZ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCAINVCUSP); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_AINVCUSP, __pyx_t_8) < 0) __PYX_ERR(34, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":45
 *     BICGSTABCUSP = S_(PCBICGSTABCUSP)
 *     AINVCUSP     = S_(PCAINVCUSP)
 *     BDDC         = S_(PCBDDC)             # <<<<<<<<<<<<<<
 *     KACZMARZ     = S_(PCKACZMARZ)
 *     TELESCOPE    = S_(PCTELESCOPE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCBDDC); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BDDC, __pyx_t_8) < 0) __PYX_ERR(34, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":46
 *     AINVCUSP     = S_(PCAINVCUSP)
 *     BDDC         = S_(PCBDDC)
 *     KACZMARZ     = S_(PCKACZMARZ)             # <<<<<<<<<<<<<<
 *     TELESCOPE    = S_(PCTELESCOPE)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCKACZMARZ); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_KACZMARZ, __pyx_t_8) < 0) __PYX_ERR(34, 46, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":47
 *     BDDC         = S_(PCBDDC)
 *     KACZMARZ     = S_(PCKACZMARZ)
 *     TELESCOPE    = S_(PCTELESCOPE)             # <<<<<<<<<<<<<<
 * 
 * class PCSide(object):
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCTELESCOPE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_TELESCOPE, __pyx_t_8) < 0) __PYX_ERR(34, 47, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class PCType(object):             # <<<<<<<<<<<<<<
 *     # native
 *     NONE         = S_(PCNONE)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PCType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PCType, __pyx_t_8) < 0) __PYX_ERR(34, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/PC.pyx":49
 *     TELESCOPE    = S_(PCTELESCOPE)
 * 
 * class PCSide(object):             # <<<<<<<<<<<<<<
 *     # native
 *     LEFT      = PC_LEFT
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_PCSide, __pyx_n_s_PCSide, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/PC.pyx":51
 * class PCSide(object):
 *     # native
 *     LEFT      = PC_LEFT             # <<<<<<<<<<<<<<
 *     RIGHT     = PC_RIGHT
 *     SYMMETRIC = PC_SYMMETRIC
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCSide(PC_LEFT); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LEFT, __pyx_t_8) < 0) __PYX_ERR(34, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":52
 *     # native
 *     LEFT      = PC_LEFT
 *     RIGHT     = PC_RIGHT             # <<<<<<<<<<<<<<
 *     SYMMETRIC = PC_SYMMETRIC
 *     # aliases
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCSide(PC_RIGHT); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_RIGHT, __pyx_t_8) < 0) __PYX_ERR(34, 52, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":53
 *     LEFT      = PC_LEFT
 *     RIGHT     = PC_RIGHT
 *     SYMMETRIC = PC_SYMMETRIC             # <<<<<<<<<<<<<<
 *     # aliases
 *     L = LEFT
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCSide(PC_SYMMETRIC); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SYMMETRIC, __pyx_t_8) < 0) __PYX_ERR(34, 53, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":55
 *     SYMMETRIC = PC_SYMMETRIC
 *     # aliases
 *     L = LEFT             # <<<<<<<<<<<<<<
 *     R = RIGHT
 *     S = SYMMETRIC
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_LEFT);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_LEFT);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_L, __pyx_t_8) < 0) __PYX_ERR(34, 55, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":56
 *     # aliases
 *     L = LEFT
 *     R = RIGHT             # <<<<<<<<<<<<<<
 *     S = SYMMETRIC
 * 
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_RIGHT);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_RIGHT);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_R, __pyx_t_8) < 0) __PYX_ERR(34, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":57
 *     L = LEFT
 *     R = RIGHT
 *     S = SYMMETRIC             # <<<<<<<<<<<<<<
 * 
 * class PCASMType(object):
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_SYMMETRIC);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_SYMMETRIC);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_S, __pyx_t_8) < 0) __PYX_ERR(34, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":49
 *     TELESCOPE    = S_(PCTELESCOPE)
 * 
 * class PCSide(object):             # <<<<<<<<<<<<<<
 *     # native
 *     LEFT      = PC_LEFT
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PCSide, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PCSide, __pyx_t_8) < 0) __PYX_ERR(34, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/PC.pyx":59
 *     S = SYMMETRIC
 * 
 * class PCASMType(object):             # <<<<<<<<<<<<<<
 *     NONE        = PC_ASM_NONE
 *     BASIC       = PC_ASM_BASIC
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_PCASMType, __pyx_n_s_PCASMType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/PC.pyx":60
 * 
 * class PCASMType(object):
 *     NONE        = PC_ASM_NONE             # <<<<<<<<<<<<<<
 *     BASIC       = PC_ASM_BASIC
 *     RESTRICT    = PC_ASM_RESTRICT
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCASMType(PC_ASM_NONE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NONE, __pyx_t_8) < 0) __PYX_ERR(34, 60, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":61
 * class PCASMType(object):
 *     NONE        = PC_ASM_NONE
 *     BASIC       = PC_ASM_BASIC             # <<<<<<<<<<<<<<
 *     RESTRICT    = PC_ASM_RESTRICT
 *     INTERPOLATE = PC_ASM_INTERPOLATE
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCASMType(PC_ASM_BASIC); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BASIC, __pyx_t_8) < 0) __PYX_ERR(34, 61, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":62
 *     NONE        = PC_ASM_NONE
 *     BASIC       = PC_ASM_BASIC
 *     RESTRICT    = PC_ASM_RESTRICT             # <<<<<<<<<<<<<<
 *     INTERPOLATE = PC_ASM_INTERPOLATE
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCASMType(PC_ASM_RESTRICT); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_RESTRICT, __pyx_t_8) < 0) __PYX_ERR(34, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":63
 *     BASIC       = PC_ASM_BASIC
 *     RESTRICT    = PC_ASM_RESTRICT
 *     INTERPOLATE = PC_ASM_INTERPOLATE             # <<<<<<<<<<<<<<
 * 
 * class PCGASMType(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCASMType(PC_ASM_INTERPOLATE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INTERPOLATE, __pyx_t_8) < 0) __PYX_ERR(34, 63, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":59
 *     S = SYMMETRIC
 * 
 * class PCASMType(object):             # <<<<<<<<<<<<<<
 *     NONE        = PC_ASM_NONE
 *     BASIC       = PC_ASM_BASIC
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PCASMType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PCASMType, __pyx_t_8) < 0) __PYX_ERR(34, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/PC.pyx":65
 *     INTERPOLATE = PC_ASM_INTERPOLATE
 * 
 * class PCGASMType(object):             # <<<<<<<<<<<<<<
 *     NONE        = PC_GASM_NONE
 *     BASIC       = PC_GASM_BASIC
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_PCGASMType, __pyx_n_s_PCGASMType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/PC.pyx":66
 * 
 * class PCGASMType(object):
 *     NONE        = PC_GASM_NONE             # <<<<<<<<<<<<<<
 *     BASIC       = PC_GASM_BASIC
 *     RESTRICT    = PC_GASM_RESTRICT
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCGASMType(PC_GASM_NONE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NONE, __pyx_t_8) < 0) __PYX_ERR(34, 66, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":67
 * class PCGASMType(object):
 *     NONE        = PC_GASM_NONE
 *     BASIC       = PC_GASM_BASIC             # <<<<<<<<<<<<<<
 *     RESTRICT    = PC_GASM_RESTRICT
 *     INTERPOLATE = PC_GASM_INTERPOLATE
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCGASMType(PC_GASM_BASIC); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BASIC, __pyx_t_8) < 0) __PYX_ERR(34, 67, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":68
 *     NONE        = PC_GASM_NONE
 *     BASIC       = PC_GASM_BASIC
 *     RESTRICT    = PC_GASM_RESTRICT             # <<<<<<<<<<<<<<
 *     INTERPOLATE = PC_GASM_INTERPOLATE
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCGASMType(PC_GASM_RESTRICT); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_RESTRICT, __pyx_t_8) < 0) __PYX_ERR(34, 68, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":69
 *     BASIC       = PC_GASM_BASIC
 *     RESTRICT    = PC_GASM_RESTRICT
 *     INTERPOLATE = PC_GASM_INTERPOLATE             # <<<<<<<<<<<<<<
 * 
 * class PCMGType(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCGASMType(PC_GASM_INTERPOLATE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INTERPOLATE, __pyx_t_8) < 0) __PYX_ERR(34, 69, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":65
 *     INTERPOLATE = PC_ASM_INTERPOLATE
 * 
 * class PCGASMType(object):             # <<<<<<<<<<<<<<
 *     NONE        = PC_GASM_NONE
 *     BASIC       = PC_GASM_BASIC
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PCGASMType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PCGASMType, __pyx_t_8) < 0) __PYX_ERR(34, 65, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/PC.pyx":71
 *     INTERPOLATE = PC_GASM_INTERPOLATE
 * 
 * class PCMGType(object):             # <<<<<<<<<<<<<<
 *     MULTIPLICATIVE = PC_MG_MULTIPLICATIVE
 *     ADDITIVE       = PC_MG_ADDITIVE
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_PCMGType, __pyx_n_s_PCMGType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/PC.pyx":72
 * 
 * class PCMGType(object):
 *     MULTIPLICATIVE = PC_MG_MULTIPLICATIVE             # <<<<<<<<<<<<<<
 *     ADDITIVE       = PC_MG_ADDITIVE
 *     FULL           = PC_MG_FULL
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCMGType(PC_MG_MULTIPLICATIVE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MULTIPLICATIVE, __pyx_t_8) < 0) __PYX_ERR(34, 72, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":73
 * class PCMGType(object):
 *     MULTIPLICATIVE = PC_MG_MULTIPLICATIVE
 *     ADDITIVE       = PC_MG_ADDITIVE             # <<<<<<<<<<<<<<
 *     FULL           = PC_MG_FULL
 *     KASKADE        = PC_MG_KASKADE
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCMGType(PC_MG_ADDITIVE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ADDITIVE, __pyx_t_8) < 0) __PYX_ERR(34, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":74
 *     MULTIPLICATIVE = PC_MG_MULTIPLICATIVE
 *     ADDITIVE       = PC_MG_ADDITIVE
 *     FULL           = PC_MG_FULL             # <<<<<<<<<<<<<<
 *     KASKADE        = PC_MG_KASKADE
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCMGType(PC_MG_FULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FULL, __pyx_t_8) < 0) __PYX_ERR(34, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":75
 *     ADDITIVE       = PC_MG_ADDITIVE
 *     FULL           = PC_MG_FULL
 *     KASKADE        = PC_MG_KASKADE             # <<<<<<<<<<<<<<
 * 
 * class PCGAMGType(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCMGType(PC_MG_KASKADE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_KASKADE, __pyx_t_8) < 0) __PYX_ERR(34, 75, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":71
 *     INTERPOLATE = PC_GASM_INTERPOLATE
 * 
 * class PCMGType(object):             # <<<<<<<<<<<<<<
 *     MULTIPLICATIVE = PC_MG_MULTIPLICATIVE
 *     ADDITIVE       = PC_MG_ADDITIVE
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PCMGType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PCMGType, __pyx_t_8) < 0) __PYX_ERR(34, 71, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/PC.pyx":77
 *     KASKADE        = PC_MG_KASKADE
 * 
 * class PCGAMGType(object):             # <<<<<<<<<<<<<<
 *     AGG       = S_(PCGAMGAGG)
 *     GEO       = S_(PCGAMGGEO)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_PCGAMGType, __pyx_n_s_PCGAMGType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/PC.pyx":78
 * 
 * class PCGAMGType(object):
 *     AGG       = S_(PCGAMGAGG)             # <<<<<<<<<<<<<<
 *     GEO       = S_(PCGAMGGEO)
 *     CLASSICAL = S_(PCGAMGCLASSICAL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCGAMGAGG); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_AGG, __pyx_t_8) < 0) __PYX_ERR(34, 78, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":79
 * class PCGAMGType(object):
 *     AGG       = S_(PCGAMGAGG)
 *     GEO       = S_(PCGAMGGEO)             # <<<<<<<<<<<<<<
 *     CLASSICAL = S_(PCGAMGCLASSICAL)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCGAMGGEO); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GEO, __pyx_t_8) < 0) __PYX_ERR(34, 79, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":80
 *     AGG       = S_(PCGAMGAGG)
 *     GEO       = S_(PCGAMGGEO)
 *     CLASSICAL = S_(PCGAMGCLASSICAL)             # <<<<<<<<<<<<<<
 * 
 * class PCCompositeType(object):
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PCGAMGCLASSICAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CLASSICAL, __pyx_t_8) < 0) __PYX_ERR(34, 80, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":77
 *     KASKADE        = PC_MG_KASKADE
 * 
 * class PCGAMGType(object):             # <<<<<<<<<<<<<<
 *     AGG       = S_(PCGAMGAGG)
 *     GEO       = S_(PCGAMGGEO)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PCGAMGType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PCGAMGType, __pyx_t_8) < 0) __PYX_ERR(34, 77, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/PC.pyx":82
 *     CLASSICAL = S_(PCGAMGCLASSICAL)
 * 
 * class PCCompositeType(object):             # <<<<<<<<<<<<<<
 *     ADDITIVE                 = PC_COMPOSITE_ADDITIVE
 *     MULTIPLICATIVE           = PC_COMPOSITE_MULTIPLICATIVE
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_PCCompositeType, __pyx_n_s_PCCompositeType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/PC.pyx":83
 * 
 * class PCCompositeType(object):
 *     ADDITIVE                 = PC_COMPOSITE_ADDITIVE             # <<<<<<<<<<<<<<
 *     MULTIPLICATIVE           = PC_COMPOSITE_MULTIPLICATIVE
 *     SYMMETRIC_MULTIPLICATIVE = PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCCompositeType(PC_COMPOSITE_ADDITIVE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ADDITIVE, __pyx_t_8) < 0) __PYX_ERR(34, 83, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":84
 * class PCCompositeType(object):
 *     ADDITIVE                 = PC_COMPOSITE_ADDITIVE
 *     MULTIPLICATIVE           = PC_COMPOSITE_MULTIPLICATIVE             # <<<<<<<<<<<<<<
 *     SYMMETRIC_MULTIPLICATIVE = PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE
 *     SPECIAL                  = PC_COMPOSITE_SPECIAL
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCCompositeType(PC_COMPOSITE_MULTIPLICATIVE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MULTIPLICATIVE, __pyx_t_8) < 0) __PYX_ERR(34, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":85
 *     ADDITIVE                 = PC_COMPOSITE_ADDITIVE
 *     MULTIPLICATIVE           = PC_COMPOSITE_MULTIPLICATIVE
 *     SYMMETRIC_MULTIPLICATIVE = PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE             # <<<<<<<<<<<<<<
 *     SPECIAL                  = PC_COMPOSITE_SPECIAL
 *     SCHUR                    = PC_COMPOSITE_SCHUR
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCCompositeType(PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SYMMETRIC_MULTIPLICATIVE, __pyx_t_8) < 0) __PYX_ERR(34, 85, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":86
 *     MULTIPLICATIVE           = PC_COMPOSITE_MULTIPLICATIVE
 *     SYMMETRIC_MULTIPLICATIVE = PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE
 *     SPECIAL                  = PC_COMPOSITE_SPECIAL             # <<<<<<<<<<<<<<
 *     SCHUR                    = PC_COMPOSITE_SCHUR
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCCompositeType(PC_COMPOSITE_SPECIAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SPECIAL, __pyx_t_8) < 0) __PYX_ERR(34, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":87
 *     SYMMETRIC_MULTIPLICATIVE = PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE
 *     SPECIAL                  = PC_COMPOSITE_SPECIAL
 *     SCHUR                    = PC_COMPOSITE_SCHUR             # <<<<<<<<<<<<<<
 * 
 * class PCFieldSplitSchurPreType(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCCompositeType(PC_COMPOSITE_SCHUR); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SCHUR, __pyx_t_8) < 0) __PYX_ERR(34, 87, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":82
 *     CLASSICAL = S_(PCGAMGCLASSICAL)
 * 
 * class PCCompositeType(object):             # <<<<<<<<<<<<<<
 *     ADDITIVE                 = PC_COMPOSITE_ADDITIVE
 *     MULTIPLICATIVE           = PC_COMPOSITE_MULTIPLICATIVE
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PCCompositeType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PCCompositeType, __pyx_t_8) < 0) __PYX_ERR(34, 82, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/PC.pyx":89
 *     SCHUR                    = PC_COMPOSITE_SCHUR
 * 
 * class PCFieldSplitSchurPreType(object):             # <<<<<<<<<<<<<<
 *     SELF                     = PC_FIELDSPLIT_SCHUR_PRE_SELF
 *     SELFP                    = PC_FIELDSPLIT_SCHUR_PRE_SELFP
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_PCFieldSplitSchurPreType, __pyx_n_s_PCFieldSplitSchurPreType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/PC.pyx":90
 * 
 * class PCFieldSplitSchurPreType(object):
 *     SELF                     = PC_FIELDSPLIT_SCHUR_PRE_SELF             # <<<<<<<<<<<<<<
 *     SELFP                    = PC_FIELDSPLIT_SCHUR_PRE_SELFP
 *     A11                      = PC_FIELDSPLIT_SCHUR_PRE_A11
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCFieldSplitSchurPreType(PC_FIELDSPLIT_SCHUR_PRE_SELF); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SELF, __pyx_t_8) < 0) __PYX_ERR(34, 90, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":91
 * class PCFieldSplitSchurPreType(object):
 *     SELF                     = PC_FIELDSPLIT_SCHUR_PRE_SELF
 *     SELFP                    = PC_FIELDSPLIT_SCHUR_PRE_SELFP             # <<<<<<<<<<<<<<
 *     A11                      = PC_FIELDSPLIT_SCHUR_PRE_A11
 *     USER                     = PC_FIELDSPLIT_SCHUR_PRE_USER
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCFieldSplitSchurPreType(PC_FIELDSPLIT_SCHUR_PRE_SELFP); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SELFP, __pyx_t_8) < 0) __PYX_ERR(34, 91, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":92
 *     SELF                     = PC_FIELDSPLIT_SCHUR_PRE_SELF
 *     SELFP                    = PC_FIELDSPLIT_SCHUR_PRE_SELFP
 *     A11                      = PC_FIELDSPLIT_SCHUR_PRE_A11             # <<<<<<<<<<<<<<
 *     USER                     = PC_FIELDSPLIT_SCHUR_PRE_USER
 *     FULL                     = PC_FIELDSPLIT_SCHUR_PRE_FULL
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCFieldSplitSchurPreType(PC_FIELDSPLIT_SCHUR_PRE_A11); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_A11, __pyx_t_8) < 0) __PYX_ERR(34, 92, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":93
 *     SELFP                    = PC_FIELDSPLIT_SCHUR_PRE_SELFP
 *     A11                      = PC_FIELDSPLIT_SCHUR_PRE_A11
 *     USER                     = PC_FIELDSPLIT_SCHUR_PRE_USER             # <<<<<<<<<<<<<<
 *     FULL                     = PC_FIELDSPLIT_SCHUR_PRE_FULL
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCFieldSplitSchurPreType(PC_FIELDSPLIT_SCHUR_PRE_USER); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_USER, __pyx_t_8) < 0) __PYX_ERR(34, 93, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":94
 *     A11                      = PC_FIELDSPLIT_SCHUR_PRE_A11
 *     USER                     = PC_FIELDSPLIT_SCHUR_PRE_USER
 *     FULL                     = PC_FIELDSPLIT_SCHUR_PRE_FULL             # <<<<<<<<<<<<<<
 * 
 * class PCFieldSplitSchurFactType(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCFieldSplitSchurPreType(PC_FIELDSPLIT_SCHUR_PRE_FULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FULL, __pyx_t_8) < 0) __PYX_ERR(34, 94, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":89
 *     SCHUR                    = PC_COMPOSITE_SCHUR
 * 
 * class PCFieldSplitSchurPreType(object):             # <<<<<<<<<<<<<<
 *     SELF                     = PC_FIELDSPLIT_SCHUR_PRE_SELF
 *     SELFP                    = PC_FIELDSPLIT_SCHUR_PRE_SELFP
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PCFieldSplitSchurPreType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PCFieldSplitSchurPreType, __pyx_t_8) < 0) __PYX_ERR(34, 89, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/PC.pyx":96
 *     FULL                     = PC_FIELDSPLIT_SCHUR_PRE_FULL
 * 
 * class PCFieldSplitSchurFactType(object):             # <<<<<<<<<<<<<<
 *     DIAG                     = PC_FIELDSPLIT_SCHUR_FACT_DIAG
 *     LOWER                    = PC_FIELDSPLIT_SCHUR_FACT_LOWER
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(34, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_PCFieldSplitSchurFactType, __pyx_n_s_PCFieldSplitSchurFactType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(34, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/PC.pyx":97
 * 
 * class PCFieldSplitSchurFactType(object):
 *     DIAG                     = PC_FIELDSPLIT_SCHUR_FACT_DIAG             # <<<<<<<<<<<<<<
 *     LOWER                    = PC_FIELDSPLIT_SCHUR_FACT_LOWER
 *     UPPER                    = PC_FIELDSPLIT_SCHUR_FACT_UPPER
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCFieldSplitSchurFactType(PC_FIELDSPLIT_SCHUR_FACT_DIAG); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIAG, __pyx_t_8) < 0) __PYX_ERR(34, 97, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":98
 * class PCFieldSplitSchurFactType(object):
 *     DIAG                     = PC_FIELDSPLIT_SCHUR_FACT_DIAG
 *     LOWER                    = PC_FIELDSPLIT_SCHUR_FACT_LOWER             # <<<<<<<<<<<<<<
 *     UPPER                    = PC_FIELDSPLIT_SCHUR_FACT_UPPER
 *     FULL                     = PC_FIELDSPLIT_SCHUR_FACT_FULL
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCFieldSplitSchurFactType(PC_FIELDSPLIT_SCHUR_FACT_LOWER); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LOWER, __pyx_t_8) < 0) __PYX_ERR(34, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":99
 *     DIAG                     = PC_FIELDSPLIT_SCHUR_FACT_DIAG
 *     LOWER                    = PC_FIELDSPLIT_SCHUR_FACT_LOWER
 *     UPPER                    = PC_FIELDSPLIT_SCHUR_FACT_UPPER             # <<<<<<<<<<<<<<
 *     FULL                     = PC_FIELDSPLIT_SCHUR_FACT_FULL
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCFieldSplitSchurFactType(PC_FIELDSPLIT_SCHUR_FACT_UPPER); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_UPPER, __pyx_t_8) < 0) __PYX_ERR(34, 99, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":100
 *     LOWER                    = PC_FIELDSPLIT_SCHUR_FACT_LOWER
 *     UPPER                    = PC_FIELDSPLIT_SCHUR_FACT_UPPER
 *     FULL                     = PC_FIELDSPLIT_SCHUR_FACT_FULL             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = __Pyx_PyInt_From_PCFieldSplitSchurFactType(PC_FIELDSPLIT_SCHUR_FACT_FULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FULL, __pyx_t_8) < 0) __PYX_ERR(34, 100, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/PC.pyx":96
 *     FULL                     = PC_FIELDSPLIT_SCHUR_PRE_FULL
 * 
 * class PCFieldSplitSchurFactType(object):             # <<<<<<<<<<<<<<
 *     DIAG                     = PC_FIELDSPLIT_SCHUR_FACT_DIAG
 *     LOWER                    = PC_FIELDSPLIT_SCHUR_FACT_LOWER
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PCFieldSplitSchurFactType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(34, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PCFieldSplitSchurFactType, __pyx_t_8) < 0) __PYX_ERR(34, 96, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/PC.pyx":106
 * cdef class PC(Object):
 * 
 *     Type = PCType             # <<<<<<<<<<<<<<
 *     Side = PCSide
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_PCType); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_PC->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(34, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_PC);

  /* "PETSc/PC.pyx":107
 * 
 *     Type = PCType
 *     Side = PCSide             # <<<<<<<<<<<<<<
 * 
 *     ASMType       = PCASMType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_PCSide); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_PC->tp_dict, __pyx_n_s_Side, __pyx_t_3) < 0) __PYX_ERR(34, 107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_PC);

  /* "PETSc/PC.pyx":109
 *     Side = PCSide
 * 
 *     ASMType       = PCASMType             # <<<<<<<<<<<<<<
 *     GASMType      = PCGASMType
 *     MGType        = PCMGType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_PCASMType); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_PC->tp_dict, __pyx_n_s_ASMType, __pyx_t_3) < 0) __PYX_ERR(34, 109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_PC);

  /* "PETSc/PC.pyx":110
 * 
 *     ASMType       = PCASMType
 *     GASMType      = PCGASMType             # <<<<<<<<<<<<<<
 *     MGType        = PCMGType
 *     GAMGType      = PCGAMGType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_PCGASMType); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_PC->tp_dict, __pyx_n_s_GASMType, __pyx_t_3) < 0) __PYX_ERR(34, 110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_PC);

  /* "PETSc/PC.pyx":111
 *     ASMType       = PCASMType
 *     GASMType      = PCGASMType
 *     MGType        = PCMGType             # <<<<<<<<<<<<<<
 *     GAMGType      = PCGAMGType
 *     CompositeType = PCCompositeType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_PCMGType); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_PC->tp_dict, __pyx_n_s_MGType, __pyx_t_3) < 0) __PYX_ERR(34, 111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_PC);

  /* "PETSc/PC.pyx":112
 *     GASMType      = PCGASMType
 *     MGType        = PCMGType
 *     GAMGType      = PCGAMGType             # <<<<<<<<<<<<<<
 *     CompositeType = PCCompositeType
 *     SchurFactType = PCFieldSplitSchurFactType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_PCGAMGType); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_PC->tp_dict, __pyx_n_s_GAMGType, __pyx_t_3) < 0) __PYX_ERR(34, 112, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_PC);

  /* "PETSc/PC.pyx":113
 *     MGType        = PCMGType
 *     GAMGType      = PCGAMGType
 *     CompositeType = PCCompositeType             # <<<<<<<<<<<<<<
 *     SchurFactType = PCFieldSplitSchurFactType
 *     SchurPreType  = PCFieldSplitSchurPreType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_PCCompositeType); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_PC->tp_dict, __pyx_n_s_CompositeType, __pyx_t_3) < 0) __PYX_ERR(34, 113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_PC);

  /* "PETSc/PC.pyx":114
 *     GAMGType      = PCGAMGType
 *     CompositeType = PCCompositeType
 *     SchurFactType = PCFieldSplitSchurFactType             # <<<<<<<<<<<<<<
 *     SchurPreType  = PCFieldSplitSchurPreType
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_PCFieldSplitSchurFactType); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_PC->tp_dict, __pyx_n_s_SchurFactType, __pyx_t_3) < 0) __PYX_ERR(34, 114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_PC);

  /* "PETSc/PC.pyx":115
 *     CompositeType = PCCompositeType
 *     SchurFactType = PCFieldSplitSchurFactType
 *     SchurPreType  = PCFieldSplitSchurPreType             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_PCFieldSplitSchurPreType); if (unlikely(!__pyx_t_3)) __PYX_ERR(34, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_PC->tp_dict, __pyx_n_s_SchurPreType, __pyx_t_3) < 0) __PYX_ERR(34, 115, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_PC);

  /* "PETSc/PC.pyx":574
 * # --------------------------------------------------------------------
 * 
 * del PCType             # <<<<<<<<<<<<<<
 * del PCSide
 * del PCASMType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PCType) < 0) __PYX_ERR(34, 574, __pyx_L1_error)

  /* "PETSc/PC.pyx":575
 * 
 * del PCType
 * del PCSide             # <<<<<<<<<<<<<<
 * del PCASMType
 * del PCGASMType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PCSide) < 0) __PYX_ERR(34, 575, __pyx_L1_error)

  /* "PETSc/PC.pyx":576
 * del PCType
 * del PCSide
 * del PCASMType             # <<<<<<<<<<<<<<
 * del PCGASMType
 * del PCMGType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PCASMType) < 0) __PYX_ERR(34, 576, __pyx_L1_error)

  /* "PETSc/PC.pyx":577
 * del PCSide
 * del PCASMType
 * del PCGASMType             # <<<<<<<<<<<<<<
 * del PCMGType
 * del PCGAMGType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PCGASMType) < 0) __PYX_ERR(34, 577, __pyx_L1_error)

  /* "PETSc/PC.pyx":578
 * del PCASMType
 * del PCGASMType
 * del PCMGType             # <<<<<<<<<<<<<<
 * del PCGAMGType
 * del PCCompositeType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PCMGType) < 0) __PYX_ERR(34, 578, __pyx_L1_error)

  /* "PETSc/PC.pyx":579
 * del PCGASMType
 * del PCMGType
 * del PCGAMGType             # <<<<<<<<<<<<<<
 * del PCCompositeType
 * del PCFieldSplitSchurPreType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PCGAMGType) < 0) __PYX_ERR(34, 579, __pyx_L1_error)

  /* "PETSc/PC.pyx":580
 * del PCMGType
 * del PCGAMGType
 * del PCCompositeType             # <<<<<<<<<<<<<<
 * del PCFieldSplitSchurPreType
 * del PCFieldSplitSchurFactType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PCCompositeType) < 0) __PYX_ERR(34, 580, __pyx_L1_error)

  /* "PETSc/PC.pyx":581
 * del PCGAMGType
 * del PCCompositeType
 * del PCFieldSplitSchurPreType             # <<<<<<<<<<<<<<
 * del PCFieldSplitSchurFactType
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PCFieldSplitSchurPreType) < 0) __PYX_ERR(34, 581, __pyx_L1_error)

  /* "PETSc/PC.pyx":582
 * del PCCompositeType
 * del PCFieldSplitSchurPreType
 * del PCFieldSplitSchurFactType             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PCFieldSplitSchurFactType) < 0) __PYX_ERR(34, 582, __pyx_L1_error)

  /* "PETSc/KSP.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class KSPType(object):             # <<<<<<<<<<<<<<
 *     RICHARDSON = S_(KSPRICHARDSON)
 *     CHEBYSHEV  = S_(KSPCHEBYSHEV)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_KSPType, __pyx_n_s_KSPType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/KSP.pyx":4
 * 
 * class KSPType(object):
 *     RICHARDSON = S_(KSPRICHARDSON)             # <<<<<<<<<<<<<<
 *     CHEBYSHEV  = S_(KSPCHEBYSHEV)
 *     CG         = S_(KSPCG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPRICHARDSON); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_RICHARDSON, __pyx_t_8) < 0) __PYX_ERR(35, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":5
 * class KSPType(object):
 *     RICHARDSON = S_(KSPRICHARDSON)
 *     CHEBYSHEV  = S_(KSPCHEBYSHEV)             # <<<<<<<<<<<<<<
 *     CG         = S_(KSPCG)
 *     GROPPCG    = S_(KSPGROPPCG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPCHEBYSHEV); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CHEBYSHEV, __pyx_t_8) < 0) __PYX_ERR(35, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":6
 *     RICHARDSON = S_(KSPRICHARDSON)
 *     CHEBYSHEV  = S_(KSPCHEBYSHEV)
 *     CG         = S_(KSPCG)             # <<<<<<<<<<<<<<
 *     GROPPCG    = S_(KSPGROPPCG)
 *     PIPECG     = S_(KSPPIPECG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPCG); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CG, __pyx_t_8) < 0) __PYX_ERR(35, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":7
 *     CHEBYSHEV  = S_(KSPCHEBYSHEV)
 *     CG         = S_(KSPCG)
 *     GROPPCG    = S_(KSPGROPPCG)             # <<<<<<<<<<<<<<
 *     PIPECG     = S_(KSPPIPECG)
 *     PIPECGRR   = S_(KSPPIPECGRR)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPGROPPCG); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GROPPCG, __pyx_t_8) < 0) __PYX_ERR(35, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":8
 *     CG         = S_(KSPCG)
 *     GROPPCG    = S_(KSPGROPPCG)
 *     PIPECG     = S_(KSPPIPECG)             # <<<<<<<<<<<<<<
 *     PIPECGRR   = S_(KSPPIPECGRR)
 *     CGNE       = S_(KSPCGNE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPPIPECG); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PIPECG, __pyx_t_8) < 0) __PYX_ERR(35, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":9
 *     GROPPCG    = S_(KSPGROPPCG)
 *     PIPECG     = S_(KSPPIPECG)
 *     PIPECGRR   = S_(KSPPIPECGRR)             # <<<<<<<<<<<<<<
 *     CGNE       = S_(KSPCGNE)
 *     NASH       = S_(KSPNASH)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPPIPECGRR); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PIPECGRR, __pyx_t_8) < 0) __PYX_ERR(35, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":10
 *     PIPECG     = S_(KSPPIPECG)
 *     PIPECGRR   = S_(KSPPIPECGRR)
 *     CGNE       = S_(KSPCGNE)             # <<<<<<<<<<<<<<
 *     NASH       = S_(KSPNASH)
 *     STCG       = S_(KSPSTCG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPCGNE); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CGNE, __pyx_t_8) < 0) __PYX_ERR(35, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":11
 *     PIPECGRR   = S_(KSPPIPECGRR)
 *     CGNE       = S_(KSPCGNE)
 *     NASH       = S_(KSPNASH)             # <<<<<<<<<<<<<<
 *     STCG       = S_(KSPSTCG)
 *     GLTR       = S_(KSPGLTR)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPNASH); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NASH, __pyx_t_8) < 0) __PYX_ERR(35, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":12
 *     CGNE       = S_(KSPCGNE)
 *     NASH       = S_(KSPNASH)
 *     STCG       = S_(KSPSTCG)             # <<<<<<<<<<<<<<
 *     GLTR       = S_(KSPGLTR)
 *     FCG        = S_(KSPFCG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPSTCG); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_STCG, __pyx_t_8) < 0) __PYX_ERR(35, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":13
 *     NASH       = S_(KSPNASH)
 *     STCG       = S_(KSPSTCG)
 *     GLTR       = S_(KSPGLTR)             # <<<<<<<<<<<<<<
 *     FCG        = S_(KSPFCG)
 *     PIPEFCG    = S_(KSPPIPEFCG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPGLTR); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GLTR, __pyx_t_8) < 0) __PYX_ERR(35, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":14
 *     STCG       = S_(KSPSTCG)
 *     GLTR       = S_(KSPGLTR)
 *     FCG        = S_(KSPFCG)             # <<<<<<<<<<<<<<
 *     PIPEFCG    = S_(KSPPIPEFCG)
 *     GMRES      = S_(KSPGMRES)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPFCG); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FCG, __pyx_t_8) < 0) __PYX_ERR(35, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":15
 *     GLTR       = S_(KSPGLTR)
 *     FCG        = S_(KSPFCG)
 *     PIPEFCG    = S_(KSPPIPEFCG)             # <<<<<<<<<<<<<<
 *     GMRES      = S_(KSPGMRES)
 *     PIPEFGMRES = S_(KSPPIPEFGMRES)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPPIPEFCG); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PIPEFCG, __pyx_t_8) < 0) __PYX_ERR(35, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":16
 *     FCG        = S_(KSPFCG)
 *     PIPEFCG    = S_(KSPPIPEFCG)
 *     GMRES      = S_(KSPGMRES)             # <<<<<<<<<<<<<<
 *     PIPEFGMRES = S_(KSPPIPEFGMRES)
 *     FGMRES     = S_(KSPFGMRES)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPGMRES); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GMRES, __pyx_t_8) < 0) __PYX_ERR(35, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":17
 *     PIPEFCG    = S_(KSPPIPEFCG)
 *     GMRES      = S_(KSPGMRES)
 *     PIPEFGMRES = S_(KSPPIPEFGMRES)             # <<<<<<<<<<<<<<
 *     FGMRES     = S_(KSPFGMRES)
 *     LGMRES     = S_(KSPLGMRES)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPPIPEFGMRES); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PIPEFGMRES, __pyx_t_8) < 0) __PYX_ERR(35, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":18
 *     GMRES      = S_(KSPGMRES)
 *     PIPEFGMRES = S_(KSPPIPEFGMRES)
 *     FGMRES     = S_(KSPFGMRES)             # <<<<<<<<<<<<<<
 *     LGMRES     = S_(KSPLGMRES)
 *     DGMRES     = S_(KSPDGMRES)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPFGMRES); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FGMRES, __pyx_t_8) < 0) __PYX_ERR(35, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":19
 *     PIPEFGMRES = S_(KSPPIPEFGMRES)
 *     FGMRES     = S_(KSPFGMRES)
 *     LGMRES     = S_(KSPLGMRES)             # <<<<<<<<<<<<<<
 *     DGMRES     = S_(KSPDGMRES)
 *     PGMRES     = S_(KSPPGMRES)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPLGMRES); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LGMRES, __pyx_t_8) < 0) __PYX_ERR(35, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":20
 *     FGMRES     = S_(KSPFGMRES)
 *     LGMRES     = S_(KSPLGMRES)
 *     DGMRES     = S_(KSPDGMRES)             # <<<<<<<<<<<<<<
 *     PGMRES     = S_(KSPPGMRES)
 *     TCQMR      = S_(KSPTCQMR)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPDGMRES); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DGMRES, __pyx_t_8) < 0) __PYX_ERR(35, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":21
 *     LGMRES     = S_(KSPLGMRES)
 *     DGMRES     = S_(KSPDGMRES)
 *     PGMRES     = S_(KSPPGMRES)             # <<<<<<<<<<<<<<
 *     TCQMR      = S_(KSPTCQMR)
 *     BCGS       = S_(KSPBCGS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPPGMRES); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PGMRES, __pyx_t_8) < 0) __PYX_ERR(35, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":22
 *     DGMRES     = S_(KSPDGMRES)
 *     PGMRES     = S_(KSPPGMRES)
 *     TCQMR      = S_(KSPTCQMR)             # <<<<<<<<<<<<<<
 *     BCGS       = S_(KSPBCGS)
 *     IBCGS      = S_(KSPIBCGS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPTCQMR); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_TCQMR, __pyx_t_8) < 0) __PYX_ERR(35, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":23
 *     PGMRES     = S_(KSPPGMRES)
 *     TCQMR      = S_(KSPTCQMR)
 *     BCGS       = S_(KSPBCGS)             # <<<<<<<<<<<<<<
 *     IBCGS      = S_(KSPIBCGS)
 *     FBCGS      = S_(KSPFBCGS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPBCGS); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BCGS, __pyx_t_8) < 0) __PYX_ERR(35, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":24
 *     TCQMR      = S_(KSPTCQMR)
 *     BCGS       = S_(KSPBCGS)
 *     IBCGS      = S_(KSPIBCGS)             # <<<<<<<<<<<<<<
 *     FBCGS      = S_(KSPFBCGS)
 *     FBCGSR     = S_(KSPFBCGSR)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPIBCGS); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_IBCGS, __pyx_t_8) < 0) __PYX_ERR(35, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":25
 *     BCGS       = S_(KSPBCGS)
 *     IBCGS      = S_(KSPIBCGS)
 *     FBCGS      = S_(KSPFBCGS)             # <<<<<<<<<<<<<<
 *     FBCGSR     = S_(KSPFBCGSR)
 *     BCGSL      = S_(KSPBCGSL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPFBCGS); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FBCGS, __pyx_t_8) < 0) __PYX_ERR(35, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":26
 *     IBCGS      = S_(KSPIBCGS)
 *     FBCGS      = S_(KSPFBCGS)
 *     FBCGSR     = S_(KSPFBCGSR)             # <<<<<<<<<<<<<<
 *     BCGSL      = S_(KSPBCGSL)
 *     CGS        = S_(KSPCGS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPFBCGSR); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FBCGSR, __pyx_t_8) < 0) __PYX_ERR(35, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":27
 *     FBCGS      = S_(KSPFBCGS)
 *     FBCGSR     = S_(KSPFBCGSR)
 *     BCGSL      = S_(KSPBCGSL)             # <<<<<<<<<<<<<<
 *     CGS        = S_(KSPCGS)
 *     TFQMR      = S_(KSPTFQMR)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPBCGSL); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BCGSL, __pyx_t_8) < 0) __PYX_ERR(35, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":28
 *     FBCGSR     = S_(KSPFBCGSR)
 *     BCGSL      = S_(KSPBCGSL)
 *     CGS        = S_(KSPCGS)             # <<<<<<<<<<<<<<
 *     TFQMR      = S_(KSPTFQMR)
 *     CR         = S_(KSPCR)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPCGS); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CGS, __pyx_t_8) < 0) __PYX_ERR(35, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":29
 *     BCGSL      = S_(KSPBCGSL)
 *     CGS        = S_(KSPCGS)
 *     TFQMR      = S_(KSPTFQMR)             # <<<<<<<<<<<<<<
 *     CR         = S_(KSPCR)
 *     PIPECR     = S_(KSPPIPECR)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPTFQMR); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_TFQMR, __pyx_t_8) < 0) __PYX_ERR(35, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":30
 *     CGS        = S_(KSPCGS)
 *     TFQMR      = S_(KSPTFQMR)
 *     CR         = S_(KSPCR)             # <<<<<<<<<<<<<<
 *     PIPECR     = S_(KSPPIPECR)
 *     LSQR       = S_(KSPLSQR)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPCR); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CR, __pyx_t_8) < 0) __PYX_ERR(35, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":31
 *     TFQMR      = S_(KSPTFQMR)
 *     CR         = S_(KSPCR)
 *     PIPECR     = S_(KSPPIPECR)             # <<<<<<<<<<<<<<
 *     LSQR       = S_(KSPLSQR)
 *     PREONLY    = S_(KSPPREONLY)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPPIPECR); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PIPECR, __pyx_t_8) < 0) __PYX_ERR(35, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":32
 *     CR         = S_(KSPCR)
 *     PIPECR     = S_(KSPPIPECR)
 *     LSQR       = S_(KSPLSQR)             # <<<<<<<<<<<<<<
 *     PREONLY    = S_(KSPPREONLY)
 *     QCG        = S_(KSPQCG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPLSQR); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LSQR, __pyx_t_8) < 0) __PYX_ERR(35, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":33
 *     PIPECR     = S_(KSPPIPECR)
 *     LSQR       = S_(KSPLSQR)
 *     PREONLY    = S_(KSPPREONLY)             # <<<<<<<<<<<<<<
 *     QCG        = S_(KSPQCG)
 *     BICG       = S_(KSPBICG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPPREONLY); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PREONLY, __pyx_t_8) < 0) __PYX_ERR(35, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":34
 *     LSQR       = S_(KSPLSQR)
 *     PREONLY    = S_(KSPPREONLY)
 *     QCG        = S_(KSPQCG)             # <<<<<<<<<<<<<<
 *     BICG       = S_(KSPBICG)
 *     MINRES     = S_(KSPMINRES)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPQCG); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_QCG, __pyx_t_8) < 0) __PYX_ERR(35, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":35
 *     PREONLY    = S_(KSPPREONLY)
 *     QCG        = S_(KSPQCG)
 *     BICG       = S_(KSPBICG)             # <<<<<<<<<<<<<<
 *     MINRES     = S_(KSPMINRES)
 *     SYMMLQ     = S_(KSPSYMMLQ)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPBICG); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BICG, __pyx_t_8) < 0) __PYX_ERR(35, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":36
 *     QCG        = S_(KSPQCG)
 *     BICG       = S_(KSPBICG)
 *     MINRES     = S_(KSPMINRES)             # <<<<<<<<<<<<<<
 *     SYMMLQ     = S_(KSPSYMMLQ)
 *     LCD        = S_(KSPLCD)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPMINRES); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MINRES, __pyx_t_8) < 0) __PYX_ERR(35, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":37
 *     BICG       = S_(KSPBICG)
 *     MINRES     = S_(KSPMINRES)
 *     SYMMLQ     = S_(KSPSYMMLQ)             # <<<<<<<<<<<<<<
 *     LCD        = S_(KSPLCD)
 *     PYTHON     = S_(KSPPYTHON)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPSYMMLQ); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SYMMLQ, __pyx_t_8) < 0) __PYX_ERR(35, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":38
 *     MINRES     = S_(KSPMINRES)
 *     SYMMLQ     = S_(KSPSYMMLQ)
 *     LCD        = S_(KSPLCD)             # <<<<<<<<<<<<<<
 *     PYTHON     = S_(KSPPYTHON)
 *     GCR        = S_(KSPGCR)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPLCD); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LCD, __pyx_t_8) < 0) __PYX_ERR(35, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":39
 *     SYMMLQ     = S_(KSPSYMMLQ)
 *     LCD        = S_(KSPLCD)
 *     PYTHON     = S_(KSPPYTHON)             # <<<<<<<<<<<<<<
 *     GCR        = S_(KSPGCR)
 *     PIPEGCR    = S_(KSPPIPEGCR)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPPYTHON); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PYTHON, __pyx_t_8) < 0) __PYX_ERR(35, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":40
 *     LCD        = S_(KSPLCD)
 *     PYTHON     = S_(KSPPYTHON)
 *     GCR        = S_(KSPGCR)             # <<<<<<<<<<<<<<
 *     PIPEGCR    = S_(KSPPIPEGCR)
 *     TSIRM      = S_(KSPTSIRM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPGCR); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GCR, __pyx_t_8) < 0) __PYX_ERR(35, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":41
 *     PYTHON     = S_(KSPPYTHON)
 *     GCR        = S_(KSPGCR)
 *     PIPEGCR    = S_(KSPPIPEGCR)             # <<<<<<<<<<<<<<
 *     TSIRM      = S_(KSPTSIRM)
 *     CGLS       = S_(KSPCGLS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPPIPEGCR); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PIPEGCR, __pyx_t_8) < 0) __PYX_ERR(35, 41, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":42
 *     GCR        = S_(KSPGCR)
 *     PIPEGCR    = S_(KSPPIPEGCR)
 *     TSIRM      = S_(KSPTSIRM)             # <<<<<<<<<<<<<<
 *     CGLS       = S_(KSPCGLS)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPTSIRM); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_TSIRM, __pyx_t_8) < 0) __PYX_ERR(35, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":43
 *     PIPEGCR    = S_(KSPPIPEGCR)
 *     TSIRM      = S_(KSPTSIRM)
 *     CGLS       = S_(KSPCGLS)             # <<<<<<<<<<<<<<
 * 
 * class KSPNormType(object):
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(KSPCGLS); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CGLS, __pyx_t_8) < 0) __PYX_ERR(35, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class KSPType(object):             # <<<<<<<<<<<<<<
 *     RICHARDSON = S_(KSPRICHARDSON)
 *     CHEBYSHEV  = S_(KSPCHEBYSHEV)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_KSPType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_KSPType, __pyx_t_8) < 0) __PYX_ERR(35, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/KSP.pyx":45
 *     CGLS       = S_(KSPCGLS)
 * 
 * class KSPNormType(object):             # <<<<<<<<<<<<<<
 *     # native
 *     NORM_DEFAULT          = KSP_NORM_DEFAULT
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_KSPNormType, __pyx_n_s_KSPNormType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/KSP.pyx":47
 * class KSPNormType(object):
 *     # native
 *     NORM_DEFAULT          = KSP_NORM_DEFAULT             # <<<<<<<<<<<<<<
 *     NORM_NONE             = KSP_NORM_NONE
 *     NORM_PRECONDITIONED   = KSP_NORM_PRECONDITIONED
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPNormType(KSP_NORM_DEFAULT); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_DEFAULT, __pyx_t_8) < 0) __PYX_ERR(35, 47, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":48
 *     # native
 *     NORM_DEFAULT          = KSP_NORM_DEFAULT
 *     NORM_NONE             = KSP_NORM_NONE             # <<<<<<<<<<<<<<
 *     NORM_PRECONDITIONED   = KSP_NORM_PRECONDITIONED
 *     NORM_UNPRECONDITIONED = KSP_NORM_UNPRECONDITIONED
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPNormType(KSP_NORM_NONE); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_NONE, __pyx_t_8) < 0) __PYX_ERR(35, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":49
 *     NORM_DEFAULT          = KSP_NORM_DEFAULT
 *     NORM_NONE             = KSP_NORM_NONE
 *     NORM_PRECONDITIONED   = KSP_NORM_PRECONDITIONED             # <<<<<<<<<<<<<<
 *     NORM_UNPRECONDITIONED = KSP_NORM_UNPRECONDITIONED
 *     NORM_NATURAL          = KSP_NORM_NATURAL
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPNormType(KSP_NORM_PRECONDITIONED); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_PRECONDITIONED, __pyx_t_8) < 0) __PYX_ERR(35, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":50
 *     NORM_NONE             = KSP_NORM_NONE
 *     NORM_PRECONDITIONED   = KSP_NORM_PRECONDITIONED
 *     NORM_UNPRECONDITIONED = KSP_NORM_UNPRECONDITIONED             # <<<<<<<<<<<<<<
 *     NORM_NATURAL          = KSP_NORM_NATURAL
 *     # aliases
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPNormType(KSP_NORM_UNPRECONDITIONED); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_UNPRECONDITIONED, __pyx_t_8) < 0) __PYX_ERR(35, 50, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":51
 *     NORM_PRECONDITIONED   = KSP_NORM_PRECONDITIONED
 *     NORM_UNPRECONDITIONED = KSP_NORM_UNPRECONDITIONED
 *     NORM_NATURAL          = KSP_NORM_NATURAL             # <<<<<<<<<<<<<<
 *     # aliases
 *     DEFAULT          = NORM_DEFAULT
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPNormType(KSP_NORM_NATURAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_NATURAL, __pyx_t_8) < 0) __PYX_ERR(35, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":53
 *     NORM_NATURAL          = KSP_NORM_NATURAL
 *     # aliases
 *     DEFAULT          = NORM_DEFAULT             # <<<<<<<<<<<<<<
 *     NONE = NO        = NORM_NONE
 *     PRECONDITIONED   = NORM_PRECONDITIONED
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_DEFAULT);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_DEFAULT);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DEFAULT, __pyx_t_8) < 0) __PYX_ERR(35, 53, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":54
 *     # aliases
 *     DEFAULT          = NORM_DEFAULT
 *     NONE = NO        = NORM_NONE             # <<<<<<<<<<<<<<
 *     PRECONDITIONED   = NORM_PRECONDITIONED
 *     UNPRECONDITIONED = NORM_UNPRECONDITIONED
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_NONE);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_NONE);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NONE, __pyx_t_8) < 0) __PYX_ERR(35, 54, __pyx_L1_error)
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NO, __pyx_t_8) < 0) __PYX_ERR(35, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":55
 *     DEFAULT          = NORM_DEFAULT
 *     NONE = NO        = NORM_NONE
 *     PRECONDITIONED   = NORM_PRECONDITIONED             # <<<<<<<<<<<<<<
 *     UNPRECONDITIONED = NORM_UNPRECONDITIONED
 *     NATURAL          = NORM_NATURAL
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_PRECONDITIONED);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_PRECONDITIONED);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PRECONDITIONED, __pyx_t_8) < 0) __PYX_ERR(35, 55, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":56
 *     NONE = NO        = NORM_NONE
 *     PRECONDITIONED   = NORM_PRECONDITIONED
 *     UNPRECONDITIONED = NORM_UNPRECONDITIONED             # <<<<<<<<<<<<<<
 *     NATURAL          = NORM_NATURAL
 * 
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_UNPRECONDITIONED);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_UNPRECONDITIONED);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_UNPRECONDITIONED, __pyx_t_8) < 0) __PYX_ERR(35, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":57
 *     PRECONDITIONED   = NORM_PRECONDITIONED
 *     UNPRECONDITIONED = NORM_UNPRECONDITIONED
 *     NATURAL          = NORM_NATURAL             # <<<<<<<<<<<<<<
 * 
 * class KSPConvergedReason(object):
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_NATURAL);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_NATURAL);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NATURAL, __pyx_t_8) < 0) __PYX_ERR(35, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":45
 *     CGLS       = S_(KSPCGLS)
 * 
 * class KSPNormType(object):             # <<<<<<<<<<<<<<
 *     # native
 *     NORM_DEFAULT          = KSP_NORM_DEFAULT
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_KSPNormType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_KSPNormType, __pyx_t_8) < 0) __PYX_ERR(35, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/KSP.pyx":59
 *     NATURAL          = NORM_NATURAL
 * 
 * class KSPConvergedReason(object):             # <<<<<<<<<<<<<<
 *     #iterating
 *     CONVERGED_ITERATING       = KSP_CONVERGED_ITERATING
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(35, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_KSPConvergedReason, __pyx_n_s_KSPConvergedReason, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(35, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/KSP.pyx":61
 * class KSPConvergedReason(object):
 *     #iterating
 *     CONVERGED_ITERATING       = KSP_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *     ITERATING                 = KSP_CONVERGED_ITERATING
 *     # converged
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_CONVERGED_ITERATING); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_ITERATING, __pyx_t_8) < 0) __PYX_ERR(35, 61, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":62
 *     #iterating
 *     CONVERGED_ITERATING       = KSP_CONVERGED_ITERATING
 *     ITERATING                 = KSP_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *     # converged
 *     CONVERGED_RTOL_NORMAL     = KSP_CONVERGED_RTOL_NORMAL
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_CONVERGED_ITERATING); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ITERATING, __pyx_t_8) < 0) __PYX_ERR(35, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":64
 *     ITERATING                 = KSP_CONVERGED_ITERATING
 *     # converged
 *     CONVERGED_RTOL_NORMAL     = KSP_CONVERGED_RTOL_NORMAL             # <<<<<<<<<<<<<<
 *     CONVERGED_ATOL_NORMAL     = KSP_CONVERGED_ATOL_NORMAL
 *     CONVERGED_RTOL            = KSP_CONVERGED_RTOL
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_CONVERGED_RTOL_NORMAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_RTOL_NORMAL, __pyx_t_8) < 0) __PYX_ERR(35, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":65
 *     # converged
 *     CONVERGED_RTOL_NORMAL     = KSP_CONVERGED_RTOL_NORMAL
 *     CONVERGED_ATOL_NORMAL     = KSP_CONVERGED_ATOL_NORMAL             # <<<<<<<<<<<<<<
 *     CONVERGED_RTOL            = KSP_CONVERGED_RTOL
 *     CONVERGED_ATOL            = KSP_CONVERGED_ATOL
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_CONVERGED_ATOL_NORMAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_ATOL_NORMAL, __pyx_t_8) < 0) __PYX_ERR(35, 65, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":66
 *     CONVERGED_RTOL_NORMAL     = KSP_CONVERGED_RTOL_NORMAL
 *     CONVERGED_ATOL_NORMAL     = KSP_CONVERGED_ATOL_NORMAL
 *     CONVERGED_RTOL            = KSP_CONVERGED_RTOL             # <<<<<<<<<<<<<<
 *     CONVERGED_ATOL            = KSP_CONVERGED_ATOL
 *     CONVERGED_ITS             = KSP_CONVERGED_ITS
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_CONVERGED_RTOL); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_RTOL, __pyx_t_8) < 0) __PYX_ERR(35, 66, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":67
 *     CONVERGED_ATOL_NORMAL     = KSP_CONVERGED_ATOL_NORMAL
 *     CONVERGED_RTOL            = KSP_CONVERGED_RTOL
 *     CONVERGED_ATOL            = KSP_CONVERGED_ATOL             # <<<<<<<<<<<<<<
 *     CONVERGED_ITS             = KSP_CONVERGED_ITS
 *     CONVERGED_CG_NEG_CURVE    = KSP_CONVERGED_CG_NEG_CURVE
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_CONVERGED_ATOL); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_ATOL, __pyx_t_8) < 0) __PYX_ERR(35, 67, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":68
 *     CONVERGED_RTOL            = KSP_CONVERGED_RTOL
 *     CONVERGED_ATOL            = KSP_CONVERGED_ATOL
 *     CONVERGED_ITS             = KSP_CONVERGED_ITS             # <<<<<<<<<<<<<<
 *     CONVERGED_CG_NEG_CURVE    = KSP_CONVERGED_CG_NEG_CURVE
 *     CONVERGED_CG_CONSTRAINED  = KSP_CONVERGED_CG_CONSTRAINED
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_CONVERGED_ITS); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_ITS, __pyx_t_8) < 0) __PYX_ERR(35, 68, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":69
 *     CONVERGED_ATOL            = KSP_CONVERGED_ATOL
 *     CONVERGED_ITS             = KSP_CONVERGED_ITS
 *     CONVERGED_CG_NEG_CURVE    = KSP_CONVERGED_CG_NEG_CURVE             # <<<<<<<<<<<<<<
 *     CONVERGED_CG_CONSTRAINED  = KSP_CONVERGED_CG_CONSTRAINED
 *     CONVERGED_STEP_LENGTH     = KSP_CONVERGED_STEP_LENGTH
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_CONVERGED_CG_NEG_CURVE); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_CG_NEG_CURVE, __pyx_t_8) < 0) __PYX_ERR(35, 69, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":70
 *     CONVERGED_ITS             = KSP_CONVERGED_ITS
 *     CONVERGED_CG_NEG_CURVE    = KSP_CONVERGED_CG_NEG_CURVE
 *     CONVERGED_CG_CONSTRAINED  = KSP_CONVERGED_CG_CONSTRAINED             # <<<<<<<<<<<<<<
 *     CONVERGED_STEP_LENGTH     = KSP_CONVERGED_STEP_LENGTH
 *     CONVERGED_HAPPY_BREAKDOWN = KSP_CONVERGED_HAPPY_BREAKDOWN
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_CONVERGED_CG_CONSTRAINED); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_CG_CONSTRAINED, __pyx_t_8) < 0) __PYX_ERR(35, 70, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":71
 *     CONVERGED_CG_NEG_CURVE    = KSP_CONVERGED_CG_NEG_CURVE
 *     CONVERGED_CG_CONSTRAINED  = KSP_CONVERGED_CG_CONSTRAINED
 *     CONVERGED_STEP_LENGTH     = KSP_CONVERGED_STEP_LENGTH             # <<<<<<<<<<<<<<
 *     CONVERGED_HAPPY_BREAKDOWN = KSP_CONVERGED_HAPPY_BREAKDOWN
 *     # diverged
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_CONVERGED_STEP_LENGTH); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_STEP_LENGTH, __pyx_t_8) < 0) __PYX_ERR(35, 71, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":72
 *     CONVERGED_CG_CONSTRAINED  = KSP_CONVERGED_CG_CONSTRAINED
 *     CONVERGED_STEP_LENGTH     = KSP_CONVERGED_STEP_LENGTH
 *     CONVERGED_HAPPY_BREAKDOWN = KSP_CONVERGED_HAPPY_BREAKDOWN             # <<<<<<<<<<<<<<
 *     # diverged
 *     DIVERGED_NULL             = KSP_DIVERGED_NULL
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_CONVERGED_HAPPY_BREAKDOWN); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_HAPPY_BREAKDOWN, __pyx_t_8) < 0) __PYX_ERR(35, 72, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":74
 *     CONVERGED_HAPPY_BREAKDOWN = KSP_CONVERGED_HAPPY_BREAKDOWN
 *     # diverged
 *     DIVERGED_NULL             = KSP_DIVERGED_NULL             # <<<<<<<<<<<<<<
 *     DIVERGED_MAX_IT           = KSP_DIVERGED_MAX_IT
 *     DIVERGED_DTOL             = KSP_DIVERGED_DTOL
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_DIVERGED_NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_NULL, __pyx_t_8) < 0) __PYX_ERR(35, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":75
 *     # diverged
 *     DIVERGED_NULL             = KSP_DIVERGED_NULL
 *     DIVERGED_MAX_IT           = KSP_DIVERGED_MAX_IT             # <<<<<<<<<<<<<<
 *     DIVERGED_DTOL             = KSP_DIVERGED_DTOL
 *     DIVERGED_BREAKDOWN        = KSP_DIVERGED_BREAKDOWN
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_DIVERGED_ITS); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_MAX_IT, __pyx_t_8) < 0) __PYX_ERR(35, 75, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":76
 *     DIVERGED_NULL             = KSP_DIVERGED_NULL
 *     DIVERGED_MAX_IT           = KSP_DIVERGED_MAX_IT
 *     DIVERGED_DTOL             = KSP_DIVERGED_DTOL             # <<<<<<<<<<<<<<
 *     DIVERGED_BREAKDOWN        = KSP_DIVERGED_BREAKDOWN
 *     DIVERGED_BREAKDOWN_BICG   = KSP_DIVERGED_BREAKDOWN_BICG
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_DIVERGED_DTOL); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_DTOL, __pyx_t_8) < 0) __PYX_ERR(35, 76, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":77
 *     DIVERGED_MAX_IT           = KSP_DIVERGED_MAX_IT
 *     DIVERGED_DTOL             = KSP_DIVERGED_DTOL
 *     DIVERGED_BREAKDOWN        = KSP_DIVERGED_BREAKDOWN             # <<<<<<<<<<<<<<
 *     DIVERGED_BREAKDOWN_BICG   = KSP_DIVERGED_BREAKDOWN_BICG
 *     DIVERGED_NONSYMMETRIC     = KSP_DIVERGED_NONSYMMETRIC
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_DIVERGED_BREAKDOWN); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_BREAKDOWN, __pyx_t_8) < 0) __PYX_ERR(35, 77, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":78
 *     DIVERGED_DTOL             = KSP_DIVERGED_DTOL
 *     DIVERGED_BREAKDOWN        = KSP_DIVERGED_BREAKDOWN
 *     DIVERGED_BREAKDOWN_BICG   = KSP_DIVERGED_BREAKDOWN_BICG             # <<<<<<<<<<<<<<
 *     DIVERGED_NONSYMMETRIC     = KSP_DIVERGED_NONSYMMETRIC
 *     DIVERGED_INDEFINITE_PC    = KSP_DIVERGED_INDEFINITE_PC
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_DIVERGED_BREAKDOWN_BICG); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_BREAKDOWN_BICG, __pyx_t_8) < 0) __PYX_ERR(35, 78, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":79
 *     DIVERGED_BREAKDOWN        = KSP_DIVERGED_BREAKDOWN
 *     DIVERGED_BREAKDOWN_BICG   = KSP_DIVERGED_BREAKDOWN_BICG
 *     DIVERGED_NONSYMMETRIC     = KSP_DIVERGED_NONSYMMETRIC             # <<<<<<<<<<<<<<
 *     DIVERGED_INDEFINITE_PC    = KSP_DIVERGED_INDEFINITE_PC
 *     DIVERGED_NANORINF         = KSP_DIVERGED_NANORINF
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_DIVERGED_NONSYMMETRIC); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_NONSYMMETRIC, __pyx_t_8) < 0) __PYX_ERR(35, 79, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":80
 *     DIVERGED_BREAKDOWN_BICG   = KSP_DIVERGED_BREAKDOWN_BICG
 *     DIVERGED_NONSYMMETRIC     = KSP_DIVERGED_NONSYMMETRIC
 *     DIVERGED_INDEFINITE_PC    = KSP_DIVERGED_INDEFINITE_PC             # <<<<<<<<<<<<<<
 *     DIVERGED_NANORINF         = KSP_DIVERGED_NANORINF
 *     DIVERGED_INDEFINITE_MAT   = KSP_DIVERGED_INDEFINITE_MAT
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_DIVERGED_INDEFINITE_PC); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_INDEFINITE_PC, __pyx_t_8) < 0) __PYX_ERR(35, 80, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":81
 *     DIVERGED_NONSYMMETRIC     = KSP_DIVERGED_NONSYMMETRIC
 *     DIVERGED_INDEFINITE_PC    = KSP_DIVERGED_INDEFINITE_PC
 *     DIVERGED_NANORINF         = KSP_DIVERGED_NANORINF             # <<<<<<<<<<<<<<
 *     DIVERGED_INDEFINITE_MAT   = KSP_DIVERGED_INDEFINITE_MAT
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_DIVERGED_NANORINF); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_NANORINF, __pyx_t_8) < 0) __PYX_ERR(35, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":82
 *     DIVERGED_INDEFINITE_PC    = KSP_DIVERGED_INDEFINITE_PC
 *     DIVERGED_NANORINF         = KSP_DIVERGED_NANORINF
 *     DIVERGED_INDEFINITE_MAT   = KSP_DIVERGED_INDEFINITE_MAT             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = __Pyx_PyInt_From_KSPConvergedReason(KSP_DIVERGED_INDEFINITE_MAT); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_INDEFINITE_MAT, __pyx_t_8) < 0) __PYX_ERR(35, 82, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/KSP.pyx":59
 *     NATURAL          = NORM_NATURAL
 * 
 * class KSPConvergedReason(object):             # <<<<<<<<<<<<<<
 *     #iterating
 *     CONVERGED_ITERATING       = KSP_CONVERGED_ITERATING
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_KSPConvergedReason, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(35, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_KSPConvergedReason, __pyx_t_8) < 0) __PYX_ERR(35, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/KSP.pyx":88
 * cdef class KSP(Object):
 * 
 *     Type            = KSPType             # <<<<<<<<<<<<<<
 *     NormType        = KSPNormType
 *     ConvergedReason = KSPConvergedReason
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_KSPType); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(35, 88, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_KSP);

  /* "PETSc/KSP.pyx":89
 * 
 *     Type            = KSPType
 *     NormType        = KSPNormType             # <<<<<<<<<<<<<<
 *     ConvergedReason = KSPConvergedReason
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_KSPNormType); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP->tp_dict, __pyx_n_s_NormType, __pyx_t_3) < 0) __PYX_ERR(35, 89, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_KSP);

  /* "PETSc/KSP.pyx":90
 *     Type            = KSPType
 *     NormType        = KSPNormType
 *     ConvergedReason = KSPConvergedReason             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_KSPConvergedReason); if (unlikely(!__pyx_t_3)) __PYX_ERR(35, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_KSP->tp_dict, __pyx_n_s_ConvergedReason, __pyx_t_3) < 0) __PYX_ERR(35, 90, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_KSP);

  /* "PETSc/KSP.pyx":655
 * # --------------------------------------------------------------------
 * 
 * del KSPType             # <<<<<<<<<<<<<<
 * del KSPNormType
 * del KSPConvergedReason
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_KSPType) < 0) __PYX_ERR(35, 655, __pyx_L1_error)

  /* "PETSc/KSP.pyx":656
 * 
 * del KSPType
 * del KSPNormType             # <<<<<<<<<<<<<<
 * del KSPConvergedReason
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_KSPNormType) < 0) __PYX_ERR(35, 656, __pyx_L1_error)

  /* "PETSc/KSP.pyx":657
 * del KSPType
 * del KSPNormType
 * del KSPConvergedReason             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_KSPConvergedReason) < 0) __PYX_ERR(35, 657, __pyx_L1_error)

  /* "PETSc/SNES.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class SNESType(object):             # <<<<<<<<<<<<<<
 *     NEWTONLS     = S_(SNESNEWTONLS)
 *     NEWTONTR     = S_(SNESNEWTONTR)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_SNESType, __pyx_n_s_SNESType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/SNES.pyx":4
 * 
 * class SNESType(object):
 *     NEWTONLS     = S_(SNESNEWTONLS)             # <<<<<<<<<<<<<<
 *     NEWTONTR     = S_(SNESNEWTONTR)
 *     PYTHON       = S_(SNESPYTHON)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESNEWTONLS); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NEWTONLS, __pyx_t_8) < 0) __PYX_ERR(36, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":5
 * class SNESType(object):
 *     NEWTONLS     = S_(SNESNEWTONLS)
 *     NEWTONTR     = S_(SNESNEWTONTR)             # <<<<<<<<<<<<<<
 *     PYTHON       = S_(SNESPYTHON)
 *     TEST         = S_(SNESTEST)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESNEWTONTR); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NEWTONTR, __pyx_t_8) < 0) __PYX_ERR(36, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":6
 *     NEWTONLS     = S_(SNESNEWTONLS)
 *     NEWTONTR     = S_(SNESNEWTONTR)
 *     PYTHON       = S_(SNESPYTHON)             # <<<<<<<<<<<<<<
 *     TEST         = S_(SNESTEST)
 *     NRICHARDSON  = S_(SNESNRICHARDSON)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESPYTHON); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PYTHON, __pyx_t_8) < 0) __PYX_ERR(36, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":7
 *     NEWTONTR     = S_(SNESNEWTONTR)
 *     PYTHON       = S_(SNESPYTHON)
 *     TEST         = S_(SNESTEST)             # <<<<<<<<<<<<<<
 *     NRICHARDSON  = S_(SNESNRICHARDSON)
 *     KSPONLY      = S_(SNESKSPONLY)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESTEST); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_TEST, __pyx_t_8) < 0) __PYX_ERR(36, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":8
 *     PYTHON       = S_(SNESPYTHON)
 *     TEST         = S_(SNESTEST)
 *     NRICHARDSON  = S_(SNESNRICHARDSON)             # <<<<<<<<<<<<<<
 *     KSPONLY      = S_(SNESKSPONLY)
 *     VINEWTONRSLS = S_(SNESVINEWTONRSLS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESNRICHARDSON); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NRICHARDSON, __pyx_t_8) < 0) __PYX_ERR(36, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":9
 *     TEST         = S_(SNESTEST)
 *     NRICHARDSON  = S_(SNESNRICHARDSON)
 *     KSPONLY      = S_(SNESKSPONLY)             # <<<<<<<<<<<<<<
 *     VINEWTONRSLS = S_(SNESVINEWTONRSLS)
 *     VINEWTONSSLS = S_(SNESVINEWTONSSLS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESKSPONLY); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_KSPONLY, __pyx_t_8) < 0) __PYX_ERR(36, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":10
 *     NRICHARDSON  = S_(SNESNRICHARDSON)
 *     KSPONLY      = S_(SNESKSPONLY)
 *     VINEWTONRSLS = S_(SNESVINEWTONRSLS)             # <<<<<<<<<<<<<<
 *     VINEWTONSSLS = S_(SNESVINEWTONSSLS)
 *     NGMRES       = S_(SNESNGMRES)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESVINEWTONRSLS); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_VINEWTONRSLS, __pyx_t_8) < 0) __PYX_ERR(36, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":11
 *     KSPONLY      = S_(SNESKSPONLY)
 *     VINEWTONRSLS = S_(SNESVINEWTONRSLS)
 *     VINEWTONSSLS = S_(SNESVINEWTONSSLS)             # <<<<<<<<<<<<<<
 *     NGMRES       = S_(SNESNGMRES)
 *     QN           = S_(SNESQN)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESVINEWTONSSLS); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_VINEWTONSSLS, __pyx_t_8) < 0) __PYX_ERR(36, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":12
 *     VINEWTONRSLS = S_(SNESVINEWTONRSLS)
 *     VINEWTONSSLS = S_(SNESVINEWTONSSLS)
 *     NGMRES       = S_(SNESNGMRES)             # <<<<<<<<<<<<<<
 *     QN           = S_(SNESQN)
 *     SHELL        = S_(SNESSHELL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESNGMRES); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NGMRES, __pyx_t_8) < 0) __PYX_ERR(36, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":13
 *     VINEWTONSSLS = S_(SNESVINEWTONSSLS)
 *     NGMRES       = S_(SNESNGMRES)
 *     QN           = S_(SNESQN)             # <<<<<<<<<<<<<<
 *     SHELL        = S_(SNESSHELL)
 *     NGS          = S_(SNESNGS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESQN); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_QN, __pyx_t_8) < 0) __PYX_ERR(36, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":14
 *     NGMRES       = S_(SNESNGMRES)
 *     QN           = S_(SNESQN)
 *     SHELL        = S_(SNESSHELL)             # <<<<<<<<<<<<<<
 *     NGS          = S_(SNESNGS)
 *     NCG          = S_(SNESNCG)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESSHELL); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SHELL, __pyx_t_8) < 0) __PYX_ERR(36, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":15
 *     QN           = S_(SNESQN)
 *     SHELL        = S_(SNESSHELL)
 *     NGS          = S_(SNESNGS)             # <<<<<<<<<<<<<<
 *     NCG          = S_(SNESNCG)
 *     FAS          = S_(SNESFAS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESNGS); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NGS, __pyx_t_8) < 0) __PYX_ERR(36, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":16
 *     SHELL        = S_(SNESSHELL)
 *     NGS          = S_(SNESNGS)
 *     NCG          = S_(SNESNCG)             # <<<<<<<<<<<<<<
 *     FAS          = S_(SNESFAS)
 *     MS           = S_(SNESMS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESNCG); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NCG, __pyx_t_8) < 0) __PYX_ERR(36, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":17
 *     NGS          = S_(SNESNGS)
 *     NCG          = S_(SNESNCG)
 *     FAS          = S_(SNESFAS)             # <<<<<<<<<<<<<<
 *     MS           = S_(SNESMS)
 *     NASM         = S_(SNESNASM)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESFAS); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FAS, __pyx_t_8) < 0) __PYX_ERR(36, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":18
 *     NCG          = S_(SNESNCG)
 *     FAS          = S_(SNESFAS)
 *     MS           = S_(SNESMS)             # <<<<<<<<<<<<<<
 *     NASM         = S_(SNESNASM)
 *     ANDERSON     = S_(SNESANDERSON)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESMS); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MS, __pyx_t_8) < 0) __PYX_ERR(36, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":19
 *     FAS          = S_(SNESFAS)
 *     MS           = S_(SNESMS)
 *     NASM         = S_(SNESNASM)             # <<<<<<<<<<<<<<
 *     ANDERSON     = S_(SNESANDERSON)
 *     ASPIN        = S_(SNESASPIN)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESNASM); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NASM, __pyx_t_8) < 0) __PYX_ERR(36, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":20
 *     MS           = S_(SNESMS)
 *     NASM         = S_(SNESNASM)
 *     ANDERSON     = S_(SNESANDERSON)             # <<<<<<<<<<<<<<
 *     ASPIN        = S_(SNESASPIN)
 *     COMPOSITE    = S_(SNESCOMPOSITE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESANDERSON); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ANDERSON, __pyx_t_8) < 0) __PYX_ERR(36, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":21
 *     NASM         = S_(SNESNASM)
 *     ANDERSON     = S_(SNESANDERSON)
 *     ASPIN        = S_(SNESASPIN)             # <<<<<<<<<<<<<<
 *     COMPOSITE    = S_(SNESCOMPOSITE)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESASPIN); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ASPIN, __pyx_t_8) < 0) __PYX_ERR(36, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":22
 *     ANDERSON     = S_(SNESANDERSON)
 *     ASPIN        = S_(SNESASPIN)
 *     COMPOSITE    = S_(SNESCOMPOSITE)             # <<<<<<<<<<<<<<
 * 
 * class SNESNormSchedule(object):
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(SNESCOMPOSITE); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_COMPOSITE, __pyx_t_8) < 0) __PYX_ERR(36, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class SNESType(object):             # <<<<<<<<<<<<<<
 *     NEWTONLS     = S_(SNESNEWTONLS)
 *     NEWTONTR     = S_(SNESNEWTONTR)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_SNESType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SNESType, __pyx_t_8) < 0) __PYX_ERR(36, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/SNES.pyx":24
 *     COMPOSITE    = S_(SNESCOMPOSITE)
 * 
 * class SNESNormSchedule(object):             # <<<<<<<<<<<<<<
 *     # native
 *     NORM_DEFAULT            = SNES_NORM_DEFAULT
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_SNESNormSchedule, __pyx_n_s_SNESNormSchedule, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/SNES.pyx":26
 * class SNESNormSchedule(object):
 *     # native
 *     NORM_DEFAULT            = SNES_NORM_DEFAULT             # <<<<<<<<<<<<<<
 *     NORM_NONE               = SNES_NORM_NONE
 *     NORM_ALWAYS             = SNES_NORM_ALWAYS
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESNormSchedule(SNES_NORM_DEFAULT); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_DEFAULT, __pyx_t_8) < 0) __PYX_ERR(36, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":27
 *     # native
 *     NORM_DEFAULT            = SNES_NORM_DEFAULT
 *     NORM_NONE               = SNES_NORM_NONE             # <<<<<<<<<<<<<<
 *     NORM_ALWAYS             = SNES_NORM_ALWAYS
 *     NORM_INITIAL_ONLY       = SNES_NORM_INITIAL_ONLY
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESNormSchedule(SNES_NORM_NONE); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_NONE, __pyx_t_8) < 0) __PYX_ERR(36, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":28
 *     NORM_DEFAULT            = SNES_NORM_DEFAULT
 *     NORM_NONE               = SNES_NORM_NONE
 *     NORM_ALWAYS             = SNES_NORM_ALWAYS             # <<<<<<<<<<<<<<
 *     NORM_INITIAL_ONLY       = SNES_NORM_INITIAL_ONLY
 *     NORM_FINAL_ONLY         = SNES_NORM_FINAL_ONLY
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESNormSchedule(SNES_NORM_ALWAYS); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_ALWAYS, __pyx_t_8) < 0) __PYX_ERR(36, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":29
 *     NORM_NONE               = SNES_NORM_NONE
 *     NORM_ALWAYS             = SNES_NORM_ALWAYS
 *     NORM_INITIAL_ONLY       = SNES_NORM_INITIAL_ONLY             # <<<<<<<<<<<<<<
 *     NORM_FINAL_ONLY         = SNES_NORM_FINAL_ONLY
 *     NORM_INITIAL_FINAL_ONLY = SNES_NORM_INITIAL_FINAL_ONLY
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESNormSchedule(SNES_NORM_INITIAL_ONLY); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_INITIAL_ONLY, __pyx_t_8) < 0) __PYX_ERR(36, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":30
 *     NORM_ALWAYS             = SNES_NORM_ALWAYS
 *     NORM_INITIAL_ONLY       = SNES_NORM_INITIAL_ONLY
 *     NORM_FINAL_ONLY         = SNES_NORM_FINAL_ONLY             # <<<<<<<<<<<<<<
 *     NORM_INITIAL_FINAL_ONLY = SNES_NORM_INITIAL_FINAL_ONLY
 *     # aliases
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESNormSchedule(SNES_NORM_FINAL_ONLY); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_FINAL_ONLY, __pyx_t_8) < 0) __PYX_ERR(36, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":31
 *     NORM_INITIAL_ONLY       = SNES_NORM_INITIAL_ONLY
 *     NORM_FINAL_ONLY         = SNES_NORM_FINAL_ONLY
 *     NORM_INITIAL_FINAL_ONLY = SNES_NORM_INITIAL_FINAL_ONLY             # <<<<<<<<<<<<<<
 *     # aliases
 *     DEFAULT            = NORM_DEFAULT
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESNormSchedule(SNES_NORM_INITIAL_FINAL_ONLY); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NORM_INITIAL_FINAL_ONLY, __pyx_t_8) < 0) __PYX_ERR(36, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":33
 *     NORM_INITIAL_FINAL_ONLY = SNES_NORM_INITIAL_FINAL_ONLY
 *     # aliases
 *     DEFAULT            = NORM_DEFAULT             # <<<<<<<<<<<<<<
 *     NONE               = NORM_NONE
 *     ALWAYS             = NORM_ALWAYS
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_DEFAULT);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_DEFAULT);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DEFAULT, __pyx_t_8) < 0) __PYX_ERR(36, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":34
 *     # aliases
 *     DEFAULT            = NORM_DEFAULT
 *     NONE               = NORM_NONE             # <<<<<<<<<<<<<<
 *     ALWAYS             = NORM_ALWAYS
 *     INITIAL_ONLY       = NORM_INITIAL_ONLY
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_NONE);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_NONE);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NONE, __pyx_t_8) < 0) __PYX_ERR(36, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":35
 *     DEFAULT            = NORM_DEFAULT
 *     NONE               = NORM_NONE
 *     ALWAYS             = NORM_ALWAYS             # <<<<<<<<<<<<<<
 *     INITIAL_ONLY       = NORM_INITIAL_ONLY
 *     FINAL_ONLY         = NORM_FINAL_ONLY
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_ALWAYS);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_ALWAYS);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ALWAYS, __pyx_t_8) < 0) __PYX_ERR(36, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":36
 *     NONE               = NORM_NONE
 *     ALWAYS             = NORM_ALWAYS
 *     INITIAL_ONLY       = NORM_INITIAL_ONLY             # <<<<<<<<<<<<<<
 *     FINAL_ONLY         = NORM_FINAL_ONLY
 *     INITIAL_FINAL_ONLY = NORM_INITIAL_FINAL_ONLY
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_INITIAL_ONLY);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_INITIAL_ONLY);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INITIAL_ONLY, __pyx_t_8) < 0) __PYX_ERR(36, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":37
 *     ALWAYS             = NORM_ALWAYS
 *     INITIAL_ONLY       = NORM_INITIAL_ONLY
 *     FINAL_ONLY         = NORM_FINAL_ONLY             # <<<<<<<<<<<<<<
 *     INITIAL_FINAL_ONLY = NORM_INITIAL_FINAL_ONLY
 * 
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_FINAL_ONLY);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_FINAL_ONLY);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FINAL_ONLY, __pyx_t_8) < 0) __PYX_ERR(36, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":38
 *     INITIAL_ONLY       = NORM_INITIAL_ONLY
 *     FINAL_ONLY         = NORM_FINAL_ONLY
 *     INITIAL_FINAL_ONLY = NORM_INITIAL_FINAL_ONLY             # <<<<<<<<<<<<<<
 * 
 * class SNESConvergedReason(object):
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_NORM_INITIAL_FINAL_ONLY);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_NORM_INITIAL_FINAL_ONLY);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INITIAL_FINAL_ONLY, __pyx_t_8) < 0) __PYX_ERR(36, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":24
 *     COMPOSITE    = S_(SNESCOMPOSITE)
 * 
 * class SNESNormSchedule(object):             # <<<<<<<<<<<<<<
 *     # native
 *     NORM_DEFAULT            = SNES_NORM_DEFAULT
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_SNESNormSchedule, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SNESNormSchedule, __pyx_t_8) < 0) __PYX_ERR(36, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/SNES.pyx":40
 *     INITIAL_FINAL_ONLY = NORM_INITIAL_FINAL_ONLY
 * 
 * class SNESConvergedReason(object):             # <<<<<<<<<<<<<<
 *     # iterating
 *     CONVERGED_ITERATING      = SNES_CONVERGED_ITERATING
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(36, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_SNESConvergedReason, __pyx_n_s_SNESConvergedReason, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(36, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/SNES.pyx":42
 * class SNESConvergedReason(object):
 *     # iterating
 *     CONVERGED_ITERATING      = SNES_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *     ITERATING                = SNES_CONVERGED_ITERATING
 *     # converged
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_CONVERGED_ITERATING); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_ITERATING, __pyx_t_8) < 0) __PYX_ERR(36, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":43
 *     # iterating
 *     CONVERGED_ITERATING      = SNES_CONVERGED_ITERATING
 *     ITERATING                = SNES_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *     # converged
 *     CONVERGED_FNORM_ABS      = SNES_CONVERGED_FNORM_ABS
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_CONVERGED_ITERATING); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ITERATING, __pyx_t_8) < 0) __PYX_ERR(36, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":45
 *     ITERATING                = SNES_CONVERGED_ITERATING
 *     # converged
 *     CONVERGED_FNORM_ABS      = SNES_CONVERGED_FNORM_ABS             # <<<<<<<<<<<<<<
 *     CONVERGED_FNORM_RELATIVE = SNES_CONVERGED_FNORM_RELATIVE
 *     CONVERGED_SNORM_RELATIVE = SNES_CONVERGED_SNORM_RELATIVE
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_CONVERGED_FNORM_ABS); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_FNORM_ABS, __pyx_t_8) < 0) __PYX_ERR(36, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":46
 *     # converged
 *     CONVERGED_FNORM_ABS      = SNES_CONVERGED_FNORM_ABS
 *     CONVERGED_FNORM_RELATIVE = SNES_CONVERGED_FNORM_RELATIVE             # <<<<<<<<<<<<<<
 *     CONVERGED_SNORM_RELATIVE = SNES_CONVERGED_SNORM_RELATIVE
 *     CONVERGED_ITS            = SNES_CONVERGED_ITS
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_CONVERGED_FNORM_RELATIVE); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_FNORM_RELATIVE, __pyx_t_8) < 0) __PYX_ERR(36, 46, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":47
 *     CONVERGED_FNORM_ABS      = SNES_CONVERGED_FNORM_ABS
 *     CONVERGED_FNORM_RELATIVE = SNES_CONVERGED_FNORM_RELATIVE
 *     CONVERGED_SNORM_RELATIVE = SNES_CONVERGED_SNORM_RELATIVE             # <<<<<<<<<<<<<<
 *     CONVERGED_ITS            = SNES_CONVERGED_ITS
 *     CONVERGED_TR_DELTA       = SNES_CONVERGED_TR_DELTA
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_CONVERGED_SNORM_RELATIVE); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_SNORM_RELATIVE, __pyx_t_8) < 0) __PYX_ERR(36, 47, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":48
 *     CONVERGED_FNORM_RELATIVE = SNES_CONVERGED_FNORM_RELATIVE
 *     CONVERGED_SNORM_RELATIVE = SNES_CONVERGED_SNORM_RELATIVE
 *     CONVERGED_ITS            = SNES_CONVERGED_ITS             # <<<<<<<<<<<<<<
 *     CONVERGED_TR_DELTA       = SNES_CONVERGED_TR_DELTA
 *     # diverged
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_CONVERGED_ITS); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_ITS, __pyx_t_8) < 0) __PYX_ERR(36, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":49
 *     CONVERGED_SNORM_RELATIVE = SNES_CONVERGED_SNORM_RELATIVE
 *     CONVERGED_ITS            = SNES_CONVERGED_ITS
 *     CONVERGED_TR_DELTA       = SNES_CONVERGED_TR_DELTA             # <<<<<<<<<<<<<<
 *     # diverged
 *     DIVERGED_FUNCTION_DOMAIN = SNES_DIVERGED_FUNCTION_DOMAIN
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_CONVERGED_TR_DELTA); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_TR_DELTA, __pyx_t_8) < 0) __PYX_ERR(36, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":51
 *     CONVERGED_TR_DELTA       = SNES_CONVERGED_TR_DELTA
 *     # diverged
 *     DIVERGED_FUNCTION_DOMAIN = SNES_DIVERGED_FUNCTION_DOMAIN             # <<<<<<<<<<<<<<
 *     DIVERGED_FUNCTION_COUNT  = SNES_DIVERGED_FUNCTION_COUNT
 *     DIVERGED_FNORM_NAN       = SNES_DIVERGED_FNORM_NAN
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_DIVERGED_FUNCTION_DOMAIN); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_FUNCTION_DOMAIN, __pyx_t_8) < 0) __PYX_ERR(36, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":52
 *     # diverged
 *     DIVERGED_FUNCTION_DOMAIN = SNES_DIVERGED_FUNCTION_DOMAIN
 *     DIVERGED_FUNCTION_COUNT  = SNES_DIVERGED_FUNCTION_COUNT             # <<<<<<<<<<<<<<
 *     DIVERGED_FNORM_NAN       = SNES_DIVERGED_FNORM_NAN
 *     DIVERGED_MAX_IT          = SNES_DIVERGED_MAX_IT
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_DIVERGED_FUNCTION_COUNT); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_FUNCTION_COUNT, __pyx_t_8) < 0) __PYX_ERR(36, 52, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":53
 *     DIVERGED_FUNCTION_DOMAIN = SNES_DIVERGED_FUNCTION_DOMAIN
 *     DIVERGED_FUNCTION_COUNT  = SNES_DIVERGED_FUNCTION_COUNT
 *     DIVERGED_FNORM_NAN       = SNES_DIVERGED_FNORM_NAN             # <<<<<<<<<<<<<<
 *     DIVERGED_MAX_IT          = SNES_DIVERGED_MAX_IT
 *     DIVERGED_LINE_SEARCH     = SNES_DIVERGED_LINE_SEARCH
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_DIVERGED_FNORM_NAN); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_FNORM_NAN, __pyx_t_8) < 0) __PYX_ERR(36, 53, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":54
 *     DIVERGED_FUNCTION_COUNT  = SNES_DIVERGED_FUNCTION_COUNT
 *     DIVERGED_FNORM_NAN       = SNES_DIVERGED_FNORM_NAN
 *     DIVERGED_MAX_IT          = SNES_DIVERGED_MAX_IT             # <<<<<<<<<<<<<<
 *     DIVERGED_LINE_SEARCH     = SNES_DIVERGED_LINE_SEARCH
 *     DIVERGED_INNER           = SNES_DIVERGED_INNER
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_DIVERGED_MAX_IT); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_MAX_IT, __pyx_t_8) < 0) __PYX_ERR(36, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":55
 *     DIVERGED_FNORM_NAN       = SNES_DIVERGED_FNORM_NAN
 *     DIVERGED_MAX_IT          = SNES_DIVERGED_MAX_IT
 *     DIVERGED_LINE_SEARCH     = SNES_DIVERGED_LINE_SEARCH             # <<<<<<<<<<<<<<
 *     DIVERGED_INNER           = SNES_DIVERGED_INNER
 *     DIVERGED_LOCAL_MIN       = SNES_DIVERGED_LOCAL_MIN
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_DIVERGED_LINE_SEARCH); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_LINE_SEARCH, __pyx_t_8) < 0) __PYX_ERR(36, 55, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":56
 *     DIVERGED_MAX_IT          = SNES_DIVERGED_MAX_IT
 *     DIVERGED_LINE_SEARCH     = SNES_DIVERGED_LINE_SEARCH
 *     DIVERGED_INNER           = SNES_DIVERGED_INNER             # <<<<<<<<<<<<<<
 *     DIVERGED_LOCAL_MIN       = SNES_DIVERGED_LOCAL_MIN
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_DIVERGED_INNER); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_INNER, __pyx_t_8) < 0) __PYX_ERR(36, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":57
 *     DIVERGED_LINE_SEARCH     = SNES_DIVERGED_LINE_SEARCH
 *     DIVERGED_INNER           = SNES_DIVERGED_INNER
 *     DIVERGED_LOCAL_MIN       = SNES_DIVERGED_LOCAL_MIN             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = __Pyx_PyInt_From_SNESConvergedReason(SNES_DIVERGED_LOCAL_MIN); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_LOCAL_MIN, __pyx_t_8) < 0) __PYX_ERR(36, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SNES.pyx":40
 *     INITIAL_FINAL_ONLY = NORM_INITIAL_FINAL_ONLY
 * 
 * class SNESConvergedReason(object):             # <<<<<<<<<<<<<<
 *     # iterating
 *     CONVERGED_ITERATING      = SNES_CONVERGED_ITERATING
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_SNESConvergedReason, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(36, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SNESConvergedReason, __pyx_t_8) < 0) __PYX_ERR(36, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/SNES.pyx":63
 * cdef class SNES(Object):
 * 
 *     Type = SNESType             # <<<<<<<<<<<<<<
 *     NormSchedule = SNESNormSchedule
 *     ConvergedReason = SNESConvergedReason
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_SNESType); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(36, 63, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_SNES);

  /* "PETSc/SNES.pyx":64
 * 
 *     Type = SNESType
 *     NormSchedule = SNESNormSchedule             # <<<<<<<<<<<<<<
 *     ConvergedReason = SNESConvergedReason
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_SNESNormSchedule); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES->tp_dict, __pyx_n_s_NormSchedule, __pyx_t_3) < 0) __PYX_ERR(36, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_SNES);

  /* "PETSc/SNES.pyx":65
 *     Type = SNESType
 *     NormSchedule = SNESNormSchedule
 *     ConvergedReason = SNESConvergedReason             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_SNESConvergedReason); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES->tp_dict, __pyx_n_s_ConvergedReason, __pyx_t_3) < 0) __PYX_ERR(36, 65, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_SNES);

  /* "PETSc/SNES.pyx":502
 *         return toInt(ival)
 * 
 *     setMaxNonlinearStepFailures = setMaxStepFailures             # <<<<<<<<<<<<<<
 *     getMaxNonlinearStepFailures = getMaxStepFailures
 *     getNonlinearStepFailures    = getStepFailures
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES, __pyx_n_s_setMaxStepFailures); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES->tp_dict, __pyx_n_s_setMaxNonlinearStepFailures, __pyx_t_3) < 0) __PYX_ERR(36, 502, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_SNES);

  /* "PETSc/SNES.pyx":503
 * 
 *     setMaxNonlinearStepFailures = setMaxStepFailures
 *     getMaxNonlinearStepFailures = getMaxStepFailures             # <<<<<<<<<<<<<<
 *     getNonlinearStepFailures    = getStepFailures
 *     setMaxLinearSolveFailures   = setMaxKSPFailures
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES, __pyx_n_s_getMaxStepFailures); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES->tp_dict, __pyx_n_s_getMaxNonlinearStepFailures, __pyx_t_3) < 0) __PYX_ERR(36, 503, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_SNES);

  /* "PETSc/SNES.pyx":504
 *     setMaxNonlinearStepFailures = setMaxStepFailures
 *     getMaxNonlinearStepFailures = getMaxStepFailures
 *     getNonlinearStepFailures    = getStepFailures             # <<<<<<<<<<<<<<
 *     setMaxLinearSolveFailures   = setMaxKSPFailures
 *     getMaxLinearSolveFailures   = getMaxKSPFailures
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES, __pyx_n_s_getStepFailures); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES->tp_dict, __pyx_n_s_getNonlinearStepFailures, __pyx_t_3) < 0) __PYX_ERR(36, 504, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_SNES);

  /* "PETSc/SNES.pyx":505
 *     getMaxNonlinearStepFailures = getMaxStepFailures
 *     getNonlinearStepFailures    = getStepFailures
 *     setMaxLinearSolveFailures   = setMaxKSPFailures             # <<<<<<<<<<<<<<
 *     getMaxLinearSolveFailures   = getMaxKSPFailures
 *     getLinearSolveFailures      = getKSPFailures
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES, __pyx_n_s_setMaxKSPFailures); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES->tp_dict, __pyx_n_s_setMaxLinearSolveFailures, __pyx_t_3) < 0) __PYX_ERR(36, 505, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_SNES);

  /* "PETSc/SNES.pyx":506
 *     getNonlinearStepFailures    = getStepFailures
 *     setMaxLinearSolveFailures   = setMaxKSPFailures
 *     getMaxLinearSolveFailures   = getMaxKSPFailures             # <<<<<<<<<<<<<<
 *     getLinearSolveFailures      = getKSPFailures
 * 
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES, __pyx_n_s_getMaxKSPFailures); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES->tp_dict, __pyx_n_s_getMaxLinearSolveFailures, __pyx_t_3) < 0) __PYX_ERR(36, 506, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_SNES);

  /* "PETSc/SNES.pyx":507
 *     setMaxLinearSolveFailures   = setMaxKSPFailures
 *     getMaxLinearSolveFailures   = getMaxKSPFailures
 *     getLinearSolveFailures      = getKSPFailures             # <<<<<<<<<<<<<<
 * 
 *     # --- solving ---
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES, __pyx_n_s_getKSPFailures); if (unlikely(!__pyx_t_3)) __PYX_ERR(36, 507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SNES->tp_dict, __pyx_n_s_getLinearSolveFailures, __pyx_t_3) < 0) __PYX_ERR(36, 507, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_SNES);

  /* "PETSc/SNES.pyx":830
 * # --------------------------------------------------------------------
 * 
 * del SNESType             # <<<<<<<<<<<<<<
 * del SNESNormSchedule
 * del SNESConvergedReason
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_SNESType) < 0) __PYX_ERR(36, 830, __pyx_L1_error)

  /* "PETSc/SNES.pyx":831
 * 
 * del SNESType
 * del SNESNormSchedule             # <<<<<<<<<<<<<<
 * del SNESConvergedReason
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_SNESNormSchedule) < 0) __PYX_ERR(36, 831, __pyx_L1_error)

  /* "PETSc/SNES.pyx":832
 * del SNESType
 * del SNESNormSchedule
 * del SNESConvergedReason             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_SNESConvergedReason) < 0) __PYX_ERR(36, 832, __pyx_L1_error)

  /* "PETSc/TS.pyx":3
 * # -----------------------------------------------------------------------------
 * 
 * class TSType(object):             # <<<<<<<<<<<<<<
 *     # native
 *     EULER    = S_(TSEULER)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_TSType, __pyx_n_s_TSType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/TS.pyx":5
 * class TSType(object):
 *     # native
 *     EULER    = S_(TSEULER)             # <<<<<<<<<<<<<<
 *     BEULER   = S_(TSBEULER)
 *     PSEUDO   = S_(TSPSEUDO)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSEULER); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_EULER, __pyx_t_8) < 0) __PYX_ERR(37, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":6
 *     # native
 *     EULER    = S_(TSEULER)
 *     BEULER   = S_(TSBEULER)             # <<<<<<<<<<<<<<
 *     PSEUDO   = S_(TSPSEUDO)
 *     CN       = S_(TSCN)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSBEULER); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BEULER, __pyx_t_8) < 0) __PYX_ERR(37, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":7
 *     EULER    = S_(TSEULER)
 *     BEULER   = S_(TSBEULER)
 *     PSEUDO   = S_(TSPSEUDO)             # <<<<<<<<<<<<<<
 *     CN       = S_(TSCN)
 *     SUNDIALS = S_(TSSUNDIALS)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSPSEUDO); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PSEUDO, __pyx_t_8) < 0) __PYX_ERR(37, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":8
 *     BEULER   = S_(TSBEULER)
 *     PSEUDO   = S_(TSPSEUDO)
 *     CN       = S_(TSCN)             # <<<<<<<<<<<<<<
 *     SUNDIALS = S_(TSSUNDIALS)
 *     RK       = S_(TSRK)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSCN); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CN, __pyx_t_8) < 0) __PYX_ERR(37, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":9
 *     PSEUDO   = S_(TSPSEUDO)
 *     CN       = S_(TSCN)
 *     SUNDIALS = S_(TSSUNDIALS)             # <<<<<<<<<<<<<<
 *     RK       = S_(TSRK)
 *     PYTHON   = S_(TSPYTHON)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSSUNDIALS); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SUNDIALS, __pyx_t_8) < 0) __PYX_ERR(37, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":10
 *     CN       = S_(TSCN)
 *     SUNDIALS = S_(TSSUNDIALS)
 *     RK       = S_(TSRK)             # <<<<<<<<<<<<<<
 *     PYTHON   = S_(TSPYTHON)
 *     THETA    = S_(TSTHETA)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSRK); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_RK, __pyx_t_8) < 0) __PYX_ERR(37, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":11
 *     SUNDIALS = S_(TSSUNDIALS)
 *     RK       = S_(TSRK)
 *     PYTHON   = S_(TSPYTHON)             # <<<<<<<<<<<<<<
 *     THETA    = S_(TSTHETA)
 *     ALPHA    = S_(TSALPHA)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSPYTHON); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PYTHON, __pyx_t_8) < 0) __PYX_ERR(37, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":12
 *     RK       = S_(TSRK)
 *     PYTHON   = S_(TSPYTHON)
 *     THETA    = S_(TSTHETA)             # <<<<<<<<<<<<<<
 *     ALPHA    = S_(TSALPHA)
 *     ALPHA2  = S_(TSALPHA2)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSTHETA); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_THETA, __pyx_t_8) < 0) __PYX_ERR(37, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":13
 *     PYTHON   = S_(TSPYTHON)
 *     THETA    = S_(TSTHETA)
 *     ALPHA    = S_(TSALPHA)             # <<<<<<<<<<<<<<
 *     ALPHA2  = S_(TSALPHA2)
 *     GL       = S_(TSGL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSALPHA); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ALPHA, __pyx_t_8) < 0) __PYX_ERR(37, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":14
 *     THETA    = S_(TSTHETA)
 *     ALPHA    = S_(TSALPHA)
 *     ALPHA2  = S_(TSALPHA2)             # <<<<<<<<<<<<<<
 *     GL       = S_(TSGL)
 *     SSP      = S_(TSSSP)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSALPHA2); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ALPHA2, __pyx_t_8) < 0) __PYX_ERR(37, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":15
 *     ALPHA    = S_(TSALPHA)
 *     ALPHA2  = S_(TSALPHA2)
 *     GL       = S_(TSGL)             # <<<<<<<<<<<<<<
 *     SSP      = S_(TSSSP)
 *     ARKIMEX  = S_(TSARKIMEX)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSGL); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GL, __pyx_t_8) < 0) __PYX_ERR(37, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":16
 *     ALPHA2  = S_(TSALPHA2)
 *     GL       = S_(TSGL)
 *     SSP      = S_(TSSSP)             # <<<<<<<<<<<<<<
 *     ARKIMEX  = S_(TSARKIMEX)
 *     ROSW     = S_(TSROSW)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSSSP); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SSP, __pyx_t_8) < 0) __PYX_ERR(37, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":17
 *     GL       = S_(TSGL)
 *     SSP      = S_(TSSSP)
 *     ARKIMEX  = S_(TSARKIMEX)             # <<<<<<<<<<<<<<
 *     ROSW     = S_(TSROSW)
 *     EIMEX    = S_(TSEIMEX)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSARKIMEX); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ARKIMEX, __pyx_t_8) < 0) __PYX_ERR(37, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":18
 *     SSP      = S_(TSSSP)
 *     ARKIMEX  = S_(TSARKIMEX)
 *     ROSW     = S_(TSROSW)             # <<<<<<<<<<<<<<
 *     EIMEX    = S_(TSEIMEX)
 *     MIMEX    = S_(TSMIMEX)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSROSW); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ROSW, __pyx_t_8) < 0) __PYX_ERR(37, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":19
 *     ARKIMEX  = S_(TSARKIMEX)
 *     ROSW     = S_(TSROSW)
 *     EIMEX    = S_(TSEIMEX)             # <<<<<<<<<<<<<<
 *     MIMEX    = S_(TSMIMEX)
 *     BDF      = S_(TSBDF)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSEIMEX); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_EIMEX, __pyx_t_8) < 0) __PYX_ERR(37, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":20
 *     ROSW     = S_(TSROSW)
 *     EIMEX    = S_(TSEIMEX)
 *     MIMEX    = S_(TSMIMEX)             # <<<<<<<<<<<<<<
 *     BDF      = S_(TSBDF)
 *     # aliases
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSMIMEX); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MIMEX, __pyx_t_8) < 0) __PYX_ERR(37, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":21
 *     EIMEX    = S_(TSEIMEX)
 *     MIMEX    = S_(TSMIMEX)
 *     BDF      = S_(TSBDF)             # <<<<<<<<<<<<<<
 *     # aliases
 *     FE = EULER
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(TSBDF); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BDF, __pyx_t_8) < 0) __PYX_ERR(37, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":23
 *     BDF      = S_(TSBDF)
 *     # aliases
 *     FE = EULER             # <<<<<<<<<<<<<<
 *     BE = BEULER
 *     TH = THETA
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_EULER);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_EULER);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_FE, __pyx_t_8) < 0) __PYX_ERR(37, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":24
 *     # aliases
 *     FE = EULER
 *     BE = BEULER             # <<<<<<<<<<<<<<
 *     TH = THETA
 *     CRANK_NICOLSON = CN
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_BEULER);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_BEULER);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BE, __pyx_t_8) < 0) __PYX_ERR(37, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":25
 *     FE = EULER
 *     BE = BEULER
 *     TH = THETA             # <<<<<<<<<<<<<<
 *     CRANK_NICOLSON = CN
 *     RUNGE_KUTTA    = RK
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_THETA);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_THETA);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_TH, __pyx_t_8) < 0) __PYX_ERR(37, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":26
 *     BE = BEULER
 *     TH = THETA
 *     CRANK_NICOLSON = CN             # <<<<<<<<<<<<<<
 *     RUNGE_KUTTA    = RK
 * 
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_CN);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_CN);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CRANK_NICOLSON, __pyx_t_8) < 0) __PYX_ERR(37, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":27
 *     TH = THETA
 *     CRANK_NICOLSON = CN
 *     RUNGE_KUTTA    = RK             # <<<<<<<<<<<<<<
 * 
 * class TSProblemType(object):
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_RK);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_RK);
  }
  if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_RUNGE_KUTTA, __pyx_t_8) < 0) __PYX_ERR(37, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":3
 * # -----------------------------------------------------------------------------
 * 
 * class TSType(object):             # <<<<<<<<<<<<<<
 *     # native
 *     EULER    = S_(TSEULER)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_TSType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TSType, __pyx_t_8) < 0) __PYX_ERR(37, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/TS.pyx":29
 *     RUNGE_KUTTA    = RK
 * 
 * class TSProblemType(object):             # <<<<<<<<<<<<<<
 *     LINEAR    = TS_LINEAR
 *     NONLINEAR = TS_NONLINEAR
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_TSProblemType, __pyx_n_s_TSProblemType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/TS.pyx":30
 * 
 * class TSProblemType(object):
 *     LINEAR    = TS_LINEAR             # <<<<<<<<<<<<<<
 *     NONLINEAR = TS_NONLINEAR
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSProblemType(TS_LINEAR); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_LINEAR, __pyx_t_8) < 0) __PYX_ERR(37, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":31
 * class TSProblemType(object):
 *     LINEAR    = TS_LINEAR
 *     NONLINEAR = TS_NONLINEAR             # <<<<<<<<<<<<<<
 * 
 * class TSEquationType(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSProblemType(TS_NONLINEAR); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NONLINEAR, __pyx_t_8) < 0) __PYX_ERR(37, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":29
 *     RUNGE_KUTTA    = RK
 * 
 * class TSProblemType(object):             # <<<<<<<<<<<<<<
 *     LINEAR    = TS_LINEAR
 *     NONLINEAR = TS_NONLINEAR
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_TSProblemType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TSProblemType, __pyx_t_8) < 0) __PYX_ERR(37, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/TS.pyx":33
 *     NONLINEAR = TS_NONLINEAR
 * 
 * class TSEquationType(object):             # <<<<<<<<<<<<<<
 *     UNSPECIFIED               = TS_EQ_UNSPECIFIED
 *     EXPLICIT                  = TS_EQ_EXPLICIT
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_TSEquationType, __pyx_n_s_TSEquationType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/TS.pyx":34
 * 
 * class TSEquationType(object):
 *     UNSPECIFIED               = TS_EQ_UNSPECIFIED             # <<<<<<<<<<<<<<
 *     EXPLICIT                  = TS_EQ_EXPLICIT
 *     ODE_EXPLICIT              = TS_EQ_ODE_EXPLICIT
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_UNSPECIFIED); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_UNSPECIFIED, __pyx_t_8) < 0) __PYX_ERR(37, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":35
 * class TSEquationType(object):
 *     UNSPECIFIED               = TS_EQ_UNSPECIFIED
 *     EXPLICIT                  = TS_EQ_EXPLICIT             # <<<<<<<<<<<<<<
 *     ODE_EXPLICIT              = TS_EQ_ODE_EXPLICIT
 *     DAE_SEMI_EXPLICIT_INDEX1  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX1
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_EXPLICIT); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_EXPLICIT, __pyx_t_8) < 0) __PYX_ERR(37, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":36
 *     UNSPECIFIED               = TS_EQ_UNSPECIFIED
 *     EXPLICIT                  = TS_EQ_EXPLICIT
 *     ODE_EXPLICIT              = TS_EQ_ODE_EXPLICIT             # <<<<<<<<<<<<<<
 *     DAE_SEMI_EXPLICIT_INDEX1  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX1
 *     DAE_SEMI_EXPLICIT_INDEX2  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX2
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_ODE_EXPLICIT); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ODE_EXPLICIT, __pyx_t_8) < 0) __PYX_ERR(37, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":37
 *     EXPLICIT                  = TS_EQ_EXPLICIT
 *     ODE_EXPLICIT              = TS_EQ_ODE_EXPLICIT
 *     DAE_SEMI_EXPLICIT_INDEX1  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX1             # <<<<<<<<<<<<<<
 *     DAE_SEMI_EXPLICIT_INDEX2  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX2
 *     DAE_SEMI_EXPLICIT_INDEX3  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX3
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_DAE_SEMI_EXPLICIT_INDEX1); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DAE_SEMI_EXPLICIT_INDEX1, __pyx_t_8) < 0) __PYX_ERR(37, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":38
 *     ODE_EXPLICIT              = TS_EQ_ODE_EXPLICIT
 *     DAE_SEMI_EXPLICIT_INDEX1  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX1
 *     DAE_SEMI_EXPLICIT_INDEX2  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX2             # <<<<<<<<<<<<<<
 *     DAE_SEMI_EXPLICIT_INDEX3  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX3
 *     DAE_SEMI_EXPLICIT_INDEXHI = TS_EQ_DAE_SEMI_EXPLICIT_INDEXHI
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_DAE_SEMI_EXPLICIT_INDEX2); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DAE_SEMI_EXPLICIT_INDEX2, __pyx_t_8) < 0) __PYX_ERR(37, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":39
 *     DAE_SEMI_EXPLICIT_INDEX1  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX1
 *     DAE_SEMI_EXPLICIT_INDEX2  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX2
 *     DAE_SEMI_EXPLICIT_INDEX3  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX3             # <<<<<<<<<<<<<<
 *     DAE_SEMI_EXPLICIT_INDEXHI = TS_EQ_DAE_SEMI_EXPLICIT_INDEXHI
 *     IMPLICIT                  = TS_EQ_IMPLICIT
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_DAE_SEMI_EXPLICIT_INDEX3); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DAE_SEMI_EXPLICIT_INDEX3, __pyx_t_8) < 0) __PYX_ERR(37, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":40
 *     DAE_SEMI_EXPLICIT_INDEX2  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX2
 *     DAE_SEMI_EXPLICIT_INDEX3  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX3
 *     DAE_SEMI_EXPLICIT_INDEXHI = TS_EQ_DAE_SEMI_EXPLICIT_INDEXHI             # <<<<<<<<<<<<<<
 *     IMPLICIT                  = TS_EQ_IMPLICIT
 *     ODE_IMPLICIT              = TS_EQ_ODE_IMPLICIT
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_DAE_SEMI_EXPLICIT_INDEXHI); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DAE_SEMI_EXPLICIT_INDEXHI, __pyx_t_8) < 0) __PYX_ERR(37, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":41
 *     DAE_SEMI_EXPLICIT_INDEX3  = TS_EQ_DAE_SEMI_EXPLICIT_INDEX3
 *     DAE_SEMI_EXPLICIT_INDEXHI = TS_EQ_DAE_SEMI_EXPLICIT_INDEXHI
 *     IMPLICIT                  = TS_EQ_IMPLICIT             # <<<<<<<<<<<<<<
 *     ODE_IMPLICIT              = TS_EQ_ODE_IMPLICIT
 *     DAE_IMPLICIT_INDEX1       = TS_EQ_DAE_IMPLICIT_INDEX1
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_IMPLICIT); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_IMPLICIT, __pyx_t_8) < 0) __PYX_ERR(37, 41, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":42
 *     DAE_SEMI_EXPLICIT_INDEXHI = TS_EQ_DAE_SEMI_EXPLICIT_INDEXHI
 *     IMPLICIT                  = TS_EQ_IMPLICIT
 *     ODE_IMPLICIT              = TS_EQ_ODE_IMPLICIT             # <<<<<<<<<<<<<<
 *     DAE_IMPLICIT_INDEX1       = TS_EQ_DAE_IMPLICIT_INDEX1
 *     DAE_IMPLICIT_INDEX2       = TS_EQ_DAE_IMPLICIT_INDEX2
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_ODE_IMPLICIT); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ODE_IMPLICIT, __pyx_t_8) < 0) __PYX_ERR(37, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":43
 *     IMPLICIT                  = TS_EQ_IMPLICIT
 *     ODE_IMPLICIT              = TS_EQ_ODE_IMPLICIT
 *     DAE_IMPLICIT_INDEX1       = TS_EQ_DAE_IMPLICIT_INDEX1             # <<<<<<<<<<<<<<
 *     DAE_IMPLICIT_INDEX2       = TS_EQ_DAE_IMPLICIT_INDEX2
 *     DAE_IMPLICIT_INDEX3       = TS_EQ_DAE_IMPLICIT_INDEX3
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_DAE_IMPLICIT_INDEX1); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DAE_IMPLICIT_INDEX1, __pyx_t_8) < 0) __PYX_ERR(37, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":44
 *     ODE_IMPLICIT              = TS_EQ_ODE_IMPLICIT
 *     DAE_IMPLICIT_INDEX1       = TS_EQ_DAE_IMPLICIT_INDEX1
 *     DAE_IMPLICIT_INDEX2       = TS_EQ_DAE_IMPLICIT_INDEX2             # <<<<<<<<<<<<<<
 *     DAE_IMPLICIT_INDEX3       = TS_EQ_DAE_IMPLICIT_INDEX3
 *     DAE_IMPLICIT_INDEXHI      = TS_EQ_DAE_IMPLICIT_INDEXHI
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_DAE_IMPLICIT_INDEX2); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DAE_IMPLICIT_INDEX2, __pyx_t_8) < 0) __PYX_ERR(37, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":45
 *     DAE_IMPLICIT_INDEX1       = TS_EQ_DAE_IMPLICIT_INDEX1
 *     DAE_IMPLICIT_INDEX2       = TS_EQ_DAE_IMPLICIT_INDEX2
 *     DAE_IMPLICIT_INDEX3       = TS_EQ_DAE_IMPLICIT_INDEX3             # <<<<<<<<<<<<<<
 *     DAE_IMPLICIT_INDEXHI      = TS_EQ_DAE_IMPLICIT_INDEXHI
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_DAE_IMPLICIT_INDEX3); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DAE_IMPLICIT_INDEX3, __pyx_t_8) < 0) __PYX_ERR(37, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":46
 *     DAE_IMPLICIT_INDEX2       = TS_EQ_DAE_IMPLICIT_INDEX2
 *     DAE_IMPLICIT_INDEX3       = TS_EQ_DAE_IMPLICIT_INDEX3
 *     DAE_IMPLICIT_INDEXHI      = TS_EQ_DAE_IMPLICIT_INDEXHI             # <<<<<<<<<<<<<<
 * 
 * class TSExactFinalTime(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSEquationType(TS_EQ_DAE_IMPLICIT_INDEXHI); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DAE_IMPLICIT_INDEXHI, __pyx_t_8) < 0) __PYX_ERR(37, 46, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":33
 *     NONLINEAR = TS_NONLINEAR
 * 
 * class TSEquationType(object):             # <<<<<<<<<<<<<<
 *     UNSPECIFIED               = TS_EQ_UNSPECIFIED
 *     EXPLICIT                  = TS_EQ_EXPLICIT
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_TSEquationType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TSEquationType, __pyx_t_8) < 0) __PYX_ERR(37, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/TS.pyx":48
 *     DAE_IMPLICIT_INDEXHI      = TS_EQ_DAE_IMPLICIT_INDEXHI
 * 
 * class TSExactFinalTime(object):             # <<<<<<<<<<<<<<
 *     UNSPECIFIED = TS_EXACTFINALTIME_UNSPECIFIED
 *     STEPOVER    = TS_EXACTFINALTIME_STEPOVER
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_TSExactFinalTime, __pyx_n_s_TSExactFinalTime, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/TS.pyx":49
 * 
 * class TSExactFinalTime(object):
 *     UNSPECIFIED = TS_EXACTFINALTIME_UNSPECIFIED             # <<<<<<<<<<<<<<
 *     STEPOVER    = TS_EXACTFINALTIME_STEPOVER
 *     INTERPOLATE = TS_EXACTFINALTIME_INTERPOLATE
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSExactFinalTimeOption(TS_EXACTFINALTIME_UNSPECIFIED); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_UNSPECIFIED, __pyx_t_8) < 0) __PYX_ERR(37, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":50
 * class TSExactFinalTime(object):
 *     UNSPECIFIED = TS_EXACTFINALTIME_UNSPECIFIED
 *     STEPOVER    = TS_EXACTFINALTIME_STEPOVER             # <<<<<<<<<<<<<<
 *     INTERPOLATE = TS_EXACTFINALTIME_INTERPOLATE
 *     MATCHSTEP   = TS_EXACTFINALTIME_MATCHSTEP
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSExactFinalTimeOption(TS_EXACTFINALTIME_STEPOVER); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_STEPOVER, __pyx_t_8) < 0) __PYX_ERR(37, 50, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":51
 *     UNSPECIFIED = TS_EXACTFINALTIME_UNSPECIFIED
 *     STEPOVER    = TS_EXACTFINALTIME_STEPOVER
 *     INTERPOLATE = TS_EXACTFINALTIME_INTERPOLATE             # <<<<<<<<<<<<<<
 *     MATCHSTEP   = TS_EXACTFINALTIME_MATCHSTEP
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSExactFinalTimeOption(TS_EXACTFINALTIME_INTERPOLATE); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_INTERPOLATE, __pyx_t_8) < 0) __PYX_ERR(37, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":52
 *     STEPOVER    = TS_EXACTFINALTIME_STEPOVER
 *     INTERPOLATE = TS_EXACTFINALTIME_INTERPOLATE
 *     MATCHSTEP   = TS_EXACTFINALTIME_MATCHSTEP             # <<<<<<<<<<<<<<
 * 
 * class TSConvergedReason(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSExactFinalTimeOption(TS_EXACTFINALTIME_MATCHSTEP); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MATCHSTEP, __pyx_t_8) < 0) __PYX_ERR(37, 52, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":48
 *     DAE_IMPLICIT_INDEXHI      = TS_EQ_DAE_IMPLICIT_INDEXHI
 * 
 * class TSExactFinalTime(object):             # <<<<<<<<<<<<<<
 *     UNSPECIFIED = TS_EXACTFINALTIME_UNSPECIFIED
 *     STEPOVER    = TS_EXACTFINALTIME_STEPOVER
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_TSExactFinalTime, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TSExactFinalTime, __pyx_t_8) < 0) __PYX_ERR(37, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/TS.pyx":54
 *     MATCHSTEP   = TS_EXACTFINALTIME_MATCHSTEP
 * 
 * class TSConvergedReason(object):             # <<<<<<<<<<<<<<
 *     # iterating
 *     CONVERGED_ITERATING      = TS_CONVERGED_ITERATING
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(37, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_TSConvergedReason, __pyx_n_s_TSConvergedReason, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(37, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/TS.pyx":56
 * class TSConvergedReason(object):
 *     # iterating
 *     CONVERGED_ITERATING      = TS_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *     ITERATING                = TS_CONVERGED_ITERATING
 *     # converged
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSConvergedReason(TS_CONVERGED_ITERATING); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_ITERATING, __pyx_t_8) < 0) __PYX_ERR(37, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":57
 *     # iterating
 *     CONVERGED_ITERATING      = TS_CONVERGED_ITERATING
 *     ITERATING                = TS_CONVERGED_ITERATING             # <<<<<<<<<<<<<<
 *     # converged
 *     CONVERGED_TIME           = TS_CONVERGED_TIME
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSConvergedReason(TS_CONVERGED_ITERATING); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ITERATING, __pyx_t_8) < 0) __PYX_ERR(37, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":59
 *     ITERATING                = TS_CONVERGED_ITERATING
 *     # converged
 *     CONVERGED_TIME           = TS_CONVERGED_TIME             # <<<<<<<<<<<<<<
 *     CONVERGED_ITS            = TS_CONVERGED_ITS
 *     CONVERGED_USER           = TS_CONVERGED_USER
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSConvergedReason(TS_CONVERGED_TIME); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_TIME, __pyx_t_8) < 0) __PYX_ERR(37, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":60
 *     # converged
 *     CONVERGED_TIME           = TS_CONVERGED_TIME
 *     CONVERGED_ITS            = TS_CONVERGED_ITS             # <<<<<<<<<<<<<<
 *     CONVERGED_USER           = TS_CONVERGED_USER
 *     CONVERGED_EVENT          = TS_CONVERGED_EVENT
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSConvergedReason(TS_CONVERGED_ITS); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_ITS, __pyx_t_8) < 0) __PYX_ERR(37, 60, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":61
 *     CONVERGED_TIME           = TS_CONVERGED_TIME
 *     CONVERGED_ITS            = TS_CONVERGED_ITS
 *     CONVERGED_USER           = TS_CONVERGED_USER             # <<<<<<<<<<<<<<
 *     CONVERGED_EVENT          = TS_CONVERGED_EVENT
 *     # diverged
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSConvergedReason(TS_CONVERGED_USER); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_USER, __pyx_t_8) < 0) __PYX_ERR(37, 61, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":62
 *     CONVERGED_ITS            = TS_CONVERGED_ITS
 *     CONVERGED_USER           = TS_CONVERGED_USER
 *     CONVERGED_EVENT          = TS_CONVERGED_EVENT             # <<<<<<<<<<<<<<
 *     # diverged
 *     DIVERGED_NONLINEAR_SOLVE = TS_DIVERGED_NONLINEAR_SOLVE
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSConvergedReason(TS_CONVERGED_EVENT); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CONVERGED_EVENT, __pyx_t_8) < 0) __PYX_ERR(37, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":64
 *     CONVERGED_EVENT          = TS_CONVERGED_EVENT
 *     # diverged
 *     DIVERGED_NONLINEAR_SOLVE = TS_DIVERGED_NONLINEAR_SOLVE             # <<<<<<<<<<<<<<
 *     DIVERGED_STEP_REJECTED   = TS_DIVERGED_STEP_REJECTED
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSConvergedReason(TS_DIVERGED_NONLINEAR_SOLVE); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_NONLINEAR_SOLVE, __pyx_t_8) < 0) __PYX_ERR(37, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":65
 *     # diverged
 *     DIVERGED_NONLINEAR_SOLVE = TS_DIVERGED_NONLINEAR_SOLVE
 *     DIVERGED_STEP_REJECTED   = TS_DIVERGED_STEP_REJECTED             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_t_8 = __Pyx_PyInt_From_TSConvergedReason(TS_DIVERGED_STEP_REJECTED); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DIVERGED_STEP_REJECTED, __pyx_t_8) < 0) __PYX_ERR(37, 65, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/TS.pyx":54
 *     MATCHSTEP   = TS_EXACTFINALTIME_MATCHSTEP
 * 
 * class TSConvergedReason(object):             # <<<<<<<<<<<<<<
 *     # iterating
 *     CONVERGED_ITERATING      = TS_CONVERGED_ITERATING
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_TSConvergedReason, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(37, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TSConvergedReason, __pyx_t_8) < 0) __PYX_ERR(37, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/TS.pyx":71
 * cdef class TS(Object):
 * 
 *     Type = TSType             # <<<<<<<<<<<<<<
 *     ProblemType = TSProblemType
 *     EquationType = TSEquationType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TSType); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TS->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(37, 71, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_TS);

  /* "PETSc/TS.pyx":72
 * 
 *     Type = TSType
 *     ProblemType = TSProblemType             # <<<<<<<<<<<<<<
 *     EquationType = TSEquationType
 *     ExactFinalTime = TSExactFinalTime
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TSProblemType); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TS->tp_dict, __pyx_n_s_ProblemType, __pyx_t_3) < 0) __PYX_ERR(37, 72, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_TS);

  /* "PETSc/TS.pyx":73
 *     Type = TSType
 *     ProblemType = TSProblemType
 *     EquationType = TSEquationType             # <<<<<<<<<<<<<<
 *     ExactFinalTime = TSExactFinalTime
 *     ExactFinalTimeOption = TSExactFinalTime
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TSEquationType); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TS->tp_dict, __pyx_n_s_EquationType, __pyx_t_3) < 0) __PYX_ERR(37, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_TS);

  /* "PETSc/TS.pyx":74
 *     ProblemType = TSProblemType
 *     EquationType = TSEquationType
 *     ExactFinalTime = TSExactFinalTime             # <<<<<<<<<<<<<<
 *     ExactFinalTimeOption = TSExactFinalTime
 *     ConvergedReason = TSConvergedReason
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TSExactFinalTime); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TS->tp_dict, __pyx_n_s_ExactFinalTime, __pyx_t_3) < 0) __PYX_ERR(37, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_TS);

  /* "PETSc/TS.pyx":75
 *     EquationType = TSEquationType
 *     ExactFinalTime = TSExactFinalTime
 *     ExactFinalTimeOption = TSExactFinalTime             # <<<<<<<<<<<<<<
 *     ConvergedReason = TSConvergedReason
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TSExactFinalTime); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TS->tp_dict, __pyx_n_s_ExactFinalTimeOption, __pyx_t_3) < 0) __PYX_ERR(37, 75, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_TS);

  /* "PETSc/TS.pyx":76
 *     ExactFinalTime = TSExactFinalTime
 *     ExactFinalTimeOption = TSExactFinalTime
 *     ConvergedReason = TSConvergedReason             # <<<<<<<<<<<<<<
 * 
 *     # --- xxx ---
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TSConvergedReason); if (unlikely(!__pyx_t_3)) __PYX_ERR(37, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TS->tp_dict, __pyx_n_s_ConvergedReason, __pyx_t_3) < 0) __PYX_ERR(37, 76, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_TS);

  /* "PETSc/TS.pyx":748
 * # -----------------------------------------------------------------------------
 * 
 * del TSType             # <<<<<<<<<<<<<<
 * del TSProblemType
 * del TSEquationType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_TSType) < 0) __PYX_ERR(37, 748, __pyx_L1_error)

  /* "PETSc/TS.pyx":749
 * 
 * del TSType
 * del TSProblemType             # <<<<<<<<<<<<<<
 * del TSEquationType
 * del TSExactFinalTime
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_TSProblemType) < 0) __PYX_ERR(37, 749, __pyx_L1_error)

  /* "PETSc/TS.pyx":750
 * del TSType
 * del TSProblemType
 * del TSEquationType             # <<<<<<<<<<<<<<
 * del TSExactFinalTime
 * del TSConvergedReason
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_TSEquationType) < 0) __PYX_ERR(37, 750, __pyx_L1_error)

  /* "PETSc/TS.pyx":751
 * del TSProblemType
 * del TSEquationType
 * del TSExactFinalTime             # <<<<<<<<<<<<<<
 * del TSConvergedReason
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_TSExactFinalTime) < 0) __PYX_ERR(37, 751, __pyx_L1_error)

  /* "PETSc/TS.pyx":752
 * del TSEquationType
 * del TSExactFinalTime
 * del TSConvergedReason             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_TSConvergedReason) < 0) __PYX_ERR(37, 752, __pyx_L1_error)

  /* "PETSc/TAO.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class TAOType:             # <<<<<<<<<<<<<<
 *     """
 *     TAO Solver Types
 */
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_TAOType, __pyx_n_s_TAOType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, __pyx_kp_s_TAO_Solver_Types); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/TAO.pyx":7
 *     TAO Solver Types
 *     """
 *     LMVM     = S_(TAOLMVM)             # <<<<<<<<<<<<<<
 *     NLS      = S_(TAONLS)
 *     NTR      = S_(TAONTR)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOLMVM); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_LMVM, __pyx_t_1) < 0) __PYX_ERR(38, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":8
 *     """
 *     LMVM     = S_(TAOLMVM)
 *     NLS      = S_(TAONLS)             # <<<<<<<<<<<<<<
 *     NTR      = S_(TAONTR)
 *     NTL      = S_(TAONTL)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAONLS); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_NLS, __pyx_t_1) < 0) __PYX_ERR(38, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":9
 *     LMVM     = S_(TAOLMVM)
 *     NLS      = S_(TAONLS)
 *     NTR      = S_(TAONTR)             # <<<<<<<<<<<<<<
 *     NTL      = S_(TAONTL)
 *     CG       = S_(TAOCG)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAONTR); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_NTR, __pyx_t_1) < 0) __PYX_ERR(38, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":10
 *     NLS      = S_(TAONLS)
 *     NTR      = S_(TAONTR)
 *     NTL      = S_(TAONTL)             # <<<<<<<<<<<<<<
 *     CG       = S_(TAOCG)
 *     TRON     = S_(TAOTRON)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAONTL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_NTL, __pyx_t_1) < 0) __PYX_ERR(38, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":11
 *     NTR      = S_(TAONTR)
 *     NTL      = S_(TAONTL)
 *     CG       = S_(TAOCG)             # <<<<<<<<<<<<<<
 *     TRON     = S_(TAOTRON)
 *     OWLQN    = S_(TAOOWLQN)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOCG); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_CG, __pyx_t_1) < 0) __PYX_ERR(38, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":12
 *     NTL      = S_(TAONTL)
 *     CG       = S_(TAOCG)
 *     TRON     = S_(TAOTRON)             # <<<<<<<<<<<<<<
 *     OWLQN    = S_(TAOOWLQN)
 *     BMRM     = S_(TAOBMRM)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOTRON); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_TRON, __pyx_t_1) < 0) __PYX_ERR(38, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":13
 *     CG       = S_(TAOCG)
 *     TRON     = S_(TAOTRON)
 *     OWLQN    = S_(TAOOWLQN)             # <<<<<<<<<<<<<<
 *     BMRM     = S_(TAOBMRM)
 *     BLMVM    = S_(TAOBLMVM)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOOWLQN); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_OWLQN, __pyx_t_1) < 0) __PYX_ERR(38, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":14
 *     TRON     = S_(TAOTRON)
 *     OWLQN    = S_(TAOOWLQN)
 *     BMRM     = S_(TAOBMRM)             # <<<<<<<<<<<<<<
 *     BLMVM    = S_(TAOBLMVM)
 *     BQPIP    = S_(TAOBQPIP)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOBMRM); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_BMRM, __pyx_t_1) < 0) __PYX_ERR(38, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":15
 *     OWLQN    = S_(TAOOWLQN)
 *     BMRM     = S_(TAOBMRM)
 *     BLMVM    = S_(TAOBLMVM)             # <<<<<<<<<<<<<<
 *     BQPIP    = S_(TAOBQPIP)
 *     GPCG     = S_(TAOGPCG)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOBLMVM); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_BLMVM, __pyx_t_1) < 0) __PYX_ERR(38, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":16
 *     BMRM     = S_(TAOBMRM)
 *     BLMVM    = S_(TAOBLMVM)
 *     BQPIP    = S_(TAOBQPIP)             # <<<<<<<<<<<<<<
 *     GPCG     = S_(TAOGPCG)
 *     NM       = S_(TAONM)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOBQPIP); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_BQPIP, __pyx_t_1) < 0) __PYX_ERR(38, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":17
 *     BLMVM    = S_(TAOBLMVM)
 *     BQPIP    = S_(TAOBQPIP)
 *     GPCG     = S_(TAOGPCG)             # <<<<<<<<<<<<<<
 *     NM       = S_(TAONM)
 *     POUNDERS = S_(TAOPOUNDERS)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOGPCG); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_GPCG, __pyx_t_1) < 0) __PYX_ERR(38, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":18
 *     BQPIP    = S_(TAOBQPIP)
 *     GPCG     = S_(TAOGPCG)
 *     NM       = S_(TAONM)             # <<<<<<<<<<<<<<
 *     POUNDERS = S_(TAOPOUNDERS)
 *     LCL      = S_(TAOLCL)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAONM); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_NM, __pyx_t_1) < 0) __PYX_ERR(38, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":19
 *     GPCG     = S_(TAOGPCG)
 *     NM       = S_(TAONM)
 *     POUNDERS = S_(TAOPOUNDERS)             # <<<<<<<<<<<<<<
 *     LCL      = S_(TAOLCL)
 *     SSILS    = S_(TAOSSILS)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOPOUNDERS); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_POUNDERS, __pyx_t_1) < 0) __PYX_ERR(38, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":20
 *     NM       = S_(TAONM)
 *     POUNDERS = S_(TAOPOUNDERS)
 *     LCL      = S_(TAOLCL)             # <<<<<<<<<<<<<<
 *     SSILS    = S_(TAOSSILS)
 *     SSFLS    = S_(TAOSSFLS)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOLCL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_LCL, __pyx_t_1) < 0) __PYX_ERR(38, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":21
 *     POUNDERS = S_(TAOPOUNDERS)
 *     LCL      = S_(TAOLCL)
 *     SSILS    = S_(TAOSSILS)             # <<<<<<<<<<<<<<
 *     SSFLS    = S_(TAOSSFLS)
 *     ASILS    = S_(TAOASILS)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOSSILS); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_SSILS, __pyx_t_1) < 0) __PYX_ERR(38, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":22
 *     LCL      = S_(TAOLCL)
 *     SSILS    = S_(TAOSSILS)
 *     SSFLS    = S_(TAOSSFLS)             # <<<<<<<<<<<<<<
 *     ASILS    = S_(TAOASILS)
 *     ASFLS    = S_(TAOASFLS)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOSSFLS); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_SSFLS, __pyx_t_1) < 0) __PYX_ERR(38, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":23
 *     SSILS    = S_(TAOSSILS)
 *     SSFLS    = S_(TAOSSFLS)
 *     ASILS    = S_(TAOASILS)             # <<<<<<<<<<<<<<
 *     ASFLS    = S_(TAOASFLS)
 *     IPM      = S_(TAOIPM)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOASILS); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_ASILS, __pyx_t_1) < 0) __PYX_ERR(38, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":24
 *     SSFLS    = S_(TAOSSFLS)
 *     ASILS    = S_(TAOASILS)
 *     ASFLS    = S_(TAOASFLS)             # <<<<<<<<<<<<<<
 *     IPM      = S_(TAOIPM)
 *     TEST     = S_(TAOTEST)
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOASFLS); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_ASFLS, __pyx_t_1) < 0) __PYX_ERR(38, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":25
 *     ASILS    = S_(TAOASILS)
 *     ASFLS    = S_(TAOASFLS)
 *     IPM      = S_(TAOIPM)             # <<<<<<<<<<<<<<
 *     TEST     = S_(TAOTEST)
 * 
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOIPM); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_IPM, __pyx_t_1) < 0) __PYX_ERR(38, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":26
 *     ASFLS    = S_(TAOASFLS)
 *     IPM      = S_(TAOIPM)
 *     TEST     = S_(TAOTEST)             # <<<<<<<<<<<<<<
 * 
 * class TAOConvergedReason:
 */
  __pyx_t_1 = __pyx_f_8petsc4py_5PETSc_S_(TAOTEST); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_TEST, __pyx_t_1) < 0) __PYX_ERR(38, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class TAOType:             # <<<<<<<<<<<<<<
 *     """
 *     TAO Solver Types
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_TAOType, __pyx_empty_tuple, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TAOType, __pyx_t_1) < 0) __PYX_ERR(38, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/TAO.pyx":28
 *     TEST     = S_(TAOTEST)
 * 
 * class TAOConvergedReason:             # <<<<<<<<<<<<<<
 *     """
 *     TAO Solver Termination Reasons
 */
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_TAOConvergedReason, __pyx_n_s_TAOConvergedReason, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, __pyx_kp_s_TAO_Solver_Termination_Reasons); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "PETSc/TAO.pyx":33
 *     """
 *     # iterating
 *     CONTINUE_ITERATING    = TAO_CONTINUE_ITERATING    # iterating             # <<<<<<<<<<<<<<
 *     CONVERGED_ITERATING   = TAO_CONTINUE_ITERATING    # iterating
 *     ITERATING             = TAO_CONTINUE_ITERATING    # iterating
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_CONTINUE_ITERATING); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_CONTINUE_ITERATING, __pyx_t_1) < 0) __PYX_ERR(38, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":34
 *     # iterating
 *     CONTINUE_ITERATING    = TAO_CONTINUE_ITERATING    # iterating
 *     CONVERGED_ITERATING   = TAO_CONTINUE_ITERATING    # iterating             # <<<<<<<<<<<<<<
 *     ITERATING             = TAO_CONTINUE_ITERATING    # iterating
 *     # converged
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_CONTINUE_ITERATING); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_CONVERGED_ITERATING, __pyx_t_1) < 0) __PYX_ERR(38, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":35
 *     CONTINUE_ITERATING    = TAO_CONTINUE_ITERATING    # iterating
 *     CONVERGED_ITERATING   = TAO_CONTINUE_ITERATING    # iterating
 *     ITERATING             = TAO_CONTINUE_ITERATING    # iterating             # <<<<<<<<<<<<<<
 *     # converged
 *     CONVERGED_GATOL       = TAO_CONVERGED_GATOL       # ||g(X)|| < gatol
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_CONTINUE_ITERATING); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_ITERATING, __pyx_t_1) < 0) __PYX_ERR(38, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":37
 *     ITERATING             = TAO_CONTINUE_ITERATING    # iterating
 *     # converged
 *     CONVERGED_GATOL       = TAO_CONVERGED_GATOL       # ||g(X)|| < gatol             # <<<<<<<<<<<<<<
 *     CONVERGED_GRTOL       = TAO_CONVERGED_GRTOL       # ||g(X)||/f(X)  < grtol
 *     CONVERGED_GTTOL       = TAO_CONVERGED_GTTOL       # ||g(X)||/||g(X0)|| < gttol
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_CONVERGED_GATOL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_CONVERGED_GATOL, __pyx_t_1) < 0) __PYX_ERR(38, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":38
 *     # converged
 *     CONVERGED_GATOL       = TAO_CONVERGED_GATOL       # ||g(X)|| < gatol
 *     CONVERGED_GRTOL       = TAO_CONVERGED_GRTOL       # ||g(X)||/f(X)  < grtol             # <<<<<<<<<<<<<<
 *     CONVERGED_GTTOL       = TAO_CONVERGED_GTTOL       # ||g(X)||/||g(X0)|| < gttol
 *     CONVERGED_STEPTOL     = TAO_CONVERGED_STEPTOL     # small step size
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_CONVERGED_GRTOL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_CONVERGED_GRTOL, __pyx_t_1) < 0) __PYX_ERR(38, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":39
 *     CONVERGED_GATOL       = TAO_CONVERGED_GATOL       # ||g(X)|| < gatol
 *     CONVERGED_GRTOL       = TAO_CONVERGED_GRTOL       # ||g(X)||/f(X)  < grtol
 *     CONVERGED_GTTOL       = TAO_CONVERGED_GTTOL       # ||g(X)||/||g(X0)|| < gttol             # <<<<<<<<<<<<<<
 *     CONVERGED_STEPTOL     = TAO_CONVERGED_STEPTOL     # small step size
 *     CONVERGED_MINF        = TAO_CONVERGED_MINF        # f(X) < F_min
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_CONVERGED_GTTOL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_CONVERGED_GTTOL, __pyx_t_1) < 0) __PYX_ERR(38, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":40
 *     CONVERGED_GRTOL       = TAO_CONVERGED_GRTOL       # ||g(X)||/f(X)  < grtol
 *     CONVERGED_GTTOL       = TAO_CONVERGED_GTTOL       # ||g(X)||/||g(X0)|| < gttol
 *     CONVERGED_STEPTOL     = TAO_CONVERGED_STEPTOL     # small step size             # <<<<<<<<<<<<<<
 *     CONVERGED_MINF        = TAO_CONVERGED_MINF        # f(X) < F_min
 *     CONVERGED_USER        = TAO_CONVERGED_USER        # user defined
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_CONVERGED_STEPTOL); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_CONVERGED_STEPTOL, __pyx_t_1) < 0) __PYX_ERR(38, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":41
 *     CONVERGED_GTTOL       = TAO_CONVERGED_GTTOL       # ||g(X)||/||g(X0)|| < gttol
 *     CONVERGED_STEPTOL     = TAO_CONVERGED_STEPTOL     # small step size
 *     CONVERGED_MINF        = TAO_CONVERGED_MINF        # f(X) < F_min             # <<<<<<<<<<<<<<
 *     CONVERGED_USER        = TAO_CONVERGED_USER        # user defined
 *     # diverged
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_CONVERGED_MINF); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_CONVERGED_MINF, __pyx_t_1) < 0) __PYX_ERR(38, 41, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":42
 *     CONVERGED_STEPTOL     = TAO_CONVERGED_STEPTOL     # small step size
 *     CONVERGED_MINF        = TAO_CONVERGED_MINF        # f(X) < F_min
 *     CONVERGED_USER        = TAO_CONVERGED_USER        # user defined             # <<<<<<<<<<<<<<
 *     # diverged
 *     DIVERGED_MAXITS       = TAO_DIVERGED_MAXITS       #
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_CONVERGED_USER); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_CONVERGED_USER, __pyx_t_1) < 0) __PYX_ERR(38, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":44
 *     CONVERGED_USER        = TAO_CONVERGED_USER        # user defined
 *     # diverged
 *     DIVERGED_MAXITS       = TAO_DIVERGED_MAXITS       #             # <<<<<<<<<<<<<<
 *     DIVERGED_NAN          = TAO_DIVERGED_NAN          #
 *     DIVERGED_MAXFCN       = TAO_DIVERGED_MAXFCN       #
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_DIVERGED_MAXITS); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_DIVERGED_MAXITS, __pyx_t_1) < 0) __PYX_ERR(38, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":45
 *     # diverged
 *     DIVERGED_MAXITS       = TAO_DIVERGED_MAXITS       #
 *     DIVERGED_NAN          = TAO_DIVERGED_NAN          #             # <<<<<<<<<<<<<<
 *     DIVERGED_MAXFCN       = TAO_DIVERGED_MAXFCN       #
 *     DIVERGED_LS_FAILURE   = TAO_DIVERGED_LS_FAILURE   #
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_DIVERGED_NAN); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_DIVERGED_NAN, __pyx_t_1) < 0) __PYX_ERR(38, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":46
 *     DIVERGED_MAXITS       = TAO_DIVERGED_MAXITS       #
 *     DIVERGED_NAN          = TAO_DIVERGED_NAN          #
 *     DIVERGED_MAXFCN       = TAO_DIVERGED_MAXFCN       #             # <<<<<<<<<<<<<<
 *     DIVERGED_LS_FAILURE   = TAO_DIVERGED_LS_FAILURE   #
 *     DIVERGED_TR_REDUCTION = TAO_DIVERGED_TR_REDUCTION #
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_DIVERGED_MAXFCN); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_DIVERGED_MAXFCN, __pyx_t_1) < 0) __PYX_ERR(38, 46, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":47
 *     DIVERGED_NAN          = TAO_DIVERGED_NAN          #
 *     DIVERGED_MAXFCN       = TAO_DIVERGED_MAXFCN       #
 *     DIVERGED_LS_FAILURE   = TAO_DIVERGED_LS_FAILURE   #             # <<<<<<<<<<<<<<
 *     DIVERGED_TR_REDUCTION = TAO_DIVERGED_TR_REDUCTION #
 *     DIVERGED_USER         = TAO_DIVERGED_USER         # user defined
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_DIVERGED_LS_FAILURE); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_DIVERGED_LS_FAILURE, __pyx_t_1) < 0) __PYX_ERR(38, 47, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":48
 *     DIVERGED_MAXFCN       = TAO_DIVERGED_MAXFCN       #
 *     DIVERGED_LS_FAILURE   = TAO_DIVERGED_LS_FAILURE   #
 *     DIVERGED_TR_REDUCTION = TAO_DIVERGED_TR_REDUCTION #             # <<<<<<<<<<<<<<
 *     DIVERGED_USER         = TAO_DIVERGED_USER         # user defined
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_DIVERGED_TR_REDUCTION); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_DIVERGED_TR_REDUCTION, __pyx_t_1) < 0) __PYX_ERR(38, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":49
 *     DIVERGED_LS_FAILURE   = TAO_DIVERGED_LS_FAILURE   #
 *     DIVERGED_TR_REDUCTION = TAO_DIVERGED_TR_REDUCTION #
 *     DIVERGED_USER         = TAO_DIVERGED_USER         # user defined             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_1 = __Pyx_PyInt_From_TaoConvergedReason(TAO_DIVERGED_USER); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_DIVERGED_USER, __pyx_t_1) < 0) __PYX_ERR(38, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "PETSc/TAO.pyx":28
 *     TEST     = S_(TAOTEST)
 * 
 * class TAOConvergedReason:             # <<<<<<<<<<<<<<
 *     """
 *     TAO Solver Termination Reasons
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_TAOConvergedReason, __pyx_empty_tuple, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(38, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TAOConvergedReason, __pyx_t_1) < 0) __PYX_ERR(38, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/TAO.pyx":59
 *     """
 * 
 *     Type   = TAOType             # <<<<<<<<<<<<<<
 *     Reason = TAOConvergedReason
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TAOType); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TAO->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(38, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_TAO);

  /* "PETSc/TAO.pyx":60
 * 
 *     Type   = TAOType
 *     Reason = TAOConvergedReason             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TAOConvergedReason); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TAO->tp_dict, __pyx_n_s_Reason, __pyx_t_3) < 0) __PYX_ERR(38, 60, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_TAO);

  /* "PETSc/TAO.pyx":511
 *         return toReal(fval)
 * 
 *     getFunctionValue = getObjectiveValue             # <<<<<<<<<<<<<<
 * 
 *     def getConvergedReason(self):
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TAO, __pyx_n_s_getObjectiveValue); if (unlikely(!__pyx_t_3)) __PYX_ERR(38, 511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_TAO->tp_dict, __pyx_n_s_getFunctionValue, __pyx_t_3) < 0) __PYX_ERR(38, 511, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_TAO);

  /* "PETSc/TAO.pyx":649
 * # --------------------------------------------------------------------
 * 
 * del TAOType             # <<<<<<<<<<<<<<
 * del TAOConvergedReason
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_TAOType) < 0) __PYX_ERR(38, 649, __pyx_L1_error)

  /* "PETSc/TAO.pyx":650
 * 
 * del TAOType
 * del TAOConvergedReason             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_TAOConvergedReason) < 0) __PYX_ERR(38, 650, __pyx_L1_error)

  /* "PETSc/AO.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class AOType(object):             # <<<<<<<<<<<<<<
 *     BASIC          = S_(AOBASIC)
 *     ADVANCED       = S_(AOADVANCED)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(39, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(39, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_AOType, __pyx_n_s_AOType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(39, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/AO.pyx":4
 * 
 * class AOType(object):
 *     BASIC          = S_(AOBASIC)             # <<<<<<<<<<<<<<
 *     ADVANCED       = S_(AOADVANCED)
 *     MAPPING        = S_(AOMAPPING)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(AOBASIC); if (unlikely(!__pyx_t_8)) __PYX_ERR(39, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BASIC, __pyx_t_8) < 0) __PYX_ERR(39, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/AO.pyx":5
 * class AOType(object):
 *     BASIC          = S_(AOBASIC)
 *     ADVANCED       = S_(AOADVANCED)             # <<<<<<<<<<<<<<
 *     MAPPING        = S_(AOMAPPING)
 *     MEMORYSCALABLE = S_(AOMEMORYSCALABLE)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(AOADVANCED); if (unlikely(!__pyx_t_8)) __PYX_ERR(39, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_ADVANCED, __pyx_t_8) < 0) __PYX_ERR(39, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/AO.pyx":6
 *     BASIC          = S_(AOBASIC)
 *     ADVANCED       = S_(AOADVANCED)
 *     MAPPING        = S_(AOMAPPING)             # <<<<<<<<<<<<<<
 *     MEMORYSCALABLE = S_(AOMEMORYSCALABLE)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(AOMAPPING); if (unlikely(!__pyx_t_8)) __PYX_ERR(39, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MAPPING, __pyx_t_8) < 0) __PYX_ERR(39, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/AO.pyx":7
 *     ADVANCED       = S_(AOADVANCED)
 *     MAPPING        = S_(AOMAPPING)
 *     MEMORYSCALABLE = S_(AOMEMORYSCALABLE)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(AOMEMORYSCALABLE); if (unlikely(!__pyx_t_8)) __PYX_ERR(39, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MEMORYSCALABLE, __pyx_t_8) < 0) __PYX_ERR(39, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/AO.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class AOType(object):             # <<<<<<<<<<<<<<
 *     BASIC          = S_(AOBASIC)
 *     ADVANCED       = S_(AOADVANCED)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_AOType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(39, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_AOType, __pyx_t_8) < 0) __PYX_ERR(39, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/AO.pyx":13
 * cdef class AO(Object):
 * 
 *     Type = AOType             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_AOType); if (unlikely(!__pyx_t_3)) __PYX_ERR(39, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_AO->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(39, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_AO);

  /* "PETSc/AO.pyx":117
 * # --------------------------------------------------------------------
 * 
 * del AOType             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_AOType) < 0) __PYX_ERR(39, 117, __pyx_L1_error)

  /* "PETSc/DM.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class DMType(object):             # <<<<<<<<<<<<<<
 *     DA        = S_(DMDA_type)
 *     COMPOSITE = S_(DMCOMPOSITE)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_DMType, __pyx_n_s_DMType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(40, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/DM.pyx":4
 * 
 * class DMType(object):
 *     DA        = S_(DMDA_type)             # <<<<<<<<<<<<<<
 *     COMPOSITE = S_(DMCOMPOSITE)
 *     SLICED    = S_(DMSLICED)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(DMDA); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_DA, __pyx_t_8) < 0) __PYX_ERR(40, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":5
 * class DMType(object):
 *     DA        = S_(DMDA_type)
 *     COMPOSITE = S_(DMCOMPOSITE)             # <<<<<<<<<<<<<<
 *     SLICED    = S_(DMSLICED)
 *     SHELL     = S_(DMSHELL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(DMCOMPOSITE); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_COMPOSITE, __pyx_t_8) < 0) __PYX_ERR(40, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":6
 *     DA        = S_(DMDA_type)
 *     COMPOSITE = S_(DMCOMPOSITE)
 *     SLICED    = S_(DMSLICED)             # <<<<<<<<<<<<<<
 *     SHELL     = S_(DMSHELL)
 *     PLEX      = S_(DMPLEX)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(DMSLICED); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SLICED, __pyx_t_8) < 0) __PYX_ERR(40, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":7
 *     COMPOSITE = S_(DMCOMPOSITE)
 *     SLICED    = S_(DMSLICED)
 *     SHELL     = S_(DMSHELL)             # <<<<<<<<<<<<<<
 *     PLEX      = S_(DMPLEX)
 *     CARTESIAN = S_(DMCARTESIAN)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(DMSHELL); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SHELL, __pyx_t_8) < 0) __PYX_ERR(40, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":8
 *     SLICED    = S_(DMSLICED)
 *     SHELL     = S_(DMSHELL)
 *     PLEX      = S_(DMPLEX)             # <<<<<<<<<<<<<<
 *     CARTESIAN = S_(DMCARTESIAN)
 *     REDUNDANT = S_(DMREDUNDANT)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(DMPLEX); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PLEX, __pyx_t_8) < 0) __PYX_ERR(40, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":9
 *     SHELL     = S_(DMSHELL)
 *     PLEX      = S_(DMPLEX)
 *     CARTESIAN = S_(DMCARTESIAN)             # <<<<<<<<<<<<<<
 *     REDUNDANT = S_(DMREDUNDANT)
 *     PATCH     = S_(DMPATCH)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(DMCARTESIAN); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CARTESIAN, __pyx_t_8) < 0) __PYX_ERR(40, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":10
 *     PLEX      = S_(DMPLEX)
 *     CARTESIAN = S_(DMCARTESIAN)
 *     REDUNDANT = S_(DMREDUNDANT)             # <<<<<<<<<<<<<<
 *     PATCH     = S_(DMPATCH)
 *     MOAB      = S_(DMMOAB)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(DMREDUNDANT); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_REDUNDANT, __pyx_t_8) < 0) __PYX_ERR(40, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":11
 *     CARTESIAN = S_(DMCARTESIAN)
 *     REDUNDANT = S_(DMREDUNDANT)
 *     PATCH     = S_(DMPATCH)             # <<<<<<<<<<<<<<
 *     MOAB      = S_(DMMOAB)
 *     NETWORK   = S_(DMNETWORK)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(DMPATCH); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PATCH, __pyx_t_8) < 0) __PYX_ERR(40, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":12
 *     REDUNDANT = S_(DMREDUNDANT)
 *     PATCH     = S_(DMPATCH)
 *     MOAB      = S_(DMMOAB)             # <<<<<<<<<<<<<<
 *     NETWORK   = S_(DMNETWORK)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(DMMOAB); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MOAB, __pyx_t_8) < 0) __PYX_ERR(40, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":13
 *     PATCH     = S_(DMPATCH)
 *     MOAB      = S_(DMMOAB)
 *     NETWORK   = S_(DMNETWORK)             # <<<<<<<<<<<<<<
 * 
 * class DMBoundaryType(object):
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(DMNETWORK); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NETWORK, __pyx_t_8) < 0) __PYX_ERR(40, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class DMType(object):             # <<<<<<<<<<<<<<
 *     DA        = S_(DMDA_type)
 *     COMPOSITE = S_(DMCOMPOSITE)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DMType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DMType, __pyx_t_8) < 0) __PYX_ERR(40, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/DM.pyx":15
 *     NETWORK   = S_(DMNETWORK)
 * 
 * class DMBoundaryType(object):             # <<<<<<<<<<<<<<
 *     NONE     = DM_BOUNDARY_NONE
 *     GHOSTED  = DM_BOUNDARY_GHOSTED
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(40, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_DMBoundaryType, __pyx_n_s_DMBoundaryType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(40, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/DM.pyx":16
 * 
 * class DMBoundaryType(object):
 *     NONE     = DM_BOUNDARY_NONE             # <<<<<<<<<<<<<<
 *     GHOSTED  = DM_BOUNDARY_GHOSTED
 *     MIRROR   = DM_BOUNDARY_MIRROR
 */
  __pyx_t_8 = __Pyx_PyInt_From_DMBoundaryType(DM_BOUNDARY_NONE); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_NONE, __pyx_t_8) < 0) __PYX_ERR(40, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":17
 * class DMBoundaryType(object):
 *     NONE     = DM_BOUNDARY_NONE
 *     GHOSTED  = DM_BOUNDARY_GHOSTED             # <<<<<<<<<<<<<<
 *     MIRROR   = DM_BOUNDARY_MIRROR
 *     PERIODIC = DM_BOUNDARY_PERIODIC
 */
  __pyx_t_8 = __Pyx_PyInt_From_DMBoundaryType(DM_BOUNDARY_GHOSTED); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_GHOSTED, __pyx_t_8) < 0) __PYX_ERR(40, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":18
 *     NONE     = DM_BOUNDARY_NONE
 *     GHOSTED  = DM_BOUNDARY_GHOSTED
 *     MIRROR   = DM_BOUNDARY_MIRROR             # <<<<<<<<<<<<<<
 *     PERIODIC = DM_BOUNDARY_PERIODIC
 *     TWIST    = DM_BOUNDARY_TWIST
 */
  __pyx_t_8 = __Pyx_PyInt_From_DMBoundaryType(DM_BOUNDARY_MIRROR); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_MIRROR, __pyx_t_8) < 0) __PYX_ERR(40, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":19
 *     GHOSTED  = DM_BOUNDARY_GHOSTED
 *     MIRROR   = DM_BOUNDARY_MIRROR
 *     PERIODIC = DM_BOUNDARY_PERIODIC             # <<<<<<<<<<<<<<
 *     TWIST    = DM_BOUNDARY_TWIST
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_DMBoundaryType(DM_BOUNDARY_PERIODIC); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PERIODIC, __pyx_t_8) < 0) __PYX_ERR(40, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":20
 *     MIRROR   = DM_BOUNDARY_MIRROR
 *     PERIODIC = DM_BOUNDARY_PERIODIC
 *     TWIST    = DM_BOUNDARY_TWIST             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = __Pyx_PyInt_From_DMBoundaryType(DM_BOUNDARY_TWIST); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_TWIST, __pyx_t_8) < 0) __PYX_ERR(40, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DM.pyx":15
 *     NETWORK   = S_(DMNETWORK)
 * 
 * class DMBoundaryType(object):             # <<<<<<<<<<<<<<
 *     NONE     = DM_BOUNDARY_NONE
 *     GHOSTED  = DM_BOUNDARY_GHOSTED
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DMBoundaryType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(40, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DMBoundaryType, __pyx_t_8) < 0) __PYX_ERR(40, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/DM.pyx":26
 * cdef class DM(Object):
 * 
 *     Type         = DMType             # <<<<<<<<<<<<<<
 *     BoundaryType = DMBoundaryType
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DMType); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DM->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(40, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_DM);

  /* "PETSc/DM.pyx":27
 * 
 *     Type         = DMType
 *     BoundaryType = DMBoundaryType             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DMBoundaryType); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DM->tp_dict, __pyx_n_s_BoundaryType, __pyx_t_3) < 0) __PYX_ERR(40, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_DM);

  /* "PETSc/DM.pyx":393
 * 
 *     # backward compatibility
 *     createGlobalVector = createGlobalVec             # <<<<<<<<<<<<<<
 *     createLocalVector = createLocalVec
 *     getMatrix = createMatrix = createMat
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DM, __pyx_n_s_createGlobalVec); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DM->tp_dict, __pyx_n_s_createGlobalVector, __pyx_t_3) < 0) __PYX_ERR(40, 393, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_DM);

  /* "PETSc/DM.pyx":394
 *     # backward compatibility
 *     createGlobalVector = createGlobalVec
 *     createLocalVector = createLocalVec             # <<<<<<<<<<<<<<
 *     getMatrix = createMatrix = createMat
 * 
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DM, __pyx_n_s_createLocalVec); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DM->tp_dict, __pyx_n_s_createLocalVector, __pyx_t_3) < 0) __PYX_ERR(40, 394, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_DM);

  /* "PETSc/DM.pyx":395
 *     createGlobalVector = createGlobalVec
 *     createLocalVector = createLocalVec
 *     getMatrix = createMatrix = createMat             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DM, __pyx_n_s_createMat); if (unlikely(!__pyx_t_3)) __PYX_ERR(40, 395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DM->tp_dict, __pyx_n_s_getMatrix, __pyx_t_3) < 0) __PYX_ERR(40, 395, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_DM);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DM->tp_dict, __pyx_n_s_createMatrix, __pyx_t_3) < 0) __PYX_ERR(40, 395, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_DM);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/DM.pyx":399
 * # --------------------------------------------------------------------
 * 
 * del DMType             # <<<<<<<<<<<<<<
 * del DMBoundaryType
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_DMType) < 0) __PYX_ERR(40, 399, __pyx_L1_error)

  /* "PETSc/DM.pyx":400
 * 
 * del DMType
 * del DMBoundaryType             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_DMBoundaryType) < 0) __PYX_ERR(40, 400, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class DMDAStencilType(object):             # <<<<<<<<<<<<<<
 *     STAR = DMDA_STENCIL_STAR
 *     BOX  = DMDA_STENCIL_BOX
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_DMDAStencilType, __pyx_n_s_DMDAStencilType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/DMDA.pyx":4
 * 
 * class DMDAStencilType(object):
 *     STAR = DMDA_STENCIL_STAR             # <<<<<<<<<<<<<<
 *     BOX  = DMDA_STENCIL_BOX
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_DMDAStencilType(DMDA_STENCIL_STAR); if (unlikely(!__pyx_t_8)) __PYX_ERR(41, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_STAR, __pyx_t_8) < 0) __PYX_ERR(41, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DMDA.pyx":5
 * class DMDAStencilType(object):
 *     STAR = DMDA_STENCIL_STAR
 *     BOX  = DMDA_STENCIL_BOX             # <<<<<<<<<<<<<<
 * 
 * class DMDAInterpolationType(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_DMDAStencilType(DMDA_STENCIL_BOX); if (unlikely(!__pyx_t_8)) __PYX_ERR(41, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BOX, __pyx_t_8) < 0) __PYX_ERR(41, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DMDA.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class DMDAStencilType(object):             # <<<<<<<<<<<<<<
 *     STAR = DMDA_STENCIL_STAR
 *     BOX  = DMDA_STENCIL_BOX
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DMDAStencilType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(41, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DMDAStencilType, __pyx_t_8) < 0) __PYX_ERR(41, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/DMDA.pyx":7
 *     BOX  = DMDA_STENCIL_BOX
 * 
 * class DMDAInterpolationType(object):             # <<<<<<<<<<<<<<
 *     Q0 = DMDA_INTERPOLATION_Q0
 *     Q1 = DMDA_INTERPOLATION_Q1
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_DMDAInterpolationType, __pyx_n_s_DMDAInterpolationType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/DMDA.pyx":8
 * 
 * class DMDAInterpolationType(object):
 *     Q0 = DMDA_INTERPOLATION_Q0             # <<<<<<<<<<<<<<
 *     Q1 = DMDA_INTERPOLATION_Q1
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_DMDAInterpolationType(DMDA_Q0); if (unlikely(!__pyx_t_8)) __PYX_ERR(41, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_Q0, __pyx_t_8) < 0) __PYX_ERR(41, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DMDA.pyx":9
 * class DMDAInterpolationType(object):
 *     Q0 = DMDA_INTERPOLATION_Q0
 *     Q1 = DMDA_INTERPOLATION_Q1             # <<<<<<<<<<<<<<
 * 
 * class DMDAElementType(object):
 */
  __pyx_t_8 = __Pyx_PyInt_From_DMDAInterpolationType(DMDA_Q1); if (unlikely(!__pyx_t_8)) __PYX_ERR(41, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_Q1, __pyx_t_8) < 0) __PYX_ERR(41, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DMDA.pyx":7
 *     BOX  = DMDA_STENCIL_BOX
 * 
 * class DMDAInterpolationType(object):             # <<<<<<<<<<<<<<
 *     Q0 = DMDA_INTERPOLATION_Q0
 *     Q1 = DMDA_INTERPOLATION_Q1
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DMDAInterpolationType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(41, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DMDAInterpolationType, __pyx_t_8) < 0) __PYX_ERR(41, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/DMDA.pyx":11
 *     Q1 = DMDA_INTERPOLATION_Q1
 * 
 * class DMDAElementType(object):             # <<<<<<<<<<<<<<
 *     P1 = DMDA_ELEMENT_P1
 *     Q1 = DMDA_ELEMENT_Q1
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(41, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_DMDAElementType, __pyx_n_s_DMDAElementType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(41, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/DMDA.pyx":12
 * 
 * class DMDAElementType(object):
 *     P1 = DMDA_ELEMENT_P1             # <<<<<<<<<<<<<<
 *     Q1 = DMDA_ELEMENT_Q1
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_DMDAElementType(DMDA_ELEMENT_P1); if (unlikely(!__pyx_t_8)) __PYX_ERR(41, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_P1, __pyx_t_8) < 0) __PYX_ERR(41, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DMDA.pyx":13
 * class DMDAElementType(object):
 *     P1 = DMDA_ELEMENT_P1
 *     Q1 = DMDA_ELEMENT_Q1             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = __Pyx_PyInt_From_DMDAElementType(DMDA_ELEMENT_Q1); if (unlikely(!__pyx_t_8)) __PYX_ERR(41, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_Q1, __pyx_t_8) < 0) __PYX_ERR(41, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/DMDA.pyx":11
 *     Q1 = DMDA_INTERPOLATION_Q1
 * 
 * class DMDAElementType(object):             # <<<<<<<<<<<<<<
 *     P1 = DMDA_ELEMENT_P1
 *     Q1 = DMDA_ELEMENT_Q1
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DMDAElementType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(41, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DMDAElementType, __pyx_t_8) < 0) __PYX_ERR(41, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/DMDA.pyx":19
 * cdef class DMDA(DM):
 * 
 *     StencilType       = DMDAStencilType             # <<<<<<<<<<<<<<
 *     InterpolationType = DMDAInterpolationType
 *     ElementType       = DMDAElementType
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DMDAStencilType); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMDA->tp_dict, __pyx_n_s_StencilType, __pyx_t_3) < 0) __PYX_ERR(41, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_DMDA);

  /* "PETSc/DMDA.pyx":20
 * 
 *     StencilType       = DMDAStencilType
 *     InterpolationType = DMDAInterpolationType             # <<<<<<<<<<<<<<
 *     ElementType       = DMDAElementType
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DMDAInterpolationType); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMDA->tp_dict, __pyx_n_s_InterpolationType, __pyx_t_3) < 0) __PYX_ERR(41, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_DMDA);

  /* "PETSc/DMDA.pyx":21
 *     StencilType       = DMDAStencilType
 *     InterpolationType = DMDAInterpolationType
 *     ElementType       = DMDAElementType             # <<<<<<<<<<<<<<
 * 
 *     #
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DMDAElementType); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMDA->tp_dict, __pyx_n_s_ElementType, __pyx_t_3) < 0) __PYX_ERR(41, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_DMDA);

  /* "PETSc/DMDA.pyx":530
 * 
 *     # backward compatibility
 *     createNaturalVector = createNaturalVec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMDA, __pyx_n_s_createNaturalVec); if (unlikely(!__pyx_t_3)) __PYX_ERR(41, 530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMDA->tp_dict, __pyx_n_s_createNaturalVector, __pyx_t_3) < 0) __PYX_ERR(41, 530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_DMDA);

  /* "PETSc/DMDA.pyx":534
 * 
 * # backward compatibility alias
 * DA = DMDA             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DA, ((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMDA)) < 0) __PYX_ERR(41, 534, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":538
 * # --------------------------------------------------------------------
 * 
 * del DMDAStencilType             # <<<<<<<<<<<<<<
 * del DMDAInterpolationType
 * del DMDAElementType
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_DMDAStencilType) < 0) __PYX_ERR(41, 538, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":539
 * 
 * del DMDAStencilType
 * del DMDAInterpolationType             # <<<<<<<<<<<<<<
 * del DMDAElementType
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_DMDAInterpolationType) < 0) __PYX_ERR(41, 539, __pyx_L1_error)

  /* "PETSc/DMDA.pyx":540
 * del DMDAStencilType
 * del DMDAInterpolationType
 * del DMDAElementType             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_DMDAElementType) < 0) __PYX_ERR(41, 540, __pyx_L1_error)

  /* "PETSc/DMComposite.pyx":25
 *         CHKERR( DMCompositeGetNumberDM(self.dm, &n) )
 *         return toInt(n)
 *     getNumberDM = getNumber             # <<<<<<<<<<<<<<
 * 
 *     def getEntries(self):
 */
  __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMComposite, __pyx_n_s_getNumber); if (unlikely(!__pyx_t_3)) __PYX_ERR(43, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_DMComposite->tp_dict, __pyx_n_s_getNumberDM, __pyx_t_3) < 0) __PYX_ERR(43, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_DMComposite);

  /* "PETSc/SF.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class SFType(object):             # <<<<<<<<<<<<<<
 *     BASIC  = S_(PETSCSFBASIC)
 *     WINDOW = S_(PETSCSFWINDOW)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(45, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(45, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_SFType, __pyx_n_s_SFType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(45, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/SF.pyx":4
 * 
 * class SFType(object):
 *     BASIC  = S_(PETSCSFBASIC)             # <<<<<<<<<<<<<<
 *     WINDOW = S_(PETSCSFWINDOW)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PETSCSFBASIC); if (unlikely(!__pyx_t_8)) __PYX_ERR(45, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_BASIC, __pyx_t_8) < 0) __PYX_ERR(45, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SF.pyx":5
 * class SFType(object):
 *     BASIC  = S_(PETSCSFBASIC)
 *     WINDOW = S_(PETSCSFWINDOW)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PETSCSFWINDOW); if (unlikely(!__pyx_t_8)) __PYX_ERR(45, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_WINDOW, __pyx_t_8) < 0) __PYX_ERR(45, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/SF.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class SFType(object):             # <<<<<<<<<<<<<<
 *     BASIC  = S_(PETSCSFBASIC)
 *     WINDOW = S_(PETSCSFWINDOW)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_SFType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(45, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SFType, __pyx_t_8) < 0) __PYX_ERR(45, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/SF.pyx":11
 * cdef class SF(Object):
 * 
 *     Type = SFType             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_SFType); if (unlikely(!__pyx_t_3)) __PYX_ERR(45, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_SF->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(45, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_SF);

  /* "PETSc/SF.pyx":104
 * # --------------------------------------------------------------------
 * 
 * del SFType             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_SFType) < 0) __PYX_ERR(45, 104, __pyx_L1_error)

  /* "PETSc/Partitioner.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class PartitionerType(object):             # <<<<<<<<<<<<<<
 *     CHACO    = S_(PETSCPARTITIONERCHACO)
 *     PARMETIS = S_(PETSCPARTITIONERPARMETIS)
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(46, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(46, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_PartitionerType, __pyx_n_s_PartitionerType, (PyObject *) NULL, __pyx_n_s_petsc4py_PETSc, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(46, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "PETSc/Partitioner.pyx":4
 * 
 * class PartitionerType(object):
 *     CHACO    = S_(PETSCPARTITIONERCHACO)             # <<<<<<<<<<<<<<
 *     PARMETIS = S_(PETSCPARTITIONERPARMETIS)
 *     SHELL    = S_(PETSCPARTITIONERSHELL)
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PETSCPARTITIONERCHACO); if (unlikely(!__pyx_t_8)) __PYX_ERR(46, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_CHACO, __pyx_t_8) < 0) __PYX_ERR(46, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Partitioner.pyx":5
 * class PartitionerType(object):
 *     CHACO    = S_(PETSCPARTITIONERCHACO)
 *     PARMETIS = S_(PETSCPARTITIONERPARMETIS)             # <<<<<<<<<<<<<<
 *     SHELL    = S_(PETSCPARTITIONERSHELL)
 * 
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PETSCPARTITIONERPARMETIS); if (unlikely(!__pyx_t_8)) __PYX_ERR(46, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_PARMETIS, __pyx_t_8) < 0) __PYX_ERR(46, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Partitioner.pyx":6
 *     CHACO    = S_(PETSCPARTITIONERCHACO)
 *     PARMETIS = S_(PETSCPARTITIONERPARMETIS)
 *     SHELL    = S_(PETSCPARTITIONERSHELL)             # <<<<<<<<<<<<<<
 * 
 * # --------------------------------------------------------------------
 */
  __pyx_t_8 = __pyx_f_8petsc4py_5PETSc_S_(PETSCPARTITIONERSHELL); if (unlikely(!__pyx_t_8)) __PYX_ERR(46, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s_SHELL, __pyx_t_8) < 0) __PYX_ERR(46, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "PETSc/Partitioner.pyx":3
 * # --------------------------------------------------------------------
 * 
 * class PartitionerType(object):             # <<<<<<<<<<<<<<
 *     CHACO    = S_(PETSCPARTITIONERCHACO)
 *     PARMETIS = S_(PETSCPARTITIONERPARMETIS)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PartitionerType, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(46, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PartitionerType, __pyx_t_8) < 0) __PYX_ERR(46, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __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;

  /* "PETSc/Partitioner.pyx":12
 * cdef class Partitioner(Object):
 * 
 *     Type = PartitionerType             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_PartitionerType); if (unlikely(!__pyx_t_3)) __PYX_ERR(46, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8petsc4py_5PETSc_Partitioner->tp_dict, __pyx_n_s_Type, __pyx_t_3) < 0) __PYX_ERR(46, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8petsc4py_5PETSc_Partitioner);

  /* "PETSc/PETSc.pyx":190
 *                   int,PetscErrorType,char*,void*)
 * 
 * cdef object tracebacklist = []             # <<<<<<<<<<<<<<
 * 
 * cdef int traceback(MPI_Comm       comm,
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_XGOTREF(__pyx_v_8petsc4py_5PETSc_tracebacklist);
  __Pyx_DECREF_SET(__pyx_v_8petsc4py_5PETSc_tracebacklist, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "PETSc/PETSc.pyx":270
 *     int PetscPythonRegisterAll()
 * 
 * cdef int    PyPetsc_Argc = 0             # <<<<<<<<<<<<<<
 * cdef char** PyPetsc_Argv = NULL
 * 
 */
  __pyx_v_8petsc4py_5PETSc_PyPetsc_Argc = 0;

  /* "PETSc/PETSc.pyx":271
 * 
 * cdef int    PyPetsc_Argc = 0
 * cdef char** PyPetsc_Argv = NULL             # <<<<<<<<<<<<<<
 * 
 * cdef int getinitargs(object args, int *argc, char **argv[]) except -1:
 */
  __pyx_v_8petsc4py_5PETSc_PyPetsc_Argv = NULL;

  /* "PETSc/PETSc.pyx":366
 *     PetscClassId PETSC_PARTITIONER_CLASSID "PETSCPARTITIONER_CLASSID"
 * 
 * cdef bint registercalled = 0             # <<<<<<<<<<<<<<
 * 
 * cdef const char *citation = b"""\
 */
  __pyx_v_8petsc4py_5PETSc_registercalled = 0;

  /* "PETSc/PETSc.pyx":368
 * cdef bint registercalled = 0
 * 
 * cdef const char *citation = b"""\             # <<<<<<<<<<<<<<
 * @Article{Dalcin2011,
 *   Author = {Lisandro D. Dalcin and Rodrigo R. Paz and Pablo A. Kler and Alejandro Cosimo},
 */
  __pyx_v_8petsc4py_5PETSc_citation = ((char const *)"@Article{Dalcin2011,\n  Author = {Lisandro D. Dalcin and Rodrigo R. Paz and Pablo A. Kler and Alejandro Cosimo},\n  Title = {Parallel distributed computing using {P}ython},\n  Journal = {Advances in Water Resources},\n  Note = {New Computational Methods and Software Tools},\n  Volume = {34},\n  Number = {9},\n  Pages = {1124--1139},\n  Year = {2011},\n  DOI = {http://dx.doi.org/10.1016/j.advwatres.2011.04.013}\n}\n");

  /* "PETSc/PETSc.pyx":417
 * # --------------------------------------------------------------------
 * 
 * def _initialize(args=None, comm=None):             # <<<<<<<<<<<<<<
 *     global tracebacklist
 *     Error._traceback_ = tracebacklist
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_8petsc4py_5PETSc_1_initialize, NULL, __pyx_n_s_petsc4py_PETSc); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_initialize, __pyx_t_3) < 0) __PYX_ERR(11, 417, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "PETSc/PETSc.pyx":433
 *     PETSC_COMM_DEFAULT = PETSC_COMM_WORLD
 * 
 * def _finalize():             # <<<<<<<<<<<<<<
 *     finalize()
 *     #
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_8petsc4py_5PETSc_3_finalize, NULL, __pyx_n_s_petsc4py_PETSc); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_finalize, __pyx_t_3) < 0) __PYX_ERR(11, 433, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /*--- Wrapped vars code ---*/

  if (__Pyx_RegisterCleanup()) __PYX_ERR(48, 1, __pyx_L1_error);
  goto __pyx_L0;
  __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_XDECREF(__pyx_t_8);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init petsc4py.PETSc", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init petsc4py.PETSc");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

static void __Pyx_CleanupGlobals(void) {
  Py_CLEAR(__pyx_tuple_);
  Py_CLEAR(__pyx_tuple__3);
  Py_CLEAR(__pyx_tuple__4);
  Py_CLEAR(__pyx_tuple__6);
  Py_CLEAR(__pyx_tuple__7);
  Py_CLEAR(__pyx_slice__8);
  Py_CLEAR(__pyx_slice__9);
  Py_CLEAR(__pyx_tuple__11);
  Py_CLEAR(__pyx_tuple__12);
  Py_CLEAR(__pyx_tuple__13);
  Py_CLEAR(__pyx_tuple__14);
  Py_CLEAR(__pyx_tuple__15);
  Py_CLEAR(__pyx_tuple__16);
  Py_CLEAR(__pyx_tuple__17);
  Py_CLEAR(__pyx_tuple__18);
  Py_CLEAR(__pyx_tuple__19);
  Py_CLEAR(__pyx_tuple__20);
  Py_CLEAR(__pyx_tuple__21);
  Py_CLEAR(__pyx_tuple__22);
  Py_CLEAR(__pyx_tuple__23);
  Py_CLEAR(__pyx_tuple__24);
  Py_CLEAR(__pyx_tuple__25);
  Py_CLEAR(__pyx_tuple__26);
  Py_CLEAR(__pyx_tuple__27);
  Py_CLEAR(__pyx_tuple__28);
  Py_CLEAR(__pyx_tuple__29);
  Py_CLEAR(__pyx_tuple__30);
  Py_CLEAR(__pyx_tuple__31);
  Py_CLEAR(__pyx_tuple__33);
  Py_CLEAR(__pyx_tuple__34);
  Py_CLEAR(__pyx_tuple__35);
  Py_CLEAR(__pyx_tuple__36);
  Py_CLEAR(__pyx_tuple__37);
  Py_CLEAR(__pyx_tuple__38);
  Py_CLEAR(__pyx_tuple__39);
  Py_CLEAR(__pyx_tuple__40);
  Py_CLEAR(__pyx_tuple__41);
  Py_CLEAR(__pyx_tuple__42);
  Py_CLEAR(__pyx_tuple__43);
  Py_CLEAR(__pyx_tuple__44);
  Py_CLEAR(__pyx_tuple__45);
  Py_CLEAR(__pyx_tuple__46);
  Py_CLEAR(__pyx_tuple__47);
  Py_CLEAR(__pyx_tuple__48);
  Py_CLEAR(__pyx_tuple__49);
  Py_CLEAR(__pyx_tuple__50);
  Py_CLEAR(__pyx_tuple__51);
  Py_CLEAR(__pyx_tuple__52);
  Py_CLEAR(__pyx_tuple__53);
  Py_CLEAR(__pyx_tuple__54);
  Py_CLEAR(__pyx_slice__55);
  Py_CLEAR(__pyx_tuple__56);
  Py_CLEAR(__pyx_tuple__57);
  Py_CLEAR(__pyx_tuple__58);
  Py_CLEAR(__pyx_tuple__59);
  Py_CLEAR(__pyx_tuple__60);
  Py_CLEAR(__pyx_tuple__61);
  Py_CLEAR(__pyx_tuple__62);
  Py_CLEAR(__pyx_slice__63);
  Py_CLEAR(__pyx_slice__64);
  Py_CLEAR(__pyx_tuple__65);
  Py_CLEAR(__pyx_tuple__66);
  Py_CLEAR(__pyx_slice__67);
  Py_CLEAR(__pyx_tuple__68);
  Py_CLEAR(__pyx_codeobj__69);
  Py_CLEAR(__pyx_tuple__70);
  Py_CLEAR(__pyx_codeobj__71);
  Py_CLEAR(__pyx_tuple__72);
  Py_CLEAR(__pyx_codeobj__73);
  Py_CLEAR(__pyx_tuple__74);
  Py_CLEAR(__pyx_codeobj__75);
  Py_CLEAR(__pyx_tuple__76);
  Py_CLEAR(__pyx_codeobj__77);
  Py_CLEAR(__pyx_codeobj__78);
  /* CodeObjectCache.cleanup */
  if (__pyx_code_cache.entries) {
      __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
      int i, count = __pyx_code_cache.count;
      __pyx_code_cache.count = 0;
      __pyx_code_cache.max_count = 0;
      __pyx_code_cache.entries = NULL;
      for (i=0; i<count; i++) {
          Py_DECREF(entries[i].code_object);
      }
      PyMem_Free(entries);
  }

Py_CLEAR(__pyx_umethod_PyDict_Type_keys.method);
  Py_CLEAR(__pyx_umethod_PyList_Type_pop.method);
}
static void __pyx_module_cleanup(CYTHON_UNUSED PyObject *self) {
  /*--- Global cleanup code ---*/
  Py_CLEAR(__pyx_v_8petsc4py_5PETSc_tracebacklist);
  Py_CLEAR(__pyx_v_8petsc4py_5PETSc_type_registry);
  Py_CLEAR(__pyx_v_8petsc4py_5PETSc___COMM_WORLD__);
  Py_CLEAR(__pyx_v_8petsc4py_5PETSc___COMM_SELF__);
  Py_CLEAR(__pyx_v_8petsc4py_5PETSc___COMM_NULL__);
  Py_CLEAR(__pyx_v_8petsc4py_5PETSc_event_registry);
  Py_CLEAR(__pyx_v_8petsc4py_5PETSc_class_registry);
  Py_CLEAR(__pyx_v_8petsc4py_5PETSc_stage_registry);
  Py_CLEAR(__pyx_v_8petsc4py_5PETSc_citations_registry);
  Py_CLEAR(__pyx_v_8petsc4py_5PETSc_PetscError);
  __Pyx_CleanupGlobals();
  /*--- Type import cleanup code ---*/
  Py_CLEAR(__pyx_ptype_8petsc4py_5PETSc_dtype);
  Py_CLEAR(__pyx_ptype_8petsc4py_5PETSc_ndarray);
  /*--- Builtin cleanup code ---*/
  Py_CLEAR(__pyx_builtin_object);
  Py_CLEAR(__pyx_builtin_RuntimeError);
  Py_CLEAR(__pyx_builtin_ValueError);
  Py_CLEAR(__pyx_builtin_TypeError);
  Py_CLEAR(__pyx_builtin_KeyError);
  Py_CLEAR(__pyx_builtin_SystemError);
  Py_CLEAR(__pyx_builtin_Ellipsis);
  Py_CLEAR(__pyx_builtin_NotImplementedError);
  Py_CLEAR(__pyx_builtin_enumerate);
  Py_CLEAR(__pyx_builtin_range);
  Py_CLEAR(__pyx_builtin_NotImplemented);
  Py_CLEAR(__pyx_builtin_AttributeError);
  Py_CLEAR(__pyx_builtin_MemoryError);
  /*--- Intern cleanup code ---*/
  Py_CLEAR(__pyx_empty_tuple);
  #if CYTHON_COMPILING_IN_PYPY
  Py_CLEAR(__pyx_b);
  #endif
  Py_CLEAR(__pyx_d);
}

/* --- 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;
}

/* decode_c_bytes */
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, 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)) {
    if (unlikely((start < 0) | (stop < 0))) {
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    if (stop > length)
        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);
    }
}

/* 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

/* 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) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
        }
    }
    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) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_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

/* PyErrFetchRestore */
    #if CYTHON_COMPILING_IN_CPYTHON
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

/* 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
}

/* 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 = 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;
        }
        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
}

/* 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 PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        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 = PyThreadState_GET();
        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

/* GetException */
      #if CYTHON_COMPILING_IN_CPYTHON
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_COMPILING_IN_CPYTHON
    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_COMPILING_IN_CPYTHON
    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_COMPILING_IN_CPYTHON
    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;
    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;
}

/* SwapException */
        #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    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;
    *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

/* SaveResetException */
        #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    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;
    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;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyObjectCallMethod1 */
        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 bad;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            args = PyTuple_New(2);
            if (unlikely(!args)) goto bad;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            Py_DECREF(method); method = NULL;
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
bad:
    Py_XDECREF(method);
    return result;
}

/* pop_index */
        static PyObject* __Pyx__PyObject_PopNewIndex(PyObject* L, PyObject* py_ix) {
    PyObject *r;
    if (unlikely(!py_ix)) return NULL;
    r = __Pyx__PyObject_PopIndex(L, py_ix);
    Py_DECREF(py_ix);
    return r;
}
static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, PyObject* py_ix) {
    return __Pyx_PyObject_CallMethod1(L, __pyx_n_s_pop, py_ix);
}
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyList_PopIndex(PyObject* L, PyObject* py_ix, Py_ssize_t ix) {
    Py_ssize_t size = PyList_GET_SIZE(L);
    if (likely(size > (((PyListObject*)L)->allocated >> 1))) {
        Py_ssize_t cix = ix;
        if (cix < 0) {
            cix += size;
        }
        if (likely(0 <= cix && cix < size)) {
            PyObject* v = PyList_GET_ITEM(L, cix);
            Py_SIZE(L) -= 1;
            size -= 1;
            memmove(&PyList_GET_ITEM(L, cix), &PyList_GET_ITEM(L, cix+1), (size_t)(size-cix)*sizeof(PyObject*));
            return v;
        }
    }
    if (py_ix == Py_None) {
        return __Pyx__PyObject_PopNewIndex(L, PyInt_FromSsize_t(ix));
    } else {
        return __Pyx__PyObject_PopIndex(L, py_ix);
    }
}
#endif

/* SliceObject */
        static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_COMPILING_IN_CPYTHON
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* GetItemInt */
        static CYTHON_INLINE 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_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, 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_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, 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_COMPILING_IN_CPYTHON
    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));
}

/* 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_VERSION_HEX < 0x03030000
    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, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                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, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            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_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* 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;
}

/* 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(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* 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_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || 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;
}

/* PyErrExceptionMatches */
        #if CYTHON_COMPILING_IN_CPYTHON
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;
    return PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* 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);
}

/* ArgTypeTest */
        static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

/* KeywordStringCheck */
        static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
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
    return 0;
}

/* UnpackUnboundCMethod */
        static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(PyObject_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_O | METH_NOARGS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod0 */
        static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* py_dict_keys */
        static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_keys, d);
    else
        return PyDict_Keys(d);
}

/* PyIntBinop */
        #if CYTHON_COMPILING_IN_CPYTHON
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 && PY_MAJOR_VERSION >= 3
    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

/* SetItemInt */
        static CYTHON_INLINE 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_COMPILING_IN_CPYTHON
    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);
}

/* PyIntBinop */
          #if CYTHON_COMPILING_IN_CPYTHON
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 && PY_MAJOR_VERSION >= 3
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
        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;
                    } 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;
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    } 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;
                    }
                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;
                    } 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;
                    }
                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;
                    } 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;
                    }
                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;
                    } 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;
                    }
                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;
                    } 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;
                    }
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
    }
    #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

/* StringJoin */
          #if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
#endif

/* 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;
}

/* dict_getitem_default */
          static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
#else
    if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
        value = PyDict_GetItem(d, key);
        if (unlikely(!value)) {
            value = default_value;
        }
        Py_INCREF(value);
    } else {
        if (default_value == Py_None)
            default_value = NULL;
        value = PyObject_CallMethodObjArgs(
            d, __pyx_n_s_get, key, default_value, NULL);
    }
#endif
    return value;
}

/* 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_COMPILING_IN_CPYTHON
    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;
}

/* pop */
          static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (Py_TYPE(L) == &PySet_Type) {
        return PySet_Pop(L);
    }
#endif
    return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
}
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
    if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
        Py_SIZE(L) -= 1;
        return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
    }
    return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_pop, L);
}
#endif

/* SliceObject */
          static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_ass_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_ass_slice(obj, cstart, cstop, value);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_ass_subscript))
#endif
    {
        int result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_COMPILING_IN_CPYTHON
        result = mp->mp_ass_subscript(obj, py_slice, value);
#else
        result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object does not support slice %.10s",
        Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
bad:
    return -1;
}

/* SliceTupleAndList */
          #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
    Py_ssize_t start = *_start, stop = *_stop, length = *_length;
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    *_length = stop - start;
    *_start = start;
    *_stop = stop;
}
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyList_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyList_New(0);
    dest = PyList_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyListObject*)src)->ob_item + start,
        ((PyListObject*)dest)->ob_item,
        length);
    return dest;
}
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyTuple_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyTuple_New(0);
    dest = PyTuple_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyTupleObject*)src)->ob_item + start,
        ((PyTupleObject*)dest)->ob_item,
        length);
    return dest;
}
#endif

/* GetModuleGlobalName */
          static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    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;
}

/* 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;
}

/* CalculateMetaclass */
            static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
            static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* FetchCommonType */
            static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunction */
            static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_COMPILING_IN_CPYTHON
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    PyObject *self = f->m_self;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0 = PySequence_ITEM(arg, 0);
                if (unlikely(!arg0)) return NULL;
                result = (*meth)(self, arg0);
                Py_DECREF(arg0);
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
	return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_Call,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (__pyx_CyFunctionType == NULL) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (!m->defaults)
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* GetNameInClass */
                static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) {
    PyObject *result;
    result = __Pyx_PyObject_GetAttrStr(nmspace, name);
    if (!result)
        result = __Pyx_GetModuleGlobalName(name);
    return result;
}

/* 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

/* RegisterModuleCleanup */
                #if PY_MAJOR_VERSION < 3
static PyObject* __pyx_module_cleanup_atexit(PyObject *module, CYTHON_UNUSED PyObject *unused) {
    __pyx_module_cleanup(module);
    Py_INCREF(Py_None); return Py_None;
}
static int __Pyx_RegisterCleanup(void) {
    static PyMethodDef cleanup_def = {
        "__cleanup", (PyCFunction)__pyx_module_cleanup_atexit, METH_NOARGS, 0};
    PyObject *cleanup_func = 0;
    PyObject *atexit = 0;
    PyObject *reg = 0;
    PyObject *args = 0;
    PyObject *res = 0;
    int ret = -1;
    cleanup_func = PyCFunction_New(&cleanup_def, 0);
    if (!cleanup_func)
        goto bad;
    atexit = __Pyx_ImportModule("atexit");
    if (!atexit)
        goto bad;
    reg = PyObject_GetAttrString(atexit, "_exithandlers");
    if (reg && PyList_Check(reg)) {
        PyObject *a, *kw;
        a = PyTuple_New(0);
        kw = PyDict_New();
        if (!a || !kw) {
            Py_XDECREF(a);
            Py_XDECREF(kw);
            goto bad;
        }
        args = PyTuple_Pack(3, cleanup_func, a, kw);
        Py_DECREF(a);
        Py_DECREF(kw);
        if (!args)
            goto bad;
        ret = PyList_Insert(reg, 0, args);
    } else {
        if (!reg)
            PyErr_Clear();
        Py_XDECREF(reg);
        reg = PyObject_GetAttrString(atexit, "register");
        if (!reg)
            goto bad;
        args = PyTuple_Pack(1, cleanup_func);
        if (!args)
            goto bad;
        res = PyObject_CallObject(reg, args);
        if (!res)
            goto bad;
        ret = 0;
    }
bad:
    Py_XDECREF(cleanup_func);
    Py_XDECREF(atexit);
    Py_XDECREF(reg);
    Py_XDECREF(args);
    Py_XDECREF(res);
    return ret;
}
#else
static int __Pyx_RegisterCleanup(void) {
    if (0) __Pyx_ImportModule(NULL);
    return 0;
}
#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;
    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(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* 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;\
    }

/* 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);
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_InsertMode(InsertMode value) {
    const InsertMode neg_one = (InsertMode) -1, const_zero = (InsertMode) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(InsertMode) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(InsertMode) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(InsertMode) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(InsertMode) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(InsertMode) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(InsertMode),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ScatterMode(ScatterMode value) {
    const ScatterMode neg_one = (ScatterMode) -1, const_zero = (ScatterMode) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(ScatterMode) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(ScatterMode) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(ScatterMode) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(ScatterMode) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(ScatterMode) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(ScatterMode),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_NormType(NormType value) {
    const NormType neg_one = (NormType) -1, const_zero = (NormType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(NormType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(NormType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(NormType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(NormType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(NormType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(NormType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscViewerFormat(PetscViewerFormat value) {
    const PetscViewerFormat neg_one = (PetscViewerFormat) -1, const_zero = (PetscViewerFormat) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PetscViewerFormat) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscViewerFormat) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PetscViewerFormat) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PetscViewerFormat) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscViewerFormat) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PetscViewerFormat),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscFileMode(PetscFileMode value) {
    const PetscFileMode neg_one = (PetscFileMode) -1, const_zero = (PetscFileMode) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PetscFileMode) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscFileMode) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PetscFileMode) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PetscFileMode) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscFileMode) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PetscFileMode),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ISGlobalToLocalMappingType(ISGlobalToLocalMappingType value) {
    const ISGlobalToLocalMappingType neg_one = (ISGlobalToLocalMappingType) -1, const_zero = (ISGlobalToLocalMappingType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(ISGlobalToLocalMappingType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(ISGlobalToLocalMappingType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(ISGlobalToLocalMappingType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(ISGlobalToLocalMappingType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(ISGlobalToLocalMappingType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(ISGlobalToLocalMappingType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_VecOption(VecOption value) {
    const VecOption neg_one = (VecOption) -1, const_zero = (VecOption) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(VecOption) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(VecOption) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(VecOption) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(VecOption) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(VecOption) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(VecOption),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MatOption(MatOption value) {
    const MatOption neg_one = (MatOption) -1, const_zero = (MatOption) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(MatOption) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MatOption) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(MatOption) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(MatOption) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MatOption) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(MatOption),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MatAssemblyType(MatAssemblyType value) {
    const MatAssemblyType neg_one = (MatAssemblyType) -1, const_zero = (MatAssemblyType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(MatAssemblyType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MatAssemblyType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(MatAssemblyType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(MatAssemblyType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MatAssemblyType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(MatAssemblyType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MatInfoType(MatInfoType value) {
    const MatInfoType neg_one = (MatInfoType) -1, const_zero = (MatInfoType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(MatInfoType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MatInfoType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(MatInfoType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(MatInfoType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MatInfoType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(MatInfoType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MatStructure(MatStructure value) {
    const MatStructure neg_one = (MatStructure) -1, const_zero = (MatStructure) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(MatStructure) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MatStructure) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(MatStructure) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(MatStructure) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MatStructure) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(MatStructure),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MatFactorShiftType(MatFactorShiftType value) {
    const MatFactorShiftType neg_one = (MatFactorShiftType) -1, const_zero = (MatFactorShiftType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(MatFactorShiftType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MatFactorShiftType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(MatFactorShiftType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(MatFactorShiftType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MatFactorShiftType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(MatFactorShiftType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MatSORType(MatSORType value) {
    const MatSORType neg_one = (MatSORType) -1, const_zero = (MatSORType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(MatSORType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MatSORType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(MatSORType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(MatSORType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MatSORType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(MatSORType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCSide(PCSide value) {
    const PCSide neg_one = (PCSide) -1, const_zero = (PCSide) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PCSide) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCSide) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PCSide) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PCSide) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCSide) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PCSide),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCASMType(PCASMType value) {
    const PCASMType neg_one = (PCASMType) -1, const_zero = (PCASMType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PCASMType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCASMType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PCASMType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PCASMType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCASMType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PCASMType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCGASMType(PCGASMType value) {
    const PCGASMType neg_one = (PCGASMType) -1, const_zero = (PCGASMType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PCGASMType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCGASMType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PCGASMType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PCGASMType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCGASMType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PCGASMType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCMGType(PCMGType value) {
    const PCMGType neg_one = (PCMGType) -1, const_zero = (PCMGType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PCMGType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCMGType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PCMGType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PCMGType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCMGType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PCMGType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCCompositeType(PCCompositeType value) {
    const PCCompositeType neg_one = (PCCompositeType) -1, const_zero = (PCCompositeType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PCCompositeType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCCompositeType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PCCompositeType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PCCompositeType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCCompositeType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PCCompositeType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCFieldSplitSchurPreType(PCFieldSplitSchurPreType value) {
    const PCFieldSplitSchurPreType neg_one = (PCFieldSplitSchurPreType) -1, const_zero = (PCFieldSplitSchurPreType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PCFieldSplitSchurPreType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCFieldSplitSchurPreType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PCFieldSplitSchurPreType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PCFieldSplitSchurPreType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCFieldSplitSchurPreType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PCFieldSplitSchurPreType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PCFieldSplitSchurFactType(PCFieldSplitSchurFactType value) {
    const PCFieldSplitSchurFactType neg_one = (PCFieldSplitSchurFactType) -1, const_zero = (PCFieldSplitSchurFactType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PCFieldSplitSchurFactType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCFieldSplitSchurFactType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PCFieldSplitSchurFactType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PCFieldSplitSchurFactType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PCFieldSplitSchurFactType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PCFieldSplitSchurFactType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_KSPNormType(KSPNormType value) {
    const KSPNormType neg_one = (KSPNormType) -1, const_zero = (KSPNormType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(KSPNormType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(KSPNormType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(KSPNormType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(KSPNormType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(KSPNormType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(KSPNormType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_KSPConvergedReason(KSPConvergedReason value) {
    const KSPConvergedReason neg_one = (KSPConvergedReason) -1, const_zero = (KSPConvergedReason) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(KSPConvergedReason) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(KSPConvergedReason) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(KSPConvergedReason) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(KSPConvergedReason) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(KSPConvergedReason) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(KSPConvergedReason),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SNESNormSchedule(SNESNormSchedule value) {
    const SNESNormSchedule neg_one = (SNESNormSchedule) -1, const_zero = (SNESNormSchedule) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(SNESNormSchedule) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(SNESNormSchedule) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(SNESNormSchedule) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(SNESNormSchedule) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(SNESNormSchedule) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(SNESNormSchedule),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SNESConvergedReason(SNESConvergedReason value) {
    const SNESConvergedReason neg_one = (SNESConvergedReason) -1, const_zero = (SNESConvergedReason) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(SNESConvergedReason) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(SNESConvergedReason) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(SNESConvergedReason) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(SNESConvergedReason) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(SNESConvergedReason) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(SNESConvergedReason),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_TSProblemType(TSProblemType value) {
    const TSProblemType neg_one = (TSProblemType) -1, const_zero = (TSProblemType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(TSProblemType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(TSProblemType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(TSProblemType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(TSProblemType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(TSProblemType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(TSProblemType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_TSEquationType(TSEquationType value) {
    const TSEquationType neg_one = (TSEquationType) -1, const_zero = (TSEquationType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(TSEquationType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(TSEquationType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(TSEquationType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(TSEquationType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(TSEquationType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(TSEquationType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_TSExactFinalTimeOption(TSExactFinalTimeOption value) {
    const TSExactFinalTimeOption neg_one = (TSExactFinalTimeOption) -1, const_zero = (TSExactFinalTimeOption) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(TSExactFinalTimeOption) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(TSExactFinalTimeOption) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(TSExactFinalTimeOption) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(TSExactFinalTimeOption) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(TSExactFinalTimeOption) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(TSExactFinalTimeOption),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_TSConvergedReason(TSConvergedReason value) {
    const TSConvergedReason neg_one = (TSConvergedReason) -1, const_zero = (TSConvergedReason) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(TSConvergedReason) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(TSConvergedReason) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(TSConvergedReason) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(TSConvergedReason) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(TSConvergedReason) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(TSConvergedReason),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_TaoConvergedReason(TaoConvergedReason value) {
    const TaoConvergedReason neg_one = (TaoConvergedReason) -1, const_zero = (TaoConvergedReason) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(TaoConvergedReason) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(TaoConvergedReason) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(TaoConvergedReason) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(TaoConvergedReason) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(TaoConvergedReason) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(TaoConvergedReason),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DMBoundaryType(DMBoundaryType value) {
    const DMBoundaryType neg_one = (DMBoundaryType) -1, const_zero = (DMBoundaryType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(DMBoundaryType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(DMBoundaryType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(DMBoundaryType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(DMBoundaryType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(DMBoundaryType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(DMBoundaryType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DMDAStencilType(DMDAStencilType value) {
    const DMDAStencilType neg_one = (DMDAStencilType) -1, const_zero = (DMDAStencilType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(DMDAStencilType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(DMDAStencilType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(DMDAStencilType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(DMDAStencilType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(DMDAStencilType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(DMDAStencilType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DMDAInterpolationType(DMDAInterpolationType value) {
    const DMDAInterpolationType neg_one = (DMDAInterpolationType) -1, const_zero = (DMDAInterpolationType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(DMDAInterpolationType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(DMDAInterpolationType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(DMDAInterpolationType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(DMDAInterpolationType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(DMDAInterpolationType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(DMDAInterpolationType),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DMDAElementType(DMDAElementType value) {
    const DMDAElementType neg_one = (DMDAElementType) -1, const_zero = (DMDAElementType) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(DMDAElementType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(DMDAElementType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(DMDAElementType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(DMDAElementType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(DMDAElementType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(DMDAElementType),
                                     little, !is_unsigned);
    }
}

/* 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);
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscInt(PetscInt value) {
    const PetscInt neg_one = (PetscInt) -1, const_zero = (PetscInt) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PetscInt) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscInt) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PetscInt) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PetscInt) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscInt) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PetscInt),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscBool(PetscBool value) {
    const PetscBool neg_one = (PetscBool) -1, const_zero = (PetscBool) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PetscBool) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscBool) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PetscBool) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PetscBool) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscBool) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PetscBool),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscLogStage(PetscLogStage value) {
    const PetscLogStage neg_one = (PetscLogStage) -1, const_zero = (PetscLogStage) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PetscLogStage) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscLogStage) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PetscLogStage) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PetscLogStage) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscLogStage) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PetscLogStage),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscClassId(PetscClassId value) {
    const PetscClassId neg_one = (PetscClassId) -1, const_zero = (PetscClassId) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PetscClassId) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscClassId) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PetscClassId) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PetscClassId) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscClassId) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PetscClassId),
                                     little, !is_unsigned);
    }
}

static PyObject* __pyx_convert__to_py_PetscEventPerfInfo(PetscEventPerfInfo s) {
                  PyObject* res;
                  PyObject* member;
                  res = PyDict_New(); if (unlikely(!res)) return NULL;
                  member = __Pyx_PyInt_From_int(s.count); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_count, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.flops); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_flops, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.time); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_time, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.numMessages); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_numMessages, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.messageLength); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_messageLength, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.numReductions); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_numReductions, member) < 0)) goto bad;
                  Py_DECREF(member);
                  return res;
                  bad:
                  Py_XDECREF(member);
                  Py_DECREF(res);
                  return NULL;
                }
                /* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PetscLogEvent(PetscLogEvent value) {
    const PetscLogEvent neg_one = (PetscLogEvent) -1, const_zero = (PetscLogEvent) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PetscLogEvent) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscLogEvent) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(PetscLogEvent) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(PetscLogEvent) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PetscLogEvent) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PetscLogEvent),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MPI_Fint(MPI_Fint value) {
    const MPI_Fint neg_one = (MPI_Fint) -1, const_zero = (MPI_Fint) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(MPI_Fint) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MPI_Fint) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(MPI_Fint) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(MPI_Fint) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(MPI_Fint) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(MPI_Fint),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value) {
    const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(unsigned long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned long),
                                     little, !is_unsigned);
    }
}

static PyObject* __pyx_convert__to_py_MatInfo(MatInfo s) {
                  PyObject* res;
                  PyObject* member;
                  res = PyDict_New(); if (unlikely(!res)) return NULL;
                  member = PyFloat_FromDouble(s.block_size); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_block_size, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.nz_allocated); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_nz_allocated, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.nz_used); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_nz_used, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.nz_unneeded); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_nz_unneeded, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.memory); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_memory, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.assemblies); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_assemblies, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.mallocs); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_mallocs, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.fill_ratio_given); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_fill_ratio_given, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.fill_ratio_needed); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_fill_ratio_needed, member) < 0)) goto bad;
                  Py_DECREF(member);
                  member = PyFloat_FromDouble(s.factor_mallocs); if (unlikely(!member)) goto bad;
                  if (unlikely(PyDict_SetItem(res, __pyx_n_s_factor_mallocs, member) < 0)) goto bad;
                  Py_DECREF(member);
                  return res;
                  bad:
                  Py_XDECREF(member);
                  Py_DECREF(res);
                  return NULL;
                }
                /* ClassMethod */
                static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
#if CYTHON_COMPILING_IN_PYPY
    if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) {
        return PyClassMethod_New(method);
    }
#else
    static PyTypeObject *methoddescr_type = NULL;
    if (methoddescr_type == NULL) {
       PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append");
       if (!meth) return NULL;
       methoddescr_type = Py_TYPE(meth);
       Py_DECREF(meth);
    }
    if (PyObject_TypeCheck(method, methoddescr_type)) {
        PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
        #if PY_VERSION_HEX < 0x03020000
        PyTypeObject *d_type = descr->d_type;
        #else
        PyTypeObject *d_type = descr->d_common.d_type;
        #endif
        return PyDescr_NewClassMethod(d_type, descr->d_method);
    }
#endif
    else if (PyMethod_Check(method)) {
        return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
    }
    else if (PyCFunction_Check(method)) {
        return PyClassMethod_New(method);
    }
#ifdef __Pyx_CyFunction_USED
    else if (PyObject_TypeCheck(method, __pyx_CyFunctionType)) {
        return PyClassMethod_New(method);
    }
#endif
    PyErr_SetString(PyExc_TypeError,
                   "Class-level classmethod() can only be called on "
                   "a method_descriptor or instance method.");
    return NULL;
}

/* 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))
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } 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))
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#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 PetscInt __Pyx_PyInt_As_PetscInt(PyObject *x) {
    const PetscInt neg_one = (PetscInt) -1, const_zero = (PetscInt) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PetscInt) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PetscInt, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PetscInt) 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 (PetscInt) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PetscInt, digit, digits[0])
                case 2:
                    if (8 * sizeof(PetscInt) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscInt, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscInt) >= 2 * PyLong_SHIFT) {
                            return (PetscInt) (((((PetscInt)digits[1]) << PyLong_SHIFT) | (PetscInt)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PetscInt) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscInt, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscInt) >= 3 * PyLong_SHIFT) {
                            return (PetscInt) (((((((PetscInt)digits[2]) << PyLong_SHIFT) | (PetscInt)digits[1]) << PyLong_SHIFT) | (PetscInt)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PetscInt) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscInt, 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(PetscInt) >= 4 * PyLong_SHIFT) {
                            return (PetscInt) (((((((((PetscInt)digits[3]) << PyLong_SHIFT) | (PetscInt)digits[2]) << PyLong_SHIFT) | (PetscInt)digits[1]) << PyLong_SHIFT) | (PetscInt)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 (PetscInt) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PetscInt) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscInt, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(PetscInt) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscInt, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PetscInt) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PetscInt, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PetscInt,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PetscInt) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscInt, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscInt) - 1 > 2 * PyLong_SHIFT) {
                            return (PetscInt) (((PetscInt)-1)*(((((PetscInt)digits[1]) << PyLong_SHIFT) | (PetscInt)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PetscInt) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscInt, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscInt) - 1 > 2 * PyLong_SHIFT) {
                            return (PetscInt) ((((((PetscInt)digits[1]) << PyLong_SHIFT) | (PetscInt)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PetscInt) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscInt, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscInt) - 1 > 3 * PyLong_SHIFT) {
                            return (PetscInt) (((PetscInt)-1)*(((((((PetscInt)digits[2]) << PyLong_SHIFT) | (PetscInt)digits[1]) << PyLong_SHIFT) | (PetscInt)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PetscInt) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscInt, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscInt) - 1 > 3 * PyLong_SHIFT) {
                            return (PetscInt) ((((((((PetscInt)digits[2]) << PyLong_SHIFT) | (PetscInt)digits[1]) << PyLong_SHIFT) | (PetscInt)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PetscInt) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscInt, 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(PetscInt) - 1 > 4 * PyLong_SHIFT) {
                            return (PetscInt) (((PetscInt)-1)*(((((((((PetscInt)digits[3]) << PyLong_SHIFT) | (PetscInt)digits[2]) << PyLong_SHIFT) | (PetscInt)digits[1]) << PyLong_SHIFT) | (PetscInt)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PetscInt) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscInt, 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(PetscInt) - 1 > 4 * PyLong_SHIFT) {
                            return (PetscInt) ((((((((((PetscInt)digits[3]) << PyLong_SHIFT) | (PetscInt)digits[2]) << PyLong_SHIFT) | (PetscInt)digits[1]) << PyLong_SHIFT) | (PetscInt)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PetscInt) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscInt, long, PyLong_AsLong(x))
            } else if (sizeof(PetscInt) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscInt, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PetscInt 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 (PetscInt) -1;
        }
    } else {
        PetscInt val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PetscInt) -1;
        val = __Pyx_PyInt_As_PetscInt(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PetscInt");
    return (PetscInt) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PetscInt");
    return (PetscInt) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE InsertMode __Pyx_PyInt_As_InsertMode(PyObject *x) {
    const InsertMode neg_one = (InsertMode) -1, const_zero = (InsertMode) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(InsertMode) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(InsertMode, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (InsertMode) 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 (InsertMode) 0;
                case  1: __PYX_VERIFY_RETURN_INT(InsertMode, digit, digits[0])
                case 2:
                    if (8 * sizeof(InsertMode) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(InsertMode, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(InsertMode) >= 2 * PyLong_SHIFT) {
                            return (InsertMode) (((((InsertMode)digits[1]) << PyLong_SHIFT) | (InsertMode)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(InsertMode) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(InsertMode, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(InsertMode) >= 3 * PyLong_SHIFT) {
                            return (InsertMode) (((((((InsertMode)digits[2]) << PyLong_SHIFT) | (InsertMode)digits[1]) << PyLong_SHIFT) | (InsertMode)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(InsertMode) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(InsertMode, 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(InsertMode) >= 4 * PyLong_SHIFT) {
                            return (InsertMode) (((((((((InsertMode)digits[3]) << PyLong_SHIFT) | (InsertMode)digits[2]) << PyLong_SHIFT) | (InsertMode)digits[1]) << PyLong_SHIFT) | (InsertMode)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 (InsertMode) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(InsertMode) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(InsertMode, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(InsertMode) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(InsertMode, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (InsertMode) 0;
                case -1: __PYX_VERIFY_RETURN_INT(InsertMode, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(InsertMode,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(InsertMode) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(InsertMode, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(InsertMode) - 1 > 2 * PyLong_SHIFT) {
                            return (InsertMode) (((InsertMode)-1)*(((((InsertMode)digits[1]) << PyLong_SHIFT) | (InsertMode)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(InsertMode) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(InsertMode, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(InsertMode) - 1 > 2 * PyLong_SHIFT) {
                            return (InsertMode) ((((((InsertMode)digits[1]) << PyLong_SHIFT) | (InsertMode)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(InsertMode) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(InsertMode, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(InsertMode) - 1 > 3 * PyLong_SHIFT) {
                            return (InsertMode) (((InsertMode)-1)*(((((((InsertMode)digits[2]) << PyLong_SHIFT) | (InsertMode)digits[1]) << PyLong_SHIFT) | (InsertMode)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(InsertMode) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(InsertMode, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(InsertMode) - 1 > 3 * PyLong_SHIFT) {
                            return (InsertMode) ((((((((InsertMode)digits[2]) << PyLong_SHIFT) | (InsertMode)digits[1]) << PyLong_SHIFT) | (InsertMode)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(InsertMode) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(InsertMode, 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(InsertMode) - 1 > 4 * PyLong_SHIFT) {
                            return (InsertMode) (((InsertMode)-1)*(((((((((InsertMode)digits[3]) << PyLong_SHIFT) | (InsertMode)digits[2]) << PyLong_SHIFT) | (InsertMode)digits[1]) << PyLong_SHIFT) | (InsertMode)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(InsertMode) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(InsertMode, 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(InsertMode) - 1 > 4 * PyLong_SHIFT) {
                            return (InsertMode) ((((((((((InsertMode)digits[3]) << PyLong_SHIFT) | (InsertMode)digits[2]) << PyLong_SHIFT) | (InsertMode)digits[1]) << PyLong_SHIFT) | (InsertMode)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(InsertMode) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(InsertMode, long, PyLong_AsLong(x))
            } else if (sizeof(InsertMode) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(InsertMode, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            InsertMode 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 (InsertMode) -1;
        }
    } else {
        InsertMode val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (InsertMode) -1;
        val = __Pyx_PyInt_As_InsertMode(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to InsertMode");
    return (InsertMode) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to InsertMode");
    return (InsertMode) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE ScatterMode __Pyx_PyInt_As_ScatterMode(PyObject *x) {
    const ScatterMode neg_one = (ScatterMode) -1, const_zero = (ScatterMode) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(ScatterMode) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(ScatterMode, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (ScatterMode) 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 (ScatterMode) 0;
                case  1: __PYX_VERIFY_RETURN_INT(ScatterMode, digit, digits[0])
                case 2:
                    if (8 * sizeof(ScatterMode) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ScatterMode, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(ScatterMode) >= 2 * PyLong_SHIFT) {
                            return (ScatterMode) (((((ScatterMode)digits[1]) << PyLong_SHIFT) | (ScatterMode)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(ScatterMode) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ScatterMode, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(ScatterMode) >= 3 * PyLong_SHIFT) {
                            return (ScatterMode) (((((((ScatterMode)digits[2]) << PyLong_SHIFT) | (ScatterMode)digits[1]) << PyLong_SHIFT) | (ScatterMode)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(ScatterMode) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ScatterMode, 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(ScatterMode) >= 4 * PyLong_SHIFT) {
                            return (ScatterMode) (((((((((ScatterMode)digits[3]) << PyLong_SHIFT) | (ScatterMode)digits[2]) << PyLong_SHIFT) | (ScatterMode)digits[1]) << PyLong_SHIFT) | (ScatterMode)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 (ScatterMode) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(ScatterMode) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(ScatterMode, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(ScatterMode) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(ScatterMode, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (ScatterMode) 0;
                case -1: __PYX_VERIFY_RETURN_INT(ScatterMode, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(ScatterMode,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(ScatterMode) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ScatterMode, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(ScatterMode) - 1 > 2 * PyLong_SHIFT) {
                            return (ScatterMode) (((ScatterMode)-1)*(((((ScatterMode)digits[1]) << PyLong_SHIFT) | (ScatterMode)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(ScatterMode) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ScatterMode, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(ScatterMode) - 1 > 2 * PyLong_SHIFT) {
                            return (ScatterMode) ((((((ScatterMode)digits[1]) << PyLong_SHIFT) | (ScatterMode)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(ScatterMode) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ScatterMode, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(ScatterMode) - 1 > 3 * PyLong_SHIFT) {
                            return (ScatterMode) (((ScatterMode)-1)*(((((((ScatterMode)digits[2]) << PyLong_SHIFT) | (ScatterMode)digits[1]) << PyLong_SHIFT) | (ScatterMode)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(ScatterMode) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ScatterMode, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(ScatterMode) - 1 > 3 * PyLong_SHIFT) {
                            return (ScatterMode) ((((((((ScatterMode)digits[2]) << PyLong_SHIFT) | (ScatterMode)digits[1]) << PyLong_SHIFT) | (ScatterMode)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(ScatterMode) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ScatterMode, 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(ScatterMode) - 1 > 4 * PyLong_SHIFT) {
                            return (ScatterMode) (((ScatterMode)-1)*(((((((((ScatterMode)digits[3]) << PyLong_SHIFT) | (ScatterMode)digits[2]) << PyLong_SHIFT) | (ScatterMode)digits[1]) << PyLong_SHIFT) | (ScatterMode)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(ScatterMode) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ScatterMode, 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(ScatterMode) - 1 > 4 * PyLong_SHIFT) {
                            return (ScatterMode) ((((((((((ScatterMode)digits[3]) << PyLong_SHIFT) | (ScatterMode)digits[2]) << PyLong_SHIFT) | (ScatterMode)digits[1]) << PyLong_SHIFT) | (ScatterMode)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(ScatterMode) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(ScatterMode, long, PyLong_AsLong(x))
            } else if (sizeof(ScatterMode) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(ScatterMode, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            ScatterMode 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 (ScatterMode) -1;
        }
    } else {
        ScatterMode val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (ScatterMode) -1;
        val = __Pyx_PyInt_As_ScatterMode(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to ScatterMode");
    return (ScatterMode) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to ScatterMode");
    return (ScatterMode) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE PetscFileMode __Pyx_PyInt_As_PetscFileMode(PyObject *x) {
    const PetscFileMode neg_one = (PetscFileMode) -1, const_zero = (PetscFileMode) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PetscFileMode) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PetscFileMode, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PetscFileMode) 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 (PetscFileMode) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PetscFileMode, digit, digits[0])
                case 2:
                    if (8 * sizeof(PetscFileMode) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscFileMode, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscFileMode) >= 2 * PyLong_SHIFT) {
                            return (PetscFileMode) (((((PetscFileMode)digits[1]) << PyLong_SHIFT) | (PetscFileMode)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PetscFileMode) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscFileMode, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscFileMode) >= 3 * PyLong_SHIFT) {
                            return (PetscFileMode) (((((((PetscFileMode)digits[2]) << PyLong_SHIFT) | (PetscFileMode)digits[1]) << PyLong_SHIFT) | (PetscFileMode)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PetscFileMode) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscFileMode, 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(PetscFileMode) >= 4 * PyLong_SHIFT) {
                            return (PetscFileMode) (((((((((PetscFileMode)digits[3]) << PyLong_SHIFT) | (PetscFileMode)digits[2]) << PyLong_SHIFT) | (PetscFileMode)digits[1]) << PyLong_SHIFT) | (PetscFileMode)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 (PetscFileMode) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PetscFileMode) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscFileMode, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(PetscFileMode) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscFileMode, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PetscFileMode) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PetscFileMode, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PetscFileMode,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PetscFileMode) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscFileMode, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscFileMode) - 1 > 2 * PyLong_SHIFT) {
                            return (PetscFileMode) (((PetscFileMode)-1)*(((((PetscFileMode)digits[1]) << PyLong_SHIFT) | (PetscFileMode)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PetscFileMode) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscFileMode, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscFileMode) - 1 > 2 * PyLong_SHIFT) {
                            return (PetscFileMode) ((((((PetscFileMode)digits[1]) << PyLong_SHIFT) | (PetscFileMode)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PetscFileMode) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscFileMode, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscFileMode) - 1 > 3 * PyLong_SHIFT) {
                            return (PetscFileMode) (((PetscFileMode)-1)*(((((((PetscFileMode)digits[2]) << PyLong_SHIFT) | (PetscFileMode)digits[1]) << PyLong_SHIFT) | (PetscFileMode)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PetscFileMode) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscFileMode, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscFileMode) - 1 > 3 * PyLong_SHIFT) {
                            return (PetscFileMode) ((((((((PetscFileMode)digits[2]) << PyLong_SHIFT) | (PetscFileMode)digits[1]) << PyLong_SHIFT) | (PetscFileMode)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PetscFileMode) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscFileMode, 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(PetscFileMode) - 1 > 4 * PyLong_SHIFT) {
                            return (PetscFileMode) (((PetscFileMode)-1)*(((((((((PetscFileMode)digits[3]) << PyLong_SHIFT) | (PetscFileMode)digits[2]) << PyLong_SHIFT) | (PetscFileMode)digits[1]) << PyLong_SHIFT) | (PetscFileMode)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PetscFileMode) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscFileMode, 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(PetscFileMode) - 1 > 4 * PyLong_SHIFT) {
                            return (PetscFileMode) ((((((((((PetscFileMode)digits[3]) << PyLong_SHIFT) | (PetscFileMode)digits[2]) << PyLong_SHIFT) | (PetscFileMode)digits[1]) << PyLong_SHIFT) | (PetscFileMode)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PetscFileMode) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscFileMode, long, PyLong_AsLong(x))
            } else if (sizeof(PetscFileMode) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscFileMode, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PetscFileMode 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 (PetscFileMode) -1;
        }
    } else {
        PetscFileMode val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PetscFileMode) -1;
        val = __Pyx_PyInt_As_PetscFileMode(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PetscFileMode");
    return (PetscFileMode) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PetscFileMode");
    return (PetscFileMode) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE MatStructure __Pyx_PyInt_As_MatStructure(PyObject *x) {
    const MatStructure neg_one = (MatStructure) -1, const_zero = (MatStructure) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(MatStructure) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(MatStructure, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (MatStructure) 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 (MatStructure) 0;
                case  1: __PYX_VERIFY_RETURN_INT(MatStructure, digit, digits[0])
                case 2:
                    if (8 * sizeof(MatStructure) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatStructure, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatStructure) >= 2 * PyLong_SHIFT) {
                            return (MatStructure) (((((MatStructure)digits[1]) << PyLong_SHIFT) | (MatStructure)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(MatStructure) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatStructure, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatStructure) >= 3 * PyLong_SHIFT) {
                            return (MatStructure) (((((((MatStructure)digits[2]) << PyLong_SHIFT) | (MatStructure)digits[1]) << PyLong_SHIFT) | (MatStructure)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(MatStructure) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatStructure, 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(MatStructure) >= 4 * PyLong_SHIFT) {
                            return (MatStructure) (((((((((MatStructure)digits[3]) << PyLong_SHIFT) | (MatStructure)digits[2]) << PyLong_SHIFT) | (MatStructure)digits[1]) << PyLong_SHIFT) | (MatStructure)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 (MatStructure) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(MatStructure) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatStructure, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(MatStructure) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatStructure, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (MatStructure) 0;
                case -1: __PYX_VERIFY_RETURN_INT(MatStructure, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(MatStructure,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(MatStructure) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatStructure, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatStructure) - 1 > 2 * PyLong_SHIFT) {
                            return (MatStructure) (((MatStructure)-1)*(((((MatStructure)digits[1]) << PyLong_SHIFT) | (MatStructure)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(MatStructure) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatStructure, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatStructure) - 1 > 2 * PyLong_SHIFT) {
                            return (MatStructure) ((((((MatStructure)digits[1]) << PyLong_SHIFT) | (MatStructure)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(MatStructure) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatStructure, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatStructure) - 1 > 3 * PyLong_SHIFT) {
                            return (MatStructure) (((MatStructure)-1)*(((((((MatStructure)digits[2]) << PyLong_SHIFT) | (MatStructure)digits[1]) << PyLong_SHIFT) | (MatStructure)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(MatStructure) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatStructure, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatStructure) - 1 > 3 * PyLong_SHIFT) {
                            return (MatStructure) ((((((((MatStructure)digits[2]) << PyLong_SHIFT) | (MatStructure)digits[1]) << PyLong_SHIFT) | (MatStructure)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(MatStructure) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatStructure, 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(MatStructure) - 1 > 4 * PyLong_SHIFT) {
                            return (MatStructure) (((MatStructure)-1)*(((((((((MatStructure)digits[3]) << PyLong_SHIFT) | (MatStructure)digits[2]) << PyLong_SHIFT) | (MatStructure)digits[1]) << PyLong_SHIFT) | (MatStructure)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(MatStructure) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatStructure, 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(MatStructure) - 1 > 4 * PyLong_SHIFT) {
                            return (MatStructure) ((((((((((MatStructure)digits[3]) << PyLong_SHIFT) | (MatStructure)digits[2]) << PyLong_SHIFT) | (MatStructure)digits[1]) << PyLong_SHIFT) | (MatStructure)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(MatStructure) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatStructure, long, PyLong_AsLong(x))
            } else if (sizeof(MatStructure) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatStructure, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            MatStructure 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 (MatStructure) -1;
        }
    } else {
        MatStructure val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (MatStructure) -1;
        val = __Pyx_PyInt_As_MatStructure(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to MatStructure");
    return (MatStructure) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to MatStructure");
    return (MatStructure) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE MatAssemblyType __Pyx_PyInt_As_MatAssemblyType(PyObject *x) {
    const MatAssemblyType neg_one = (MatAssemblyType) -1, const_zero = (MatAssemblyType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(MatAssemblyType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(MatAssemblyType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (MatAssemblyType) 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 (MatAssemblyType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(MatAssemblyType, digit, digits[0])
                case 2:
                    if (8 * sizeof(MatAssemblyType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatAssemblyType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatAssemblyType) >= 2 * PyLong_SHIFT) {
                            return (MatAssemblyType) (((((MatAssemblyType)digits[1]) << PyLong_SHIFT) | (MatAssemblyType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(MatAssemblyType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatAssemblyType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatAssemblyType) >= 3 * PyLong_SHIFT) {
                            return (MatAssemblyType) (((((((MatAssemblyType)digits[2]) << PyLong_SHIFT) | (MatAssemblyType)digits[1]) << PyLong_SHIFT) | (MatAssemblyType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(MatAssemblyType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatAssemblyType, 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(MatAssemblyType) >= 4 * PyLong_SHIFT) {
                            return (MatAssemblyType) (((((((((MatAssemblyType)digits[3]) << PyLong_SHIFT) | (MatAssemblyType)digits[2]) << PyLong_SHIFT) | (MatAssemblyType)digits[1]) << PyLong_SHIFT) | (MatAssemblyType)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 (MatAssemblyType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(MatAssemblyType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatAssemblyType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(MatAssemblyType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatAssemblyType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (MatAssemblyType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(MatAssemblyType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(MatAssemblyType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(MatAssemblyType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatAssemblyType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatAssemblyType) - 1 > 2 * PyLong_SHIFT) {
                            return (MatAssemblyType) (((MatAssemblyType)-1)*(((((MatAssemblyType)digits[1]) << PyLong_SHIFT) | (MatAssemblyType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(MatAssemblyType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatAssemblyType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatAssemblyType) - 1 > 2 * PyLong_SHIFT) {
                            return (MatAssemblyType) ((((((MatAssemblyType)digits[1]) << PyLong_SHIFT) | (MatAssemblyType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(MatAssemblyType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatAssemblyType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatAssemblyType) - 1 > 3 * PyLong_SHIFT) {
                            return (MatAssemblyType) (((MatAssemblyType)-1)*(((((((MatAssemblyType)digits[2]) << PyLong_SHIFT) | (MatAssemblyType)digits[1]) << PyLong_SHIFT) | (MatAssemblyType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(MatAssemblyType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatAssemblyType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatAssemblyType) - 1 > 3 * PyLong_SHIFT) {
                            return (MatAssemblyType) ((((((((MatAssemblyType)digits[2]) << PyLong_SHIFT) | (MatAssemblyType)digits[1]) << PyLong_SHIFT) | (MatAssemblyType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(MatAssemblyType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatAssemblyType, 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(MatAssemblyType) - 1 > 4 * PyLong_SHIFT) {
                            return (MatAssemblyType) (((MatAssemblyType)-1)*(((((((((MatAssemblyType)digits[3]) << PyLong_SHIFT) | (MatAssemblyType)digits[2]) << PyLong_SHIFT) | (MatAssemblyType)digits[1]) << PyLong_SHIFT) | (MatAssemblyType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(MatAssemblyType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatAssemblyType, 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(MatAssemblyType) - 1 > 4 * PyLong_SHIFT) {
                            return (MatAssemblyType) ((((((((((MatAssemblyType)digits[3]) << PyLong_SHIFT) | (MatAssemblyType)digits[2]) << PyLong_SHIFT) | (MatAssemblyType)digits[1]) << PyLong_SHIFT) | (MatAssemblyType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(MatAssemblyType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatAssemblyType, long, PyLong_AsLong(x))
            } else if (sizeof(MatAssemblyType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatAssemblyType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            MatAssemblyType 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 (MatAssemblyType) -1;
        }
    } else {
        MatAssemblyType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (MatAssemblyType) -1;
        val = __Pyx_PyInt_As_MatAssemblyType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to MatAssemblyType");
    return (MatAssemblyType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to MatAssemblyType");
    return (MatAssemblyType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE MatInfoType __Pyx_PyInt_As_MatInfoType(PyObject *x) {
    const MatInfoType neg_one = (MatInfoType) -1, const_zero = (MatInfoType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(MatInfoType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(MatInfoType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (MatInfoType) 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 (MatInfoType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(MatInfoType, digit, digits[0])
                case 2:
                    if (8 * sizeof(MatInfoType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatInfoType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatInfoType) >= 2 * PyLong_SHIFT) {
                            return (MatInfoType) (((((MatInfoType)digits[1]) << PyLong_SHIFT) | (MatInfoType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(MatInfoType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatInfoType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatInfoType) >= 3 * PyLong_SHIFT) {
                            return (MatInfoType) (((((((MatInfoType)digits[2]) << PyLong_SHIFT) | (MatInfoType)digits[1]) << PyLong_SHIFT) | (MatInfoType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(MatInfoType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatInfoType, 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(MatInfoType) >= 4 * PyLong_SHIFT) {
                            return (MatInfoType) (((((((((MatInfoType)digits[3]) << PyLong_SHIFT) | (MatInfoType)digits[2]) << PyLong_SHIFT) | (MatInfoType)digits[1]) << PyLong_SHIFT) | (MatInfoType)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 (MatInfoType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(MatInfoType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatInfoType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(MatInfoType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatInfoType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (MatInfoType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(MatInfoType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(MatInfoType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(MatInfoType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatInfoType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatInfoType) - 1 > 2 * PyLong_SHIFT) {
                            return (MatInfoType) (((MatInfoType)-1)*(((((MatInfoType)digits[1]) << PyLong_SHIFT) | (MatInfoType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(MatInfoType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatInfoType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatInfoType) - 1 > 2 * PyLong_SHIFT) {
                            return (MatInfoType) ((((((MatInfoType)digits[1]) << PyLong_SHIFT) | (MatInfoType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(MatInfoType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatInfoType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatInfoType) - 1 > 3 * PyLong_SHIFT) {
                            return (MatInfoType) (((MatInfoType)-1)*(((((((MatInfoType)digits[2]) << PyLong_SHIFT) | (MatInfoType)digits[1]) << PyLong_SHIFT) | (MatInfoType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(MatInfoType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatInfoType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatInfoType) - 1 > 3 * PyLong_SHIFT) {
                            return (MatInfoType) ((((((((MatInfoType)digits[2]) << PyLong_SHIFT) | (MatInfoType)digits[1]) << PyLong_SHIFT) | (MatInfoType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(MatInfoType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatInfoType, 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(MatInfoType) - 1 > 4 * PyLong_SHIFT) {
                            return (MatInfoType) (((MatInfoType)-1)*(((((((((MatInfoType)digits[3]) << PyLong_SHIFT) | (MatInfoType)digits[2]) << PyLong_SHIFT) | (MatInfoType)digits[1]) << PyLong_SHIFT) | (MatInfoType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(MatInfoType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatInfoType, 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(MatInfoType) - 1 > 4 * PyLong_SHIFT) {
                            return (MatInfoType) ((((((((((MatInfoType)digits[3]) << PyLong_SHIFT) | (MatInfoType)digits[2]) << PyLong_SHIFT) | (MatInfoType)digits[1]) << PyLong_SHIFT) | (MatInfoType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(MatInfoType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatInfoType, long, PyLong_AsLong(x))
            } else if (sizeof(MatInfoType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatInfoType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            MatInfoType 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 (MatInfoType) -1;
        }
    } else {
        MatInfoType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (MatInfoType) -1;
        val = __Pyx_PyInt_As_MatInfoType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to MatInfoType");
    return (MatInfoType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to MatInfoType");
    return (MatInfoType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE MatFactorShiftType __Pyx_PyInt_As_MatFactorShiftType(PyObject *x) {
    const MatFactorShiftType neg_one = (MatFactorShiftType) -1, const_zero = (MatFactorShiftType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(MatFactorShiftType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(MatFactorShiftType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (MatFactorShiftType) 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 (MatFactorShiftType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(MatFactorShiftType, digit, digits[0])
                case 2:
                    if (8 * sizeof(MatFactorShiftType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatFactorShiftType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatFactorShiftType) >= 2 * PyLong_SHIFT) {
                            return (MatFactorShiftType) (((((MatFactorShiftType)digits[1]) << PyLong_SHIFT) | (MatFactorShiftType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(MatFactorShiftType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatFactorShiftType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatFactorShiftType) >= 3 * PyLong_SHIFT) {
                            return (MatFactorShiftType) (((((((MatFactorShiftType)digits[2]) << PyLong_SHIFT) | (MatFactorShiftType)digits[1]) << PyLong_SHIFT) | (MatFactorShiftType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(MatFactorShiftType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatFactorShiftType, 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(MatFactorShiftType) >= 4 * PyLong_SHIFT) {
                            return (MatFactorShiftType) (((((((((MatFactorShiftType)digits[3]) << PyLong_SHIFT) | (MatFactorShiftType)digits[2]) << PyLong_SHIFT) | (MatFactorShiftType)digits[1]) << PyLong_SHIFT) | (MatFactorShiftType)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 (MatFactorShiftType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(MatFactorShiftType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatFactorShiftType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(MatFactorShiftType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatFactorShiftType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (MatFactorShiftType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(MatFactorShiftType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(MatFactorShiftType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(MatFactorShiftType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatFactorShiftType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatFactorShiftType) - 1 > 2 * PyLong_SHIFT) {
                            return (MatFactorShiftType) (((MatFactorShiftType)-1)*(((((MatFactorShiftType)digits[1]) << PyLong_SHIFT) | (MatFactorShiftType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(MatFactorShiftType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatFactorShiftType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatFactorShiftType) - 1 > 2 * PyLong_SHIFT) {
                            return (MatFactorShiftType) ((((((MatFactorShiftType)digits[1]) << PyLong_SHIFT) | (MatFactorShiftType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(MatFactorShiftType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatFactorShiftType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatFactorShiftType) - 1 > 3 * PyLong_SHIFT) {
                            return (MatFactorShiftType) (((MatFactorShiftType)-1)*(((((((MatFactorShiftType)digits[2]) << PyLong_SHIFT) | (MatFactorShiftType)digits[1]) << PyLong_SHIFT) | (MatFactorShiftType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(MatFactorShiftType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatFactorShiftType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatFactorShiftType) - 1 > 3 * PyLong_SHIFT) {
                            return (MatFactorShiftType) ((((((((MatFactorShiftType)digits[2]) << PyLong_SHIFT) | (MatFactorShiftType)digits[1]) << PyLong_SHIFT) | (MatFactorShiftType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(MatFactorShiftType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatFactorShiftType, 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(MatFactorShiftType) - 1 > 4 * PyLong_SHIFT) {
                            return (MatFactorShiftType) (((MatFactorShiftType)-1)*(((((((((MatFactorShiftType)digits[3]) << PyLong_SHIFT) | (MatFactorShiftType)digits[2]) << PyLong_SHIFT) | (MatFactorShiftType)digits[1]) << PyLong_SHIFT) | (MatFactorShiftType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(MatFactorShiftType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatFactorShiftType, 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(MatFactorShiftType) - 1 > 4 * PyLong_SHIFT) {
                            return (MatFactorShiftType) ((((((((((MatFactorShiftType)digits[3]) << PyLong_SHIFT) | (MatFactorShiftType)digits[2]) << PyLong_SHIFT) | (MatFactorShiftType)digits[1]) << PyLong_SHIFT) | (MatFactorShiftType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(MatFactorShiftType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatFactorShiftType, long, PyLong_AsLong(x))
            } else if (sizeof(MatFactorShiftType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatFactorShiftType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            MatFactorShiftType 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 (MatFactorShiftType) -1;
        }
    } else {
        MatFactorShiftType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (MatFactorShiftType) -1;
        val = __Pyx_PyInt_As_MatFactorShiftType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to MatFactorShiftType");
    return (MatFactorShiftType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to MatFactorShiftType");
    return (MatFactorShiftType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE KSPConvergedReason __Pyx_PyInt_As_KSPConvergedReason(PyObject *x) {
    const KSPConvergedReason neg_one = (KSPConvergedReason) -1, const_zero = (KSPConvergedReason) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(KSPConvergedReason) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(KSPConvergedReason, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (KSPConvergedReason) 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 (KSPConvergedReason) 0;
                case  1: __PYX_VERIFY_RETURN_INT(KSPConvergedReason, digit, digits[0])
                case 2:
                    if (8 * sizeof(KSPConvergedReason) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPConvergedReason, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(KSPConvergedReason) >= 2 * PyLong_SHIFT) {
                            return (KSPConvergedReason) (((((KSPConvergedReason)digits[1]) << PyLong_SHIFT) | (KSPConvergedReason)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(KSPConvergedReason) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPConvergedReason, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(KSPConvergedReason) >= 3 * PyLong_SHIFT) {
                            return (KSPConvergedReason) (((((((KSPConvergedReason)digits[2]) << PyLong_SHIFT) | (KSPConvergedReason)digits[1]) << PyLong_SHIFT) | (KSPConvergedReason)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(KSPConvergedReason) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPConvergedReason, 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(KSPConvergedReason) >= 4 * PyLong_SHIFT) {
                            return (KSPConvergedReason) (((((((((KSPConvergedReason)digits[3]) << PyLong_SHIFT) | (KSPConvergedReason)digits[2]) << PyLong_SHIFT) | (KSPConvergedReason)digits[1]) << PyLong_SHIFT) | (KSPConvergedReason)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 (KSPConvergedReason) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(KSPConvergedReason) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(KSPConvergedReason, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(KSPConvergedReason) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(KSPConvergedReason, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (KSPConvergedReason) 0;
                case -1: __PYX_VERIFY_RETURN_INT(KSPConvergedReason, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(KSPConvergedReason,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(KSPConvergedReason) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPConvergedReason, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(KSPConvergedReason) - 1 > 2 * PyLong_SHIFT) {
                            return (KSPConvergedReason) (((KSPConvergedReason)-1)*(((((KSPConvergedReason)digits[1]) << PyLong_SHIFT) | (KSPConvergedReason)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(KSPConvergedReason) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPConvergedReason, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(KSPConvergedReason) - 1 > 2 * PyLong_SHIFT) {
                            return (KSPConvergedReason) ((((((KSPConvergedReason)digits[1]) << PyLong_SHIFT) | (KSPConvergedReason)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(KSPConvergedReason) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPConvergedReason, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(KSPConvergedReason) - 1 > 3 * PyLong_SHIFT) {
                            return (KSPConvergedReason) (((KSPConvergedReason)-1)*(((((((KSPConvergedReason)digits[2]) << PyLong_SHIFT) | (KSPConvergedReason)digits[1]) << PyLong_SHIFT) | (KSPConvergedReason)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(KSPConvergedReason) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPConvergedReason, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(KSPConvergedReason) - 1 > 3 * PyLong_SHIFT) {
                            return (KSPConvergedReason) ((((((((KSPConvergedReason)digits[2]) << PyLong_SHIFT) | (KSPConvergedReason)digits[1]) << PyLong_SHIFT) | (KSPConvergedReason)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(KSPConvergedReason) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPConvergedReason, 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(KSPConvergedReason) - 1 > 4 * PyLong_SHIFT) {
                            return (KSPConvergedReason) (((KSPConvergedReason)-1)*(((((((((KSPConvergedReason)digits[3]) << PyLong_SHIFT) | (KSPConvergedReason)digits[2]) << PyLong_SHIFT) | (KSPConvergedReason)digits[1]) << PyLong_SHIFT) | (KSPConvergedReason)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(KSPConvergedReason) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPConvergedReason, 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(KSPConvergedReason) - 1 > 4 * PyLong_SHIFT) {
                            return (KSPConvergedReason) ((((((((((KSPConvergedReason)digits[3]) << PyLong_SHIFT) | (KSPConvergedReason)digits[2]) << PyLong_SHIFT) | (KSPConvergedReason)digits[1]) << PyLong_SHIFT) | (KSPConvergedReason)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(KSPConvergedReason) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(KSPConvergedReason, long, PyLong_AsLong(x))
            } else if (sizeof(KSPConvergedReason) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(KSPConvergedReason, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            KSPConvergedReason 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 (KSPConvergedReason) -1;
        }
    } else {
        KSPConvergedReason val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (KSPConvergedReason) -1;
        val = __Pyx_PyInt_As_KSPConvergedReason(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to KSPConvergedReason");
    return (KSPConvergedReason) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to KSPConvergedReason");
    return (KSPConvergedReason) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE SNESConvergedReason __Pyx_PyInt_As_SNESConvergedReason(PyObject *x) {
    const SNESConvergedReason neg_one = (SNESConvergedReason) -1, const_zero = (SNESConvergedReason) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(SNESConvergedReason) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(SNESConvergedReason, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (SNESConvergedReason) 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 (SNESConvergedReason) 0;
                case  1: __PYX_VERIFY_RETURN_INT(SNESConvergedReason, digit, digits[0])
                case 2:
                    if (8 * sizeof(SNESConvergedReason) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESConvergedReason, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(SNESConvergedReason) >= 2 * PyLong_SHIFT) {
                            return (SNESConvergedReason) (((((SNESConvergedReason)digits[1]) << PyLong_SHIFT) | (SNESConvergedReason)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(SNESConvergedReason) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESConvergedReason, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(SNESConvergedReason) >= 3 * PyLong_SHIFT) {
                            return (SNESConvergedReason) (((((((SNESConvergedReason)digits[2]) << PyLong_SHIFT) | (SNESConvergedReason)digits[1]) << PyLong_SHIFT) | (SNESConvergedReason)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(SNESConvergedReason) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESConvergedReason, 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(SNESConvergedReason) >= 4 * PyLong_SHIFT) {
                            return (SNESConvergedReason) (((((((((SNESConvergedReason)digits[3]) << PyLong_SHIFT) | (SNESConvergedReason)digits[2]) << PyLong_SHIFT) | (SNESConvergedReason)digits[1]) << PyLong_SHIFT) | (SNESConvergedReason)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 (SNESConvergedReason) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(SNESConvergedReason) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(SNESConvergedReason, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(SNESConvergedReason) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(SNESConvergedReason, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (SNESConvergedReason) 0;
                case -1: __PYX_VERIFY_RETURN_INT(SNESConvergedReason, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(SNESConvergedReason,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(SNESConvergedReason) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESConvergedReason, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(SNESConvergedReason) - 1 > 2 * PyLong_SHIFT) {
                            return (SNESConvergedReason) (((SNESConvergedReason)-1)*(((((SNESConvergedReason)digits[1]) << PyLong_SHIFT) | (SNESConvergedReason)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(SNESConvergedReason) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESConvergedReason, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(SNESConvergedReason) - 1 > 2 * PyLong_SHIFT) {
                            return (SNESConvergedReason) ((((((SNESConvergedReason)digits[1]) << PyLong_SHIFT) | (SNESConvergedReason)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(SNESConvergedReason) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESConvergedReason, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(SNESConvergedReason) - 1 > 3 * PyLong_SHIFT) {
                            return (SNESConvergedReason) (((SNESConvergedReason)-1)*(((((((SNESConvergedReason)digits[2]) << PyLong_SHIFT) | (SNESConvergedReason)digits[1]) << PyLong_SHIFT) | (SNESConvergedReason)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(SNESConvergedReason) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESConvergedReason, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(SNESConvergedReason) - 1 > 3 * PyLong_SHIFT) {
                            return (SNESConvergedReason) ((((((((SNESConvergedReason)digits[2]) << PyLong_SHIFT) | (SNESConvergedReason)digits[1]) << PyLong_SHIFT) | (SNESConvergedReason)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(SNESConvergedReason) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESConvergedReason, 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(SNESConvergedReason) - 1 > 4 * PyLong_SHIFT) {
                            return (SNESConvergedReason) (((SNESConvergedReason)-1)*(((((((((SNESConvergedReason)digits[3]) << PyLong_SHIFT) | (SNESConvergedReason)digits[2]) << PyLong_SHIFT) | (SNESConvergedReason)digits[1]) << PyLong_SHIFT) | (SNESConvergedReason)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(SNESConvergedReason) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESConvergedReason, 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(SNESConvergedReason) - 1 > 4 * PyLong_SHIFT) {
                            return (SNESConvergedReason) ((((((((((SNESConvergedReason)digits[3]) << PyLong_SHIFT) | (SNESConvergedReason)digits[2]) << PyLong_SHIFT) | (SNESConvergedReason)digits[1]) << PyLong_SHIFT) | (SNESConvergedReason)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(SNESConvergedReason) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(SNESConvergedReason, long, PyLong_AsLong(x))
            } else if (sizeof(SNESConvergedReason) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(SNESConvergedReason, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            SNESConvergedReason 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 (SNESConvergedReason) -1;
        }
    } else {
        SNESConvergedReason val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (SNESConvergedReason) -1;
        val = __Pyx_PyInt_As_SNESConvergedReason(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to SNESConvergedReason");
    return (SNESConvergedReason) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to SNESConvergedReason");
    return (SNESConvergedReason) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE TaoConvergedReason __Pyx_PyInt_As_TaoConvergedReason(PyObject *x) {
    const TaoConvergedReason neg_one = (TaoConvergedReason) -1, const_zero = (TaoConvergedReason) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(TaoConvergedReason) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(TaoConvergedReason, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (TaoConvergedReason) 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 (TaoConvergedReason) 0;
                case  1: __PYX_VERIFY_RETURN_INT(TaoConvergedReason, digit, digits[0])
                case 2:
                    if (8 * sizeof(TaoConvergedReason) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TaoConvergedReason, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TaoConvergedReason) >= 2 * PyLong_SHIFT) {
                            return (TaoConvergedReason) (((((TaoConvergedReason)digits[1]) << PyLong_SHIFT) | (TaoConvergedReason)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(TaoConvergedReason) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TaoConvergedReason, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TaoConvergedReason) >= 3 * PyLong_SHIFT) {
                            return (TaoConvergedReason) (((((((TaoConvergedReason)digits[2]) << PyLong_SHIFT) | (TaoConvergedReason)digits[1]) << PyLong_SHIFT) | (TaoConvergedReason)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(TaoConvergedReason) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TaoConvergedReason, 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(TaoConvergedReason) >= 4 * PyLong_SHIFT) {
                            return (TaoConvergedReason) (((((((((TaoConvergedReason)digits[3]) << PyLong_SHIFT) | (TaoConvergedReason)digits[2]) << PyLong_SHIFT) | (TaoConvergedReason)digits[1]) << PyLong_SHIFT) | (TaoConvergedReason)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 (TaoConvergedReason) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(TaoConvergedReason) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(TaoConvergedReason, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(TaoConvergedReason) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(TaoConvergedReason, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (TaoConvergedReason) 0;
                case -1: __PYX_VERIFY_RETURN_INT(TaoConvergedReason, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(TaoConvergedReason,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(TaoConvergedReason) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TaoConvergedReason, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TaoConvergedReason) - 1 > 2 * PyLong_SHIFT) {
                            return (TaoConvergedReason) (((TaoConvergedReason)-1)*(((((TaoConvergedReason)digits[1]) << PyLong_SHIFT) | (TaoConvergedReason)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(TaoConvergedReason) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TaoConvergedReason, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TaoConvergedReason) - 1 > 2 * PyLong_SHIFT) {
                            return (TaoConvergedReason) ((((((TaoConvergedReason)digits[1]) << PyLong_SHIFT) | (TaoConvergedReason)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(TaoConvergedReason) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TaoConvergedReason, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TaoConvergedReason) - 1 > 3 * PyLong_SHIFT) {
                            return (TaoConvergedReason) (((TaoConvergedReason)-1)*(((((((TaoConvergedReason)digits[2]) << PyLong_SHIFT) | (TaoConvergedReason)digits[1]) << PyLong_SHIFT) | (TaoConvergedReason)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(TaoConvergedReason) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TaoConvergedReason, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TaoConvergedReason) - 1 > 3 * PyLong_SHIFT) {
                            return (TaoConvergedReason) ((((((((TaoConvergedReason)digits[2]) << PyLong_SHIFT) | (TaoConvergedReason)digits[1]) << PyLong_SHIFT) | (TaoConvergedReason)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(TaoConvergedReason) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TaoConvergedReason, 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(TaoConvergedReason) - 1 > 4 * PyLong_SHIFT) {
                            return (TaoConvergedReason) (((TaoConvergedReason)-1)*(((((((((TaoConvergedReason)digits[3]) << PyLong_SHIFT) | (TaoConvergedReason)digits[2]) << PyLong_SHIFT) | (TaoConvergedReason)digits[1]) << PyLong_SHIFT) | (TaoConvergedReason)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(TaoConvergedReason) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TaoConvergedReason, 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(TaoConvergedReason) - 1 > 4 * PyLong_SHIFT) {
                            return (TaoConvergedReason) ((((((((((TaoConvergedReason)digits[3]) << PyLong_SHIFT) | (TaoConvergedReason)digits[2]) << PyLong_SHIFT) | (TaoConvergedReason)digits[1]) << PyLong_SHIFT) | (TaoConvergedReason)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(TaoConvergedReason) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(TaoConvergedReason, long, PyLong_AsLong(x))
            } else if (sizeof(TaoConvergedReason) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(TaoConvergedReason, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            TaoConvergedReason 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 (TaoConvergedReason) -1;
        }
    } else {
        TaoConvergedReason val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (TaoConvergedReason) -1;
        val = __Pyx_PyInt_As_TaoConvergedReason(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to TaoConvergedReason");
    return (TaoConvergedReason) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to TaoConvergedReason");
    return (TaoConvergedReason) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE DMBoundaryType __Pyx_PyInt_As_DMBoundaryType(PyObject *x) {
    const DMBoundaryType neg_one = (DMBoundaryType) -1, const_zero = (DMBoundaryType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(DMBoundaryType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(DMBoundaryType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (DMBoundaryType) 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 (DMBoundaryType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(DMBoundaryType, digit, digits[0])
                case 2:
                    if (8 * sizeof(DMBoundaryType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMBoundaryType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMBoundaryType) >= 2 * PyLong_SHIFT) {
                            return (DMBoundaryType) (((((DMBoundaryType)digits[1]) << PyLong_SHIFT) | (DMBoundaryType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(DMBoundaryType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMBoundaryType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMBoundaryType) >= 3 * PyLong_SHIFT) {
                            return (DMBoundaryType) (((((((DMBoundaryType)digits[2]) << PyLong_SHIFT) | (DMBoundaryType)digits[1]) << PyLong_SHIFT) | (DMBoundaryType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(DMBoundaryType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMBoundaryType, 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(DMBoundaryType) >= 4 * PyLong_SHIFT) {
                            return (DMBoundaryType) (((((((((DMBoundaryType)digits[3]) << PyLong_SHIFT) | (DMBoundaryType)digits[2]) << PyLong_SHIFT) | (DMBoundaryType)digits[1]) << PyLong_SHIFT) | (DMBoundaryType)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 (DMBoundaryType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(DMBoundaryType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMBoundaryType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(DMBoundaryType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMBoundaryType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (DMBoundaryType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(DMBoundaryType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(DMBoundaryType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(DMBoundaryType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMBoundaryType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMBoundaryType) - 1 > 2 * PyLong_SHIFT) {
                            return (DMBoundaryType) (((DMBoundaryType)-1)*(((((DMBoundaryType)digits[1]) << PyLong_SHIFT) | (DMBoundaryType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(DMBoundaryType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMBoundaryType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMBoundaryType) - 1 > 2 * PyLong_SHIFT) {
                            return (DMBoundaryType) ((((((DMBoundaryType)digits[1]) << PyLong_SHIFT) | (DMBoundaryType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(DMBoundaryType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMBoundaryType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMBoundaryType) - 1 > 3 * PyLong_SHIFT) {
                            return (DMBoundaryType) (((DMBoundaryType)-1)*(((((((DMBoundaryType)digits[2]) << PyLong_SHIFT) | (DMBoundaryType)digits[1]) << PyLong_SHIFT) | (DMBoundaryType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(DMBoundaryType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMBoundaryType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMBoundaryType) - 1 > 3 * PyLong_SHIFT) {
                            return (DMBoundaryType) ((((((((DMBoundaryType)digits[2]) << PyLong_SHIFT) | (DMBoundaryType)digits[1]) << PyLong_SHIFT) | (DMBoundaryType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(DMBoundaryType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMBoundaryType, 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(DMBoundaryType) - 1 > 4 * PyLong_SHIFT) {
                            return (DMBoundaryType) (((DMBoundaryType)-1)*(((((((((DMBoundaryType)digits[3]) << PyLong_SHIFT) | (DMBoundaryType)digits[2]) << PyLong_SHIFT) | (DMBoundaryType)digits[1]) << PyLong_SHIFT) | (DMBoundaryType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(DMBoundaryType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMBoundaryType, 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(DMBoundaryType) - 1 > 4 * PyLong_SHIFT) {
                            return (DMBoundaryType) ((((((((((DMBoundaryType)digits[3]) << PyLong_SHIFT) | (DMBoundaryType)digits[2]) << PyLong_SHIFT) | (DMBoundaryType)digits[1]) << PyLong_SHIFT) | (DMBoundaryType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(DMBoundaryType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMBoundaryType, long, PyLong_AsLong(x))
            } else if (sizeof(DMBoundaryType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMBoundaryType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            DMBoundaryType 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 (DMBoundaryType) -1;
        }
    } else {
        DMBoundaryType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (DMBoundaryType) -1;
        val = __Pyx_PyInt_As_DMBoundaryType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to DMBoundaryType");
    return (DMBoundaryType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to DMBoundaryType");
    return (DMBoundaryType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE DMDAStencilType __Pyx_PyInt_As_DMDAStencilType(PyObject *x) {
    const DMDAStencilType neg_one = (DMDAStencilType) -1, const_zero = (DMDAStencilType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(DMDAStencilType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(DMDAStencilType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (DMDAStencilType) 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 (DMDAStencilType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(DMDAStencilType, digit, digits[0])
                case 2:
                    if (8 * sizeof(DMDAStencilType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAStencilType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAStencilType) >= 2 * PyLong_SHIFT) {
                            return (DMDAStencilType) (((((DMDAStencilType)digits[1]) << PyLong_SHIFT) | (DMDAStencilType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(DMDAStencilType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAStencilType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAStencilType) >= 3 * PyLong_SHIFT) {
                            return (DMDAStencilType) (((((((DMDAStencilType)digits[2]) << PyLong_SHIFT) | (DMDAStencilType)digits[1]) << PyLong_SHIFT) | (DMDAStencilType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(DMDAStencilType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAStencilType, 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(DMDAStencilType) >= 4 * PyLong_SHIFT) {
                            return (DMDAStencilType) (((((((((DMDAStencilType)digits[3]) << PyLong_SHIFT) | (DMDAStencilType)digits[2]) << PyLong_SHIFT) | (DMDAStencilType)digits[1]) << PyLong_SHIFT) | (DMDAStencilType)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 (DMDAStencilType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(DMDAStencilType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMDAStencilType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(DMDAStencilType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMDAStencilType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (DMDAStencilType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(DMDAStencilType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(DMDAStencilType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(DMDAStencilType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAStencilType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAStencilType) - 1 > 2 * PyLong_SHIFT) {
                            return (DMDAStencilType) (((DMDAStencilType)-1)*(((((DMDAStencilType)digits[1]) << PyLong_SHIFT) | (DMDAStencilType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(DMDAStencilType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAStencilType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAStencilType) - 1 > 2 * PyLong_SHIFT) {
                            return (DMDAStencilType) ((((((DMDAStencilType)digits[1]) << PyLong_SHIFT) | (DMDAStencilType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(DMDAStencilType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAStencilType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAStencilType) - 1 > 3 * PyLong_SHIFT) {
                            return (DMDAStencilType) (((DMDAStencilType)-1)*(((((((DMDAStencilType)digits[2]) << PyLong_SHIFT) | (DMDAStencilType)digits[1]) << PyLong_SHIFT) | (DMDAStencilType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(DMDAStencilType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAStencilType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAStencilType) - 1 > 3 * PyLong_SHIFT) {
                            return (DMDAStencilType) ((((((((DMDAStencilType)digits[2]) << PyLong_SHIFT) | (DMDAStencilType)digits[1]) << PyLong_SHIFT) | (DMDAStencilType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(DMDAStencilType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAStencilType, 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(DMDAStencilType) - 1 > 4 * PyLong_SHIFT) {
                            return (DMDAStencilType) (((DMDAStencilType)-1)*(((((((((DMDAStencilType)digits[3]) << PyLong_SHIFT) | (DMDAStencilType)digits[2]) << PyLong_SHIFT) | (DMDAStencilType)digits[1]) << PyLong_SHIFT) | (DMDAStencilType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(DMDAStencilType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAStencilType, 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(DMDAStencilType) - 1 > 4 * PyLong_SHIFT) {
                            return (DMDAStencilType) ((((((((((DMDAStencilType)digits[3]) << PyLong_SHIFT) | (DMDAStencilType)digits[2]) << PyLong_SHIFT) | (DMDAStencilType)digits[1]) << PyLong_SHIFT) | (DMDAStencilType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(DMDAStencilType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMDAStencilType, long, PyLong_AsLong(x))
            } else if (sizeof(DMDAStencilType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMDAStencilType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            DMDAStencilType 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 (DMDAStencilType) -1;
        }
    } else {
        DMDAStencilType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (DMDAStencilType) -1;
        val = __Pyx_PyInt_As_DMDAStencilType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to DMDAStencilType");
    return (DMDAStencilType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to DMDAStencilType");
    return (DMDAStencilType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE DMDAInterpolationType __Pyx_PyInt_As_DMDAInterpolationType(PyObject *x) {
    const DMDAInterpolationType neg_one = (DMDAInterpolationType) -1, const_zero = (DMDAInterpolationType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(DMDAInterpolationType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(DMDAInterpolationType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (DMDAInterpolationType) 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 (DMDAInterpolationType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(DMDAInterpolationType, digit, digits[0])
                case 2:
                    if (8 * sizeof(DMDAInterpolationType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAInterpolationType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAInterpolationType) >= 2 * PyLong_SHIFT) {
                            return (DMDAInterpolationType) (((((DMDAInterpolationType)digits[1]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(DMDAInterpolationType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAInterpolationType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAInterpolationType) >= 3 * PyLong_SHIFT) {
                            return (DMDAInterpolationType) (((((((DMDAInterpolationType)digits[2]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[1]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(DMDAInterpolationType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAInterpolationType, 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(DMDAInterpolationType) >= 4 * PyLong_SHIFT) {
                            return (DMDAInterpolationType) (((((((((DMDAInterpolationType)digits[3]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[2]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[1]) << PyLong_SHIFT) | (DMDAInterpolationType)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 (DMDAInterpolationType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(DMDAInterpolationType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMDAInterpolationType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(DMDAInterpolationType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMDAInterpolationType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (DMDAInterpolationType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(DMDAInterpolationType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(DMDAInterpolationType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(DMDAInterpolationType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAInterpolationType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAInterpolationType) - 1 > 2 * PyLong_SHIFT) {
                            return (DMDAInterpolationType) (((DMDAInterpolationType)-1)*(((((DMDAInterpolationType)digits[1]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(DMDAInterpolationType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAInterpolationType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAInterpolationType) - 1 > 2 * PyLong_SHIFT) {
                            return (DMDAInterpolationType) ((((((DMDAInterpolationType)digits[1]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(DMDAInterpolationType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAInterpolationType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAInterpolationType) - 1 > 3 * PyLong_SHIFT) {
                            return (DMDAInterpolationType) (((DMDAInterpolationType)-1)*(((((((DMDAInterpolationType)digits[2]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[1]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(DMDAInterpolationType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAInterpolationType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAInterpolationType) - 1 > 3 * PyLong_SHIFT) {
                            return (DMDAInterpolationType) ((((((((DMDAInterpolationType)digits[2]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[1]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(DMDAInterpolationType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAInterpolationType, 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(DMDAInterpolationType) - 1 > 4 * PyLong_SHIFT) {
                            return (DMDAInterpolationType) (((DMDAInterpolationType)-1)*(((((((((DMDAInterpolationType)digits[3]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[2]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[1]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(DMDAInterpolationType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAInterpolationType, 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(DMDAInterpolationType) - 1 > 4 * PyLong_SHIFT) {
                            return (DMDAInterpolationType) ((((((((((DMDAInterpolationType)digits[3]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[2]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[1]) << PyLong_SHIFT) | (DMDAInterpolationType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(DMDAInterpolationType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMDAInterpolationType, long, PyLong_AsLong(x))
            } else if (sizeof(DMDAInterpolationType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMDAInterpolationType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            DMDAInterpolationType 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 (DMDAInterpolationType) -1;
        }
    } else {
        DMDAInterpolationType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (DMDAInterpolationType) -1;
        val = __Pyx_PyInt_As_DMDAInterpolationType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to DMDAInterpolationType");
    return (DMDAInterpolationType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to DMDAInterpolationType");
    return (DMDAInterpolationType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE DMDAElementType __Pyx_PyInt_As_DMDAElementType(PyObject *x) {
    const DMDAElementType neg_one = (DMDAElementType) -1, const_zero = (DMDAElementType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(DMDAElementType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(DMDAElementType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (DMDAElementType) 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 (DMDAElementType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(DMDAElementType, digit, digits[0])
                case 2:
                    if (8 * sizeof(DMDAElementType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAElementType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAElementType) >= 2 * PyLong_SHIFT) {
                            return (DMDAElementType) (((((DMDAElementType)digits[1]) << PyLong_SHIFT) | (DMDAElementType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(DMDAElementType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAElementType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAElementType) >= 3 * PyLong_SHIFT) {
                            return (DMDAElementType) (((((((DMDAElementType)digits[2]) << PyLong_SHIFT) | (DMDAElementType)digits[1]) << PyLong_SHIFT) | (DMDAElementType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(DMDAElementType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAElementType, 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(DMDAElementType) >= 4 * PyLong_SHIFT) {
                            return (DMDAElementType) (((((((((DMDAElementType)digits[3]) << PyLong_SHIFT) | (DMDAElementType)digits[2]) << PyLong_SHIFT) | (DMDAElementType)digits[1]) << PyLong_SHIFT) | (DMDAElementType)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 (DMDAElementType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(DMDAElementType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMDAElementType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(DMDAElementType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMDAElementType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (DMDAElementType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(DMDAElementType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(DMDAElementType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(DMDAElementType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAElementType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAElementType) - 1 > 2 * PyLong_SHIFT) {
                            return (DMDAElementType) (((DMDAElementType)-1)*(((((DMDAElementType)digits[1]) << PyLong_SHIFT) | (DMDAElementType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(DMDAElementType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAElementType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAElementType) - 1 > 2 * PyLong_SHIFT) {
                            return (DMDAElementType) ((((((DMDAElementType)digits[1]) << PyLong_SHIFT) | (DMDAElementType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(DMDAElementType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAElementType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAElementType) - 1 > 3 * PyLong_SHIFT) {
                            return (DMDAElementType) (((DMDAElementType)-1)*(((((((DMDAElementType)digits[2]) << PyLong_SHIFT) | (DMDAElementType)digits[1]) << PyLong_SHIFT) | (DMDAElementType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(DMDAElementType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAElementType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(DMDAElementType) - 1 > 3 * PyLong_SHIFT) {
                            return (DMDAElementType) ((((((((DMDAElementType)digits[2]) << PyLong_SHIFT) | (DMDAElementType)digits[1]) << PyLong_SHIFT) | (DMDAElementType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(DMDAElementType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAElementType, 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(DMDAElementType) - 1 > 4 * PyLong_SHIFT) {
                            return (DMDAElementType) (((DMDAElementType)-1)*(((((((((DMDAElementType)digits[3]) << PyLong_SHIFT) | (DMDAElementType)digits[2]) << PyLong_SHIFT) | (DMDAElementType)digits[1]) << PyLong_SHIFT) | (DMDAElementType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(DMDAElementType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(DMDAElementType, 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(DMDAElementType) - 1 > 4 * PyLong_SHIFT) {
                            return (DMDAElementType) ((((((((((DMDAElementType)digits[3]) << PyLong_SHIFT) | (DMDAElementType)digits[2]) << PyLong_SHIFT) | (DMDAElementType)digits[1]) << PyLong_SHIFT) | (DMDAElementType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(DMDAElementType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMDAElementType, long, PyLong_AsLong(x))
            } else if (sizeof(DMDAElementType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(DMDAElementType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            DMDAElementType 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 (DMDAElementType) -1;
        }
    } else {
        DMDAElementType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (DMDAElementType) -1;
        val = __Pyx_PyInt_As_DMDAElementType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to DMDAElementType");
    return (DMDAElementType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to DMDAElementType");
    return (DMDAElementType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE PetscClassId __Pyx_PyInt_As_PetscClassId(PyObject *x) {
    const PetscClassId neg_one = (PetscClassId) -1, const_zero = (PetscClassId) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PetscClassId) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PetscClassId, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PetscClassId) 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 (PetscClassId) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PetscClassId, digit, digits[0])
                case 2:
                    if (8 * sizeof(PetscClassId) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscClassId, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscClassId) >= 2 * PyLong_SHIFT) {
                            return (PetscClassId) (((((PetscClassId)digits[1]) << PyLong_SHIFT) | (PetscClassId)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PetscClassId) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscClassId, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscClassId) >= 3 * PyLong_SHIFT) {
                            return (PetscClassId) (((((((PetscClassId)digits[2]) << PyLong_SHIFT) | (PetscClassId)digits[1]) << PyLong_SHIFT) | (PetscClassId)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PetscClassId) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscClassId, 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(PetscClassId) >= 4 * PyLong_SHIFT) {
                            return (PetscClassId) (((((((((PetscClassId)digits[3]) << PyLong_SHIFT) | (PetscClassId)digits[2]) << PyLong_SHIFT) | (PetscClassId)digits[1]) << PyLong_SHIFT) | (PetscClassId)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 (PetscClassId) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PetscClassId) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscClassId, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(PetscClassId) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscClassId, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PetscClassId) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PetscClassId, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PetscClassId,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PetscClassId) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscClassId, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscClassId) - 1 > 2 * PyLong_SHIFT) {
                            return (PetscClassId) (((PetscClassId)-1)*(((((PetscClassId)digits[1]) << PyLong_SHIFT) | (PetscClassId)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PetscClassId) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscClassId, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscClassId) - 1 > 2 * PyLong_SHIFT) {
                            return (PetscClassId) ((((((PetscClassId)digits[1]) << PyLong_SHIFT) | (PetscClassId)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PetscClassId) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscClassId, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscClassId) - 1 > 3 * PyLong_SHIFT) {
                            return (PetscClassId) (((PetscClassId)-1)*(((((((PetscClassId)digits[2]) << PyLong_SHIFT) | (PetscClassId)digits[1]) << PyLong_SHIFT) | (PetscClassId)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PetscClassId) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscClassId, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscClassId) - 1 > 3 * PyLong_SHIFT) {
                            return (PetscClassId) ((((((((PetscClassId)digits[2]) << PyLong_SHIFT) | (PetscClassId)digits[1]) << PyLong_SHIFT) | (PetscClassId)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PetscClassId) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscClassId, 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(PetscClassId) - 1 > 4 * PyLong_SHIFT) {
                            return (PetscClassId) (((PetscClassId)-1)*(((((((((PetscClassId)digits[3]) << PyLong_SHIFT) | (PetscClassId)digits[2]) << PyLong_SHIFT) | (PetscClassId)digits[1]) << PyLong_SHIFT) | (PetscClassId)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PetscClassId) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscClassId, 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(PetscClassId) - 1 > 4 * PyLong_SHIFT) {
                            return (PetscClassId) ((((((((((PetscClassId)digits[3]) << PyLong_SHIFT) | (PetscClassId)digits[2]) << PyLong_SHIFT) | (PetscClassId)digits[1]) << PyLong_SHIFT) | (PetscClassId)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PetscClassId) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscClassId, long, PyLong_AsLong(x))
            } else if (sizeof(PetscClassId) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscClassId, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PetscClassId 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 (PetscClassId) -1;
        }
    } else {
        PetscClassId val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PetscClassId) -1;
        val = __Pyx_PyInt_As_PetscClassId(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PetscClassId");
    return (PetscClassId) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PetscClassId");
    return (PetscClassId) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE PetscViewerFormat __Pyx_PyInt_As_PetscViewerFormat(PyObject *x) {
    const PetscViewerFormat neg_one = (PetscViewerFormat) -1, const_zero = (PetscViewerFormat) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PetscViewerFormat) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PetscViewerFormat, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PetscViewerFormat) 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 (PetscViewerFormat) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PetscViewerFormat, digit, digits[0])
                case 2:
                    if (8 * sizeof(PetscViewerFormat) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscViewerFormat, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscViewerFormat) >= 2 * PyLong_SHIFT) {
                            return (PetscViewerFormat) (((((PetscViewerFormat)digits[1]) << PyLong_SHIFT) | (PetscViewerFormat)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PetscViewerFormat) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscViewerFormat, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscViewerFormat) >= 3 * PyLong_SHIFT) {
                            return (PetscViewerFormat) (((((((PetscViewerFormat)digits[2]) << PyLong_SHIFT) | (PetscViewerFormat)digits[1]) << PyLong_SHIFT) | (PetscViewerFormat)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PetscViewerFormat) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscViewerFormat, 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(PetscViewerFormat) >= 4 * PyLong_SHIFT) {
                            return (PetscViewerFormat) (((((((((PetscViewerFormat)digits[3]) << PyLong_SHIFT) | (PetscViewerFormat)digits[2]) << PyLong_SHIFT) | (PetscViewerFormat)digits[1]) << PyLong_SHIFT) | (PetscViewerFormat)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 (PetscViewerFormat) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PetscViewerFormat) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscViewerFormat, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(PetscViewerFormat) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscViewerFormat, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PetscViewerFormat) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PetscViewerFormat, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PetscViewerFormat,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PetscViewerFormat) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscViewerFormat, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscViewerFormat) - 1 > 2 * PyLong_SHIFT) {
                            return (PetscViewerFormat) (((PetscViewerFormat)-1)*(((((PetscViewerFormat)digits[1]) << PyLong_SHIFT) | (PetscViewerFormat)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PetscViewerFormat) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscViewerFormat, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscViewerFormat) - 1 > 2 * PyLong_SHIFT) {
                            return (PetscViewerFormat) ((((((PetscViewerFormat)digits[1]) << PyLong_SHIFT) | (PetscViewerFormat)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PetscViewerFormat) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscViewerFormat, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscViewerFormat) - 1 > 3 * PyLong_SHIFT) {
                            return (PetscViewerFormat) (((PetscViewerFormat)-1)*(((((((PetscViewerFormat)digits[2]) << PyLong_SHIFT) | (PetscViewerFormat)digits[1]) << PyLong_SHIFT) | (PetscViewerFormat)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PetscViewerFormat) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscViewerFormat, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscViewerFormat) - 1 > 3 * PyLong_SHIFT) {
                            return (PetscViewerFormat) ((((((((PetscViewerFormat)digits[2]) << PyLong_SHIFT) | (PetscViewerFormat)digits[1]) << PyLong_SHIFT) | (PetscViewerFormat)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PetscViewerFormat) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscViewerFormat, 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(PetscViewerFormat) - 1 > 4 * PyLong_SHIFT) {
                            return (PetscViewerFormat) (((PetscViewerFormat)-1)*(((((((((PetscViewerFormat)digits[3]) << PyLong_SHIFT) | (PetscViewerFormat)digits[2]) << PyLong_SHIFT) | (PetscViewerFormat)digits[1]) << PyLong_SHIFT) | (PetscViewerFormat)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PetscViewerFormat) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscViewerFormat, 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(PetscViewerFormat) - 1 > 4 * PyLong_SHIFT) {
                            return (PetscViewerFormat) ((((((((((PetscViewerFormat)digits[3]) << PyLong_SHIFT) | (PetscViewerFormat)digits[2]) << PyLong_SHIFT) | (PetscViewerFormat)digits[1]) << PyLong_SHIFT) | (PetscViewerFormat)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PetscViewerFormat) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscViewerFormat, long, PyLong_AsLong(x))
            } else if (sizeof(PetscViewerFormat) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscViewerFormat, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PetscViewerFormat 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 (PetscViewerFormat) -1;
        }
    } else {
        PetscViewerFormat val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PetscViewerFormat) -1;
        val = __Pyx_PyInt_As_PetscViewerFormat(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PetscViewerFormat");
    return (PetscViewerFormat) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PetscViewerFormat");
    return (PetscViewerFormat) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *x) {
    const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned 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 (unsigned long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned long, digit, digits[0])
                case 2:
                    if (8 * sizeof(unsigned long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned long) >= 2 * PyLong_SHIFT) {
                            return (unsigned long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned long) >= 3 * PyLong_SHIFT) {
                            return (unsigned long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned long) >= 4 * PyLong_SHIFT) {
                            return (unsigned long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned 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 (unsigned long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(unsigned long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(unsigned long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(unsigned long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(unsigned long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned long) (((unsigned long)-1)*(((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(unsigned long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned long) ((((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned long) (((unsigned long)-1)*(((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned long) ((((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned long) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned long) (((unsigned long)-1)*(((((((((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(unsigned long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned long) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned long) ((((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(unsigned long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned long, long, PyLong_AsLong(x))
            } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned long, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            unsigned 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 (unsigned long) -1;
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (unsigned long) -1;
        val = __Pyx_PyInt_As_unsigned_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned long");
    return (unsigned long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned long");
    return (unsigned long) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE PetscBool __Pyx_PyInt_As_PetscBool(PyObject *x) {
    const PetscBool neg_one = (PetscBool) -1, const_zero = (PetscBool) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PetscBool) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PetscBool, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PetscBool) 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 (PetscBool) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PetscBool, digit, digits[0])
                case 2:
                    if (8 * sizeof(PetscBool) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscBool, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscBool) >= 2 * PyLong_SHIFT) {
                            return (PetscBool) (((((PetscBool)digits[1]) << PyLong_SHIFT) | (PetscBool)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PetscBool) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscBool, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscBool) >= 3 * PyLong_SHIFT) {
                            return (PetscBool) (((((((PetscBool)digits[2]) << PyLong_SHIFT) | (PetscBool)digits[1]) << PyLong_SHIFT) | (PetscBool)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PetscBool) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscBool, 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(PetscBool) >= 4 * PyLong_SHIFT) {
                            return (PetscBool) (((((((((PetscBool)digits[3]) << PyLong_SHIFT) | (PetscBool)digits[2]) << PyLong_SHIFT) | (PetscBool)digits[1]) << PyLong_SHIFT) | (PetscBool)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 (PetscBool) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PetscBool) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscBool, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(PetscBool) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscBool, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PetscBool) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PetscBool, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PetscBool,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PetscBool) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscBool, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscBool) - 1 > 2 * PyLong_SHIFT) {
                            return (PetscBool) (((PetscBool)-1)*(((((PetscBool)digits[1]) << PyLong_SHIFT) | (PetscBool)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PetscBool) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscBool, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscBool) - 1 > 2 * PyLong_SHIFT) {
                            return (PetscBool) ((((((PetscBool)digits[1]) << PyLong_SHIFT) | (PetscBool)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PetscBool) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscBool, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscBool) - 1 > 3 * PyLong_SHIFT) {
                            return (PetscBool) (((PetscBool)-1)*(((((((PetscBool)digits[2]) << PyLong_SHIFT) | (PetscBool)digits[1]) << PyLong_SHIFT) | (PetscBool)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PetscBool) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscBool, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PetscBool) - 1 > 3 * PyLong_SHIFT) {
                            return (PetscBool) ((((((((PetscBool)digits[2]) << PyLong_SHIFT) | (PetscBool)digits[1]) << PyLong_SHIFT) | (PetscBool)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PetscBool) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscBool, 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(PetscBool) - 1 > 4 * PyLong_SHIFT) {
                            return (PetscBool) (((PetscBool)-1)*(((((((((PetscBool)digits[3]) << PyLong_SHIFT) | (PetscBool)digits[2]) << PyLong_SHIFT) | (PetscBool)digits[1]) << PyLong_SHIFT) | (PetscBool)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PetscBool) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PetscBool, 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(PetscBool) - 1 > 4 * PyLong_SHIFT) {
                            return (PetscBool) ((((((((((PetscBool)digits[3]) << PyLong_SHIFT) | (PetscBool)digits[2]) << PyLong_SHIFT) | (PetscBool)digits[1]) << PyLong_SHIFT) | (PetscBool)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PetscBool) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscBool, long, PyLong_AsLong(x))
            } else if (sizeof(PetscBool) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PetscBool, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PetscBool 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 (PetscBool) -1;
        }
    } else {
        PetscBool val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PetscBool) -1;
        val = __Pyx_PyInt_As_PetscBool(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PetscBool");
    return (PetscBool) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PetscBool");
    return (PetscBool) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE ISGlobalToLocalMappingType __Pyx_PyInt_As_ISGlobalToLocalMappingType(PyObject *x) {
    const ISGlobalToLocalMappingType neg_one = (ISGlobalToLocalMappingType) -1, const_zero = (ISGlobalToLocalMappingType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(ISGlobalToLocalMappingType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (ISGlobalToLocalMappingType) 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 (ISGlobalToLocalMappingType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType, digit, digits[0])
                case 2:
                    if (8 * sizeof(ISGlobalToLocalMappingType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(ISGlobalToLocalMappingType) >= 2 * PyLong_SHIFT) {
                            return (ISGlobalToLocalMappingType) (((((ISGlobalToLocalMappingType)digits[1]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(ISGlobalToLocalMappingType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(ISGlobalToLocalMappingType) >= 3 * PyLong_SHIFT) {
                            return (ISGlobalToLocalMappingType) (((((((ISGlobalToLocalMappingType)digits[2]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[1]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(ISGlobalToLocalMappingType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType, 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(ISGlobalToLocalMappingType) >= 4 * PyLong_SHIFT) {
                            return (ISGlobalToLocalMappingType) (((((((((ISGlobalToLocalMappingType)digits[3]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[2]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[1]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)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 (ISGlobalToLocalMappingType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(ISGlobalToLocalMappingType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(ISGlobalToLocalMappingType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(ISGlobalToLocalMappingType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(ISGlobalToLocalMappingType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (ISGlobalToLocalMappingType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(ISGlobalToLocalMappingType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(ISGlobalToLocalMappingType) - 1 > 2 * PyLong_SHIFT) {
                            return (ISGlobalToLocalMappingType) (((ISGlobalToLocalMappingType)-1)*(((((ISGlobalToLocalMappingType)digits[1]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(ISGlobalToLocalMappingType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(ISGlobalToLocalMappingType) - 1 > 2 * PyLong_SHIFT) {
                            return (ISGlobalToLocalMappingType) ((((((ISGlobalToLocalMappingType)digits[1]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(ISGlobalToLocalMappingType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(ISGlobalToLocalMappingType) - 1 > 3 * PyLong_SHIFT) {
                            return (ISGlobalToLocalMappingType) (((ISGlobalToLocalMappingType)-1)*(((((((ISGlobalToLocalMappingType)digits[2]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[1]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(ISGlobalToLocalMappingType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(ISGlobalToLocalMappingType) - 1 > 3 * PyLong_SHIFT) {
                            return (ISGlobalToLocalMappingType) ((((((((ISGlobalToLocalMappingType)digits[2]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[1]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(ISGlobalToLocalMappingType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType, 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(ISGlobalToLocalMappingType) - 1 > 4 * PyLong_SHIFT) {
                            return (ISGlobalToLocalMappingType) (((ISGlobalToLocalMappingType)-1)*(((((((((ISGlobalToLocalMappingType)digits[3]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[2]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[1]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(ISGlobalToLocalMappingType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(ISGlobalToLocalMappingType, 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(ISGlobalToLocalMappingType) - 1 > 4 * PyLong_SHIFT) {
                            return (ISGlobalToLocalMappingType) ((((((((((ISGlobalToLocalMappingType)digits[3]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[2]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[1]) << PyLong_SHIFT) | (ISGlobalToLocalMappingType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(ISGlobalToLocalMappingType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(ISGlobalToLocalMappingType, long, PyLong_AsLong(x))
            } else if (sizeof(ISGlobalToLocalMappingType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(ISGlobalToLocalMappingType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            ISGlobalToLocalMappingType 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 (ISGlobalToLocalMappingType) -1;
        }
    } else {
        ISGlobalToLocalMappingType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (ISGlobalToLocalMappingType) -1;
        val = __Pyx_PyInt_As_ISGlobalToLocalMappingType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to ISGlobalToLocalMappingType");
    return (ISGlobalToLocalMappingType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to ISGlobalToLocalMappingType");
    return (ISGlobalToLocalMappingType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE VecOption __Pyx_PyInt_As_VecOption(PyObject *x) {
    const VecOption neg_one = (VecOption) -1, const_zero = (VecOption) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(VecOption) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(VecOption, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (VecOption) 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 (VecOption) 0;
                case  1: __PYX_VERIFY_RETURN_INT(VecOption, digit, digits[0])
                case 2:
                    if (8 * sizeof(VecOption) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(VecOption, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(VecOption) >= 2 * PyLong_SHIFT) {
                            return (VecOption) (((((VecOption)digits[1]) << PyLong_SHIFT) | (VecOption)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(VecOption) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(VecOption, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(VecOption) >= 3 * PyLong_SHIFT) {
                            return (VecOption) (((((((VecOption)digits[2]) << PyLong_SHIFT) | (VecOption)digits[1]) << PyLong_SHIFT) | (VecOption)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(VecOption) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(VecOption, 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(VecOption) >= 4 * PyLong_SHIFT) {
                            return (VecOption) (((((((((VecOption)digits[3]) << PyLong_SHIFT) | (VecOption)digits[2]) << PyLong_SHIFT) | (VecOption)digits[1]) << PyLong_SHIFT) | (VecOption)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 (VecOption) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(VecOption) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(VecOption, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(VecOption) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(VecOption, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (VecOption) 0;
                case -1: __PYX_VERIFY_RETURN_INT(VecOption, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(VecOption,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(VecOption) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(VecOption, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(VecOption) - 1 > 2 * PyLong_SHIFT) {
                            return (VecOption) (((VecOption)-1)*(((((VecOption)digits[1]) << PyLong_SHIFT) | (VecOption)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(VecOption) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(VecOption, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(VecOption) - 1 > 2 * PyLong_SHIFT) {
                            return (VecOption) ((((((VecOption)digits[1]) << PyLong_SHIFT) | (VecOption)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(VecOption) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(VecOption, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(VecOption) - 1 > 3 * PyLong_SHIFT) {
                            return (VecOption) (((VecOption)-1)*(((((((VecOption)digits[2]) << PyLong_SHIFT) | (VecOption)digits[1]) << PyLong_SHIFT) | (VecOption)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(VecOption) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(VecOption, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(VecOption) - 1 > 3 * PyLong_SHIFT) {
                            return (VecOption) ((((((((VecOption)digits[2]) << PyLong_SHIFT) | (VecOption)digits[1]) << PyLong_SHIFT) | (VecOption)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(VecOption) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(VecOption, 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(VecOption) - 1 > 4 * PyLong_SHIFT) {
                            return (VecOption) (((VecOption)-1)*(((((((((VecOption)digits[3]) << PyLong_SHIFT) | (VecOption)digits[2]) << PyLong_SHIFT) | (VecOption)digits[1]) << PyLong_SHIFT) | (VecOption)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(VecOption) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(VecOption, 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(VecOption) - 1 > 4 * PyLong_SHIFT) {
                            return (VecOption) ((((((((((VecOption)digits[3]) << PyLong_SHIFT) | (VecOption)digits[2]) << PyLong_SHIFT) | (VecOption)digits[1]) << PyLong_SHIFT) | (VecOption)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(VecOption) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(VecOption, long, PyLong_AsLong(x))
            } else if (sizeof(VecOption) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(VecOption, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            VecOption 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 (VecOption) -1;
        }
    } else {
        VecOption val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (VecOption) -1;
        val = __Pyx_PyInt_As_VecOption(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to VecOption");
    return (VecOption) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to VecOption");
    return (VecOption) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) 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 (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, 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(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_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
#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 (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, 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(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((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(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, 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(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_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
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t 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 (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE NormType __Pyx_PyInt_As_NormType(PyObject *x) {
    const NormType neg_one = (NormType) -1, const_zero = (NormType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(NormType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(NormType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (NormType) 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 (NormType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(NormType, digit, digits[0])
                case 2:
                    if (8 * sizeof(NormType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(NormType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(NormType) >= 2 * PyLong_SHIFT) {
                            return (NormType) (((((NormType)digits[1]) << PyLong_SHIFT) | (NormType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(NormType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(NormType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(NormType) >= 3 * PyLong_SHIFT) {
                            return (NormType) (((((((NormType)digits[2]) << PyLong_SHIFT) | (NormType)digits[1]) << PyLong_SHIFT) | (NormType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(NormType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(NormType, 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(NormType) >= 4 * PyLong_SHIFT) {
                            return (NormType) (((((((((NormType)digits[3]) << PyLong_SHIFT) | (NormType)digits[2]) << PyLong_SHIFT) | (NormType)digits[1]) << PyLong_SHIFT) | (NormType)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 (NormType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(NormType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(NormType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(NormType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(NormType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (NormType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(NormType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(NormType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(NormType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(NormType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(NormType) - 1 > 2 * PyLong_SHIFT) {
                            return (NormType) (((NormType)-1)*(((((NormType)digits[1]) << PyLong_SHIFT) | (NormType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(NormType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(NormType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(NormType) - 1 > 2 * PyLong_SHIFT) {
                            return (NormType) ((((((NormType)digits[1]) << PyLong_SHIFT) | (NormType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(NormType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(NormType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(NormType) - 1 > 3 * PyLong_SHIFT) {
                            return (NormType) (((NormType)-1)*(((((((NormType)digits[2]) << PyLong_SHIFT) | (NormType)digits[1]) << PyLong_SHIFT) | (NormType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(NormType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(NormType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(NormType) - 1 > 3 * PyLong_SHIFT) {
                            return (NormType) ((((((((NormType)digits[2]) << PyLong_SHIFT) | (NormType)digits[1]) << PyLong_SHIFT) | (NormType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(NormType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(NormType, 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(NormType) - 1 > 4 * PyLong_SHIFT) {
                            return (NormType) (((NormType)-1)*(((((((((NormType)digits[3]) << PyLong_SHIFT) | (NormType)digits[2]) << PyLong_SHIFT) | (NormType)digits[1]) << PyLong_SHIFT) | (NormType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(NormType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(NormType, 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(NormType) - 1 > 4 * PyLong_SHIFT) {
                            return (NormType) ((((((((((NormType)digits[3]) << PyLong_SHIFT) | (NormType)digits[2]) << PyLong_SHIFT) | (NormType)digits[1]) << PyLong_SHIFT) | (NormType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(NormType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(NormType, long, PyLong_AsLong(x))
            } else if (sizeof(NormType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(NormType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            NormType 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 (NormType) -1;
        }
    } else {
        NormType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (NormType) -1;
        val = __Pyx_PyInt_As_NormType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to NormType");
    return (NormType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to NormType");
    return (NormType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE MatOption __Pyx_PyInt_As_MatOption(PyObject *x) {
    const MatOption neg_one = (MatOption) -1, const_zero = (MatOption) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(MatOption) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(MatOption, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (MatOption) 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 (MatOption) 0;
                case  1: __PYX_VERIFY_RETURN_INT(MatOption, digit, digits[0])
                case 2:
                    if (8 * sizeof(MatOption) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatOption, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatOption) >= 2 * PyLong_SHIFT) {
                            return (MatOption) (((((MatOption)digits[1]) << PyLong_SHIFT) | (MatOption)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(MatOption) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatOption, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatOption) >= 3 * PyLong_SHIFT) {
                            return (MatOption) (((((((MatOption)digits[2]) << PyLong_SHIFT) | (MatOption)digits[1]) << PyLong_SHIFT) | (MatOption)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(MatOption) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatOption, 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(MatOption) >= 4 * PyLong_SHIFT) {
                            return (MatOption) (((((((((MatOption)digits[3]) << PyLong_SHIFT) | (MatOption)digits[2]) << PyLong_SHIFT) | (MatOption)digits[1]) << PyLong_SHIFT) | (MatOption)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 (MatOption) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(MatOption) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatOption, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(MatOption) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatOption, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (MatOption) 0;
                case -1: __PYX_VERIFY_RETURN_INT(MatOption, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(MatOption,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(MatOption) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatOption, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatOption) - 1 > 2 * PyLong_SHIFT) {
                            return (MatOption) (((MatOption)-1)*(((((MatOption)digits[1]) << PyLong_SHIFT) | (MatOption)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(MatOption) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatOption, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatOption) - 1 > 2 * PyLong_SHIFT) {
                            return (MatOption) ((((((MatOption)digits[1]) << PyLong_SHIFT) | (MatOption)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(MatOption) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatOption, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatOption) - 1 > 3 * PyLong_SHIFT) {
                            return (MatOption) (((MatOption)-1)*(((((((MatOption)digits[2]) << PyLong_SHIFT) | (MatOption)digits[1]) << PyLong_SHIFT) | (MatOption)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(MatOption) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatOption, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(MatOption) - 1 > 3 * PyLong_SHIFT) {
                            return (MatOption) ((((((((MatOption)digits[2]) << PyLong_SHIFT) | (MatOption)digits[1]) << PyLong_SHIFT) | (MatOption)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(MatOption) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatOption, 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(MatOption) - 1 > 4 * PyLong_SHIFT) {
                            return (MatOption) (((MatOption)-1)*(((((((((MatOption)digits[3]) << PyLong_SHIFT) | (MatOption)digits[2]) << PyLong_SHIFT) | (MatOption)digits[1]) << PyLong_SHIFT) | (MatOption)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(MatOption) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(MatOption, 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(MatOption) - 1 > 4 * PyLong_SHIFT) {
                            return (MatOption) ((((((((((MatOption)digits[3]) << PyLong_SHIFT) | (MatOption)digits[2]) << PyLong_SHIFT) | (MatOption)digits[1]) << PyLong_SHIFT) | (MatOption)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(MatOption) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatOption, long, PyLong_AsLong(x))
            } else if (sizeof(MatOption) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(MatOption, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            MatOption 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 (MatOption) -1;
        }
    } else {
        MatOption val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (MatOption) -1;
        val = __Pyx_PyInt_As_MatOption(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to MatOption");
    return (MatOption) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to MatOption");
    return (MatOption) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE PCASMType __Pyx_PyInt_As_PCASMType(PyObject *x) {
    const PCASMType neg_one = (PCASMType) -1, const_zero = (PCASMType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PCASMType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PCASMType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PCASMType) 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 (PCASMType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PCASMType, digit, digits[0])
                case 2:
                    if (8 * sizeof(PCASMType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCASMType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCASMType) >= 2 * PyLong_SHIFT) {
                            return (PCASMType) (((((PCASMType)digits[1]) << PyLong_SHIFT) | (PCASMType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCASMType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCASMType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCASMType) >= 3 * PyLong_SHIFT) {
                            return (PCASMType) (((((((PCASMType)digits[2]) << PyLong_SHIFT) | (PCASMType)digits[1]) << PyLong_SHIFT) | (PCASMType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCASMType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCASMType, 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(PCASMType) >= 4 * PyLong_SHIFT) {
                            return (PCASMType) (((((((((PCASMType)digits[3]) << PyLong_SHIFT) | (PCASMType)digits[2]) << PyLong_SHIFT) | (PCASMType)digits[1]) << PyLong_SHIFT) | (PCASMType)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 (PCASMType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PCASMType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCASMType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(PCASMType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCASMType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PCASMType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PCASMType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PCASMType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PCASMType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCASMType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCASMType) - 1 > 2 * PyLong_SHIFT) {
                            return (PCASMType) (((PCASMType)-1)*(((((PCASMType)digits[1]) << PyLong_SHIFT) | (PCASMType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PCASMType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCASMType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCASMType) - 1 > 2 * PyLong_SHIFT) {
                            return (PCASMType) ((((((PCASMType)digits[1]) << PyLong_SHIFT) | (PCASMType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PCASMType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCASMType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCASMType) - 1 > 3 * PyLong_SHIFT) {
                            return (PCASMType) (((PCASMType)-1)*(((((((PCASMType)digits[2]) << PyLong_SHIFT) | (PCASMType)digits[1]) << PyLong_SHIFT) | (PCASMType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCASMType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCASMType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCASMType) - 1 > 3 * PyLong_SHIFT) {
                            return (PCASMType) ((((((((PCASMType)digits[2]) << PyLong_SHIFT) | (PCASMType)digits[1]) << PyLong_SHIFT) | (PCASMType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PCASMType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCASMType, 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(PCASMType) - 1 > 4 * PyLong_SHIFT) {
                            return (PCASMType) (((PCASMType)-1)*(((((((((PCASMType)digits[3]) << PyLong_SHIFT) | (PCASMType)digits[2]) << PyLong_SHIFT) | (PCASMType)digits[1]) << PyLong_SHIFT) | (PCASMType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCASMType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCASMType, 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(PCASMType) - 1 > 4 * PyLong_SHIFT) {
                            return (PCASMType) ((((((((((PCASMType)digits[3]) << PyLong_SHIFT) | (PCASMType)digits[2]) << PyLong_SHIFT) | (PCASMType)digits[1]) << PyLong_SHIFT) | (PCASMType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PCASMType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCASMType, long, PyLong_AsLong(x))
            } else if (sizeof(PCASMType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCASMType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PCASMType 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 (PCASMType) -1;
        }
    } else {
        PCASMType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PCASMType) -1;
        val = __Pyx_PyInt_As_PCASMType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PCASMType");
    return (PCASMType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PCASMType");
    return (PCASMType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE PCGASMType __Pyx_PyInt_As_PCGASMType(PyObject *x) {
    const PCGASMType neg_one = (PCGASMType) -1, const_zero = (PCGASMType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PCGASMType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PCGASMType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PCGASMType) 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 (PCGASMType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PCGASMType, digit, digits[0])
                case 2:
                    if (8 * sizeof(PCGASMType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCGASMType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCGASMType) >= 2 * PyLong_SHIFT) {
                            return (PCGASMType) (((((PCGASMType)digits[1]) << PyLong_SHIFT) | (PCGASMType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCGASMType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCGASMType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCGASMType) >= 3 * PyLong_SHIFT) {
                            return (PCGASMType) (((((((PCGASMType)digits[2]) << PyLong_SHIFT) | (PCGASMType)digits[1]) << PyLong_SHIFT) | (PCGASMType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCGASMType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCGASMType, 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(PCGASMType) >= 4 * PyLong_SHIFT) {
                            return (PCGASMType) (((((((((PCGASMType)digits[3]) << PyLong_SHIFT) | (PCGASMType)digits[2]) << PyLong_SHIFT) | (PCGASMType)digits[1]) << PyLong_SHIFT) | (PCGASMType)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 (PCGASMType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PCGASMType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCGASMType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(PCGASMType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCGASMType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PCGASMType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PCGASMType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PCGASMType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PCGASMType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCGASMType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCGASMType) - 1 > 2 * PyLong_SHIFT) {
                            return (PCGASMType) (((PCGASMType)-1)*(((((PCGASMType)digits[1]) << PyLong_SHIFT) | (PCGASMType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PCGASMType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCGASMType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCGASMType) - 1 > 2 * PyLong_SHIFT) {
                            return (PCGASMType) ((((((PCGASMType)digits[1]) << PyLong_SHIFT) | (PCGASMType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PCGASMType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCGASMType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCGASMType) - 1 > 3 * PyLong_SHIFT) {
                            return (PCGASMType) (((PCGASMType)-1)*(((((((PCGASMType)digits[2]) << PyLong_SHIFT) | (PCGASMType)digits[1]) << PyLong_SHIFT) | (PCGASMType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCGASMType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCGASMType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCGASMType) - 1 > 3 * PyLong_SHIFT) {
                            return (PCGASMType) ((((((((PCGASMType)digits[2]) << PyLong_SHIFT) | (PCGASMType)digits[1]) << PyLong_SHIFT) | (PCGASMType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PCGASMType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCGASMType, 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(PCGASMType) - 1 > 4 * PyLong_SHIFT) {
                            return (PCGASMType) (((PCGASMType)-1)*(((((((((PCGASMType)digits[3]) << PyLong_SHIFT) | (PCGASMType)digits[2]) << PyLong_SHIFT) | (PCGASMType)digits[1]) << PyLong_SHIFT) | (PCGASMType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCGASMType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCGASMType, 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(PCGASMType) - 1 > 4 * PyLong_SHIFT) {
                            return (PCGASMType) ((((((((((PCGASMType)digits[3]) << PyLong_SHIFT) | (PCGASMType)digits[2]) << PyLong_SHIFT) | (PCGASMType)digits[1]) << PyLong_SHIFT) | (PCGASMType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PCGASMType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCGASMType, long, PyLong_AsLong(x))
            } else if (sizeof(PCGASMType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCGASMType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PCGASMType 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 (PCGASMType) -1;
        }
    } else {
        PCGASMType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PCGASMType) -1;
        val = __Pyx_PyInt_As_PCGASMType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PCGASMType");
    return (PCGASMType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PCGASMType");
    return (PCGASMType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE PCCompositeType __Pyx_PyInt_As_PCCompositeType(PyObject *x) {
    const PCCompositeType neg_one = (PCCompositeType) -1, const_zero = (PCCompositeType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PCCompositeType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PCCompositeType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PCCompositeType) 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 (PCCompositeType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PCCompositeType, digit, digits[0])
                case 2:
                    if (8 * sizeof(PCCompositeType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCCompositeType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCCompositeType) >= 2 * PyLong_SHIFT) {
                            return (PCCompositeType) (((((PCCompositeType)digits[1]) << PyLong_SHIFT) | (PCCompositeType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCCompositeType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCCompositeType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCCompositeType) >= 3 * PyLong_SHIFT) {
                            return (PCCompositeType) (((((((PCCompositeType)digits[2]) << PyLong_SHIFT) | (PCCompositeType)digits[1]) << PyLong_SHIFT) | (PCCompositeType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCCompositeType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCCompositeType, 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(PCCompositeType) >= 4 * PyLong_SHIFT) {
                            return (PCCompositeType) (((((((((PCCompositeType)digits[3]) << PyLong_SHIFT) | (PCCompositeType)digits[2]) << PyLong_SHIFT) | (PCCompositeType)digits[1]) << PyLong_SHIFT) | (PCCompositeType)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 (PCCompositeType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PCCompositeType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCCompositeType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(PCCompositeType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCCompositeType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PCCompositeType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PCCompositeType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PCCompositeType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PCCompositeType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCCompositeType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCCompositeType) - 1 > 2 * PyLong_SHIFT) {
                            return (PCCompositeType) (((PCCompositeType)-1)*(((((PCCompositeType)digits[1]) << PyLong_SHIFT) | (PCCompositeType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PCCompositeType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCCompositeType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCCompositeType) - 1 > 2 * PyLong_SHIFT) {
                            return (PCCompositeType) ((((((PCCompositeType)digits[1]) << PyLong_SHIFT) | (PCCompositeType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PCCompositeType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCCompositeType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCCompositeType) - 1 > 3 * PyLong_SHIFT) {
                            return (PCCompositeType) (((PCCompositeType)-1)*(((((((PCCompositeType)digits[2]) << PyLong_SHIFT) | (PCCompositeType)digits[1]) << PyLong_SHIFT) | (PCCompositeType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCCompositeType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCCompositeType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCCompositeType) - 1 > 3 * PyLong_SHIFT) {
                            return (PCCompositeType) ((((((((PCCompositeType)digits[2]) << PyLong_SHIFT) | (PCCompositeType)digits[1]) << PyLong_SHIFT) | (PCCompositeType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PCCompositeType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCCompositeType, 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(PCCompositeType) - 1 > 4 * PyLong_SHIFT) {
                            return (PCCompositeType) (((PCCompositeType)-1)*(((((((((PCCompositeType)digits[3]) << PyLong_SHIFT) | (PCCompositeType)digits[2]) << PyLong_SHIFT) | (PCCompositeType)digits[1]) << PyLong_SHIFT) | (PCCompositeType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCCompositeType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCCompositeType, 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(PCCompositeType) - 1 > 4 * PyLong_SHIFT) {
                            return (PCCompositeType) ((((((((((PCCompositeType)digits[3]) << PyLong_SHIFT) | (PCCompositeType)digits[2]) << PyLong_SHIFT) | (PCCompositeType)digits[1]) << PyLong_SHIFT) | (PCCompositeType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PCCompositeType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCCompositeType, long, PyLong_AsLong(x))
            } else if (sizeof(PCCompositeType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCCompositeType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PCCompositeType 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 (PCCompositeType) -1;
        }
    } else {
        PCCompositeType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PCCompositeType) -1;
        val = __Pyx_PyInt_As_PCCompositeType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PCCompositeType");
    return (PCCompositeType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PCCompositeType");
    return (PCCompositeType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE PCFieldSplitSchurFactType __Pyx_PyInt_As_PCFieldSplitSchurFactType(PyObject *x) {
    const PCFieldSplitSchurFactType neg_one = (PCFieldSplitSchurFactType) -1, const_zero = (PCFieldSplitSchurFactType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PCFieldSplitSchurFactType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PCFieldSplitSchurFactType) 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 (PCFieldSplitSchurFactType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType, digit, digits[0])
                case 2:
                    if (8 * sizeof(PCFieldSplitSchurFactType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCFieldSplitSchurFactType) >= 2 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurFactType) (((((PCFieldSplitSchurFactType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCFieldSplitSchurFactType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCFieldSplitSchurFactType) >= 3 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurFactType) (((((((PCFieldSplitSchurFactType)digits[2]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCFieldSplitSchurFactType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType, 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(PCFieldSplitSchurFactType) >= 4 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurFactType) (((((((((PCFieldSplitSchurFactType)digits[3]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[2]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)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 (PCFieldSplitSchurFactType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PCFieldSplitSchurFactType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCFieldSplitSchurFactType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(PCFieldSplitSchurFactType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCFieldSplitSchurFactType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PCFieldSplitSchurFactType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PCFieldSplitSchurFactType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCFieldSplitSchurFactType) - 1 > 2 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurFactType) (((PCFieldSplitSchurFactType)-1)*(((((PCFieldSplitSchurFactType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PCFieldSplitSchurFactType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCFieldSplitSchurFactType) - 1 > 2 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurFactType) ((((((PCFieldSplitSchurFactType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PCFieldSplitSchurFactType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCFieldSplitSchurFactType) - 1 > 3 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurFactType) (((PCFieldSplitSchurFactType)-1)*(((((((PCFieldSplitSchurFactType)digits[2]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCFieldSplitSchurFactType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCFieldSplitSchurFactType) - 1 > 3 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurFactType) ((((((((PCFieldSplitSchurFactType)digits[2]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PCFieldSplitSchurFactType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType, 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(PCFieldSplitSchurFactType) - 1 > 4 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurFactType) (((PCFieldSplitSchurFactType)-1)*(((((((((PCFieldSplitSchurFactType)digits[3]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[2]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCFieldSplitSchurFactType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurFactType, 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(PCFieldSplitSchurFactType) - 1 > 4 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurFactType) ((((((((((PCFieldSplitSchurFactType)digits[3]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[2]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurFactType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PCFieldSplitSchurFactType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCFieldSplitSchurFactType, long, PyLong_AsLong(x))
            } else if (sizeof(PCFieldSplitSchurFactType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCFieldSplitSchurFactType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PCFieldSplitSchurFactType 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 (PCFieldSplitSchurFactType) -1;
        }
    } else {
        PCFieldSplitSchurFactType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PCFieldSplitSchurFactType) -1;
        val = __Pyx_PyInt_As_PCFieldSplitSchurFactType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PCFieldSplitSchurFactType");
    return (PCFieldSplitSchurFactType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PCFieldSplitSchurFactType");
    return (PCFieldSplitSchurFactType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE PCFieldSplitSchurPreType __Pyx_PyInt_As_PCFieldSplitSchurPreType(PyObject *x) {
    const PCFieldSplitSchurPreType neg_one = (PCFieldSplitSchurPreType) -1, const_zero = (PCFieldSplitSchurPreType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PCFieldSplitSchurPreType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PCFieldSplitSchurPreType) 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 (PCFieldSplitSchurPreType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType, digit, digits[0])
                case 2:
                    if (8 * sizeof(PCFieldSplitSchurPreType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCFieldSplitSchurPreType) >= 2 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurPreType) (((((PCFieldSplitSchurPreType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCFieldSplitSchurPreType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCFieldSplitSchurPreType) >= 3 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurPreType) (((((((PCFieldSplitSchurPreType)digits[2]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCFieldSplitSchurPreType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType, 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(PCFieldSplitSchurPreType) >= 4 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurPreType) (((((((((PCFieldSplitSchurPreType)digits[3]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[2]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)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 (PCFieldSplitSchurPreType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PCFieldSplitSchurPreType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCFieldSplitSchurPreType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(PCFieldSplitSchurPreType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCFieldSplitSchurPreType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PCFieldSplitSchurPreType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PCFieldSplitSchurPreType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCFieldSplitSchurPreType) - 1 > 2 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurPreType) (((PCFieldSplitSchurPreType)-1)*(((((PCFieldSplitSchurPreType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PCFieldSplitSchurPreType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCFieldSplitSchurPreType) - 1 > 2 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurPreType) ((((((PCFieldSplitSchurPreType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PCFieldSplitSchurPreType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCFieldSplitSchurPreType) - 1 > 3 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurPreType) (((PCFieldSplitSchurPreType)-1)*(((((((PCFieldSplitSchurPreType)digits[2]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCFieldSplitSchurPreType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCFieldSplitSchurPreType) - 1 > 3 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurPreType) ((((((((PCFieldSplitSchurPreType)digits[2]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PCFieldSplitSchurPreType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType, 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(PCFieldSplitSchurPreType) - 1 > 4 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurPreType) (((PCFieldSplitSchurPreType)-1)*(((((((((PCFieldSplitSchurPreType)digits[3]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[2]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCFieldSplitSchurPreType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCFieldSplitSchurPreType, 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(PCFieldSplitSchurPreType) - 1 > 4 * PyLong_SHIFT) {
                            return (PCFieldSplitSchurPreType) ((((((((((PCFieldSplitSchurPreType)digits[3]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[2]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[1]) << PyLong_SHIFT) | (PCFieldSplitSchurPreType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PCFieldSplitSchurPreType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCFieldSplitSchurPreType, long, PyLong_AsLong(x))
            } else if (sizeof(PCFieldSplitSchurPreType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCFieldSplitSchurPreType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PCFieldSplitSchurPreType 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 (PCFieldSplitSchurPreType) -1;
        }
    } else {
        PCFieldSplitSchurPreType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PCFieldSplitSchurPreType) -1;
        val = __Pyx_PyInt_As_PCFieldSplitSchurPreType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PCFieldSplitSchurPreType");
    return (PCFieldSplitSchurPreType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PCFieldSplitSchurPreType");
    return (PCFieldSplitSchurPreType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE PCMGType __Pyx_PyInt_As_PCMGType(PyObject *x) {
    const PCMGType neg_one = (PCMGType) -1, const_zero = (PCMGType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PCMGType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PCMGType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PCMGType) 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 (PCMGType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PCMGType, digit, digits[0])
                case 2:
                    if (8 * sizeof(PCMGType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCMGType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCMGType) >= 2 * PyLong_SHIFT) {
                            return (PCMGType) (((((PCMGType)digits[1]) << PyLong_SHIFT) | (PCMGType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCMGType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCMGType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCMGType) >= 3 * PyLong_SHIFT) {
                            return (PCMGType) (((((((PCMGType)digits[2]) << PyLong_SHIFT) | (PCMGType)digits[1]) << PyLong_SHIFT) | (PCMGType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCMGType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCMGType, 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(PCMGType) >= 4 * PyLong_SHIFT) {
                            return (PCMGType) (((((((((PCMGType)digits[3]) << PyLong_SHIFT) | (PCMGType)digits[2]) << PyLong_SHIFT) | (PCMGType)digits[1]) << PyLong_SHIFT) | (PCMGType)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 (PCMGType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PCMGType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCMGType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(PCMGType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCMGType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PCMGType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PCMGType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PCMGType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PCMGType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCMGType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCMGType) - 1 > 2 * PyLong_SHIFT) {
                            return (PCMGType) (((PCMGType)-1)*(((((PCMGType)digits[1]) << PyLong_SHIFT) | (PCMGType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PCMGType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCMGType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCMGType) - 1 > 2 * PyLong_SHIFT) {
                            return (PCMGType) ((((((PCMGType)digits[1]) << PyLong_SHIFT) | (PCMGType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PCMGType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCMGType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCMGType) - 1 > 3 * PyLong_SHIFT) {
                            return (PCMGType) (((PCMGType)-1)*(((((((PCMGType)digits[2]) << PyLong_SHIFT) | (PCMGType)digits[1]) << PyLong_SHIFT) | (PCMGType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCMGType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCMGType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCMGType) - 1 > 3 * PyLong_SHIFT) {
                            return (PCMGType) ((((((((PCMGType)digits[2]) << PyLong_SHIFT) | (PCMGType)digits[1]) << PyLong_SHIFT) | (PCMGType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PCMGType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCMGType, 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(PCMGType) - 1 > 4 * PyLong_SHIFT) {
                            return (PCMGType) (((PCMGType)-1)*(((((((((PCMGType)digits[3]) << PyLong_SHIFT) | (PCMGType)digits[2]) << PyLong_SHIFT) | (PCMGType)digits[1]) << PyLong_SHIFT) | (PCMGType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCMGType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCMGType, 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(PCMGType) - 1 > 4 * PyLong_SHIFT) {
                            return (PCMGType) ((((((((((PCMGType)digits[3]) << PyLong_SHIFT) | (PCMGType)digits[2]) << PyLong_SHIFT) | (PCMGType)digits[1]) << PyLong_SHIFT) | (PCMGType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PCMGType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCMGType, long, PyLong_AsLong(x))
            } else if (sizeof(PCMGType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCMGType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PCMGType 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 (PCMGType) -1;
        }
    } else {
        PCMGType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PCMGType) -1;
        val = __Pyx_PyInt_As_PCMGType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PCMGType");
    return (PCMGType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PCMGType");
    return (PCMGType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE PCSide __Pyx_PyInt_As_PCSide(PyObject *x) {
    const PCSide neg_one = (PCSide) -1, const_zero = (PCSide) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PCSide) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PCSide, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PCSide) 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 (PCSide) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PCSide, digit, digits[0])
                case 2:
                    if (8 * sizeof(PCSide) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCSide, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCSide) >= 2 * PyLong_SHIFT) {
                            return (PCSide) (((((PCSide)digits[1]) << PyLong_SHIFT) | (PCSide)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCSide) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCSide, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCSide) >= 3 * PyLong_SHIFT) {
                            return (PCSide) (((((((PCSide)digits[2]) << PyLong_SHIFT) | (PCSide)digits[1]) << PyLong_SHIFT) | (PCSide)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCSide) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCSide, 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(PCSide) >= 4 * PyLong_SHIFT) {
                            return (PCSide) (((((((((PCSide)digits[3]) << PyLong_SHIFT) | (PCSide)digits[2]) << PyLong_SHIFT) | (PCSide)digits[1]) << PyLong_SHIFT) | (PCSide)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 (PCSide) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PCSide) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCSide, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(PCSide) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCSide, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PCSide) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PCSide, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PCSide,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PCSide) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCSide, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCSide) - 1 > 2 * PyLong_SHIFT) {
                            return (PCSide) (((PCSide)-1)*(((((PCSide)digits[1]) << PyLong_SHIFT) | (PCSide)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PCSide) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCSide, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCSide) - 1 > 2 * PyLong_SHIFT) {
                            return (PCSide) ((((((PCSide)digits[1]) << PyLong_SHIFT) | (PCSide)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PCSide) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCSide, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCSide) - 1 > 3 * PyLong_SHIFT) {
                            return (PCSide) (((PCSide)-1)*(((((((PCSide)digits[2]) << PyLong_SHIFT) | (PCSide)digits[1]) << PyLong_SHIFT) | (PCSide)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PCSide) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCSide, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PCSide) - 1 > 3 * PyLong_SHIFT) {
                            return (PCSide) ((((((((PCSide)digits[2]) << PyLong_SHIFT) | (PCSide)digits[1]) << PyLong_SHIFT) | (PCSide)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PCSide) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCSide, 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(PCSide) - 1 > 4 * PyLong_SHIFT) {
                            return (PCSide) (((PCSide)-1)*(((((((((PCSide)digits[3]) << PyLong_SHIFT) | (PCSide)digits[2]) << PyLong_SHIFT) | (PCSide)digits[1]) << PyLong_SHIFT) | (PCSide)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PCSide) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PCSide, 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(PCSide) - 1 > 4 * PyLong_SHIFT) {
                            return (PCSide) ((((((((((PCSide)digits[3]) << PyLong_SHIFT) | (PCSide)digits[2]) << PyLong_SHIFT) | (PCSide)digits[1]) << PyLong_SHIFT) | (PCSide)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PCSide) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCSide, long, PyLong_AsLong(x))
            } else if (sizeof(PCSide) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PCSide, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PCSide 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 (PCSide) -1;
        }
    } else {
        PCSide val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PCSide) -1;
        val = __Pyx_PyInt_As_PCSide(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PCSide");
    return (PCSide) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PCSide");
    return (PCSide) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE KSPNormType __Pyx_PyInt_As_KSPNormType(PyObject *x) {
    const KSPNormType neg_one = (KSPNormType) -1, const_zero = (KSPNormType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(KSPNormType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(KSPNormType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (KSPNormType) 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 (KSPNormType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(KSPNormType, digit, digits[0])
                case 2:
                    if (8 * sizeof(KSPNormType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPNormType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(KSPNormType) >= 2 * PyLong_SHIFT) {
                            return (KSPNormType) (((((KSPNormType)digits[1]) << PyLong_SHIFT) | (KSPNormType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(KSPNormType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPNormType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(KSPNormType) >= 3 * PyLong_SHIFT) {
                            return (KSPNormType) (((((((KSPNormType)digits[2]) << PyLong_SHIFT) | (KSPNormType)digits[1]) << PyLong_SHIFT) | (KSPNormType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(KSPNormType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPNormType, 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(KSPNormType) >= 4 * PyLong_SHIFT) {
                            return (KSPNormType) (((((((((KSPNormType)digits[3]) << PyLong_SHIFT) | (KSPNormType)digits[2]) << PyLong_SHIFT) | (KSPNormType)digits[1]) << PyLong_SHIFT) | (KSPNormType)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 (KSPNormType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(KSPNormType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(KSPNormType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(KSPNormType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(KSPNormType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (KSPNormType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(KSPNormType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(KSPNormType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(KSPNormType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPNormType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(KSPNormType) - 1 > 2 * PyLong_SHIFT) {
                            return (KSPNormType) (((KSPNormType)-1)*(((((KSPNormType)digits[1]) << PyLong_SHIFT) | (KSPNormType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(KSPNormType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPNormType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(KSPNormType) - 1 > 2 * PyLong_SHIFT) {
                            return (KSPNormType) ((((((KSPNormType)digits[1]) << PyLong_SHIFT) | (KSPNormType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(KSPNormType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPNormType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(KSPNormType) - 1 > 3 * PyLong_SHIFT) {
                            return (KSPNormType) (((KSPNormType)-1)*(((((((KSPNormType)digits[2]) << PyLong_SHIFT) | (KSPNormType)digits[1]) << PyLong_SHIFT) | (KSPNormType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(KSPNormType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPNormType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(KSPNormType) - 1 > 3 * PyLong_SHIFT) {
                            return (KSPNormType) ((((((((KSPNormType)digits[2]) << PyLong_SHIFT) | (KSPNormType)digits[1]) << PyLong_SHIFT) | (KSPNormType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(KSPNormType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPNormType, 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(KSPNormType) - 1 > 4 * PyLong_SHIFT) {
                            return (KSPNormType) (((KSPNormType)-1)*(((((((((KSPNormType)digits[3]) << PyLong_SHIFT) | (KSPNormType)digits[2]) << PyLong_SHIFT) | (KSPNormType)digits[1]) << PyLong_SHIFT) | (KSPNormType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(KSPNormType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(KSPNormType, 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(KSPNormType) - 1 > 4 * PyLong_SHIFT) {
                            return (KSPNormType) ((((((((((KSPNormType)digits[3]) << PyLong_SHIFT) | (KSPNormType)digits[2]) << PyLong_SHIFT) | (KSPNormType)digits[1]) << PyLong_SHIFT) | (KSPNormType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(KSPNormType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(KSPNormType, long, PyLong_AsLong(x))
            } else if (sizeof(KSPNormType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(KSPNormType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            KSPNormType 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 (KSPNormType) -1;
        }
    } else {
        KSPNormType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (KSPNormType) -1;
        val = __Pyx_PyInt_As_KSPNormType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to KSPNormType");
    return (KSPNormType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to KSPNormType");
    return (KSPNormType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE SNESNormSchedule __Pyx_PyInt_As_SNESNormSchedule(PyObject *x) {
    const SNESNormSchedule neg_one = (SNESNormSchedule) -1, const_zero = (SNESNormSchedule) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(SNESNormSchedule) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(SNESNormSchedule, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (SNESNormSchedule) 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 (SNESNormSchedule) 0;
                case  1: __PYX_VERIFY_RETURN_INT(SNESNormSchedule, digit, digits[0])
                case 2:
                    if (8 * sizeof(SNESNormSchedule) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESNormSchedule, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(SNESNormSchedule) >= 2 * PyLong_SHIFT) {
                            return (SNESNormSchedule) (((((SNESNormSchedule)digits[1]) << PyLong_SHIFT) | (SNESNormSchedule)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(SNESNormSchedule) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESNormSchedule, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(SNESNormSchedule) >= 3 * PyLong_SHIFT) {
                            return (SNESNormSchedule) (((((((SNESNormSchedule)digits[2]) << PyLong_SHIFT) | (SNESNormSchedule)digits[1]) << PyLong_SHIFT) | (SNESNormSchedule)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(SNESNormSchedule) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESNormSchedule, 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(SNESNormSchedule) >= 4 * PyLong_SHIFT) {
                            return (SNESNormSchedule) (((((((((SNESNormSchedule)digits[3]) << PyLong_SHIFT) | (SNESNormSchedule)digits[2]) << PyLong_SHIFT) | (SNESNormSchedule)digits[1]) << PyLong_SHIFT) | (SNESNormSchedule)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 (SNESNormSchedule) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(SNESNormSchedule) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(SNESNormSchedule, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(SNESNormSchedule) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(SNESNormSchedule, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (SNESNormSchedule) 0;
                case -1: __PYX_VERIFY_RETURN_INT(SNESNormSchedule, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(SNESNormSchedule,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(SNESNormSchedule) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESNormSchedule, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(SNESNormSchedule) - 1 > 2 * PyLong_SHIFT) {
                            return (SNESNormSchedule) (((SNESNormSchedule)-1)*(((((SNESNormSchedule)digits[1]) << PyLong_SHIFT) | (SNESNormSchedule)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(SNESNormSchedule) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESNormSchedule, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(SNESNormSchedule) - 1 > 2 * PyLong_SHIFT) {
                            return (SNESNormSchedule) ((((((SNESNormSchedule)digits[1]) << PyLong_SHIFT) | (SNESNormSchedule)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(SNESNormSchedule) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESNormSchedule, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(SNESNormSchedule) - 1 > 3 * PyLong_SHIFT) {
                            return (SNESNormSchedule) (((SNESNormSchedule)-1)*(((((((SNESNormSchedule)digits[2]) << PyLong_SHIFT) | (SNESNormSchedule)digits[1]) << PyLong_SHIFT) | (SNESNormSchedule)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(SNESNormSchedule) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESNormSchedule, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(SNESNormSchedule) - 1 > 3 * PyLong_SHIFT) {
                            return (SNESNormSchedule) ((((((((SNESNormSchedule)digits[2]) << PyLong_SHIFT) | (SNESNormSchedule)digits[1]) << PyLong_SHIFT) | (SNESNormSchedule)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(SNESNormSchedule) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESNormSchedule, 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(SNESNormSchedule) - 1 > 4 * PyLong_SHIFT) {
                            return (SNESNormSchedule) (((SNESNormSchedule)-1)*(((((((((SNESNormSchedule)digits[3]) << PyLong_SHIFT) | (SNESNormSchedule)digits[2]) << PyLong_SHIFT) | (SNESNormSchedule)digits[1]) << PyLong_SHIFT) | (SNESNormSchedule)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(SNESNormSchedule) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(SNESNormSchedule, 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(SNESNormSchedule) - 1 > 4 * PyLong_SHIFT) {
                            return (SNESNormSchedule) ((((((((((SNESNormSchedule)digits[3]) << PyLong_SHIFT) | (SNESNormSchedule)digits[2]) << PyLong_SHIFT) | (SNESNormSchedule)digits[1]) << PyLong_SHIFT) | (SNESNormSchedule)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(SNESNormSchedule) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(SNESNormSchedule, long, PyLong_AsLong(x))
            } else if (sizeof(SNESNormSchedule) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(SNESNormSchedule, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            SNESNormSchedule 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 (SNESNormSchedule) -1;
        }
    } else {
        SNESNormSchedule val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (SNESNormSchedule) -1;
        val = __Pyx_PyInt_As_SNESNormSchedule(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to SNESNormSchedule");
    return (SNESNormSchedule) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to SNESNormSchedule");
    return (SNESNormSchedule) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE TSProblemType __Pyx_PyInt_As_TSProblemType(PyObject *x) {
    const TSProblemType neg_one = (TSProblemType) -1, const_zero = (TSProblemType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(TSProblemType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(TSProblemType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (TSProblemType) 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 (TSProblemType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(TSProblemType, digit, digits[0])
                case 2:
                    if (8 * sizeof(TSProblemType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSProblemType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSProblemType) >= 2 * PyLong_SHIFT) {
                            return (TSProblemType) (((((TSProblemType)digits[1]) << PyLong_SHIFT) | (TSProblemType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(TSProblemType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSProblemType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSProblemType) >= 3 * PyLong_SHIFT) {
                            return (TSProblemType) (((((((TSProblemType)digits[2]) << PyLong_SHIFT) | (TSProblemType)digits[1]) << PyLong_SHIFT) | (TSProblemType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(TSProblemType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSProblemType, 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(TSProblemType) >= 4 * PyLong_SHIFT) {
                            return (TSProblemType) (((((((((TSProblemType)digits[3]) << PyLong_SHIFT) | (TSProblemType)digits[2]) << PyLong_SHIFT) | (TSProblemType)digits[1]) << PyLong_SHIFT) | (TSProblemType)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 (TSProblemType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(TSProblemType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSProblemType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(TSProblemType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSProblemType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (TSProblemType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(TSProblemType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(TSProblemType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(TSProblemType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSProblemType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSProblemType) - 1 > 2 * PyLong_SHIFT) {
                            return (TSProblemType) (((TSProblemType)-1)*(((((TSProblemType)digits[1]) << PyLong_SHIFT) | (TSProblemType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(TSProblemType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSProblemType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSProblemType) - 1 > 2 * PyLong_SHIFT) {
                            return (TSProblemType) ((((((TSProblemType)digits[1]) << PyLong_SHIFT) | (TSProblemType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(TSProblemType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSProblemType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSProblemType) - 1 > 3 * PyLong_SHIFT) {
                            return (TSProblemType) (((TSProblemType)-1)*(((((((TSProblemType)digits[2]) << PyLong_SHIFT) | (TSProblemType)digits[1]) << PyLong_SHIFT) | (TSProblemType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(TSProblemType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSProblemType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSProblemType) - 1 > 3 * PyLong_SHIFT) {
                            return (TSProblemType) ((((((((TSProblemType)digits[2]) << PyLong_SHIFT) | (TSProblemType)digits[1]) << PyLong_SHIFT) | (TSProblemType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(TSProblemType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSProblemType, 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(TSProblemType) - 1 > 4 * PyLong_SHIFT) {
                            return (TSProblemType) (((TSProblemType)-1)*(((((((((TSProblemType)digits[3]) << PyLong_SHIFT) | (TSProblemType)digits[2]) << PyLong_SHIFT) | (TSProblemType)digits[1]) << PyLong_SHIFT) | (TSProblemType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(TSProblemType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSProblemType, 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(TSProblemType) - 1 > 4 * PyLong_SHIFT) {
                            return (TSProblemType) ((((((((((TSProblemType)digits[3]) << PyLong_SHIFT) | (TSProblemType)digits[2]) << PyLong_SHIFT) | (TSProblemType)digits[1]) << PyLong_SHIFT) | (TSProblemType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(TSProblemType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSProblemType, long, PyLong_AsLong(x))
            } else if (sizeof(TSProblemType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSProblemType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            TSProblemType 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 (TSProblemType) -1;
        }
    } else {
        TSProblemType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (TSProblemType) -1;
        val = __Pyx_PyInt_As_TSProblemType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to TSProblemType");
    return (TSProblemType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to TSProblemType");
    return (TSProblemType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE TSEquationType __Pyx_PyInt_As_TSEquationType(PyObject *x) {
    const TSEquationType neg_one = (TSEquationType) -1, const_zero = (TSEquationType) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(TSEquationType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(TSEquationType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (TSEquationType) 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 (TSEquationType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(TSEquationType, digit, digits[0])
                case 2:
                    if (8 * sizeof(TSEquationType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSEquationType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSEquationType) >= 2 * PyLong_SHIFT) {
                            return (TSEquationType) (((((TSEquationType)digits[1]) << PyLong_SHIFT) | (TSEquationType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(TSEquationType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSEquationType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSEquationType) >= 3 * PyLong_SHIFT) {
                            return (TSEquationType) (((((((TSEquationType)digits[2]) << PyLong_SHIFT) | (TSEquationType)digits[1]) << PyLong_SHIFT) | (TSEquationType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(TSEquationType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSEquationType, 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(TSEquationType) >= 4 * PyLong_SHIFT) {
                            return (TSEquationType) (((((((((TSEquationType)digits[3]) << PyLong_SHIFT) | (TSEquationType)digits[2]) << PyLong_SHIFT) | (TSEquationType)digits[1]) << PyLong_SHIFT) | (TSEquationType)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 (TSEquationType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(TSEquationType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSEquationType, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(TSEquationType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSEquationType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (TSEquationType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(TSEquationType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(TSEquationType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(TSEquationType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSEquationType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSEquationType) - 1 > 2 * PyLong_SHIFT) {
                            return (TSEquationType) (((TSEquationType)-1)*(((((TSEquationType)digits[1]) << PyLong_SHIFT) | (TSEquationType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(TSEquationType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSEquationType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSEquationType) - 1 > 2 * PyLong_SHIFT) {
                            return (TSEquationType) ((((((TSEquationType)digits[1]) << PyLong_SHIFT) | (TSEquationType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(TSEquationType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSEquationType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSEquationType) - 1 > 3 * PyLong_SHIFT) {
                            return (TSEquationType) (((TSEquationType)-1)*(((((((TSEquationType)digits[2]) << PyLong_SHIFT) | (TSEquationType)digits[1]) << PyLong_SHIFT) | (TSEquationType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(TSEquationType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSEquationType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSEquationType) - 1 > 3 * PyLong_SHIFT) {
                            return (TSEquationType) ((((((((TSEquationType)digits[2]) << PyLong_SHIFT) | (TSEquationType)digits[1]) << PyLong_SHIFT) | (TSEquationType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(TSEquationType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSEquationType, 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(TSEquationType) - 1 > 4 * PyLong_SHIFT) {
                            return (TSEquationType) (((TSEquationType)-1)*(((((((((TSEquationType)digits[3]) << PyLong_SHIFT) | (TSEquationType)digits[2]) << PyLong_SHIFT) | (TSEquationType)digits[1]) << PyLong_SHIFT) | (TSEquationType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(TSEquationType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSEquationType, 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(TSEquationType) - 1 > 4 * PyLong_SHIFT) {
                            return (TSEquationType) ((((((((((TSEquationType)digits[3]) << PyLong_SHIFT) | (TSEquationType)digits[2]) << PyLong_SHIFT) | (TSEquationType)digits[1]) << PyLong_SHIFT) | (TSEquationType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(TSEquationType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSEquationType, long, PyLong_AsLong(x))
            } else if (sizeof(TSEquationType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSEquationType, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            TSEquationType 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 (TSEquationType) -1;
        }
    } else {
        TSEquationType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (TSEquationType) -1;
        val = __Pyx_PyInt_As_TSEquationType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to TSEquationType");
    return (TSEquationType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to TSEquationType");
    return (TSEquationType) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE TSExactFinalTimeOption __Pyx_PyInt_As_TSExactFinalTimeOption(PyObject *x) {
    const TSExactFinalTimeOption neg_one = (TSExactFinalTimeOption) -1, const_zero = (TSExactFinalTimeOption) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(TSExactFinalTimeOption) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (TSExactFinalTimeOption) 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 (TSExactFinalTimeOption) 0;
                case  1: __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption, digit, digits[0])
                case 2:
                    if (8 * sizeof(TSExactFinalTimeOption) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSExactFinalTimeOption) >= 2 * PyLong_SHIFT) {
                            return (TSExactFinalTimeOption) (((((TSExactFinalTimeOption)digits[1]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(TSExactFinalTimeOption) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSExactFinalTimeOption) >= 3 * PyLong_SHIFT) {
                            return (TSExactFinalTimeOption) (((((((TSExactFinalTimeOption)digits[2]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[1]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(TSExactFinalTimeOption) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption, 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(TSExactFinalTimeOption) >= 4 * PyLong_SHIFT) {
                            return (TSExactFinalTimeOption) (((((((((TSExactFinalTimeOption)digits[3]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[2]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[1]) << PyLong_SHIFT) | (TSExactFinalTimeOption)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 (TSExactFinalTimeOption) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(TSExactFinalTimeOption) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSExactFinalTimeOption, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(TSExactFinalTimeOption) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSExactFinalTimeOption, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (TSExactFinalTimeOption) 0;
                case -1: __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(TSExactFinalTimeOption) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSExactFinalTimeOption) - 1 > 2 * PyLong_SHIFT) {
                            return (TSExactFinalTimeOption) (((TSExactFinalTimeOption)-1)*(((((TSExactFinalTimeOption)digits[1]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(TSExactFinalTimeOption) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSExactFinalTimeOption) - 1 > 2 * PyLong_SHIFT) {
                            return (TSExactFinalTimeOption) ((((((TSExactFinalTimeOption)digits[1]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(TSExactFinalTimeOption) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSExactFinalTimeOption) - 1 > 3 * PyLong_SHIFT) {
                            return (TSExactFinalTimeOption) (((TSExactFinalTimeOption)-1)*(((((((TSExactFinalTimeOption)digits[2]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[1]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(TSExactFinalTimeOption) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSExactFinalTimeOption) - 1 > 3 * PyLong_SHIFT) {
                            return (TSExactFinalTimeOption) ((((((((TSExactFinalTimeOption)digits[2]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[1]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(TSExactFinalTimeOption) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption, 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(TSExactFinalTimeOption) - 1 > 4 * PyLong_SHIFT) {
                            return (TSExactFinalTimeOption) (((TSExactFinalTimeOption)-1)*(((((((((TSExactFinalTimeOption)digits[3]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[2]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[1]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(TSExactFinalTimeOption) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSExactFinalTimeOption, 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(TSExactFinalTimeOption) - 1 > 4 * PyLong_SHIFT) {
                            return (TSExactFinalTimeOption) ((((((((((TSExactFinalTimeOption)digits[3]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[2]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[1]) << PyLong_SHIFT) | (TSExactFinalTimeOption)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(TSExactFinalTimeOption) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSExactFinalTimeOption, long, PyLong_AsLong(x))
            } else if (sizeof(TSExactFinalTimeOption) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSExactFinalTimeOption, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            TSExactFinalTimeOption 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 (TSExactFinalTimeOption) -1;
        }
    } else {
        TSExactFinalTimeOption val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (TSExactFinalTimeOption) -1;
        val = __Pyx_PyInt_As_TSExactFinalTimeOption(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to TSExactFinalTimeOption");
    return (TSExactFinalTimeOption) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to TSExactFinalTimeOption");
    return (TSExactFinalTimeOption) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE TSConvergedReason __Pyx_PyInt_As_TSConvergedReason(PyObject *x) {
    const TSConvergedReason neg_one = (TSConvergedReason) -1, const_zero = (TSConvergedReason) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(TSConvergedReason) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(TSConvergedReason, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (TSConvergedReason) 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 (TSConvergedReason) 0;
                case  1: __PYX_VERIFY_RETURN_INT(TSConvergedReason, digit, digits[0])
                case 2:
                    if (8 * sizeof(TSConvergedReason) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSConvergedReason, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSConvergedReason) >= 2 * PyLong_SHIFT) {
                            return (TSConvergedReason) (((((TSConvergedReason)digits[1]) << PyLong_SHIFT) | (TSConvergedReason)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(TSConvergedReason) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSConvergedReason, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSConvergedReason) >= 3 * PyLong_SHIFT) {
                            return (TSConvergedReason) (((((((TSConvergedReason)digits[2]) << PyLong_SHIFT) | (TSConvergedReason)digits[1]) << PyLong_SHIFT) | (TSConvergedReason)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(TSConvergedReason) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSConvergedReason, 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(TSConvergedReason) >= 4 * PyLong_SHIFT) {
                            return (TSConvergedReason) (((((((((TSConvergedReason)digits[3]) << PyLong_SHIFT) | (TSConvergedReason)digits[2]) << PyLong_SHIFT) | (TSConvergedReason)digits[1]) << PyLong_SHIFT) | (TSConvergedReason)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 (TSConvergedReason) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(TSConvergedReason) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSConvergedReason, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(TSConvergedReason) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSConvergedReason, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (TSConvergedReason) 0;
                case -1: __PYX_VERIFY_RETURN_INT(TSConvergedReason, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(TSConvergedReason,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(TSConvergedReason) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSConvergedReason, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSConvergedReason) - 1 > 2 * PyLong_SHIFT) {
                            return (TSConvergedReason) (((TSConvergedReason)-1)*(((((TSConvergedReason)digits[1]) << PyLong_SHIFT) | (TSConvergedReason)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(TSConvergedReason) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSConvergedReason, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSConvergedReason) - 1 > 2 * PyLong_SHIFT) {
                            return (TSConvergedReason) ((((((TSConvergedReason)digits[1]) << PyLong_SHIFT) | (TSConvergedReason)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(TSConvergedReason) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSConvergedReason, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSConvergedReason) - 1 > 3 * PyLong_SHIFT) {
                            return (TSConvergedReason) (((TSConvergedReason)-1)*(((((((TSConvergedReason)digits[2]) << PyLong_SHIFT) | (TSConvergedReason)digits[1]) << PyLong_SHIFT) | (TSConvergedReason)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(TSConvergedReason) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSConvergedReason, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(TSConvergedReason) - 1 > 3 * PyLong_SHIFT) {
                            return (TSConvergedReason) ((((((((TSConvergedReason)digits[2]) << PyLong_SHIFT) | (TSConvergedReason)digits[1]) << PyLong_SHIFT) | (TSConvergedReason)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(TSConvergedReason) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSConvergedReason, 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(TSConvergedReason) - 1 > 4 * PyLong_SHIFT) {
                            return (TSConvergedReason) (((TSConvergedReason)-1)*(((((((((TSConvergedReason)digits[3]) << PyLong_SHIFT) | (TSConvergedReason)digits[2]) << PyLong_SHIFT) | (TSConvergedReason)digits[1]) << PyLong_SHIFT) | (TSConvergedReason)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(TSConvergedReason) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(TSConvergedReason, 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(TSConvergedReason) - 1 > 4 * PyLong_SHIFT) {
                            return (TSConvergedReason) ((((((((((TSConvergedReason)digits[3]) << PyLong_SHIFT) | (TSConvergedReason)digits[2]) << PyLong_SHIFT) | (TSConvergedReason)digits[1]) << PyLong_SHIFT) | (TSConvergedReason)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(TSConvergedReason) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSConvergedReason, long, PyLong_AsLong(x))
            } else if (sizeof(TSConvergedReason) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(TSConvergedReason, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            TSConvergedReason 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 (TSConvergedReason) -1;
        }
    } else {
        TSConvergedReason val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (TSConvergedReason) -1;
        val = __Pyx_PyInt_As_TSConvergedReason(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to TSConvergedReason");
    return (TSConvergedReason) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to TSConvergedReason");
    return (TSConvergedReason) -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))
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } 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))
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#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;
}

/* 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;
}

/* FunctionExport */
                static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* 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;
        ++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 char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if CYTHON_COMPILING_IN_CPYTHON && (__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)) {
#if PY_VERSION_HEX < 0x03030000
        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
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (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
    } 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 CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return __Pyx_NewRef(x);
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  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 */
